feat: export isLinearElement and getNonDeletedElements (#4072)

* feat: export isLinearElement and getNonDeletedElements

* fix
This commit is contained in:
Aakansha Doshi 2021-10-19 14:40:48 +05:30 committed by GitHub
parent bc88cf5002
commit 6eecadce60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

View File

@ -17,6 +17,8 @@ Please add the latest change on the top under the correct section.
### Features
- Export [`isLinearElement`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#isLinearElement) and [`getNonDeletedElements`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#getNonDeletedElements).
- Support [`renderTopRightUI`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderTopRightUI) in mobile UI.
- Export `THEME` constant from the package so host can use this when passing the theme.

View File

@ -910,6 +910,38 @@ getFreeDrawSvgPath(element: <a href="https://github.com/excalidraw/excalidraw/bl
This function returns the free draw svg path for the element.
#### `isLinearElement`
**How to use**
```js
import { isLinearElement } from "@excalidraw/excalidraw-next";
```
**Signature**
<pre>
isLinearElement(elementType?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L80">ExcalidrawElement</a>): boolean
</pre>
This function returns true if the element is linear type (`arrow` |`line`) else returns false.
#### `getNonDeletedElements`
**How to use**
```js
import { getNonDeletedElements } from "@excalidraw/excalidraw-next";
```
**Signature**
<pre>
getNonDeletedElements(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L80"> readonly ExcalidrawElement[]</a>): as readonly <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L90">NonDeletedExcalidrawElement[]</a>
</pre>
This function returns an array of deleted elements.
### Exported constants
#### `FONT_FAMILY`

View File

@ -171,6 +171,7 @@ export {
getSceneVersion,
getElementMap,
isInvisiblySmallElement,
getNonDeletedElements,
} from "../../element";
export { defaultLang, languages } from "../../i18n";
export { restore, restoreAppState, restoreElements } from "../../data/restore";
@ -183,4 +184,6 @@ export {
loadFromBlob,
getFreeDrawSvgPath,
} from "../../packages/utils";
export { isLinearElement } from "../../element/typeChecks";
export { FONT_FAMILY, THEME } from "../../constants";