diff --git a/.changeset/button-minor.md b/.changeset/button-minor.md new file mode 100644 index 0000000000..8d56093f39 --- /dev/null +++ b/.changeset/button-minor.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-ui-button': minor +--- + +- `PlateButton` \ No newline at end of file diff --git a/.changeset/button.md b/.changeset/button.md new file mode 100644 index 0000000000..f974a2d0cb --- /dev/null +++ b/.changeset/button.md @@ -0,0 +1,6 @@ +--- +'@udecode/plate-ui-button': major +--- + +- moved `Button` to `@udecode/plate-button` +- `Button` is now unstyled \ No newline at end of file diff --git a/.changeset/combobox.md b/.changeset/combobox.md new file mode 100644 index 0000000000..2e8e6046a2 --- /dev/null +++ b/.changeset/combobox.md @@ -0,0 +1,9 @@ +--- +'@udecode/plate-combobox': major +--- + +- deps: + - replaced `@udecode/plate-ui-popper` by `@udecode/plate-floating` +- `comboboxStore`: + - removed `popperContainer`, use `floatingOptions` instead + - removed `popperOptions`, use `floatingOptions` instead \ No newline at end of file diff --git a/.changeset/core-minor.md b/.changeset/core-minor.md new file mode 100644 index 0000000000..ce770b2908 --- /dev/null +++ b/.changeset/core-minor.md @@ -0,0 +1,23 @@ +--- +'@udecode/plate-core': minor +--- + +- new dep + re-exports `"react-hotkeys-hook": "^3.4.6"` +- new core plugin `createSelectionPlugin` + - stores the previous selection in `editor.prevSelection` (default is `null`) + - enabled by default, can be disabled using `selection` key +- new `PlatePlugin` props: + - `renderAboveEditable`: Render a component above `Editable`. + - `renderAfterEditable`: Render a component after `Editable`. + - `renderBeforeEditable`: Render a component before `Editable`. +- `Plate`: + - pipes plugins `renderAboveEditable` and render the result above `Editable` + - pipes plugins `renderAfterEditable` and render the result after `Editable`, before `children` + - pipes plugins `renderBeforeEditable` and render the result before `Editable`, after `firstChildren` +- new queries + - `getNextNodeStartPoint` + - `getPreviousNodeEndPoint` +- new hooks + - `useOnClickOutside` +- `PlateEditor` new prop: + - `prevSelection: TRange | null;` \ No newline at end of file diff --git a/.changeset/floating.md b/.changeset/floating.md new file mode 100644 index 0000000000..a4f147c6c6 --- /dev/null +++ b/.changeset/floating.md @@ -0,0 +1,12 @@ +--- +'@udecode/plate-floating': minor +--- + +- new package replacing `plate-popper` +- dep: + - `"@floating-ui/react-dom-interactions": "^0.6.6"` +- re-exports `@floating-ui/react-dom-interactions` +- utils: + - `createVirtualElement` + - `useVirtualFloating` + - `getSelectionBoundingClientRect` \ No newline at end of file diff --git a/.changeset/headless.md b/.changeset/headless.md new file mode 100644 index 0000000000..1dfa1ee3a3 --- /dev/null +++ b/.changeset/headless.md @@ -0,0 +1,7 @@ +--- +'@udecode/plate-headless': minor +--- + +- new deps + re-exports: + - `@udecode/plate-button` + - `@udecode/plate-floating` \ No newline at end of file diff --git a/.changeset/link-major.md b/.changeset/link-major.md new file mode 100644 index 0000000000..154034e107 --- /dev/null +++ b/.changeset/link-major.md @@ -0,0 +1,12 @@ +--- +'@udecode/plate-link': major +--- + +- `createLinkPlugin` + - removed `onKeyDownLink` for floating link + - removed `hotkey` for `triggerFloatingLinkHotkeys` +- removed: + - `getAndUpsertLink` for `upsertLink` + - `upsertLinkAtSelection` for `upsertLink` +- `LinkToolbarButton`: + - `onClick` now calls `triggerFloatingLink` \ No newline at end of file diff --git a/.changeset/link-minor.md b/.changeset/link-minor.md new file mode 100644 index 0000000000..376f7adebf --- /dev/null +++ b/.changeset/link-minor.md @@ -0,0 +1,65 @@ +--- +'@udecode/plate-link': minor +--- + +- new dep: + - `@udecode/plate-button` +- new unstyled components + props hooks: + - `PlateFloatingLink` + - `LinkRoot` + - `FloatingLink` + - `FloatingLinkEditRoot` + - `FloatingLinkInsertRoot` + - `FloatingLinkUrlInput` + - `FloatingLinkTextInput` + - `FloatingLinkEditButton` + - `UnlinkButton` + - `OpenLinkButton` +- new store: `floatingLinkStore` +- `LinkPlugin` new props: + - `triggerFloatingLinkHotkeys`: Hotkeys to trigger floating link. Default is 'command+k, ctrl+k' +- new utils: + - `insertLink` + - `submitFloatingLink` + - `unwrapLink` + - `upsertLink` + - `createLinkNode` + - `triggerFloatingLink` + - `triggerFloatingLinkEdit` + - `triggerFloatingLinkInsert` + +Specs: +- Insert data: + - https://github.com/udecode/editor-protocol/issues/34 + - https://github.com/udecode/editor-protocol/issues/35 + - https://github.com/udecode/editor-protocol/issues/36 + - https://github.com/udecode/editor-protocol/issues/37 + - https://github.com/udecode/editor-protocol/issues/38 + - https://github.com/udecode/editor-protocol/issues/43 +- Insert space: + - https://github.com/udecode/editor-protocol/issues/39 + - https://github.com/udecode/editor-protocol/issues/40 + - https://github.com/udecode/editor-protocol/issues/41 + - https://github.com/udecode/editor-protocol/issues/42 +- Floating link: + - https://github.com/udecode/editor-protocol/issues/45 + - https://github.com/udecode/editor-protocol/issues/48 + - https://github.com/udecode/editor-protocol/issues/51 + - https://github.com/udecode/editor-protocol/issues/60 +- Floating link insert: + - https://github.com/udecode/editor-protocol/issues/44 + - https://github.com/udecode/editor-protocol/issues/46 + - https://github.com/udecode/editor-protocol/issues/47 + - https://github.com/udecode/editor-protocol/issues/49 + - https://github.com/udecode/editor-protocol/issues/50 +- Floating link edit: + - https://github.com/udecode/editor-protocol/issues/54 + - https://github.com/udecode/editor-protocol/issues/55 + - https://github.com/udecode/editor-protocol/issues/56 + - https://github.com/udecode/editor-protocol/issues/57 + - https://github.com/udecode/editor-protocol/issues/58 + - https://github.com/udecode/editor-protocol/issues/59 + - https://github.com/udecode/editor-protocol/issues/61 +- Selection: + - https://github.com/udecode/editor-protocol/issues/52 + - https://github.com/udecode/editor-protocol/issues/53 diff --git a/.changeset/link-patch.md b/.changeset/link-patch.md new file mode 100644 index 0000000000..3c295ceefe --- /dev/null +++ b/.changeset/link-patch.md @@ -0,0 +1,8 @@ +--- +'@udecode/plate-link': patch +--- + +- Fixes #1580 +- Fixes #1542 +- Fixes #1194 +- Fixes #712 \ No newline at end of file diff --git a/.changeset/plate.md b/.changeset/plate.md new file mode 100644 index 0000000000..fa19c51b13 --- /dev/null +++ b/.changeset/plate.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate': major +--- + +- remove `@udecode/plate-ui-popper` dep for `@udecode/plate-floating` \ No newline at end of file diff --git a/.changeset/popper.md b/.changeset/popper.md new file mode 100644 index 0000000000..5746635e46 --- /dev/null +++ b/.changeset/popper.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-ui-popper': major +--- + +- deprecated, use instead `@udecode/plate-floating` \ No newline at end of file diff --git a/.changeset/table.md b/.changeset/table.md new file mode 100644 index 0000000000..939d1810b6 --- /dev/null +++ b/.changeset/table.md @@ -0,0 +1,6 @@ +--- +'@udecode/plate-table': major +--- + +- remove `addRow` for `insertTableRow` +- remove `addColumn` for `insertTableColumn` \ No newline at end of file diff --git a/.changeset/toolbar-fix.md b/.changeset/toolbar-fix.md new file mode 100644 index 0000000000..c2bb7696c5 --- /dev/null +++ b/.changeset/toolbar-fix.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-ui-toolbar': patch +--- + +- Fixes #1434 \ No newline at end of file diff --git a/.changeset/toolbar.md b/.changeset/toolbar.md new file mode 100644 index 0000000000..7d81e2e6aa --- /dev/null +++ b/.changeset/toolbar.md @@ -0,0 +1,8 @@ +--- +'@udecode/plate-ui-toolbar': major +--- + +- remove `@udecode/plate-ui-popper` and `react-popper` deps for `@udecode/plate-floating` +- `BalloonToolbarProps`: + - removed `popperOptions` for `floatingOptions` +- remove `useBalloonToolbarPopper` for `useFloatingToolbar` \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 816ed0734c..1ecb924b64 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -36,7 +36,7 @@ module.exports = { settings: { 'import/resolver': { node: { - moduleDirectory: ['node_modules', 'src'], + moduleDirectory: ['node_modules'], typescript: { alwaysTryTypes: true, }, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6eed562be..771b5fe4ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,8 +76,8 @@ Build: #### How to: Create an example - Did you create a new package? - - edit `/examples/apps/next/next.config.js` - - add `'@udecode/plate-x': x/src'` to `alias` object to watch file changes + - edit `/config/aliases.js` + - add `'@udecode/plate-x': '` to watch file changes - Run the example app: - run `yarn g:dev` - Create an example app in `/examples/src` diff --git a/config/aliases-plate.js b/config/aliases-plate.js new file mode 100644 index 0000000000..6932b17148 --- /dev/null +++ b/config/aliases-plate.js @@ -0,0 +1,40 @@ +module.exports = { + '@udecode/plate-alignment': 'nodes/alignment', + '@udecode/plate-autoformat': 'editor/autoformat', + '@udecode/plate-basic-elements': 'nodes/basic-elements', + '@udecode/plate-basic-marks': 'nodes/basic-marks', + '@udecode/plate-block-quote': 'nodes/block-quote', + '@udecode/plate-break': 'editor/break', + '@udecode/plate-button': 'button', + '@udecode/plate-code-block': 'nodes/code-block', + '@udecode/plate-combobox': 'editor/combobox', + '@udecode/plate-core': 'core', + '@udecode/plate-serializer-csv': 'serializers/csv', + '@udecode/plate-serializer-docx': 'serializers/docx', + '@udecode/plate-find-replace': 'decorators/find-replace', + '@udecode/plate-floating': 'floating', + '@udecode/plate-font': 'nodes/font', + '@udecode/plate-headless': 'headless', + '@udecode/plate-heading': 'nodes/heading', + '@udecode/plate-highlight': 'nodes/highlight', + '@udecode/plate-horizontal-rule': 'nodes/horizontal-rule', + '@udecode/plate-image': 'nodes/image', + '@udecode/plate-indent': 'nodes/indent', + '@udecode/plate-indent-list': 'nodes/indent-list', + '@udecode/plate-juice': 'serializers/juice', + '@udecode/plate-kbd': 'nodes/kbd', + '@udecode/plate-line-height': 'nodes/line-height', + '@udecode/plate-link': 'nodes/link', + '@udecode/plate-list': 'nodes/list', + '@udecode/plate-serializer-md': 'serializers/md', + '@udecode/plate-media-embed': 'nodes/media-embed', + '@udecode/plate-mention': 'nodes/mention', + '@udecode/plate-node-id': 'editor/node-id', + '@udecode/plate-normalizers': 'editor/normalizers', + '@udecode/plate-paragraph': 'nodes/paragraph', + '@udecode/plate-reset-node': 'editor/reset-node', + '@udecode/plate-select': 'editor/select', + '@udecode/plate-table': 'nodes/table', + '@udecode/plate-test-utils': 'test-utils', + '@udecode/plate-trailing-block': 'editor/trailing-block', +}; diff --git a/config/aliases.js b/config/aliases.js new file mode 100644 index 0000000000..7486592f97 --- /dev/null +++ b/config/aliases.js @@ -0,0 +1,27 @@ +module.exports = { + ...require('./aliases-plate'), + '@udecode/plate': 'plate', + '@udecode/plate-excalidraw': 'ui/nodes/excalidraw', + '@udecode/plate-styled-components': 'ui/styled-components', + '@udecode/plate-ui': 'ui/plate', + '@udecode/plate-ui-alignment': 'ui/nodes/alignment', + '@udecode/plate-ui-block-quote': 'ui/nodes/block-quote', + '@udecode/plate-ui-button': 'ui/button', + '@udecode/plate-ui-code-block': 'ui/nodes/code-block', + '@udecode/plate-ui-combobox': 'ui/combobox', + '@udecode/plate-ui-cursor': 'ui/cursor', + '@udecode/plate-ui-dnd': 'ui/dnd', + '@udecode/plate-ui-find-replace': 'ui/find-replace', + '@udecode/plate-ui-font': 'ui/nodes/font', + '@udecode/plate-ui-horizontal-rule': 'ui/nodes/horizontal-rule', + '@udecode/plate-ui-image': 'ui/nodes/image', + '@udecode/plate-ui-line-height': 'ui/nodes/line-height', + '@udecode/plate-ui-link': 'ui/nodes/link', + '@udecode/plate-ui-list': 'ui/nodes/list', + '@udecode/plate-ui-media-embed': 'ui/nodes/media-embed', + '@udecode/plate-ui-mention': 'ui/nodes/mention', + '@udecode/plate-ui-placeholder': 'ui/placeholder', + '@udecode/plate-ui-popover': 'ui/popover', + '@udecode/plate-ui-table': 'ui/nodes/table', + '@udecode/plate-ui-toolbar': 'ui/toolbar', +}; diff --git a/docs/docs/guides/plugins.mdx b/docs/docs/guides/plugins.mdx index 92e2d1e913..f505d9cb0a 100644 --- a/docs/docs/guides/plugins.mdx +++ b/docs/docs/guides/plugins.mdx @@ -501,6 +501,18 @@ createIndentPlugin({ - If function, its returning value will be shallow merged to the old props, with the old props as parameter. - If object, its value will be shallow merged to the old props. +### `renderAboveEditable` + +- Render a component above `Editable`. + +### `renderAfterEditable` + +- Render a component after `Editable`. + +### `renderBeforeEditable` + +- Render a component before `Editable`. + ### `serializeHtml` - Property used by `serializeHtml` util to replace `renderElement` and `renderLeaf` when serializing a node of this `type`. diff --git a/docs/docs/plugins/combobox.mdx b/docs/docs/plugins/combobox.mdx index 167323e661..42ef39616c 100644 --- a/docs/docs/plugins/combobox.mdx +++ b/docs/docs/plugins/combobox.mdx @@ -22,8 +22,7 @@ The combobox state is stored in a [zustood store](https://github.com/udecode/zus - `items` – Unfiltered items - `filteredItems` – Filtered items - `highlightedIndex` – Highlighted index -- `popperContainer` – Parent element of the popper element (the one that has the scroll) -- `popperOptions` – Overrides `usePopper` options +- `floatingOptions` – Overrides `useFloating` options - `targetRange` – Range from the trigger to the cursor - `text` – Text after the trigger diff --git a/docs/docs/plugins/link.mdx b/docs/docs/plugins/link.mdx index 5e77d4c2fd..e62e9c9f6b 100644 --- a/docs/docs/plugins/link.mdx +++ b/docs/docs/plugins/link.mdx @@ -3,6 +3,8 @@ slug: /plugins/link title: Link --- +Specs in [editor-protocol](https://github.com/udecode/editor-protocol/issues/33) + ### Installation ```bash npm2yarn @@ -18,20 +20,45 @@ import { LinkSandpack } from './LinkSandpack' +Enable floating link using: + +```tsx +renderAfterEditable: PlateFloatingLink +``` + ### Options ```tsx -interface LinkPlugin extends HotkeyPlugin { +interface LinkPlugin { /** * Allow custom config for rangeBeforeOptions. + * @example default + * { + * matchString: ' ', + * skipInvalid: true, + * afterMatch: true, + * } */ rangeBeforeOptions?: RangeBeforeOptions; + /** + * Hotkeys to trigger floating link. + * @default 'command+k, ctrl+k' + */ + triggerFloatingLinkHotkeys?: string; + /** * Callback to validate an url. + * @default isUrl */ isUrl?: (text: string) => boolean; + /** + * Callback to optionally get the href for a url + * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com) + */ + getUrlHref?: (url: string) => string | undefined; + /** * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The * default behavior is to use the browser's native `prompt`. diff --git a/docs/docs/sandpack/files/common/code-components.ts b/docs/docs/sandpack/files/common/code-components.ts index 39e09f6111..8dbc12ad82 100644 --- a/docs/docs/sandpack/files/common/code-components.ts +++ b/docs/docs/sandpack/files/common/code-components.ts @@ -1,5 +1,5 @@ -export const componentsCode = `import { ELEMENT_CODE_BLOCK } from '@udecode/plate-code-block/src/index'; -import { createPlateUI } from '@udecode/plate-ui/src/index'; +export const componentsCode = `import { ELEMENT_CODE_BLOCK } from '@udecode/plate-code-block'; +import { createPlateUI } from '@udecode/plate-ui'; export const plateUI = createPlateUI({ // disabled for the sandbox as prismjs is throwing an error sometimes diff --git a/docs/docs/sandpack/files/table/code-TableToolbarButtons.tsx b/docs/docs/sandpack/files/table/code-TableToolbarButtons.tsx index 6639ed3874..850d20dd18 100644 --- a/docs/docs/sandpack/files/table/code-TableToolbarButtons.tsx +++ b/docs/docs/sandpack/files/table/code-TableToolbarButtons.tsx @@ -6,8 +6,8 @@ import { BorderLeft } from '@styled-icons/material/BorderLeft'; import { BorderRight } from '@styled-icons/material/BorderRight'; import { BorderTop } from '@styled-icons/material/BorderTop'; import { - addColumn, - addRow, + insertTableColumn, + insertTableRow, deleteColumn, deleteRow, deleteTable, @@ -19,9 +19,9 @@ export const TableToolbarButtons = () => ( <> } transform={insertTable} /> } transform={deleteTable} /> - } transform={addRow} /> + } transform={insertTableRow} /> } transform={deleteRow} /> - } transform={addColumn} /> + } transform={insertTableColumn} /> } transform={deleteColumn} /> ); diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index e8021a8088..c1e95c840b 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -20,76 +20,6 @@ const customFields = { announcementBarContent: `If you like plate, give it a star on GitHub 🎉 !️`, }; -const alias = { - '@udecode/plate': 'plate', - '@udecode/plate-alignment': 'nodes/alignment', - '@udecode/plate-autoformat': 'editor/autoformat', - '@udecode/plate-basic-elements': 'nodes/basic-elements', - '@udecode/plate-basic-marks': 'nodes/basic-marks', - '@udecode/plate-block-quote': 'nodes/block-quote', - '@udecode/plate-break': 'editor/break', - '@udecode/plate-code-block': 'nodes/code-block', - '@udecode/plate-combobox': 'editor/combobox', - '@udecode/plate-core': 'core', - '@udecode/plate-serializer-csv': 'serializers/csv', - '@udecode/plate-serializer-docx': 'serializers/docx', - '@udecode/plate-excalidraw': 'ui/nodes/excalidraw', - '@udecode/plate-find-replace': 'decorators/find-replace', - '@udecode/plate-font': 'nodes/font', - '@udecode/plate-headless': 'headless', - '@udecode/plate-heading': 'nodes/heading', - '@udecode/plate-highlight': 'nodes/highlight', - '@udecode/plate-horizontal-rule': 'nodes/horizontal-rule', - '@udecode/plate-image': 'nodes/image', - '@udecode/plate-indent': 'nodes/indent', - '@udecode/plate-indent-list': 'nodes/indent-list', - '@udecode/plate-juice': 'serializers/juice', - '@udecode/plate-kbd': 'nodes/kbd', - '@udecode/plate-line-height': 'nodes/line-height', - '@udecode/plate-link': 'nodes/link', - '@udecode/plate-list': 'nodes/list', - '@udecode/plate-serializer-md': 'serializers/md', - '@udecode/plate-media-embed': 'nodes/media-embed', - '@udecode/plate-mention': 'nodes/mention', - '@udecode/plate-node-id': 'editor/node-id', - '@udecode/plate-normalizers': 'editor/normalizers', - '@udecode/plate-paragraph': 'nodes/paragraph', - '@udecode/plate-reset-node': 'editor/reset-node', - '@udecode/plate-select': 'editor/select', - '@udecode/plate-styled-components': 'ui/styled-components', - '@udecode/plate-table': 'nodes/table', - '@udecode/plate-test-utils': 'test-utils', - '@udecode/plate-trailing-block': 'editor/trailing-block', - '@udecode/plate-ui': 'ui/plate', - '@udecode/plate-ui-alignment': 'ui/nodes/alignment', - '@udecode/plate-ui-block-quote': 'ui/nodes/block-quote', - '@udecode/plate-ui-button': 'ui/button', - '@udecode/plate-ui-code-block': 'ui/nodes/code-block', - '@udecode/plate-ui-combobox': 'ui/combobox', - '@udecode/plate-ui-cursor': 'ui/cursor', - '@udecode/plate-ui-dnd': 'ui/dnd', - '@udecode/plate-ui-find-replace': 'ui/find-replace', - '@udecode/plate-ui-font': 'ui/nodes/font', - '@udecode/plate-ui-horizontal-rule': 'ui/nodes/horizontal-rule', - '@udecode/plate-ui-image': 'ui/nodes/image', - '@udecode/plate-ui-line-height': 'ui/nodes/line-height', - '@udecode/plate-ui-link': 'ui/nodes/link', - '@udecode/plate-ui-list': 'ui/nodes/list', - '@udecode/plate-ui-media-embed': 'ui/nodes/media-embed', - '@udecode/plate-ui-mention': 'ui/nodes/mention', - '@udecode/plate-ui-placeholder': 'ui/placeholder', - '@udecode/plate-ui-popover': 'ui/popover', - '@udecode/plate-ui-popper': 'ui/popper', - '@udecode/plate-ui-table': 'ui/nodes/table', - '@udecode/plate-ui-toolbar': 'ui/toolbar', - 'react/jsx-runtime': 'react/jsx-runtime.js', - 'react/jsx-dev-runtime': 'react/jsx-dev-runtime.js', -}; - -Object.keys(alias).forEach((key) => { - alias[key] = path.resolve(__dirname, `../../packages/${alias[key]}/src`); -}); - module.exports = { title: customFields.title, tagline: customFields.tagline, @@ -253,7 +183,7 @@ module.exports = { [ path.resolve(__dirname, 'plugins/module-alias'), { - alias, + alias: {}, }, ], path.resolve(__dirname, 'plugins/source-maps'), diff --git a/examples/apps/next/README.md b/examples/apps/next/README.md index ae3da8498b..8ba4c9a838 100644 --- a/examples/apps/next/README.md +++ b/examples/apps/next/README.md @@ -133,8 +133,6 @@ yarn dev [//]: # ( "@udecode/plate-ui-popover": ["../../packages/ui/popover"],) -[//]: # ( "@udecode/plate-ui-popper": ["../../packages/ui/popper"],) - [//]: # ( "@udecode/plate-ui-table": ["../../packages/ui/nodes/table"],) [//]: # ( "@udecode/plate-ui-toolbar": ["../../packages/ui/toolbar"])) \ No newline at end of file diff --git a/examples/apps/next/next.config.js b/examples/apps/next/next.config.js index 892793237b..59c6a5888e 100644 --- a/examples/apps/next/next.config.js +++ b/examples/apps/next/next.config.js @@ -1,68 +1,6 @@ const path = require('path'); -const alias = { - '@udecode/plate': 'plate', - '@udecode/plate-alignment': 'nodes/alignment', - '@udecode/plate-autoformat': 'editor/autoformat', - '@udecode/plate-basic-elements': 'nodes/basic-elements', - '@udecode/plate-basic-marks': 'nodes/basic-marks', - '@udecode/plate-block-quote': 'nodes/block-quote', - '@udecode/plate-break': 'editor/break', - '@udecode/plate-code-block': 'nodes/code-block', - '@udecode/plate-combobox': 'editor/combobox', - '@udecode/plate-core': 'core', - '@udecode/plate-serializer-csv': 'serializers/csv', - '@udecode/plate-serializer-docx': 'serializers/docx', - '@udecode/plate-excalidraw': 'ui/nodes/excalidraw', - '@udecode/plate-find-replace': 'decorators/find-replace', - '@udecode/plate-font': 'nodes/font', - '@udecode/plate-headless': 'headless', - '@udecode/plate-heading': 'nodes/heading', - '@udecode/plate-highlight': 'nodes/highlight', - '@udecode/plate-horizontal-rule': 'nodes/horizontal-rule', - '@udecode/plate-image': 'nodes/image', - '@udecode/plate-indent': 'nodes/indent', - '@udecode/plate-indent-list': 'nodes/indent-list', - '@udecode/plate-juice': 'serializers/juice', - '@udecode/plate-kbd': 'nodes/kbd', - '@udecode/plate-line-height': 'nodes/line-height', - '@udecode/plate-link': 'nodes/link', - '@udecode/plate-list': 'nodes/list', - '@udecode/plate-serializer-md': 'serializers/md', - '@udecode/plate-media-embed': 'nodes/media-embed', - '@udecode/plate-mention': 'nodes/mention', - '@udecode/plate-node-id': 'editor/node-id', - '@udecode/plate-normalizers': 'editor/normalizers', - '@udecode/plate-paragraph': 'nodes/paragraph', - '@udecode/plate-reset-node': 'editor/reset-node', - '@udecode/plate-select': 'editor/select', - '@udecode/plate-styled-components': 'ui/styled-components', - '@udecode/plate-table': 'nodes/table', - '@udecode/plate-test-utils': 'test-utils', - '@udecode/plate-trailing-block': 'editor/trailing-block', - '@udecode/plate-ui': 'ui/plate', - '@udecode/plate-ui-alignment': 'ui/nodes/alignment', - '@udecode/plate-ui-block-quote': 'ui/nodes/block-quote', - '@udecode/plate-ui-button': 'ui/button', - '@udecode/plate-ui-code-block': 'ui/nodes/code-block', - '@udecode/plate-ui-combobox': 'ui/combobox', - '@udecode/plate-ui-cursor': 'ui/cursor', - '@udecode/plate-ui-dnd': 'ui/dnd', - '@udecode/plate-ui-find-replace': 'ui/find-replace', - '@udecode/plate-ui-font': 'ui/nodes/font', - '@udecode/plate-ui-horizontal-rule': 'ui/nodes/horizontal-rule', - '@udecode/plate-ui-image': 'ui/nodes/image', - '@udecode/plate-ui-line-height': 'ui/nodes/line-height', - '@udecode/plate-ui-link': 'ui/nodes/link', - '@udecode/plate-ui-list': 'ui/nodes/list', - '@udecode/plate-ui-media-embed': 'ui/nodes/media-embed', - '@udecode/plate-ui-mention': 'ui/nodes/mention', - '@udecode/plate-ui-placeholder': 'ui/placeholder', - '@udecode/plate-ui-popover': 'ui/popover', - '@udecode/plate-ui-popper': 'ui/popper', - '@udecode/plate-ui-table': 'ui/nodes/table', - '@udecode/plate-ui-toolbar': 'ui/toolbar', -}; +const alias = require('../../../config/aliases'); Object.keys(alias).forEach((key) => { alias[key] = path.resolve(__dirname, `../../../packages/${alias[key]}/src`); diff --git a/examples/src/LinkApp.tsx b/examples/src/LinkApp.tsx index 194c4bb5ea..f7837230c7 100644 --- a/examples/src/LinkApp.tsx +++ b/examples/src/LinkApp.tsx @@ -4,13 +4,17 @@ import { createLinkPlugin, LinkToolbarButton, Plate } from '@udecode/plate'; import { basicNodesPlugins } from './basic-nodes/basicNodesPlugins'; import { editableProps } from './common/editableProps'; import { plateUI } from './common/plateUI'; +import { linkPlugin } from './link/linkPlugin'; import { linkValue } from './link/linkValue'; import { Toolbar } from './toolbar/Toolbar'; import { createMyPlugins, MyValue } from './typescript/plateTypes'; -const plugins = createMyPlugins([...basicNodesPlugins, createLinkPlugin()], { - components: plateUI, -}); +const plugins = createMyPlugins( + [...basicNodesPlugins, createLinkPlugin(linkPlugin)], + { + components: plateUI, + } +); export default () => ( <> diff --git a/examples/src/PlaygroundApp.tsx b/examples/src/PlaygroundApp.tsx index 72f140cb66..c30af9212c 100644 --- a/examples/src/PlaygroundApp.tsx +++ b/examples/src/PlaygroundApp.tsx @@ -64,6 +64,7 @@ import { withStyledDraggables } from './dnd/withStyledDraggables'; import { exitBreakPlugin } from './exit-break/exitBreakPlugin'; import { forcedLayoutPlugin } from './forced-layout/forcedLayoutPlugin'; import { indentPlugin } from './indent/indentPlugin'; +import { linkPlugin } from './link/linkPlugin'; import { MENTIONABLES } from './mention/mentionables'; import { withStyledPlaceHolders } from './placeholder/withStyledPlaceHolders'; import { resetBlockTypePlugin } from './reset-node/resetBlockTypePlugin'; @@ -104,7 +105,7 @@ const App = () => { createHeadingPlugin(), createImagePlugin(), createHorizontalRulePlugin(), - createLinkPlugin(), + createLinkPlugin(linkPlugin), createListPlugin(), createTablePlugin(), createMediaEmbedPlugin(), diff --git a/examples/src/SerializingCsvApp.tsx b/examples/src/SerializingCsvApp.tsx index 1351344d33..8cf9bada86 100644 --- a/examples/src/SerializingCsvApp.tsx +++ b/examples/src/SerializingCsvApp.tsx @@ -16,6 +16,7 @@ import { createExcalidrawPlugin } from '@udecode/plate-ui-excalidraw'; import { basicNodesPlugins } from './basic-nodes/basicNodesPlugins'; import { editableProps } from './common/editableProps'; import { plateUI } from './common/plateUI'; +import { linkPlugin } from './link/linkPlugin'; import { deserializeCsvValue } from './serializing-csv/deserializeCsvValue'; import { softBreakPlugin } from './soft-break/softBreakPlugin'; import { createMyPlugins, MyValue } from './typescript/plateTypes'; @@ -24,7 +25,7 @@ const plugins = createMyPlugins( [ ...basicNodesPlugins, createImagePlugin(), - createLinkPlugin(), + createLinkPlugin(linkPlugin), createListPlugin(), createTablePlugin(), createTodoListPlugin(), diff --git a/examples/src/SerializingHtmlApp.tsx b/examples/src/SerializingHtmlApp.tsx index d7be9dee50..7f1a590d52 100644 --- a/examples/src/SerializingHtmlApp.tsx +++ b/examples/src/SerializingHtmlApp.tsx @@ -18,6 +18,7 @@ import { basicNodesPlugins } from './basic-nodes/basicNodesPlugins'; import { basicNodesValue } from './basic-nodes/basicNodesValue'; import { editableProps } from './common/editableProps'; import { plateUI } from './common/plateUI'; +import { linkPlugin } from './link/linkPlugin'; import { deserializeHtmlValue } from './serializing-html/deserializeHtmlValue'; import { HighlightHTML } from './serializing-html/HighlightHTML'; import { softBreakPlugin } from './soft-break/softBreakPlugin'; @@ -27,7 +28,7 @@ const plugins = createMyPlugins( [ ...basicNodesPlugins, createImagePlugin(), - createLinkPlugin(), + createLinkPlugin(linkPlugin), createListPlugin(), createTablePlugin(), createTodoListPlugin(), diff --git a/examples/src/SerializingMdApp.tsx b/examples/src/SerializingMdApp.tsx index e27e5dbdb1..30ded9a59f 100644 --- a/examples/src/SerializingMdApp.tsx +++ b/examples/src/SerializingMdApp.tsx @@ -10,6 +10,7 @@ import { import { basicNodesPlugins } from './basic-nodes/basicNodesPlugins'; import { editableProps } from './common/editableProps'; import { plateUI } from './common/plateUI'; +import { linkPlugin } from './link/linkPlugin'; import { deserializeMdValue } from './serializing-md/deserializeMdValue'; import { createMyPlugins, MyValue } from './typescript/plateTypes'; @@ -17,7 +18,7 @@ const plugins = createMyPlugins( [ ...basicNodesPlugins, createImagePlugin(), - createLinkPlugin(), + createLinkPlugin(linkPlugin), createListPlugin(), createTablePlugin(), createDeserializeMdPlugin(), diff --git a/examples/src/SlashCommandApp.tsx b/examples/src/SlashCommandApp.tsx new file mode 100644 index 0000000000..c522572f4f --- /dev/null +++ b/examples/src/SlashCommandApp.tsx @@ -0,0 +1,83 @@ +import React, { useEffect } from 'react'; +import { + Combobox, + comboboxActions, + ComboboxItemProps, + isDefined, + useComboboxSelectors, +} from '@udecode/plate'; + +// WIP + +export const COMBOBOX_TRIGGER_SLASH_COMMAND = '/'; +export const COMBOBOX_KEY_SLASH_COMMAND = 'slash_command'; + +const COMMAND_BLOCK_ADD_PARAGRAPH = { + id: 'block.add.paragraph', + label: 'Block: Add Paragraph', + inlineLabel: 'Paragraph', + description: 'Plain text', + keybinding: '⌘⏎', +}; + +const SlashCommandComboboxEffect = () => { + const search = useComboboxSelectors.text(); + + useEffect(() => { + const commands = [COMMAND_BLOCK_ADD_PARAGRAPH, COMMAND_BLOCK_ADD_PARAGRAPH]; + + const items = commands + .map((item) => ({ + key: item.id, + text: item.inlineLabel, + data: { + description: item.description, + keybinding: item.keybinding, + }, + })) + .filter( + (c) => + !isDefined(search) || + c.text?.toLowerCase().includes(search.toLowerCase()) + ); + + comboboxActions.items(items); + }, [search]); + + return null; +}; + +const SlashCommandComboboxItem = ({ item }: ComboboxItemProps<{}>) => { + const data = item.data as any; + + return ( +
+
+
+
{item.text}
+ {isDefined(data.description) && ( +
+ {data.description} +
+ )} +
+ {isDefined(data.keybinding) && ( +
+ {/* {data.keybinding} */} +
+ )} +
+
+ ); +}; + +const SlashCommandCombobox = () => ( + {}} + /> +); diff --git a/examples/src/link/linkPlugin.tsx b/examples/src/link/linkPlugin.tsx new file mode 100644 index 0000000000..65aff7a516 --- /dev/null +++ b/examples/src/link/linkPlugin.tsx @@ -0,0 +1,6 @@ +import { LinkPlugin, PlateFloatingLink } from '@udecode/plate'; +import { MyPlatePlugin } from '../typescript/plateTypes'; + +export const linkPlugin: Partial> = { + renderAfterEditable: PlateFloatingLink, +}; diff --git a/examples/src/table/TableToolbarButtons.tsx b/examples/src/table/TableToolbarButtons.tsx index e2a40bd279..62bf866c69 100644 --- a/examples/src/table/TableToolbarButtons.tsx +++ b/examples/src/table/TableToolbarButtons.tsx @@ -6,12 +6,12 @@ import { BorderLeft } from '@styled-icons/material/BorderLeft'; import { BorderRight } from '@styled-icons/material/BorderRight'; import { BorderTop } from '@styled-icons/material/BorderTop'; import { - addColumn, - addRow, deleteColumn, deleteRow, deleteTable, insertTable, + insertTableColumn, + insertTableRow, TableToolbarButton, } from '@udecode/plate'; @@ -19,9 +19,9 @@ export const TableToolbarButtons = () => ( <> } transform={insertTable} /> } transform={deleteTable} /> - } transform={addRow} /> + } transform={insertTableRow} /> } transform={deleteRow} /> - } transform={addColumn} /> + } transform={insertTableColumn} /> } transform={deleteColumn} /> ); diff --git a/index.ts b/index.ts deleted file mode 100644 index a9cdf64834..0000000000 --- a/index.ts +++ /dev/null @@ -1,1505 +0,0 @@ -/** - * @file Automatically generated by barrelsby. - */ - -export * from "./docs/docs/PlaygroundSandpack"; -export * from "./docs/docs/components/BalloonToolbarSandpack"; -export * from "./docs/docs/components/CursorOverlaySandpack"; -export * from "./docs/docs/components/DndSandpack"; -export * from "./docs/docs/components/PlaceholderSandpack"; -export * from "./docs/docs/components/PlateSandpack"; -export * from "./docs/docs/examples/EditableVoidsSandpack"; -export * from "./docs/docs/examples/HugeDocumentSandpack"; -export * from "./docs/docs/examples/IframeSandpack"; -export * from "./docs/docs/examples/MultiSandpack"; -export * from "./docs/docs/examples/PreviewMdSandpack"; -export * from "./docs/docs/getting-started/BasicEditorSandpack"; -export * from "./docs/docs/getting-started/BasicPluginsSandpack"; -export * from "./docs/docs/guides/MultipleEditorsSandpack"; -export * from "./docs/docs/guides/TypescriptSandpack"; -export * from "./docs/docs/plugins/AlignmentSandpack"; -export * from "./docs/docs/plugins/AutoformatSandpack"; -export * from "./docs/docs/plugins/BasicElementsSandpack"; -export * from "./docs/docs/plugins/BasicMarksSandpack"; -export * from "./docs/docs/plugins/ExcalidrawSandpack"; -export * from "./docs/docs/plugins/ExitBreakSandpack"; -export * from "./docs/docs/plugins/FindReplaceSandpack"; -export * from "./docs/docs/plugins/FontSandpack"; -export * from "./docs/docs/plugins/ForcedLayoutSandpack"; -export * from "./docs/docs/plugins/HighlightSandpack"; -export * from "./docs/docs/plugins/HorizontalRuleSandpack"; -export * from "./docs/docs/plugins/ImageSandpack"; -export * from "./docs/docs/plugins/IndentListSandpack"; -export * from "./docs/docs/plugins/IndentSandpack"; -export * from "./docs/docs/plugins/KbdSandpack"; -export * from "./docs/docs/plugins/LineHeightSandpack"; -export * from "./docs/docs/plugins/LinkSandpack"; -export * from "./docs/docs/plugins/ListSandpack"; -export * from "./docs/docs/plugins/MediaEmbedSandpack"; -export * from "./docs/docs/plugins/MentionSandpack"; -export * from "./docs/docs/plugins/ResetNodeSandpack"; -export * from "./docs/docs/plugins/SerializingCsvSandpack"; -export * from "./docs/docs/plugins/SerializingDocxSandpack"; -export * from "./docs/docs/plugins/SerializingHtmlSandpack"; -export * from "./docs/docs/plugins/SerializingMdSandpack"; -export * from "./docs/docs/plugins/SingleLineSandpack"; -export * from "./docs/docs/plugins/SoftBreakSandpack"; -export * from "./docs/docs/plugins/TableSandpack"; -export * from "./docs/docs/sandpack/CommonSandpack"; -export * from "./docs/docs/sandpack/code-deps"; -export * from "./docs/docs/sandpack/code-files"; -export * from "./docs/docs/sandpack/code-root"; -export * from "./docs/docs/sandpack/files/code-AlignmentApp"; -export * from "./docs/docs/sandpack/files/code-AutoformatApp"; -export * from "./docs/docs/sandpack/files/code-BalloonToolbarApp"; -export * from "./docs/docs/sandpack/files/code-BasicEditorDefaultApp"; -export * from "./docs/docs/sandpack/files/code-BasicEditorHandlerApp"; -export * from "./docs/docs/sandpack/files/code-BasicEditorValueApp"; -export * from "./docs/docs/sandpack/files/code-BasicElementsApp"; -export * from "./docs/docs/sandpack/files/code-BasicMarksApp"; -export * from "./docs/docs/sandpack/files/code-BasicPluginsComponentsApp"; -export * from "./docs/docs/sandpack/files/code-BasicPluginsDefaultApp"; -export * from "./docs/docs/sandpack/files/code-CursorOverlayApp"; -export * from "./docs/docs/sandpack/files/code-DndApp"; -export * from "./docs/docs/sandpack/files/code-EditableVoidsApp"; -export * from "./docs/docs/sandpack/files/code-ExcalidrawApp"; -export * from "./docs/docs/sandpack/files/code-ExitBreakApp"; -export * from "./docs/docs/sandpack/files/code-FindReplaceApp"; -export * from "./docs/docs/sandpack/files/code-FontApp"; -export * from "./docs/docs/sandpack/files/code-ForcedLayoutApp"; -export * from "./docs/docs/sandpack/files/code-HighlightApp"; -export * from "./docs/docs/sandpack/files/code-HorizontalRuleApp"; -export * from "./docs/docs/sandpack/files/code-HugeDocumentApp"; -export * from "./docs/docs/sandpack/files/code-IframeApp"; -export * from "./docs/docs/sandpack/files/code-ImageApp"; -export * from "./docs/docs/sandpack/files/code-IndentApp"; -export * from "./docs/docs/sandpack/files/code-IndentListApp"; -export * from "./docs/docs/sandpack/files/code-KbdApp"; -export * from "./docs/docs/sandpack/files/code-LineHeightApp"; -export * from "./docs/docs/sandpack/files/code-LinkApp"; -export * from "./docs/docs/sandpack/files/code-ListApp"; -export * from "./docs/docs/sandpack/files/code-MediaEmbedApp"; -export * from "./docs/docs/sandpack/files/code-MentionApp"; -export * from "./docs/docs/sandpack/files/code-MultiEditorsApp"; -export * from "./docs/docs/sandpack/files/code-MultipleEditorsApp"; -export * from "./docs/docs/sandpack/files/code-PlaceholderApp"; -export * from "./docs/docs/sandpack/files/code-PlateApp"; -export * from "./docs/docs/sandpack/files/code-PlaygroundApp"; -export * from "./docs/docs/sandpack/files/code-PreviewMdApp"; -export * from "./docs/docs/sandpack/files/code-ResetNodeApp"; -export * from "./docs/docs/sandpack/files/code-Sandpack"; -export * from "./docs/docs/sandpack/files/code-SerializingCsvApp"; -export * from "./docs/docs/sandpack/files/code-SerializingDocxApp"; -export * from "./docs/docs/sandpack/files/code-SerializingHtmlApp"; -export * from "./docs/docs/sandpack/files/code-SerializingMdApp"; -export * from "./docs/docs/sandpack/files/code-SingleLineApp"; -export * from "./docs/docs/sandpack/files/code-SoftBreakApp"; -export * from "./docs/docs/sandpack/files/code-TableApp"; -export * from "./docs/docs/sandpack/files/code-ToolbarButtons"; -export * from "./docs/docs/sandpack/files/code-TypescriptApp"; -export * from "./docs/docs/sandpack/files/code-files"; -export * from "./docs/docs/sandpack/files/code-playgroundValue"; -export * from "./docs/docs/sandpack/files/code-styles"; -export * from "./docs/docs/sandpack/files/align/code-AlignToolbarButtons"; -export * from "./docs/docs/sandpack/files/align/code-alignFiles"; -export * from "./docs/docs/sandpack/files/align/code-alignPlugin"; -export * from "./docs/docs/sandpack/files/align/code-alignValue"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatBlocks"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatFiles"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatLists"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatMarks"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatPlugin"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatRules"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatUtils"; -export * from "./docs/docs/sandpack/files/autoformat/code-autoformatValue"; -export * from "./docs/docs/sandpack/files/balloon-toolbar/code-MarkBalloonToolbar"; -export * from "./docs/docs/sandpack/files/balloon-toolbar/code-balloonToolbarFiles"; -export * from "./docs/docs/sandpack/files/balloon-toolbar/code-balloonToolbarValue"; -export * from "./docs/docs/sandpack/files/basic-editor/code-basicEditorFiles"; -export * from "./docs/docs/sandpack/files/basic-editor/code-plainTextValue"; -export * from "./docs/docs/sandpack/files/basic-elements/code-BasicElementToolbarButtons"; -export * from "./docs/docs/sandpack/files/basic-elements/code-basicElementsFiles"; -export * from "./docs/docs/sandpack/files/basic-elements/code-basicElementsPlugins"; -export * from "./docs/docs/sandpack/files/basic-elements/code-basicElementsValue"; -export * from "./docs/docs/sandpack/files/basic-marks/code-BasicMarkToolbarButtons"; -export * from "./docs/docs/sandpack/files/basic-marks/code-basicMarksFiles"; -export * from "./docs/docs/sandpack/files/basic-marks/code-basicMarksPlugins"; -export * from "./docs/docs/sandpack/files/basic-marks/code-basicMarksValue"; -export * from "./docs/docs/sandpack/files/basic-nodes/code-basicNodesFiles"; -export * from "./docs/docs/sandpack/files/basic-nodes/code-basicNodesPlugins"; -export * from "./docs/docs/sandpack/files/basic-nodes/code-basicNodesValue"; -export * from "./docs/docs/sandpack/files/basic-plugins/code-basicPluginsFiles"; -export * from "./docs/docs/sandpack/files/basic-plugins/code-createElement"; -export * from "./docs/docs/sandpack/files/common/code-commonFiles"; -export * from "./docs/docs/sandpack/files/common/code-components"; -export * from "./docs/docs/sandpack/files/common/code-editableProps"; -export * from "./docs/docs/sandpack/files/common/code-plateUI"; -export * from "./docs/docs/sandpack/files/cursor-overlay/code-CursorOverlayContainer"; -export * from "./docs/docs/sandpack/files/cursor-overlay/code-cursorOverlayFiles"; -export * from "./docs/docs/sandpack/files/cursor-overlay/code-cursorOverlayValue"; -export * from "./docs/docs/sandpack/files/cursor-overlay/code-cursorStore"; -export * from "./docs/docs/sandpack/files/cursor-overlay/code-dragOverCursorPlugin"; -export * from "./docs/docs/sandpack/files/cursor-overlay/code-staticCursors"; -export * from "./docs/docs/sandpack/files/dnd/code-createNodesWithId"; -export * from "./docs/docs/sandpack/files/dnd/code-dndFiles"; -export * from "./docs/docs/sandpack/files/dnd/code-getNodesWithRandomId"; -export * from "./docs/docs/sandpack/files/dnd/code-withStyledDraggables"; -export * from "./docs/docs/sandpack/files/editable-voids/code-EditableVoidElement"; -export * from "./docs/docs/sandpack/files/editable-voids/code-createEditableVoidPlugin"; -export * from "./docs/docs/sandpack/files/editable-voids/code-editableVoidsFiles"; -export * from "./docs/docs/sandpack/files/editable-voids/code-editableVoidsValue"; -export * from "./docs/docs/sandpack/files/excalidraw/code-excalidrawFiles"; -export * from "./docs/docs/sandpack/files/excalidraw/code-excalidrawValue"; -export * from "./docs/docs/sandpack/files/excalidraw/code-initialDataExcalidraw"; -export * from "./docs/docs/sandpack/files/exit-break/code-exitBreakFiles"; -export * from "./docs/docs/sandpack/files/exit-break/code-exitBreakPlugin"; -export * from "./docs/docs/sandpack/files/exit-break/code-exitBreakValue"; -export * from "./docs/docs/sandpack/files/find-replace/code-findReplaceFiles"; -export * from "./docs/docs/sandpack/files/find-replace/code-findReplaceValue"; -export * from "./docs/docs/sandpack/files/font/code-fontFiles"; -export * from "./docs/docs/sandpack/files/font/code-fontValue"; -export * from "./docs/docs/sandpack/files/forced-layout/code-forcedLayoutFiles"; -export * from "./docs/docs/sandpack/files/forced-layout/code-forcedLayoutPlugin"; -export * from "./docs/docs/sandpack/files/forced-layout/code-forcedLayoutValue"; -export * from "./docs/docs/sandpack/files/highlight/code-HighlightToolbarButton"; -export * from "./docs/docs/sandpack/files/highlight/code-highlightFiles"; -export * from "./docs/docs/sandpack/files/highlight/code-highlightValue"; -export * from "./docs/docs/sandpack/files/horizontal-rule/code-horizontalRuleFiles"; -export * from "./docs/docs/sandpack/files/horizontal-rule/code-horizontalRuleValue"; -export * from "./docs/docs/sandpack/files/huge-document/code-createHugeDocumentValue"; -export * from "./docs/docs/sandpack/files/huge-document/code-hugeDocumentFiles"; -export * from "./docs/docs/sandpack/files/iframe/code-IFrame"; -export * from "./docs/docs/sandpack/files/iframe/code-iframeFiles"; -export * from "./docs/docs/sandpack/files/iframe/code-iframeValue"; -export * from "./docs/docs/sandpack/files/image/code-imageFiles"; -export * from "./docs/docs/sandpack/files/image/code-imagePlugins"; -export * from "./docs/docs/sandpack/files/image/code-imageValue"; -export * from "./docs/docs/sandpack/files/indent/code-IndentToolbarButtons"; -export * from "./docs/docs/sandpack/files/indent/code-indentFiles"; -export * from "./docs/docs/sandpack/files/indent/code-indentPlugin"; -export * from "./docs/docs/sandpack/files/indent/code-indentValue"; -export * from "./docs/docs/sandpack/files/indent-list/code-indentListFiles"; -export * from "./docs/docs/sandpack/files/indent-list/code-indentListPlugin"; -export * from "./docs/docs/sandpack/files/indent-list/code-indentListValue"; -export * from "./docs/docs/sandpack/files/kbd/code-KbdToolbarButton"; -export * from "./docs/docs/sandpack/files/kbd/code-kbdFiles"; -export * from "./docs/docs/sandpack/files/kbd/code-kbdValue"; -export * from "./docs/docs/sandpack/files/line-height/code-lineHeightFiles"; -export * from "./docs/docs/sandpack/files/line-height/code-lineHeightPlugin"; -export * from "./docs/docs/sandpack/files/line-height/code-lineHeightValue"; -export * from "./docs/docs/sandpack/files/link/code-linkFiles"; -export * from "./docs/docs/sandpack/files/link/code-linkValue"; -export * from "./docs/docs/sandpack/files/list/code-ListToolbarButtons"; -export * from "./docs/docs/sandpack/files/list/code-createList"; -export * from "./docs/docs/sandpack/files/list/code-listFiles"; -export * from "./docs/docs/sandpack/files/list/code-listValue"; -export * from "./docs/docs/sandpack/files/media-embed/code-mediaEmbedFiles"; -export * from "./docs/docs/sandpack/files/media-embed/code-mediaEmbedValue"; -export * from "./docs/docs/sandpack/files/mention/code-mentionFiles"; -export * from "./docs/docs/sandpack/files/mention/code-mentionValue"; -export * from "./docs/docs/sandpack/files/mention/code-mentionables"; -export * from "./docs/docs/sandpack/files/multiple-editors/code-createMultiEditorsValue"; -export * from "./docs/docs/sandpack/files/multiple-editors/code-multipleEditorsFiles"; -export * from "./docs/docs/sandpack/files/placeholder/code-placeholderFiles"; -export * from "./docs/docs/sandpack/files/placeholder/code-placeholderValue"; -export * from "./docs/docs/sandpack/files/placeholder/code-withStyledPlaceHolders"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-PreviewLeaf.styles"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-PreviewLeaf"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-PreviewLeaf.types"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-createPreviewPlugin"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-decoratePreview"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-previewMarkdownFiles"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-previewMdValue"; -export * from "./docs/docs/sandpack/files/preview-markdown/code-renderLeafPreview"; -export * from "./docs/docs/sandpack/files/preview-markdown/PreviewLeaf/code-PreviewLeaf.styles"; -export * from "./docs/docs/sandpack/files/preview-markdown/PreviewLeaf/code-PreviewLeaf"; -export * from "./docs/docs/sandpack/files/preview-markdown/PreviewLeaf/code-PreviewLeaf.types"; -export * from "./docs/docs/sandpack/files/preview-markdown/PreviewLeaf/code-previewLeafFiles"; -export * from "./docs/docs/sandpack/files/reset-node/code-resetBlockTypePlugin"; -export * from "./docs/docs/sandpack/files/reset-node/code-resetNodeFiles"; -export * from "./docs/docs/sandpack/files/select-on-backspace/code-selectOnBackspaceFiles"; -export * from "./docs/docs/sandpack/files/select-on-backspace/code-selectOnBackspacePlugin"; -export * from "./docs/docs/sandpack/files/serializing-csv/code-deserializeCsvValue"; -export * from "./docs/docs/sandpack/files/serializing-csv/code-serializingCsvFiles"; -export * from "./docs/docs/sandpack/files/serializing-docx/code-deserializeDocxValue"; -export * from "./docs/docs/sandpack/files/serializing-docx/code-serializingDocxFiles"; -export * from "./docs/docs/sandpack/files/serializing-html/code-HighlightHTML"; -export * from "./docs/docs/sandpack/files/serializing-html/code-deserializeHtmlValue"; -export * from "./docs/docs/sandpack/files/serializing-html/code-formatHTML"; -export * from "./docs/docs/sandpack/files/serializing-html/code-serializingHtmlFiles"; -export * from "./docs/docs/sandpack/files/serializing-md/code-deserializeMdValue"; -export * from "./docs/docs/sandpack/files/serializing-md/code-serializingMdFiles"; -export * from "./docs/docs/sandpack/files/single-line/code-singleLineFiles"; -export * from "./docs/docs/sandpack/files/single-line/code-singleLineValue"; -export * from "./docs/docs/sandpack/files/soft-break/code-softBreakFiles"; -export * from "./docs/docs/sandpack/files/soft-break/code-softBreakPlugin"; -export * from "./docs/docs/sandpack/files/soft-break/code-softBreakValue"; -export * from "./docs/docs/sandpack/files/table/code-TableToolbarButtons"; -export * from "./docs/docs/sandpack/files/table/code-tableFiles"; -export * from "./docs/docs/sandpack/files/table/code-tableValue"; -export * from "./docs/docs/sandpack/files/toolbar/code-Toolbar"; -export * from "./docs/docs/sandpack/files/toolbar/code-toolbarFiles"; -export * from "./docs/docs/sandpack/files/trailing-block/code-trailingBlockFiles"; -export * from "./docs/docs/sandpack/files/trailing-block/code-trailingBlockPlugin"; -export * from "./docs/docs/sandpack/files/typescript/code-plateTypes"; -export * from "./docs/docs/sandpack/files/typescript/code-typescriptFiles"; -export * from "./docs/src/components/Home/CarbonAds"; -export * from "./docs/src/components/Home/Demo"; -export * from "./docs/src/components/Home/DemoHeader"; -export * from "./docs/src/components/Home/Footer"; -export * from "./docs/src/components/Home/Header"; -export * from "./docs/src/components/Home/HomeContent"; -export * from "./docs/src/components/Home/MacroFeatures"; -export * from "./docs/src/components/Home/MicroFeatures"; -export * from "./docs/src/components/Home/PoweredByVercel"; -export * from "./docs/src/pages/index"; -export * from "./docs/src/theme/DocPage/index"; -export * from "./docs/src/theme/DocSidebar/index"; -export * from "./docs/src/theme/Navbar/index"; -export * from "./docs/src/theme/Navbar/components/QuickSocialLinksView/index"; -export * from "./docs/src/theme/Root/index"; -export * from "./docs/src/types/custom"; -export * from "./examples/apps/cra/src/index"; -export * from "./examples/apps/cra/src/react-app-env"; -export * from "./examples/apps/next/next-env"; -export * from "./examples/apps/next/src/pages/_app"; -export * from "./examples/apps/next/src/pages/index"; -export * from "./examples/src/AlignmentApp"; -export * from "./examples/src/AutoformatApp"; -export * from "./examples/src/BalloonToolbarApp"; -export * from "./examples/src/BasicEditorDefaultApp"; -export * from "./examples/src/BasicEditorHandlerApp"; -export * from "./examples/src/BasicEditorValueApp"; -export * from "./examples/src/BasicElementsApp"; -export * from "./examples/src/BasicMarksApp"; -export * from "./examples/src/BasicPluginsComponentsApp"; -export * from "./examples/src/BasicPluginsDefaultApp"; -export * from "./examples/src/CursorOverlayApp"; -export * from "./examples/src/DndApp"; -export * from "./examples/src/EditableVoidsApp"; -export * from "./examples/src/ExcalidrawApp"; -export * from "./examples/src/ExitBreakApp"; -export * from "./examples/src/FindReplaceApp"; -export * from "./examples/src/FontApp"; -export * from "./examples/src/ForcedLayoutApp"; -export * from "./examples/src/HighlightApp"; -export * from "./examples/src/HorizontalRuleApp"; -export * from "./examples/src/HugeDocumentApp"; -export * from "./examples/src/IframeApp"; -export * from "./examples/src/ImageApp"; -export * from "./examples/src/IndentApp"; -export * from "./examples/src/IndentListApp"; -export * from "./examples/src/KbdApp"; -export * from "./examples/src/LineHeightApp"; -export * from "./examples/src/LinkApp"; -export * from "./examples/src/ListApp"; -export * from "./examples/src/MediaEmbedApp"; -export * from "./examples/src/MentionApp"; -export * from "./examples/src/MultiEditorsApp"; -export * from "./examples/src/MultipleEditorsApp"; -export * from "./examples/src/PlaceholderApp"; -export * from "./examples/src/PlateApp"; -export * from "./examples/src/PlaygroundApp"; -export * from "./examples/src/PreviewMdApp"; -export * from "./examples/src/ResetNodeApp"; -export * from "./examples/src/Sandpack"; -export * from "./examples/src/SerializingCsvApp"; -export * from "./examples/src/SerializingDocxApp"; -export * from "./examples/src/SerializingHtmlApp"; -export * from "./examples/src/SerializingMdApp"; -export * from "./examples/src/SingleLineApp"; -export * from "./examples/src/SoftBreakApp"; -export * from "./examples/src/TableApp"; -export * from "./examples/src/ToolbarButtons"; -export * from "./examples/src/TypescriptApp"; -export * from "./examples/src/playgroundValue"; -export * from "./examples/src/align/AlignToolbarButtons"; -export * from "./examples/src/align/alignPlugin"; -export * from "./examples/src/align/alignValue"; -export * from "./examples/src/autoformat/autoformatBlocks"; -export * from "./examples/src/autoformat/autoformatLists"; -export * from "./examples/src/autoformat/autoformatMarks"; -export * from "./examples/src/autoformat/autoformatPlugin"; -export * from "./examples/src/autoformat/autoformatRules"; -export * from "./examples/src/autoformat/autoformatUtils"; -export * from "./examples/src/autoformat/autoformatValue"; -export * from "./examples/src/balloon-toolbar/MarkBalloonToolbar"; -export * from "./examples/src/balloon-toolbar/balloonToolbarValue"; -export * from "./examples/src/basic-editor/plainTextValue"; -export * from "./examples/src/basic-elements/BasicElementToolbarButtons"; -export * from "./examples/src/basic-elements/basicElementsPlugins"; -export * from "./examples/src/basic-elements/basicElementsValue"; -export * from "./examples/src/basic-marks/BasicMarkToolbarButtons"; -export * from "./examples/src/basic-marks/basicMarksPlugins"; -export * from "./examples/src/basic-marks/basicMarksValue"; -export * from "./examples/src/basic-nodes/basicNodesPlugins"; -export * from "./examples/src/basic-nodes/basicNodesValue"; -export * from "./examples/src/basic-plugins/createElement"; -export * from "./examples/src/common/editableProps"; -export * from "./examples/src/common/plateUI"; -export * from "./examples/src/cursor-overlay/CursorOverlayContainer"; -export * from "./examples/src/cursor-overlay/cursorOverlayValue"; -export * from "./examples/src/cursor-overlay/cursorStore"; -export * from "./examples/src/cursor-overlay/dragOverCursorPlugin"; -export * from "./examples/src/cursor-overlay/staticCursors"; -export * from "./examples/src/dnd/createNodesWithId"; -export * from "./examples/src/dnd/withStyledDraggables"; -export * from "./examples/src/editable-voids/EditableVoidElement"; -export * from "./examples/src/editable-voids/createEditableVoidPlugin"; -export * from "./examples/src/editable-voids/editableVoidsValue"; -export * from "./examples/src/excalidraw/excalidrawValue"; -export * from "./examples/src/excalidraw/initialDataExcalidraw"; -export * from "./examples/src/exit-break/exitBreakPlugin"; -export * from "./examples/src/exit-break/exitBreakValue"; -export * from "./examples/src/find-replace/findReplaceValue"; -export * from "./examples/src/font/fontValue"; -export * from "./examples/src/forced-layout/forcedLayoutPlugin"; -export * from "./examples/src/forced-layout/forcedLayoutValue"; -export * from "./examples/src/highlight/HighlightToolbarButton"; -export * from "./examples/src/highlight/highlightValue"; -export * from "./examples/src/horizontal-rule/horizontalRuleValue"; -export * from "./examples/src/huge-document/createHugeDocumentValue"; -export * from "./examples/src/iframe/IFrame"; -export * from "./examples/src/iframe/iframeValue"; -export * from "./examples/src/image/imagePlugins"; -export * from "./examples/src/image/imageValue"; -export * from "./examples/src/indent/IndentToolbarButtons"; -export * from "./examples/src/indent/indentPlugin"; -export * from "./examples/src/indent/indentValue"; -export * from "./examples/src/indent-list/indentListPlugin"; -export * from "./examples/src/indent-list/indentListValue"; -export * from "./examples/src/kbd/KbdToolbarButton"; -export * from "./examples/src/kbd/kbdValue"; -export * from "./examples/src/line-height/lineHeightPlugin"; -export * from "./examples/src/line-height/lineHeightValue"; -export * from "./examples/src/link/linkValue"; -export * from "./examples/src/list/ListToolbarButtons"; -export * from "./examples/src/list/createList"; -export * from "./examples/src/list/listValue"; -export * from "./examples/src/media-embed/mediaEmbedValue"; -export * from "./examples/src/mention/mentionValue"; -export * from "./examples/src/mention/mentionables"; -export * from "./examples/src/multiple-editors/createMultiEditorsValue"; -export * from "./examples/src/placeholder/placeholderValue"; -export * from "./examples/src/placeholder/withStyledPlaceHolders"; -export * from "./examples/src/preview-markdown/PreviewLeaf.styles"; -export * from "./examples/src/preview-markdown/PreviewLeaf"; -export * from "./examples/src/preview-markdown/PreviewLeaf.types"; -export * from "./examples/src/preview-markdown/createPreviewPlugin"; -export * from "./examples/src/preview-markdown/decoratePreview"; -export * from "./examples/src/preview-markdown/previewMdValue"; -export * from "./examples/src/preview-markdown/renderLeafPreview"; -export * from "./examples/src/reset-node/resetBlockTypePlugin"; -export * from "./examples/src/select-on-backspace/selectOnBackspacePlugin"; -export * from "./examples/src/serializing-csv/deserializeCsvValue"; -export * from "./examples/src/serializing-docx/deserializeDocxValue"; -export * from "./examples/src/serializing-html/HighlightHTML"; -export * from "./examples/src/serializing-html/deserializeHtmlValue"; -export * from "./examples/src/serializing-html/formatHTML"; -export * from "./examples/src/serializing-md/deserializeMdValue"; -export * from "./examples/src/single-line/singleLineValue"; -export * from "./examples/src/soft-break/softBreakPlugin"; -export * from "./examples/src/soft-break/softBreakValue"; -export * from "./examples/src/table/TableToolbarButtons"; -export * from "./examples/src/table/tableValue"; -export * from "./examples/src/toolbar/Toolbar"; -export * from "./examples/src/trailing-block/trailingBlockPlugin"; -export * from "./examples/src/typescript/plateTypes"; -export * from "./packages/core/dist/index"; -export * from "./packages/core/dist/atoms/createAtomStore"; -export * from "./packages/core/dist/atoms/elementAtom"; -export * from "./packages/core/dist/atoms/index"; -export * from "./packages/core/dist/atoms/plateIdAtom"; -export * from "./packages/core/dist/components/Box"; -export * from "./packages/core/dist/components/index"; -export * from "./packages/core/dist/components/plate/DefaultLeaf"; -export * from "./packages/core/dist/components/plate/EditablePlugins"; -export * from "./packages/core/dist/components/plate/EditorRefEffect"; -export * from "./packages/core/dist/components/plate/EditorStateEffect"; -export * from "./packages/core/dist/components/plate/Plate"; -export * from "./packages/core/dist/components/plate/PlateEventProvider"; -export * from "./packages/core/dist/components/plate/PlateProvider"; -export * from "./packages/core/dist/components/plate/PlateTest"; -export * from "./packages/core/dist/components/plate/index"; -export * from "./packages/core/dist/hooks/index"; -export * from "./packages/core/dist/hooks/plate/index"; -export * from "./packages/core/dist/hooks/plate/useEditableProps"; -export * from "./packages/core/dist/hooks/plate/usePlate"; -export * from "./packages/core/dist/hooks/plate/usePlateEffects"; -export * from "./packages/core/dist/hooks/plate/usePlateStoreEffects"; -export * from "./packages/core/dist/hooks/plate/usePlatesStoreEffect"; -export * from "./packages/core/dist/hooks/plate/useSlateProps"; -export * from "./packages/core/dist/hooks/react/index"; -export * from "./packages/core/dist/hooks/react/useComposedRef"; -export * from "./packages/core/dist/hooks/react/useWrapElement"; -export * from "./packages/core/dist/hooks/slate/index"; -export * from "./packages/core/dist/hooks/slate/useEditorRef"; -export * from "./packages/core/dist/hooks/slate/useEditorState"; -export * from "./packages/core/dist/plugins/createDeserializeAstPlugin"; -export * from "./packages/core/dist/plugins/createEventEditorPlugin"; -export * from "./packages/core/dist/plugins/createHistoryPlugin"; -export * from "./packages/core/dist/plugins/createInlineVoidPlugin"; -export * from "./packages/core/dist/plugins/createInsertDataPlugin"; -export * from "./packages/core/dist/plugins/createReactPlugin"; -export * from "./packages/core/dist/plugins/index"; -export * from "./packages/core/dist/plugins/onKeyDownToggleElement"; -export * from "./packages/core/dist/plugins/onKeyDownToggleMark"; -export * from "./packages/core/dist/plugins/withPlate"; -export * from "./packages/core/dist/plugins/withTReact"; -export * from "./packages/core/dist/plugins/html-deserializer/constants"; -export * from "./packages/core/dist/plugins/html-deserializer/createDeserializeHtmlPlugin"; -export * from "./packages/core/dist/plugins/html-deserializer/index"; -export * from "./packages/core/dist/plugins/html-deserializer/types"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/cleanHtmlBrElements"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/cleanHtmlCrLf"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/cleanHtmlEmptyElements"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/cleanHtmlFontElements"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/cleanHtmlLinkElements"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/cleanHtmlTextNodes"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/copyBlockMarksToSpanChild"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/deserializeHtml"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/deserializeHtmlElement"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/deserializeHtmlNode"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/deserializeHtmlNodeChildren"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/findHtmlElement"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/getHtmlComments"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/htmlBodyToFragment"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/htmlBrToNewLine"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/htmlElementToElement"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/htmlElementToLeaf"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/htmlTextNodeToString"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/index"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/isHtmlBlockElement"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/isHtmlComment"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/isHtmlElement"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/isHtmlFragmentHref"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/isHtmlText"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/isOlSymbol"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/parseHtmlDocument"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/parseHtmlElement"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/pipeDeserializeHtmlElement"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/pipeDeserializeHtmlLeaf"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/pluginDeserializeHtml"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/postCleanHtml"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/preCleanHtml"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/removeHtmlNodesBetweenComments"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/removeHtmlSurroundings"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/replaceTagName"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/traverseHtmlComments"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/traverseHtmlElements"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/traverseHtmlNode"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/traverseHtmlTexts"; -export * from "./packages/core/dist/plugins/html-deserializer/utils/unwrapHtmlElement"; -export * from "./packages/core/dist/plugins/html-serializer/elementToHtml"; -export * from "./packages/core/dist/plugins/html-serializer/index"; -export * from "./packages/core/dist/plugins/html-serializer/leafToHtml"; -export * from "./packages/core/dist/plugins/html-serializer/serializeHtml"; -export * from "./packages/core/dist/plugins/html-serializer/utils/createElementWithSlate"; -export * from "./packages/core/dist/plugins/html-serializer/utils/htmlStringToDOMNode"; -export * from "./packages/core/dist/plugins/html-serializer/utils/index"; -export * from "./packages/core/dist/plugins/html-serializer/utils/isEncoded"; -export * from "./packages/core/dist/plugins/html-serializer/utils/stripClassNames"; -export * from "./packages/core/dist/plugins/html-serializer/utils/stripSlateDataAttributes"; -export * from "./packages/core/dist/plugins/html-serializer/utils/trimWhitespace"; -export * from "./packages/core/dist/queries/findDescendant"; -export * from "./packages/core/dist/queries/findNode"; -export * from "./packages/core/dist/queries/getBlockAbove"; -export * from "./packages/core/dist/queries/getChildren"; -export * from "./packages/core/dist/queries/getEdgeBlocksAbove"; -export * from "./packages/core/dist/queries/getLastChild"; -export * from "./packages/core/dist/queries/getLastNodeByLevel"; -export * from "./packages/core/dist/queries/getMark"; -export * from "./packages/core/dist/queries/getNextSiblingNodes"; -export * from "./packages/core/dist/queries/getOperations"; -export * from "./packages/core/dist/queries/getPointBeforeLocation"; -export * from "./packages/core/dist/queries/getPointFromLocation"; -export * from "./packages/core/dist/queries/getPointNextToVoid"; -export * from "./packages/core/dist/queries/getPreviousBlockById"; -export * from "./packages/core/dist/queries/getPreviousPath"; -export * from "./packages/core/dist/queries/getRangeBefore"; -export * from "./packages/core/dist/queries/getRangeFromBlockStart"; -export * from "./packages/core/dist/queries/getSelectionText"; -export * from "./packages/core/dist/queries/hasSingleChild"; -export * from "./packages/core/dist/queries/index"; -export * from "./packages/core/dist/queries/isAncestorEmpty"; -export * from "./packages/core/dist/queries/isBlockAboveEmpty"; -export * from "./packages/core/dist/queries/isBlockTextEmptyAfterSelection"; -export * from "./packages/core/dist/queries/isFirstChild"; -export * from "./packages/core/dist/queries/isMarkActive"; -export * from "./packages/core/dist/queries/isPointAtWordEnd"; -export * from "./packages/core/dist/queries/isRangeAcrossBlocks"; -export * from "./packages/core/dist/queries/isRangeInSingleText"; -export * from "./packages/core/dist/queries/isSelectionAtBlockEnd"; -export * from "./packages/core/dist/queries/isSelectionAtBlockStart"; -export * from "./packages/core/dist/queries/isSelectionExpanded"; -export * from "./packages/core/dist/queries/isTextByPath"; -export * from "./packages/core/dist/queries/isType"; -export * from "./packages/core/dist/queries/isWordAfterTrigger"; -export * from "./packages/core/dist/queries/match"; -export * from "./packages/core/dist/queries/queryEditor"; -export * from "./packages/core/dist/queries/queryNode"; -export * from "./packages/core/dist/queries/someNode"; -export * from "./packages/core/dist/slate/index"; -export * from "./packages/core/dist/slate/editor/TEditor"; -export * from "./packages/core/dist/slate/editor/addMark"; -export * from "./packages/core/dist/slate/editor/createPathRef"; -export * from "./packages/core/dist/slate/editor/createPointRef"; -export * from "./packages/core/dist/slate/editor/createRangeRef"; -export * from "./packages/core/dist/slate/editor/deleteBackward"; -export * from "./packages/core/dist/slate/editor/deleteForward"; -export * from "./packages/core/dist/slate/editor/deleteFragment"; -export * from "./packages/core/dist/slate/editor/deleteMerge"; -export * from "./packages/core/dist/slate/editor/getAboveNode"; -export * from "./packages/core/dist/slate/editor/getEdgePoints"; -export * from "./packages/core/dist/slate/editor/getEditorString"; -export * from "./packages/core/dist/slate/editor/getEndPoint"; -export * from "./packages/core/dist/slate/editor/getFirstNode"; -export * from "./packages/core/dist/slate/editor/getFragment"; -export * from "./packages/core/dist/slate/editor/getLastNode"; -export * from "./packages/core/dist/slate/editor/getLeafNode"; -export * from "./packages/core/dist/slate/editor/getLevels"; -export * from "./packages/core/dist/slate/editor/getMarks"; -export * from "./packages/core/dist/slate/editor/getNextNode"; -export * from "./packages/core/dist/slate/editor/getNodeEntries"; -export * from "./packages/core/dist/slate/editor/getNodeEntry"; -export * from "./packages/core/dist/slate/editor/getParentNode"; -export * from "./packages/core/dist/slate/editor/getPath"; -export * from "./packages/core/dist/slate/editor/getPathRefs"; -export * from "./packages/core/dist/slate/editor/getPoint"; -export * from "./packages/core/dist/slate/editor/getPointAfter"; -export * from "./packages/core/dist/slate/editor/getPointBefore"; -export * from "./packages/core/dist/slate/editor/getPointRefs"; -export * from "./packages/core/dist/slate/editor/getPositions"; -export * from "./packages/core/dist/slate/editor/getPreviousNode"; -export * from "./packages/core/dist/slate/editor/getRange"; -export * from "./packages/core/dist/slate/editor/getRangeRefs"; -export * from "./packages/core/dist/slate/editor/getStartPoint"; -export * from "./packages/core/dist/slate/editor/getVoidNode"; -export * from "./packages/core/dist/slate/editor/hasBlocks"; -export * from "./packages/core/dist/slate/editor/hasInlines"; -export * from "./packages/core/dist/slate/editor/hasTexts"; -export * from "./packages/core/dist/slate/editor/index"; -export * from "./packages/core/dist/slate/editor/insertBreak"; -export * from "./packages/core/dist/slate/editor/insertNode"; -export * from "./packages/core/dist/slate/editor/isBlock"; -export * from "./packages/core/dist/slate/editor/isEdgePoint"; -export * from "./packages/core/dist/slate/editor/isEditor"; -export * from "./packages/core/dist/slate/editor/isEditorNormalizing"; -export * from "./packages/core/dist/slate/editor/isElementEmpty"; -export * from "./packages/core/dist/slate/editor/isEndPoint"; -export * from "./packages/core/dist/slate/editor/isInline"; -export * from "./packages/core/dist/slate/editor/isStartPoint"; -export * from "./packages/core/dist/slate/editor/isVoid"; -export * from "./packages/core/dist/slate/editor/normalizeEditor"; -export * from "./packages/core/dist/slate/editor/removeEditorMark"; -export * from "./packages/core/dist/slate/editor/unhangRange"; -export * from "./packages/core/dist/slate/editor/withoutNormalizing"; -export * from "./packages/core/dist/slate/element/TElement"; -export * from "./packages/core/dist/slate/element/elementMatches"; -export * from "./packages/core/dist/slate/element/index"; -export * from "./packages/core/dist/slate/element/isElement"; -export * from "./packages/core/dist/slate/element/isElementList"; -export * from "./packages/core/dist/slate/history-editor/THistoryEditor"; -export * from "./packages/core/dist/slate/history-editor/index"; -export * from "./packages/core/dist/slate/history-editor/isHistoryEditor"; -export * from "./packages/core/dist/slate/history-editor/isHistoryMerging"; -export * from "./packages/core/dist/slate/history-editor/isHistorySaving"; -export * from "./packages/core/dist/slate/history-editor/withoutMergingHistory"; -export * from "./packages/core/dist/slate/history-editor/withoutSavingHistory"; -export * from "./packages/core/dist/slate/node/TAncestor"; -export * from "./packages/core/dist/slate/node/TDescendant"; -export * from "./packages/core/dist/slate/node/TNode"; -export * from "./packages/core/dist/slate/node/TNodeEntry"; -export * from "./packages/core/dist/slate/node/getCommonNode"; -export * from "./packages/core/dist/slate/node/getNode"; -export * from "./packages/core/dist/slate/node/getNodeAncestor"; -export * from "./packages/core/dist/slate/node/getNodeAncestors"; -export * from "./packages/core/dist/slate/node/getNodeChild"; -export * from "./packages/core/dist/slate/node/getNodeChildren"; -export * from "./packages/core/dist/slate/node/getNodeDescendant"; -export * from "./packages/core/dist/slate/node/getNodeDescendants"; -export * from "./packages/core/dist/slate/node/getNodeElements"; -export * from "./packages/core/dist/slate/node/getNodeFirstNode"; -export * from "./packages/core/dist/slate/node/getNodeFragment"; -export * from "./packages/core/dist/slate/node/getNodeLastNode"; -export * from "./packages/core/dist/slate/node/getNodeLeaf"; -export * from "./packages/core/dist/slate/node/getNodeLevels"; -export * from "./packages/core/dist/slate/node/getNodeParent"; -export * from "./packages/core/dist/slate/node/getNodeProps"; -export * from "./packages/core/dist/slate/node/getNodeString"; -export * from "./packages/core/dist/slate/node/getNodeTexts"; -export * from "./packages/core/dist/slate/node/getNodes"; -export * from "./packages/core/dist/slate/node/hasNode"; -export * from "./packages/core/dist/slate/node/index"; -export * from "./packages/core/dist/slate/node/isAncestor"; -export * from "./packages/core/dist/slate/node/isNode"; -export * from "./packages/core/dist/slate/node/isNodeList"; -export * from "./packages/core/dist/slate/node/nodeMatches"; -export * from "./packages/core/dist/slate/range/index"; -export * from "./packages/core/dist/slate/range/isCollapsed"; -export * from "./packages/core/dist/slate/range/isExpanded"; -export * from "./packages/core/dist/slate/react-editor/TReactEditor"; -export * from "./packages/core/dist/slate/react-editor/blurEditor"; -export * from "./packages/core/dist/slate/react-editor/deselectEditor"; -export * from "./packages/core/dist/slate/react-editor/findEditorDocumentOrShadowRoot"; -export * from "./packages/core/dist/slate/react-editor/findEventRange"; -export * from "./packages/core/dist/slate/react-editor/findNodeKey"; -export * from "./packages/core/dist/slate/react-editor/findNodePath"; -export * from "./packages/core/dist/slate/react-editor/focusEditor"; -export * from "./packages/core/dist/slate/react-editor/getEditorWindow"; -export * from "./packages/core/dist/slate/react-editor/hasEditorDOMNode"; -export * from "./packages/core/dist/slate/react-editor/index"; -export * from "./packages/core/dist/slate/react-editor/insertData"; -export * from "./packages/core/dist/slate/react-editor/isComposing"; -export * from "./packages/core/dist/slate/react-editor/isEditorFocused"; -export * from "./packages/core/dist/slate/react-editor/isEditorReadOnly"; -export * from "./packages/core/dist/slate/react-editor/setFragmentData"; -export * from "./packages/core/dist/slate/react-editor/toDOMNode"; -export * from "./packages/core/dist/slate/react-editor/toDOMPoint"; -export * from "./packages/core/dist/slate/react-editor/toDOMRange"; -export * from "./packages/core/dist/slate/react-editor/toSlateNode"; -export * from "./packages/core/dist/slate/react-editor/toSlatePoint"; -export * from "./packages/core/dist/slate/react-editor/toSlateRange"; -export * from "./packages/core/dist/slate/text/TText"; -export * from "./packages/core/dist/slate/text/index"; -export * from "./packages/core/dist/slate/text/isText"; -export * from "./packages/core/dist/slate/text/isTextList"; -export * from "./packages/core/dist/slate/text/textEquals"; -export * from "./packages/core/dist/slate/text/textMatches"; -export * from "./packages/core/dist/slate/transforms/collapseSelection"; -export * from "./packages/core/dist/slate/transforms/deleteText"; -export * from "./packages/core/dist/slate/transforms/deselect"; -export * from "./packages/core/dist/slate/transforms/index"; -export * from "./packages/core/dist/slate/transforms/insertFragment"; -export * from "./packages/core/dist/slate/transforms/insertNodes"; -export * from "./packages/core/dist/slate/transforms/insertText"; -export * from "./packages/core/dist/slate/transforms/liftNodes"; -export * from "./packages/core/dist/slate/transforms/mergeNodes"; -export * from "./packages/core/dist/slate/transforms/moveNodes"; -export * from "./packages/core/dist/slate/transforms/moveSelection"; -export * from "./packages/core/dist/slate/transforms/removeNodes"; -export * from "./packages/core/dist/slate/transforms/select"; -export * from "./packages/core/dist/slate/transforms/setNodes"; -export * from "./packages/core/dist/slate/transforms/setPoint"; -export * from "./packages/core/dist/slate/transforms/setSelection"; -export * from "./packages/core/dist/slate/transforms/splitNodes"; -export * from "./packages/core/dist/slate/transforms/unsetNodes"; -export * from "./packages/core/dist/slate/transforms/unwrapNodes"; -export * from "./packages/core/dist/slate/transforms/wrapNodes"; -export * from "./packages/core/dist/slate/types/NodeMatchOption"; -export * from "./packages/core/dist/slate/types/SlateProps"; -export * from "./packages/core/dist/slate/types/TEditableProps"; -export * from "./packages/core/dist/slate/types/TOperation"; -export * from "./packages/core/dist/slate/types/TRenderElementProps"; -export * from "./packages/core/dist/slate/types/TRenderLeafProps"; -export * from "./packages/core/dist/slate/types/index"; -export * from "./packages/core/dist/slate/types/interfaces"; -export * from "./packages/core/dist/stores/index"; -export * from "./packages/core/dist/stores/event-editor/event-editor.store"; -export * from "./packages/core/dist/stores/event-editor/index"; -export * from "./packages/core/dist/stores/event-editor/selectors/getEventEditorId"; -export * from "./packages/core/dist/stores/event-editor/selectors/index"; -export * from "./packages/core/dist/stores/event-editor/selectors/useEventEditorId"; -export * from "./packages/core/dist/stores/event-editor/selectors/useEventPlateId"; -export * from "./packages/core/dist/stores/plate/createPlateStore"; -export * from "./packages/core/dist/stores/plate/index"; -export * from "./packages/core/dist/stores/plate/platesStore"; -export * from "./packages/core/dist/stores/plate/usePlateStore"; -export * from "./packages/core/dist/stores/plate/selectors/index"; -export * from "./packages/core/dist/stores/plate/selectors/usePlateEditorRef"; -export * from "./packages/core/dist/stores/plate/selectors/usePlateEditorState"; -export * from "./packages/core/dist/stores/plate/selectors/usePlatePlugins"; -export * from "./packages/core/dist/stores/plate/selectors/usePlateSelection"; -export * from "./packages/core/dist/transforms/defaultsDeepToNodes"; -export * from "./packages/core/dist/transforms/index"; -export * from "./packages/core/dist/transforms/insertElements"; -export * from "./packages/core/dist/transforms/insertEmptyElement"; -export * from "./packages/core/dist/transforms/moveChildren"; -export * from "./packages/core/dist/transforms/removeMark"; -export * from "./packages/core/dist/transforms/selectEditor"; -export * from "./packages/core/dist/transforms/selectEndOfBlockAboveSelection"; -export * from "./packages/core/dist/transforms/setElements"; -export * from "./packages/core/dist/transforms/setMarks"; -export * from "./packages/core/dist/transforms/toggleMark"; -export * from "./packages/core/dist/transforms/toggleNodeType"; -export * from "./packages/core/dist/transforms/toggleWrapNodes"; -export * from "./packages/core/dist/types/index"; -export * from "./packages/core/dist/types/misc/AnyObject"; -export * from "./packages/core/dist/types/misc/DeepPartial"; -export * from "./packages/core/dist/types/misc/ErrorHandler"; -export * from "./packages/core/dist/types/misc/FunctionProperties"; -export * from "./packages/core/dist/types/misc/NoInfer"; -export * from "./packages/core/dist/types/misc/Nullable"; -export * from "./packages/core/dist/types/misc/WithOptional"; -export * from "./packages/core/dist/types/misc/index"; -export * from "./packages/core/dist/types/misc/types"; -export * from "./packages/core/dist/types/plate/OverrideByKey"; -export * from "./packages/core/dist/types/plate/PlateEditor"; -export * from "./packages/core/dist/types/plate/PlateRenderElementProps"; -export * from "./packages/core/dist/types/plate/PlateRenderLeafProps"; -export * from "./packages/core/dist/types/plate/PlateRenderNodeProps"; -export * from "./packages/core/dist/types/plate/PlateStore"; -export * from "./packages/core/dist/types/plate/RenderElement"; -export * from "./packages/core/dist/types/plate/RenderLeaf"; -export * from "./packages/core/dist/types/plate/index"; -export * from "./packages/core/dist/types/plate/node.types"; -export * from "./packages/core/dist/types/plugin/DOMHandlers"; -export * from "./packages/core/dist/types/plugin/Decorate"; -export * from "./packages/core/dist/types/plugin/DeserializeHtml"; -export * from "./packages/core/dist/types/plugin/HotkeyPlugin"; -export * from "./packages/core/dist/types/plugin/InjectComponent"; -export * from "./packages/core/dist/types/plugin/InjectProps"; -export * from "./packages/core/dist/types/plugin/KeyboardHandler"; -export * from "./packages/core/dist/types/plugin/OnChange"; -export * from "./packages/core/dist/types/plugin/PlatePlugin"; -export * from "./packages/core/dist/types/plugin/PlatePluginComponent"; -export * from "./packages/core/dist/types/plugin/PlatePluginInsertData"; -export * from "./packages/core/dist/types/plugin/PlatePluginKey"; -export * from "./packages/core/dist/types/plugin/PlatePluginProps"; -export * from "./packages/core/dist/types/plugin/SerializeHtml"; -export * from "./packages/core/dist/types/plugin/ToggleMarkPlugin"; -export * from "./packages/core/dist/types/plugin/WithOverride"; -export * from "./packages/core/dist/types/plugin/index"; -export * from "./packages/core/dist/types/react/RenderFunction"; -export * from "./packages/core/dist/types/react/index"; -export * from "./packages/core/dist/types/react/react-types"; -export * from "./packages/core/dist/types/slate/QueryEditorOptions"; -export * from "./packages/core/dist/types/slate/QueryNodeOptions"; -export * from "./packages/core/dist/types/slate/index"; -export * from "./packages/core/dist/utils/index"; -export * from "./packages/core/dist/utils/misc/dom-attributes"; -export * from "./packages/core/dist/utils/misc/environment"; -export * from "./packages/core/dist/utils/misc/escapeRegexp"; -export * from "./packages/core/dist/utils/misc/findHtmlParentElement"; -export * from "./packages/core/dist/utils/misc/getHandler"; -export * from "./packages/core/dist/utils/misc/getSlateClass"; -export * from "./packages/core/dist/utils/misc/hexToBase64"; -export * from "./packages/core/dist/utils/misc/hotkeys"; -export * from "./packages/core/dist/utils/misc/index"; -export * from "./packages/core/dist/utils/misc/isUrl"; -export * from "./packages/core/dist/utils/misc/jotai"; -export * from "./packages/core/dist/utils/misc/type-utils"; -export * from "./packages/core/dist/utils/misc/zustood"; -export * from "./packages/core/dist/utils/plate/createPlateEditor"; -export * from "./packages/core/dist/utils/plate/createPluginFactory"; -export * from "./packages/core/dist/utils/plate/createPlugins"; -export * from "./packages/core/dist/utils/plate/flattenDeepPlugins"; -export * from "./packages/core/dist/utils/plate/getInjectedPlugins"; -export * from "./packages/core/dist/utils/plate/getKeyByType"; -export * from "./packages/core/dist/utils/plate/getKeysByTypes"; -export * from "./packages/core/dist/utils/plate/getPlugin"; -export * from "./packages/core/dist/utils/plate/getPluginInjectProps"; -export * from "./packages/core/dist/utils/plate/getPluginOptions"; -export * from "./packages/core/dist/utils/plate/getPluginType"; -export * from "./packages/core/dist/utils/plate/getPluginTypes"; -export * from "./packages/core/dist/utils/plate/getPlugins"; -export * from "./packages/core/dist/utils/plate/getPluginsByKey"; -export * from "./packages/core/dist/utils/plate/getRenderNodeProps"; -export * from "./packages/core/dist/utils/plate/index"; -export * from "./packages/core/dist/utils/plate/mapInjectPropsToPlugin"; -export * from "./packages/core/dist/utils/plate/mergeDeepPlugins"; -export * from "./packages/core/dist/utils/plate/mockPlugin"; -export * from "./packages/core/dist/utils/plate/normalizeDescendantsToDocumentFragment"; -export * from "./packages/core/dist/utils/plate/overridePluginsByKey"; -export * from "./packages/core/dist/utils/plate/pipeDecorate"; -export * from "./packages/core/dist/utils/plate/pipeHandler"; -export * from "./packages/core/dist/utils/plate/pipeInjectProps"; -export * from "./packages/core/dist/utils/plate/pipeInsertDataQuery"; -export * from "./packages/core/dist/utils/plate/pipeInsertFragment"; -export * from "./packages/core/dist/utils/plate/pipeOnChange"; -export * from "./packages/core/dist/utils/plate/pipeRenderElement"; -export * from "./packages/core/dist/utils/plate/pipeRenderLeaf"; -export * from "./packages/core/dist/utils/plate/pipeTransformData"; -export * from "./packages/core/dist/utils/plate/pipeTransformFragment"; -export * from "./packages/core/dist/utils/plate/pluginInjectProps"; -export * from "./packages/core/dist/utils/plate/pluginRenderElement"; -export * from "./packages/core/dist/utils/plate/pluginRenderLeaf"; -export * from "./packages/core/dist/utils/plate/setDefaultPlugin"; -export * from "./packages/core/dist/utils/plate/setPlatePlugins"; -export * from "./packages/core/dist/utils/react/composeEventHandlers"; -export * from "./packages/core/dist/utils/react/createComponentAs"; -export * from "./packages/core/dist/utils/react/createElementAs"; -export * from "./packages/core/dist/utils/react/createNodeHOC"; -export * from "./packages/core/dist/utils/react/createNodesHOC"; -export * from "./packages/core/dist/utils/react/getPreventDefaultHandler"; -export * from "./packages/core/dist/utils/react/index"; -export * from "./packages/core/dist/utils/react/withHOC"; -export * from "./packages/core/dist/utils/react/withProps"; -export * from "./packages/core/dist/utils/react/withProviders"; -export * from "./packages/core/dist/utils/slate/applyDeepToNodes"; -export * from "./packages/core/dist/utils/slate/createDocumentNode"; -export * from "./packages/core/dist/utils/slate/createNode"; -export * from "./packages/core/dist/utils/slate/createTEditor"; -export * from "./packages/core/dist/utils/slate/index"; -export * from "./packages/core/dist/utils/slate/mergeDeepToNodes"; -export * from "./packages/core/src/index"; -export * from "./packages/decorators/find-replace/dist/createFindReplacePlugin"; -export * from "./packages/decorators/find-replace/dist/decorateFindReplace"; -export * from "./packages/decorators/find-replace/dist/index"; -export * from "./packages/decorators/find-replace/dist/types"; -export * from "./packages/decorators/find-replace/src/index"; -export * from "./packages/editor/autoformat/dist/createAutoformatPlugin"; -export * from "./packages/editor/autoformat/dist/index"; -export * from "./packages/editor/autoformat/dist/types"; -export * from "./packages/editor/autoformat/dist/withAutoformat"; -export * from "./packages/editor/autoformat/dist/rules/autoformatArrow"; -export * from "./packages/editor/autoformat/dist/rules/autoformatLegal"; -export * from "./packages/editor/autoformat/dist/rules/autoformatPunctuation"; -export * from "./packages/editor/autoformat/dist/rules/autoformatSmartQuotes"; -export * from "./packages/editor/autoformat/dist/rules/index"; -export * from "./packages/editor/autoformat/dist/rules/math/autoformatComparison"; -export * from "./packages/editor/autoformat/dist/rules/math/autoformatEquality"; -export * from "./packages/editor/autoformat/dist/rules/math/autoformatFraction"; -export * from "./packages/editor/autoformat/dist/rules/math/autoformatMath"; -export * from "./packages/editor/autoformat/dist/rules/math/autoformatOperation"; -export * from "./packages/editor/autoformat/dist/rules/math/autoformatSubscript"; -export * from "./packages/editor/autoformat/dist/rules/math/autoformatSuperscript"; -export * from "./packages/editor/autoformat/dist/rules/math/index"; -export * from "./packages/editor/autoformat/dist/transforms/autoformatBlock"; -export * from "./packages/editor/autoformat/dist/transforms/autoformatMark"; -export * from "./packages/editor/autoformat/dist/transforms/autoformatText"; -export * from "./packages/editor/autoformat/dist/transforms/index"; -export * from "./packages/editor/autoformat/dist/utils/getMatchPoints"; -export * from "./packages/editor/autoformat/dist/utils/getMatchRange"; -export * from "./packages/editor/autoformat/dist/utils/index"; -export * from "./packages/editor/autoformat/dist/utils/isPreviousCharacterEmpty"; -export * from "./packages/editor/autoformat/src/index"; -export * from "./packages/editor/break/dist/index"; -export * from "./packages/editor/break/dist/exit-break/createExitBreakPlugin"; -export * from "./packages/editor/break/dist/exit-break/index"; -export * from "./packages/editor/break/dist/exit-break/onKeyDownExitBreak"; -export * from "./packages/editor/break/dist/exit-break/types"; -export * from "./packages/editor/break/dist/exit-break/queries/exitBreakAtEdges"; -export * from "./packages/editor/break/dist/exit-break/queries/index"; -export * from "./packages/editor/break/dist/exit-break/transforms/exitBreak"; -export * from "./packages/editor/break/dist/exit-break/transforms/index"; -export * from "./packages/editor/break/dist/single-line/createSingleLinePlugin"; -export * from "./packages/editor/break/dist/single-line/index"; -export * from "./packages/editor/break/dist/single-line/onKeyDownSingleLine"; -export * from "./packages/editor/break/dist/single-line/withSingleLine"; -export * from "./packages/editor/break/dist/soft-break/createSoftBreakPlugin"; -export * from "./packages/editor/break/dist/soft-break/index"; -export * from "./packages/editor/break/dist/soft-break/onKeyDownSoftBreak"; -export * from "./packages/editor/break/dist/soft-break/types"; -export * from "./packages/editor/break/src/index"; -export * from "./packages/editor/combobox/dist/combobox.store"; -export * from "./packages/editor/combobox/dist/createComboboxPlugin"; -export * from "./packages/editor/combobox/dist/index"; -export * from "./packages/editor/combobox/dist/onChangeCombobox"; -export * from "./packages/editor/combobox/dist/onKeyDownCombobox"; -export * from "./packages/editor/combobox/dist/hooks/index"; -export * from "./packages/editor/combobox/dist/hooks/useComboboxControls"; -export * from "./packages/editor/combobox/dist/types/ComboboxOnSelectItem"; -export * from "./packages/editor/combobox/dist/types/index"; -export * from "./packages/editor/combobox/dist/utils/getNextNonDisabledIndex"; -export * from "./packages/editor/combobox/dist/utils/getNextWrappingIndex"; -export * from "./packages/editor/combobox/dist/utils/getTextFromTrigger"; -export * from "./packages/editor/combobox/dist/utils/index"; -export * from "./packages/editor/combobox/src/index"; -export * from "./packages/editor/node-id/dist/createNodeIdPlugin"; -export * from "./packages/editor/node-id/dist/index"; -export * from "./packages/editor/node-id/dist/withNodeId"; -export * from "./packages/editor/node-id/src/index"; -export * from "./packages/editor/normalizers/dist/createNormalizeTypesPlugin"; -export * from "./packages/editor/normalizers/dist/createRemoveEmptyNodesPlugin"; -export * from "./packages/editor/normalizers/dist/index"; -export * from "./packages/editor/normalizers/dist/withNormalizeTypes"; -export * from "./packages/editor/normalizers/dist/withRemoveEmptyNodes"; -export * from "./packages/editor/normalizers/src/index"; -export * from "./packages/editor/reset-node/dist/createResetNodePlugin"; -export * from "./packages/editor/reset-node/dist/index"; -export * from "./packages/editor/reset-node/dist/onKeyDownResetNode"; -export * from "./packages/editor/reset-node/dist/types"; -export * from "./packages/editor/reset-node/src/index"; -export * from "./packages/editor/select/dist/createSelectOnBackspacePlugin"; -export * from "./packages/editor/select/dist/index"; -export * from "./packages/editor/select/dist/withSelectOnBackspace"; -export * from "./packages/editor/select/src/index"; -export * from "./packages/editor/trailing-block/dist/createTrailingBlockPlugin"; -export * from "./packages/editor/trailing-block/dist/index"; -export * from "./packages/editor/trailing-block/dist/withTrailingBlock"; -export * from "./packages/editor/trailing-block/src/index"; -export * from "./packages/headless/dist/index"; -export * from "./packages/headless/src/index"; -export * from "./packages/hocuspocus/dist/index"; -export * from "./packages/nodes/alignment/dist/createAlignPlugin"; -export * from "./packages/nodes/alignment/dist/index"; -export * from "./packages/nodes/alignment/dist/types"; -export * from "./packages/nodes/alignment/dist/transforms/index"; -export * from "./packages/nodes/alignment/dist/transforms/setAlign"; -export * from "./packages/nodes/alignment/src/index"; -export * from "./packages/nodes/basic-elements/dist/createBasicElementsPlugin"; -export * from "./packages/nodes/basic-elements/dist/index"; -export * from "./packages/nodes/basic-elements/src/index"; -export * from "./packages/nodes/basic-marks/dist/createBasicMarksPlugin"; -export * from "./packages/nodes/basic-marks/dist/createBoldPlugin"; -export * from "./packages/nodes/basic-marks/dist/createCodePlugin"; -export * from "./packages/nodes/basic-marks/dist/createItalicPlugin"; -export * from "./packages/nodes/basic-marks/dist/createStrikethroughPlugin"; -export * from "./packages/nodes/basic-marks/dist/createSubscriptPlugin"; -export * from "./packages/nodes/basic-marks/dist/createSuperscriptPlugin"; -export * from "./packages/nodes/basic-marks/dist/createUnderlinePlugin"; -export * from "./packages/nodes/basic-marks/dist/index"; -export * from "./packages/nodes/basic-marks/src/index"; -export * from "./packages/nodes/block-quote/dist/createBlockquotePlugin"; -export * from "./packages/nodes/block-quote/dist/index"; -export * from "./packages/nodes/block-quote/src/index"; -export * from "./packages/nodes/code-block/dist/constants"; -export * from "./packages/nodes/code-block/dist/createCodeBlockPlugin"; -export * from "./packages/nodes/code-block/dist/decorateCodeLine"; -export * from "./packages/nodes/code-block/dist/deserializeHtmlCodeBlockPre"; -export * from "./packages/nodes/code-block/dist/index"; -export * from "./packages/nodes/code-block/dist/insertFragmentCodeBlock"; -export * from "./packages/nodes/code-block/dist/onKeyDownCodeBlock"; -export * from "./packages/nodes/code-block/dist/types"; -export * from "./packages/nodes/code-block/dist/withCodeBlock"; -export * from "./packages/nodes/code-block/dist/options/getCodeLineType"; -export * from "./packages/nodes/code-block/dist/options/index"; -export * from "./packages/nodes/code-block/dist/queries/getCodeLineEntry"; -export * from "./packages/nodes/code-block/dist/queries/getIndentDepth"; -export * from "./packages/nodes/code-block/dist/queries/index"; -export * from "./packages/nodes/code-block/dist/transforms/deleteStartSpace"; -export * from "./packages/nodes/code-block/dist/transforms/indentCodeLine"; -export * from "./packages/nodes/code-block/dist/transforms/index"; -export * from "./packages/nodes/code-block/dist/transforms/insertCodeBlock"; -export * from "./packages/nodes/code-block/dist/transforms/insertCodeLine"; -export * from "./packages/nodes/code-block/dist/transforms/insertEmptyCodeBlock"; -export * from "./packages/nodes/code-block/dist/transforms/outdentCodeLine"; -export * from "./packages/nodes/code-block/dist/transforms/toggleCodeBlock"; -export * from "./packages/nodes/code-block/dist/transforms/unwrapCodeBlock"; -export * from "./packages/nodes/code-block/src/index"; -export * from "./packages/nodes/font/dist/createFontBackgroundColorPlugin"; -export * from "./packages/nodes/font/dist/createFontColorPlugin"; -export * from "./packages/nodes/font/dist/createFontFamilyPlugin"; -export * from "./packages/nodes/font/dist/createFontSizePlugin"; -export * from "./packages/nodes/font/dist/createFontWeightPlugin"; -export * from "./packages/nodes/font/dist/index"; -export * from "./packages/nodes/font/src/index"; -export * from "./packages/nodes/heading/dist/constants"; -export * from "./packages/nodes/heading/dist/createHeadingPlugin"; -export * from "./packages/nodes/heading/dist/index"; -export * from "./packages/nodes/heading/dist/types"; -export * from "./packages/nodes/heading/src/index"; -export * from "./packages/nodes/highlight/dist/createHighlightPlugin"; -export * from "./packages/nodes/highlight/dist/index"; -export * from "./packages/nodes/highlight/src/index"; -export * from "./packages/nodes/horizontal-rule/dist/createHorizontalRulePlugin"; -export * from "./packages/nodes/horizontal-rule/dist/index"; -export * from "./packages/nodes/horizontal-rule/src/index"; -export * from "./packages/nodes/image/dist/createImagePlugin"; -export * from "./packages/nodes/image/dist/index"; -export * from "./packages/nodes/image/dist/types"; -export * from "./packages/nodes/image/dist/withImageUpload"; -export * from "./packages/nodes/image/dist/components/Image"; -export * from "./packages/nodes/image/dist/components/ImageCaption"; -export * from "./packages/nodes/image/dist/components/ImageCaptionTextarea"; -export * from "./packages/nodes/image/dist/components/ImageImg"; -export * from "./packages/nodes/image/dist/components/ImageResizable"; -export * from "./packages/nodes/image/dist/components/index"; -export * from "./packages/nodes/image/dist/hooks/index"; -export * from "./packages/nodes/image/dist/hooks/useImageCaptionString"; -export * from "./packages/nodes/image/dist/hooks/useImageElement"; -export * from "./packages/nodes/image/dist/transforms/index"; -export * from "./packages/nodes/image/dist/transforms/insertImage"; -export * from "./packages/nodes/image/dist/utils/index"; -export * from "./packages/nodes/image/dist/utils/isImageUrl"; -export * from "./packages/nodes/image/src/index"; -export * from "./packages/nodes/indent/dist/createIndentPlugin"; -export * from "./packages/nodes/indent/dist/createTextIndentPlugin"; -export * from "./packages/nodes/indent/dist/index"; -export * from "./packages/nodes/indent/dist/onKeyDownIndent"; -export * from "./packages/nodes/indent/dist/types"; -export * from "./packages/nodes/indent/dist/withIndent"; -export * from "./packages/nodes/indent/dist/transforms/indent"; -export * from "./packages/nodes/indent/dist/transforms/index"; -export * from "./packages/nodes/indent/dist/transforms/outdent"; -export * from "./packages/nodes/indent/dist/transforms/setIndent"; -export * from "./packages/nodes/indent/src/index"; -export * from "./packages/nodes/indent-list/dist/createIndentListPlugin"; -export * from "./packages/nodes/indent-list/dist/index"; -export * from "./packages/nodes/indent-list/dist/injectIndentListComponent"; -export * from "./packages/nodes/indent-list/dist/normalizeIndentList"; -export * from "./packages/nodes/indent-list/dist/types"; -export * from "./packages/nodes/indent-list/dist/withIndentList"; -export * from "./packages/nodes/indent-list/dist/normalizers/index"; -export * from "./packages/nodes/indent-list/dist/normalizers/normalizeFirstIndentListStart"; -export * from "./packages/nodes/indent-list/dist/normalizers/normalizeIndentListNotIndented"; -export * from "./packages/nodes/indent-list/dist/normalizers/normalizeIndentListStart"; -export * from "./packages/nodes/indent-list/dist/queries/areEqListStyleType"; -export * from "./packages/nodes/indent-list/dist/queries/getIndentListSiblings"; -export * from "./packages/nodes/indent-list/dist/queries/getNextIndentList"; -export * from "./packages/nodes/indent-list/dist/queries/getPreviousIndentList"; -export * from "./packages/nodes/indent-list/dist/queries/getSiblingIndentList"; -export * from "./packages/nodes/indent-list/dist/queries/index"; -export * from "./packages/nodes/indent-list/dist/transforms/indentList"; -export * from "./packages/nodes/indent-list/dist/transforms/index"; -export * from "./packages/nodes/indent-list/dist/transforms/outdentList"; -export * from "./packages/nodes/indent-list/dist/transforms/setIndentListNode"; -export * from "./packages/nodes/indent-list/dist/transforms/setIndentListNodes"; -export * from "./packages/nodes/indent-list/dist/transforms/setIndentListSiblingNodes"; -export * from "./packages/nodes/indent-list/dist/transforms/toggleIndentList"; -export * from "./packages/nodes/indent-list/dist/transforms/toggleIndentListSet"; -export * from "./packages/nodes/indent-list/dist/transforms/toggleIndentListUnset"; -export * from "./packages/nodes/indent-list/src/index"; -export * from "./packages/nodes/kbd/dist/createKbdPlugin"; -export * from "./packages/nodes/kbd/dist/index"; -export * from "./packages/nodes/kbd/src/index"; -export * from "./packages/nodes/line-height/dist/createLineHeightPlugin"; -export * from "./packages/nodes/line-height/dist/index"; -export * from "./packages/nodes/line-height/dist/transforms/index"; -export * from "./packages/nodes/line-height/dist/transforms/setLineHeight"; -export * from "./packages/nodes/line-height/src/index"; -export * from "./packages/nodes/link/dist/createLinkPlugin"; -export * from "./packages/nodes/link/dist/index"; -export * from "./packages/nodes/link/dist/onKeyDownLink"; -export * from "./packages/nodes/link/dist/types"; -export * from "./packages/nodes/link/dist/withLink"; -export * from "./packages/nodes/link/dist/transforms/getAndUpsertLink"; -export * from "./packages/nodes/link/dist/transforms/index"; -export * from "./packages/nodes/link/dist/transforms/upsertLinkAtSelection"; -export * from "./packages/nodes/link/dist/transforms/wrapLink"; -export * from "./packages/nodes/link/src/index"; -export * from "./packages/nodes/list/dist/createListPlugin"; -export * from "./packages/nodes/list/dist/deleteBackwardList"; -export * from "./packages/nodes/list/dist/deleteForwardList"; -export * from "./packages/nodes/list/dist/deleteFragmentList"; -export * from "./packages/nodes/list/dist/index"; -export * from "./packages/nodes/list/dist/insertBreakList"; -export * from "./packages/nodes/list/dist/insertFragmentList"; -export * from "./packages/nodes/list/dist/onKeyDownList"; -export * from "./packages/nodes/list/dist/types"; -export * from "./packages/nodes/list/dist/withList"; -export * from "./packages/nodes/list/dist/normalizers/index"; -export * from "./packages/nodes/list/dist/normalizers/normalizeList"; -export * from "./packages/nodes/list/dist/normalizers/normalizeListItem"; -export * from "./packages/nodes/list/dist/normalizers/normalizeNestedList"; -export * from "./packages/nodes/list/dist/queries/getHighestEmptyList"; -export * from "./packages/nodes/list/dist/queries/getListItemEntry"; -export * from "./packages/nodes/list/dist/queries/getListRoot"; -export * from "./packages/nodes/list/dist/queries/getListTypes"; -export * from "./packages/nodes/list/dist/queries/hasListChild"; -export * from "./packages/nodes/list/dist/queries/index"; -export * from "./packages/nodes/list/dist/queries/isAcrossListItems"; -export * from "./packages/nodes/list/dist/queries/isListNested"; -export * from "./packages/nodes/list/dist/queries/isListRoot"; -export * from "./packages/nodes/list/dist/todo-list/createTodoListPlugin"; -export * from "./packages/nodes/list/dist/todo-list/index"; -export * from "./packages/nodes/list/dist/todo-list/types"; -export * from "./packages/nodes/list/dist/transforms/indentListItems"; -export * from "./packages/nodes/list/dist/transforms/index"; -export * from "./packages/nodes/list/dist/transforms/insertListItem"; -export * from "./packages/nodes/list/dist/transforms/moveListItemDown"; -export * from "./packages/nodes/list/dist/transforms/moveListItemSublistItemsToListItemSublist"; -export * from "./packages/nodes/list/dist/transforms/moveListItemUp"; -export * from "./packages/nodes/list/dist/transforms/moveListItems"; -export * from "./packages/nodes/list/dist/transforms/moveListItemsToList"; -export * from "./packages/nodes/list/dist/transforms/moveListSiblingsAfterCursor"; -export * from "./packages/nodes/list/dist/transforms/removeFirstListItem"; -export * from "./packages/nodes/list/dist/transforms/removeListItem"; -export * from "./packages/nodes/list/dist/transforms/toggleList"; -export * from "./packages/nodes/list/dist/transforms/unindentListItems"; -export * from "./packages/nodes/list/dist/transforms/unwrapList"; -export * from "./packages/nodes/list/src/index"; -export * from "./packages/nodes/media-embed/dist/createMediaEmbedPlugin"; -export * from "./packages/nodes/media-embed/dist/index"; -export * from "./packages/nodes/media-embed/dist/types"; -export * from "./packages/nodes/media-embed/dist/transforms/index"; -export * from "./packages/nodes/media-embed/dist/transforms/insertMediaEmbed"; -export * from "./packages/nodes/media-embed/src/index"; -export * from "./packages/nodes/mention/dist/createMentionPlugin"; -export * from "./packages/nodes/mention/dist/getMentionOnSelectItem"; -export * from "./packages/nodes/mention/dist/index"; -export * from "./packages/nodes/mention/dist/types"; -export * from "./packages/nodes/mention/dist/withMention"; -export * from "./packages/nodes/mention/dist/handlers/KeyboardEventHandler"; -export * from "./packages/nodes/mention/dist/handlers/index"; -export * from "./packages/nodes/mention/dist/handlers/mentionOnKeyDownHandler"; -export * from "./packages/nodes/mention/dist/handlers/moveSelectionByOffset"; -export * from "./packages/nodes/mention/dist/queries/findMentionInput"; -export * from "./packages/nodes/mention/dist/queries/index"; -export * from "./packages/nodes/mention/dist/queries/isNodeMentionInput"; -export * from "./packages/nodes/mention/dist/queries/isSelectionInMentionInput"; -export * from "./packages/nodes/mention/dist/transforms/index"; -export * from "./packages/nodes/mention/dist/transforms/removeMentionInput"; -export * from "./packages/nodes/mention/src/index"; -export * from "./packages/nodes/paragraph/dist/createParagraphPlugin"; -export * from "./packages/nodes/paragraph/dist/index"; -export * from "./packages/nodes/paragraph/src/index"; -export * from "./packages/nodes/table/dist/createTablePlugin"; -export * from "./packages/nodes/table/dist/index"; -export * from "./packages/nodes/table/dist/onKeyDownTable"; -export * from "./packages/nodes/table/dist/types"; -export * from "./packages/nodes/table/dist/withDeleteTable"; -export * from "./packages/nodes/table/dist/withGetFragmentTable"; -export * from "./packages/nodes/table/dist/withInsertFragmentTable"; -export * from "./packages/nodes/table/dist/withTable"; -export * from "./packages/nodes/table/dist/queries/getCellInNextTableRow"; -export * from "./packages/nodes/table/dist/queries/getCellInPreviousTableRow"; -export * from "./packages/nodes/table/dist/queries/getNextTableCell"; -export * from "./packages/nodes/table/dist/queries/getPreviousTableCell"; -export * from "./packages/nodes/table/dist/queries/getTableCellEntry"; -export * from "./packages/nodes/table/dist/queries/getTableColumnCount"; -export * from "./packages/nodes/table/dist/queries/getTableColumnIndex"; -export * from "./packages/nodes/table/dist/queries/getTableGridAbove"; -export * from "./packages/nodes/table/dist/queries/getTableGridByRange"; -export * from "./packages/nodes/table/dist/queries/index"; -export * from "./packages/nodes/table/dist/transforms/addColumn"; -export * from "./packages/nodes/table/dist/transforms/addRow"; -export * from "./packages/nodes/table/dist/transforms/deleteColumn"; -export * from "./packages/nodes/table/dist/transforms/deleteRow"; -export * from "./packages/nodes/table/dist/transforms/deleteTable"; -export * from "./packages/nodes/table/dist/transforms/index"; -export * from "./packages/nodes/table/dist/transforms/insertTable"; -export * from "./packages/nodes/table/dist/transforms/insertTableColumn"; -export * from "./packages/nodes/table/dist/transforms/insertTableRow"; -export * from "./packages/nodes/table/dist/transforms/moveSelectionFromCell"; -export * from "./packages/nodes/table/dist/transforms/setTableColSize"; -export * from "./packages/nodes/table/dist/utils/getCellType"; -export * from "./packages/nodes/table/dist/utils/getEmptyCellNode"; -export * from "./packages/nodes/table/dist/utils/getEmptyRowNode"; -export * from "./packages/nodes/table/dist/utils/getEmptyTableNode"; -export * from "./packages/nodes/table/dist/utils/index"; -export * from "./packages/nodes/table/src/index"; -export * from "./packages/plate/dist/index"; -export * from "./packages/plate/src/index"; -export * from "./packages/plate/src/__tests__/all-plugins.spec"; -export * from "./packages/serializers/csv/dist/index"; -export * from "./packages/serializers/csv/dist/deserializer/createDeserializeCsvPlugin"; -export * from "./packages/serializers/csv/dist/deserializer/index"; -export * from "./packages/serializers/csv/dist/deserializer/types"; -export * from "./packages/serializers/csv/dist/deserializer/utils/deserializeCsv"; -export * from "./packages/serializers/csv/dist/deserializer/utils/index"; -export * from "./packages/serializers/csv/src/index"; -export * from "./packages/serializers/docx/dist/index"; -export * from "./packages/serializers/docx/dist/deserializer/createDeserializeDocxPlugin"; -export * from "./packages/serializers/docx/dist/deserializer/index"; -export * from "./packages/serializers/docx/dist/docx-cleaner/cleanDocx"; -export * from "./packages/serializers/docx/dist/docx-cleaner/index"; -export * from "./packages/serializers/docx/dist/docx-cleaner/types"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxBrComments"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxEmptyParagraphs"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxFootnotes"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxImageElements"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxListElements"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxListElementsToList"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxQuotes"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxSpacerun"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxSpans"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/cleanDocxTabCount"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/docxListToList"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/generateSpaces"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getDocxIndent"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getDocxListContentHtml"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getDocxListIndent"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getDocxListNode"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getRtfImageHex"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getRtfImageMimeType"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getRtfImageSpid"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getRtfImagesByType"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getRtfImagesMap"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getTextListStyleType"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getVShapeSpid"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/getVShapes"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/index"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/isDocxBookmark"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/isDocxContent"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/isDocxFootnote"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/isDocxList"; -export * from "./packages/serializers/docx/dist/docx-cleaner/utils/isDocxOl"; -export * from "./packages/serializers/docx/src/index"; -export * from "./packages/serializers/juice/dist/createJuicePlugin"; -export * from "./packages/serializers/juice/dist/index"; -export * from "./packages/serializers/juice/src/index"; -export * from "./packages/serializers/md/dist/index"; -export * from "./packages/serializers/md/dist/deserializer/createDeserializeMdPlugin"; -export * from "./packages/serializers/md/dist/deserializer/index"; -export * from "./packages/serializers/md/dist/deserializer/utils/deserializeMd"; -export * from "./packages/serializers/md/dist/deserializer/utils/filterBreakLines"; -export * from "./packages/serializers/md/dist/deserializer/utils/index"; -export * from "./packages/serializers/md/src/index"; -export * from "./packages/test-utils/dist/createDataTransfer"; -export * from "./packages/test-utils/dist/getHtmlDocument"; -export * from "./packages/test-utils/dist/index"; -export * from "./packages/test-utils/dist/jsx"; -export * from "./packages/test-utils/dist/hyperscript/creators"; -export * from "./packages/test-utils/dist/hyperscript/index"; -export * from "./packages/test-utils/dist/hyperscript/tokens"; -export * from "./packages/test-utils/src/index"; -export * from "./packages/ui/button/dist/index"; -export * from "./packages/ui/button/dist/Button/Button"; -export * from "./packages/ui/button/dist/Button/Button.styles"; -export * from "./packages/ui/button/dist/Button/Button.types"; -export * from "./packages/ui/button/dist/Button/RemoveNodeButton"; -export * from "./packages/ui/button/dist/Button/index"; -export * from "./packages/ui/button/dist/Icon/ChevronDownIcon"; -export * from "./packages/ui/button/dist/Icon/DeleteIcon"; -export * from "./packages/ui/button/dist/Icon/StyledIcon"; -export * from "./packages/ui/button/dist/Icon/index"; -export * from "./packages/ui/button/src/index"; -export * from "./packages/ui/combobox/dist/Combobox"; -export * from "./packages/ui/combobox/dist/Combobox.styles"; -export * from "./packages/ui/combobox/dist/Combobox.types"; -export * from "./packages/ui/combobox/dist/index"; -export * from "./packages/ui/combobox/src/index"; -export * from "./packages/ui/cursor/dist/index"; -export * from "./packages/ui/cursor/dist/types"; -export * from "./packages/ui/cursor/dist/components/Cursor"; -export * from "./packages/ui/cursor/dist/components/CursorOverlay"; -export * from "./packages/ui/cursor/dist/components/CursorOverlay.styles"; -export * from "./packages/ui/cursor/dist/components/index"; -export * from "./packages/ui/cursor/dist/hooks/index"; -export * from "./packages/ui/cursor/dist/hooks/useCursorOverlayPositions"; -export * from "./packages/ui/cursor/dist/hooks/useRefreshOnResize"; -export * from "./packages/ui/cursor/dist/hooks/useRequestReRender"; -export * from "./packages/ui/cursor/dist/queries/getCaretPosition"; -export * from "./packages/ui/cursor/dist/queries/getCursorOverlayState"; -export * from "./packages/ui/cursor/dist/queries/getSelectionRects"; -export * from "./packages/ui/cursor/dist/queries/index"; -export * from "./packages/ui/cursor/src/index"; -export * from "./packages/ui/dnd/dist/createDndPlugin"; -export * from "./packages/ui/dnd/dist/index"; -export * from "./packages/ui/dnd/dist/types"; -export * from "./packages/ui/dnd/dist/components/Draggable"; -export * from "./packages/ui/dnd/dist/components/Draggable.styles"; -export * from "./packages/ui/dnd/dist/components/Draggable.types"; -export * from "./packages/ui/dnd/dist/components/grabberTooltipProps"; -export * from "./packages/ui/dnd/dist/components/index"; -export * from "./packages/ui/dnd/dist/components/withDraggable"; -export * from "./packages/ui/dnd/dist/hooks/index"; -export * from "./packages/ui/dnd/dist/hooks/useDndBlock"; -export * from "./packages/ui/dnd/dist/hooks/useDndNode"; -export * from "./packages/ui/dnd/dist/hooks/useDragBlock"; -export * from "./packages/ui/dnd/dist/hooks/useDragNode"; -export * from "./packages/ui/dnd/dist/hooks/useDropBlock"; -export * from "./packages/ui/dnd/dist/hooks/useDropNode"; -export * from "./packages/ui/dnd/dist/queries/getBlocksWithId"; -export * from "./packages/ui/dnd/dist/queries/getNodesRange"; -export * from "./packages/ui/dnd/dist/queries/index"; -export * from "./packages/ui/dnd/dist/transforms/focusBlockStartById"; -export * from "./packages/ui/dnd/dist/transforms/index"; -export * from "./packages/ui/dnd/dist/transforms/onDropNode"; -export * from "./packages/ui/dnd/dist/transforms/onHoverNode"; -export * from "./packages/ui/dnd/dist/transforms/removeBlocksAndFocus"; -export * from "./packages/ui/dnd/dist/transforms/selectBlockById"; -export * from "./packages/ui/dnd/dist/transforms/selectBlocksBySelectionOrId"; -export * from "./packages/ui/dnd/dist/utils/getHoverDirection"; -export * from "./packages/ui/dnd/dist/utils/getNewDirection"; -export * from "./packages/ui/dnd/dist/utils/index"; -export * from "./packages/ui/dnd/src/index"; -export * from "./packages/ui/find-replace/dist/index"; -export * from "./packages/ui/find-replace/dist/SearchHighlightToolbar/SearchHighlightToolbar"; -export * from "./packages/ui/find-replace/dist/SearchHighlightToolbar/index"; -export * from "./packages/ui/find-replace/src/index"; -export * from "./packages/ui/nodes/alignment/dist/index"; -export * from "./packages/ui/nodes/alignment/dist/AlignToolbarButton/AlignToolbarButton"; -export * from "./packages/ui/nodes/alignment/dist/AlignToolbarButton/index"; -export * from "./packages/ui/nodes/alignment/src/index"; -export * from "./packages/ui/nodes/block-quote/dist/index"; -export * from "./packages/ui/nodes/block-quote/dist/BlockquoteElement/BlockquoteElement"; -export * from "./packages/ui/nodes/block-quote/dist/BlockquoteElement/BlockquoteElement.styles"; -export * from "./packages/ui/nodes/block-quote/dist/BlockquoteElement/index"; -export * from "./packages/ui/nodes/block-quote/src/index"; -export * from "./packages/ui/nodes/code-block/dist/index"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockElement/CodeBlockElement"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockElement/CodeBlockElement.styles"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockElement/CodeBlockSelectElement"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockElement/CodeLineElement"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockElement/CodeLineElement.styles"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockElement/CodeSyntaxLeaf"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockElement/index"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockToolbarButton/CodeBlockToolbarButton"; -export * from "./packages/ui/nodes/code-block/dist/CodeBlockToolbarButton/index"; -export * from "./packages/ui/nodes/code-block/src/index"; -export * from "./packages/ui/nodes/excalidraw/dist/createExcalidrawPlugin"; -export * from "./packages/ui/nodes/excalidraw/dist/index"; -export * from "./packages/ui/nodes/excalidraw/dist/types"; -export * from "./packages/ui/nodes/excalidraw/dist/components/index"; -export * from "./packages/ui/nodes/excalidraw/dist/components/ExcalidrawElement/ExcalidrawElement"; -export * from "./packages/ui/nodes/excalidraw/dist/components/ExcalidrawElement/ExcalidrawElement.styles"; -export * from "./packages/ui/nodes/excalidraw/dist/components/ExcalidrawElement/ExcalidrawElement.types"; -export * from "./packages/ui/nodes/excalidraw/dist/components/ExcalidrawElement/index"; -export * from "./packages/ui/nodes/excalidraw/dist/transforms/index"; -export * from "./packages/ui/nodes/excalidraw/dist/transforms/insertExcalidraw"; -export * from "./packages/ui/nodes/excalidraw/src/index"; -export * from "./packages/ui/nodes/font/dist/index"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/ColorButton"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/ColorButton.styles"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/ColorInput"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/ColorInput.styles"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/ColorPicker"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/ColorPicker.styles"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/ColorType"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/Colors"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/Colors.styles"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/CustomColors"; -export * from "./packages/ui/nodes/font/dist/ColorPicker/index"; -export * from "./packages/ui/nodes/font/dist/ColorPickerToolbarDropdown/ColorPickerToolbarDropdown"; -export * from "./packages/ui/nodes/font/dist/ColorPickerToolbarDropdown/constants"; -export * from "./packages/ui/nodes/font/dist/ColorPickerToolbarDropdown/index"; -export * from "./packages/ui/nodes/font/src/index"; -export * from "./packages/ui/nodes/horizontal-rule/dist/index"; -export * from "./packages/ui/nodes/horizontal-rule/dist/HrElement/HrElement"; -export * from "./packages/ui/nodes/horizontal-rule/dist/HrElement/HrElement.styles"; -export * from "./packages/ui/nodes/horizontal-rule/dist/HrElement/HrElement.types"; -export * from "./packages/ui/nodes/horizontal-rule/dist/HrElement/index"; -export * from "./packages/ui/nodes/horizontal-rule/src/index"; -export * from "./packages/ui/nodes/image/dist/index"; -export * from "./packages/ui/nodes/image/dist/ImageElement/ImageElement"; -export * from "./packages/ui/nodes/image/dist/ImageElement/ImageElement.styles"; -export * from "./packages/ui/nodes/image/dist/ImageElement/ImageElement.types"; -export * from "./packages/ui/nodes/image/dist/ImageElement/index"; -export * from "./packages/ui/nodes/image/dist/ImageToolbarButton/ImageToolbarButton"; -export * from "./packages/ui/nodes/image/dist/ImageToolbarButton/index"; -export * from "./packages/ui/nodes/image/src/index"; -export * from "./packages/ui/nodes/line-height/dist/index"; -export * from "./packages/ui/nodes/line-height/dist/LineHeightToolbarButton/LineHeightToolbarDropdown"; -export * from "./packages/ui/nodes/line-height/dist/LineHeightToolbarButton/index"; -export * from "./packages/ui/nodes/line-height/src/index"; -export * from "./packages/ui/nodes/link/dist/index"; -export * from "./packages/ui/nodes/link/dist/LinkElement/LinkElement"; -export * from "./packages/ui/nodes/link/dist/LinkElement/LinkElement.styles"; -export * from "./packages/ui/nodes/link/dist/LinkElement/index"; -export * from "./packages/ui/nodes/link/dist/LinkToolbarButton/LinkToolbarButton"; -export * from "./packages/ui/nodes/link/dist/LinkToolbarButton/index"; -export * from "./packages/ui/nodes/link/src/index"; -export * from "./packages/ui/nodes/list/dist/index"; -export * from "./packages/ui/nodes/list/dist/ListToolbarButton/ListToolbarButton"; -export * from "./packages/ui/nodes/list/dist/ListToolbarButton/index"; -export * from "./packages/ui/nodes/list/dist/TodoListElement/TodoListElement"; -export * from "./packages/ui/nodes/list/dist/TodoListElement/TodoListElement.styles"; -export * from "./packages/ui/nodes/list/dist/TodoListElement/TodoListElement.types"; -export * from "./packages/ui/nodes/list/dist/TodoListElement/index"; -export * from "./packages/ui/nodes/list/src/index"; -export * from "./packages/ui/nodes/media-embed/dist/index"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/MediaEmbedElement"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/MediaEmbedElement.styles"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/MediaEmbedElement.types"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/MediaEmbedUrlInput"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/Tweet"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/index"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/utils/index"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/utils/parseEmbedUrl"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/utils/parseTwitterUrl"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedElement/utils/parseVideoUrl"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedToolbarButton/MediaEmbedToolbarButton"; -export * from "./packages/ui/nodes/media-embed/dist/MediaEmbedToolbarButton/index"; -export * from "./packages/ui/nodes/media-embed/src/index"; -export * from "./packages/ui/nodes/mention/dist/index"; -export * from "./packages/ui/nodes/mention/dist/MentionCombobox/MentionCombobox"; -export * from "./packages/ui/nodes/mention/dist/MentionCombobox/index"; -export * from "./packages/ui/nodes/mention/dist/MentionElement/MentionElement"; -export * from "./packages/ui/nodes/mention/dist/MentionElement/MentionElement.styles"; -export * from "./packages/ui/nodes/mention/dist/MentionElement/MentionElement.types"; -export * from "./packages/ui/nodes/mention/dist/MentionElement/index"; -export * from "./packages/ui/nodes/mention/dist/MentionInputElement/MentionInputElement"; -export * from "./packages/ui/nodes/mention/dist/MentionInputElement/MentionInputElement.styles"; -export * from "./packages/ui/nodes/mention/dist/MentionInputElement/MentionInputElement.types"; -export * from "./packages/ui/nodes/mention/dist/MentionInputElement/index"; -export * from "./packages/ui/nodes/mention/src/index"; -export * from "./packages/ui/nodes/table/dist/index"; -export * from "./packages/ui/nodes/table/dist/table.atoms"; -export * from "./packages/ui/nodes/table/dist/TableCellElement/TableCellElement"; -export * from "./packages/ui/nodes/table/dist/TableCellElement/TableCellElement.styles"; -export * from "./packages/ui/nodes/table/dist/TableCellElement/TableCellElement.types"; -export * from "./packages/ui/nodes/table/dist/TableCellElement/index"; -export * from "./packages/ui/nodes/table/dist/TableElement/TableElement"; -export * from "./packages/ui/nodes/table/dist/TableElement/TableElement.styles"; -export * from "./packages/ui/nodes/table/dist/TableElement/TableElement.types"; -export * from "./packages/ui/nodes/table/dist/TableElement/index"; -export * from "./packages/ui/nodes/table/dist/TablePopover/TablePopover"; -export * from "./packages/ui/nodes/table/dist/TablePopover/index"; -export * from "./packages/ui/nodes/table/dist/TableRowElement/TableRowElement"; -export * from "./packages/ui/nodes/table/dist/TableRowElement/TableRowElement.styles"; -export * from "./packages/ui/nodes/table/dist/TableRowElement/TableRowElement.types"; -export * from "./packages/ui/nodes/table/dist/TableRowElement/index"; -export * from "./packages/ui/nodes/table/dist/TableToolbarButton/TableToolbarButton"; -export * from "./packages/ui/nodes/table/dist/TableToolbarButton/TableToolbarButton.types"; -export * from "./packages/ui/nodes/table/dist/TableToolbarButton/index"; -export * from "./packages/ui/nodes/table/dist/hooks/index"; -export * from "./packages/ui/nodes/table/dist/hooks/useIsCellSelected"; -export * from "./packages/ui/nodes/table/dist/hooks/useSelectedCells"; -export * from "./packages/ui/nodes/table/dist/hooks/useTableColSizes"; -export * from "./packages/ui/nodes/table/src/index"; -export * from "./packages/ui/placeholder/dist/index"; -export * from "./packages/ui/placeholder/dist/components/Placeholder"; -export * from "./packages/ui/placeholder/dist/components/Placeholder.styles"; -export * from "./packages/ui/placeholder/dist/components/Placeholder.types"; -export * from "./packages/ui/placeholder/dist/components/index"; -export * from "./packages/ui/placeholder/src/index"; -export * from "./packages/ui/plate/dist/index"; -export * from "./packages/ui/plate/dist/types/DefaultPlatePluginKey"; -export * from "./packages/ui/plate/dist/types/index"; -export * from "./packages/ui/plate/dist/utils/createPlateUI"; -export * from "./packages/ui/plate/dist/utils/createPlateUIEditor"; -export * from "./packages/ui/plate/dist/utils/index"; -export * from "./packages/ui/plate/src/index"; -export * from "./packages/ui/plate/src/types/index"; -export * from "./packages/ui/plate/src/utils/index"; -export * from "./packages/ui/plate/typings/is-hotkey"; -export * from "./packages/ui/popover/dist/index"; -export * from "./packages/ui/popover/dist/Popover/Popover"; -export * from "./packages/ui/popover/dist/Popover/Popover.styles"; -export * from "./packages/ui/popover/dist/Popover/index"; -export * from "./packages/ui/popover/src/index"; -export * from "./packages/ui/popper/dist/getRangeBoundingClientRect"; -export * from "./packages/ui/popper/dist/getSelectionBoundingClientRect"; -export * from "./packages/ui/popper/dist/index"; -export * from "./packages/ui/popper/dist/usePopperPosition"; -export * from "./packages/ui/popper/src/index"; -export * from "./packages/ui/portive/dist/PortiveImage"; -export * from "./packages/ui/portive/dist/createPortivePlugin"; -export * from "./packages/ui/portive/dist/index"; -export * from "./packages/ui/styled-components/dist/index"; -export * from "./packages/ui/styled-components/dist/Divider/Divider"; -export * from "./packages/ui/styled-components/dist/Divider/index"; -export * from "./packages/ui/styled-components/dist/PortalBody/PortalBody"; -export * from "./packages/ui/styled-components/dist/PortalBody/PortalBody.types"; -export * from "./packages/ui/styled-components/dist/PortalBody/index"; -export * from "./packages/ui/styled-components/dist/StyledElement/StyledElement"; -export * from "./packages/ui/styled-components/dist/StyledElement/StyledElement.types"; -export * from "./packages/ui/styled-components/dist/StyledElement/index"; -export * from "./packages/ui/styled-components/dist/StyledLeaf/StyledLeaf"; -export * from "./packages/ui/styled-components/dist/StyledLeaf/StyledLeaf.types"; -export * from "./packages/ui/styled-components/dist/StyledLeaf/index"; -export * from "./packages/ui/styled-components/dist/hocs/index"; -export * from "./packages/ui/styled-components/dist/hocs/withStyledProps"; -export * from "./packages/ui/styled-components/dist/types/RootClassName"; -export * from "./packages/ui/styled-components/dist/types/RootStyles"; -export * from "./packages/ui/styled-components/dist/types/StyledProps"; -export * from "./packages/ui/styled-components/dist/types/index"; -export * from "./packages/ui/styled-components/dist/utils/createStyles"; -export * from "./packages/ui/styled-components/dist/utils/getRootProps"; -export * from "./packages/ui/styled-components/dist/utils/getStyledNodeStyles"; -export * from "./packages/ui/styled-components/dist/utils/index"; -export * from "./packages/ui/styled-components/src/index"; -export * from "./packages/ui/toolbar/dist/index"; -export * from "./packages/ui/toolbar/dist/BalloonToolbar/BalloonToolbar"; -export * from "./packages/ui/toolbar/dist/BalloonToolbar/BalloonToolbar.styles"; -export * from "./packages/ui/toolbar/dist/BalloonToolbar/BalloonToolbar.types"; -export * from "./packages/ui/toolbar/dist/BalloonToolbar/index"; -export * from "./packages/ui/toolbar/dist/BalloonToolbar/useBalloonToolbarPopper"; -export * from "./packages/ui/toolbar/dist/BlockToolbarButton/BlockToolbarButton"; -export * from "./packages/ui/toolbar/dist/BlockToolbarButton/BlockToolbarButton.types"; -export * from "./packages/ui/toolbar/dist/BlockToolbarButton/index"; -export * from "./packages/ui/toolbar/dist/HeadingToolbar/HeadingToolbar"; -export * from "./packages/ui/toolbar/dist/HeadingToolbar/HeadingToolbar.styles"; -export * from "./packages/ui/toolbar/dist/HeadingToolbar/index"; -export * from "./packages/ui/toolbar/dist/MarkToolbarButton/MarkToolbarButton"; -export * from "./packages/ui/toolbar/dist/MarkToolbarButton/MarkToolbarButton.types"; -export * from "./packages/ui/toolbar/dist/MarkToolbarButton/index"; -export * from "./packages/ui/toolbar/dist/Toolbar/Toolbar"; -export * from "./packages/ui/toolbar/dist/Toolbar/Toolbar.styles"; -export * from "./packages/ui/toolbar/dist/Toolbar/Toolbar.types"; -export * from "./packages/ui/toolbar/dist/Toolbar/index"; -export * from "./packages/ui/toolbar/dist/ToolbarButton/ToolbarButton"; -export * from "./packages/ui/toolbar/dist/ToolbarButton/ToolbarButton.styles"; -export * from "./packages/ui/toolbar/dist/ToolbarButton/ToolbarButton.types"; -export * from "./packages/ui/toolbar/dist/ToolbarButton/index"; -export * from "./packages/ui/toolbar/dist/ToolbarDropdown/ToolbarDropdown"; -export * from "./packages/ui/toolbar/dist/ToolbarDropdown/index"; -export * from "./packages/ui/toolbar/src/index"; -export * from "./scripts/setupTests"; -export * from "./scripts/templates/menu/src/index"; -export * from "./scripts/templates/menu/src/Menu/index"; -export * from "./scripts/templates/menu/src/MenuButton/index"; -export * from "./scripts/types/twin"; diff --git a/jest.config.js b/jest.config.js index 994bef1d27..e67195e70a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -19,6 +19,16 @@ const getTsConfigBasePaths = () => { : {}; }; +const aliases = require(`${process.cwd()}/config/aliases-plate`); + +const modules = {}; + +Object.keys(aliases).forEach((key) => { + const value = aliases[key]; + + modules[`^${key}$`] = `/packages/${value}/src`; +}); + /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ module.exports = { displayName: packageName, @@ -45,57 +55,8 @@ module.exports = { moduleNameMapper: { '\\.(css|less|sass|scss)$': '/scripts/styleMock.js', ...getTsConfigBasePaths(), - // '^@udecode/plate-ui-dnd$': '/packages/dnd/src', '^@udecode/plate-core$': '/packages/core/src', - // '^@udecode/plate-basic-elements$': - // '/packages/nodes/basic-elements/src', - // '^@udecode/plate-alignment$': '/packages/nodes/alignment/src', - // '^@udecode/plate-ui-alignment$': - // '/packages/nodes/alignment-ui/src', - // '^@udecode/plate-block-quote$': - // '/packages/nodes/block-quote/src', - // '^@udecode/plate-ui-block-quote$': - // '/packages/ui/nodes/block-quote/src', - // '^@udecode/plate-code-block$': '/packages/nodes/code-block/src', - // '^@udecode/plate-ui-code-block$': - // '/packages/ui/nodes/code-block/src', - // '^@udecode/plate-excalidraw$': '/packages/ui/nodes/excalidraw/src', - // '^@udecode/plate-heading$': '/packages/nodes/heading/src', - // '^@udecode/plate-image$': '/packages/nodes/image/src', - // '^@udecode/plate-ui-image$': '/packages/ui/nodes/image/src', - // '^@udecode/plate-link$': '/packages/nodes/link/src', - // '^@udecode/plate-ui-link$': '/packages/ui/nodes/link/src', - // '^@udecode/plate-list$': '/packages/nodes/list/src', - // '^@udecode/plate-ui-list$': '/packages/ui/nodes/list/src', - // '^@udecode/plate-media-embed$': - // '/packages/nodes/media-embed/src', - // '^@udecode/plate-ui-media-embed$': - // '/packages/ui/nodes/media-embed/src', - // '^@udecode/plate-mention$': '/packages/nodes/mention/src', - // '^@udecode/plate-ui-mention$': '/packages/ui/nodes/mention/src', - // '^@udecode/plate-paragraph$': '/packages/nodes/paragraph/src', - // '^@udecode/plate-ui-placeholder$': '/packages/placeholder/src', - // '^@udecode/plate-table$': '/packages/nodes/table/src', - // '^@udecode/plate-ui-table$': '/packages/ui/nodes/table/src', - // '^@udecode/plate-basic-marks$': '/packages/nodes/basic-marks/src', - // '^@udecode/plate-font$': '/packages/nodes/font/src', - // '^@udecode/plate-ui-font$': '/packages/ui/nodes/font/src', - // '^@udecode/plate-highlight$': '/packages/nodes/highlight/src', - // '^@udecode/plate-kbd$': '/packages/nodes/kbd/src', - // '^@udecode/plate-serializer-md$': - // '/packages/serializers/md/src', - // '^@udecode/plate-autoformat$': '/packages/autoformat/src', - // '^@udecode/plate-break$': '/packages/break/src', - // '^@udecode/plate-find-replace$': '/packages/find-replace/src', - // '^@udecode/plate-ui-find-replace$': '/packages/ui/find-replace/src', - // '^@udecode/plate-node-id$': '/packages/node-id/src', - // '^@udecode/plate-normalizers$': '/packages/normalizers/src', - // '^@udecode/plate-reset-node$': '/packages/reset-node/src', - // '^@udecode/plate-select$': '/packages/select/src', - // '^@udecode/plate-styled-components$': - // '/packages/ui/styled-components/src', - // '^@udecode/plate-trailing-block$': '/packages/trailing-block/src', - // '^@udecode/plate-ui-toolbar$': '/packages/ui/toolbar/src', + ...modules, }, testEnvironment: 'jsdom', testRegex: '(test|spec).tsx?$', diff --git a/packages/button/.npmignore b/packages/button/.npmignore new file mode 100644 index 0000000000..7d3b305b17 --- /dev/null +++ b/packages/button/.npmignore @@ -0,0 +1,3 @@ +__tests__ +__test-utils__ +__mocks__ diff --git a/packages/button/README.md b/packages/button/README.md new file mode 100644 index 0000000000..7e2d694cbd --- /dev/null +++ b/packages/button/README.md @@ -0,0 +1,11 @@ +# Plate button UI + +This package implements the button UI for Plate. + +## API + +See the [API documentation](https://plate-api.udecode.io/globals.html). + +## License + +[MIT](../../LICENSE) diff --git a/packages/button/package.json b/packages/button/package.json new file mode 100644 index 0000000000..a53fdac833 --- /dev/null +++ b/packages/button/package.json @@ -0,0 +1,39 @@ +{ + "name": "@udecode/plate-button", + "version": "14.4.2", + "description": "Button UI for Plate", + "license": "MIT", + "homepage": "https://plate.udecode.io", + "repository": { + "type": "git", + "url": "https://github.com/udecode/plate.git", + "directory": "packages/button" + }, + "bugs": { + "url": "https://github.com/udecode/plate/issues" + }, + "main": "dist/index.js", + "module": "dist/index.es.js", + "files": [ + "dist" + ], + "types": "dist/index.d.ts", + "dependencies": { + "@udecode/plate-core": "14.4.2" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0", + "slate": ">=0.66.1", + "slate-history": ">=0.66.0", + "slate-react": ">=0.74.2" + }, + "keywords": [ + "plate", + "plugin", + "slate" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/button/src/Button.tsx b/packages/button/src/Button.tsx new file mode 100644 index 0000000000..b0bd39b88d --- /dev/null +++ b/packages/button/src/Button.tsx @@ -0,0 +1,9 @@ +import { + AsProps, + createComponentAs, + createElementAs, +} from '@udecode/plate-core'; + +export const Button = createComponentAs>((props) => + createElementAs('button', props) +); diff --git a/packages/button/src/index.ts b/packages/button/src/index.ts new file mode 100644 index 0000000000..695ef07960 --- /dev/null +++ b/packages/button/src/index.ts @@ -0,0 +1,5 @@ +/** + * @file Automatically generated by barrelsby. + */ + +export * from './Button'; diff --git a/packages/button/tsconfig.json b/packages/button/tsconfig.json new file mode 100644 index 0000000000..9f68b4628c --- /dev/null +++ b/packages/button/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../config/tsconfig.build.json", + "compilerOptions": { + "declarationDir": "./dist" + }, + "include": ["src"] +} diff --git a/packages/core/package.json b/packages/core/package.json index bc249b4229..668432a767 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -24,6 +24,7 @@ "clsx": "^1.1.1", "jotai": "^1.7.2", "lodash": "^4.17.21", + "react-hotkeys-hook": "^3.4.6", "use-deep-compare": "^1.1.0", "zustand": "^3.7.2" }, diff --git a/packages/core/src/atoms/createAtomStore.spec.ts b/packages/core/src/atoms/createAtomStore.spec.ts index 96d4f63e96..b8c8b314a6 100644 --- a/packages/core/src/atoms/createAtomStore.spec.ts +++ b/packages/core/src/atoms/createAtomStore.spec.ts @@ -23,10 +23,12 @@ describe('createAtomStore', () => { }, { name: 'named', + scope: 'named', } ); expect(name).toBe('named'); + expect(namedStore.scope).toBe('named'); expect(namedStore.atom.b).toBeDefined(); expect(useNamedStore().get.b).toBeDefined(); expect(useNamedStore().use.b).toBeDefined(); @@ -51,11 +53,12 @@ describe('createAtomStore', () => { }, { name: 'renamed', + scope: 'renamed', } ); expect(name).toBe('renamed'); - expect(renamedStore.atom.b).toBeDefined(); + expect(renamedStore.scope).toBe('renamed'); expect(useRenamedStore().get.b).toBeDefined(); expect(useRenamedStore().use.b).toBeDefined(); expect(useRenamedStore().set.b).toBeDefined(); diff --git a/packages/core/src/atoms/createAtomStore.ts b/packages/core/src/atoms/createAtomStore.ts index 1cd108c3e6..781cae0771 100644 --- a/packages/core/src/atoms/createAtomStore.ts +++ b/packages/core/src/atoms/createAtomStore.ts @@ -23,6 +23,7 @@ export type AtomStoreApi = { } & { [key in keyof Record, {}>]: { atom: AtomRecord; + scope?: Scope; extend: ( extendedState: ET, options?: Omit< @@ -121,6 +122,7 @@ export const createAtomStore = ( ...api, [storeIndex]: { ...api[storeIndex], + scope: storeScope, extend: (extendedState: any, options: any) => createAtomStore(extendedState, { scope: storeScope, diff --git a/packages/core/src/components/plate/Plate.tsx b/packages/core/src/components/plate/Plate.tsx index 71cbeef40b..1de433fc01 100644 --- a/packages/core/src/components/plate/Plate.tsx +++ b/packages/core/src/components/plate/Plate.tsx @@ -1,5 +1,5 @@ import React, { Ref, useEffect } from 'react'; -import { Editable, Slate } from 'slate-react'; +import { Slate } from 'slate-react'; import { plateIdAtom, SCOPE_PLATE } from '../../atoms/plateIdAtom'; import { usePlate } from '../../hooks/plate/usePlate'; import { usePlatesStoreEffect } from '../../hooks/plate/usePlatesStoreEffect'; @@ -11,8 +11,7 @@ import { import { PlateEditor } from '../../types/plate/PlateEditor'; import { PlateStoreState } from '../../types/plate/PlateStore'; import { JotaiProvider, Scope } from '../../utils/misc/jotai'; -import { EditorRefEffect } from './EditorRefEffect'; -import { EditorStateEffect } from './EditorStateEffect'; +import { SlateChildren } from './SlateChildren'; export interface PlateProps< V extends Value = Value, @@ -38,6 +37,7 @@ export interface PlateProps< insertData?: boolean; history?: boolean; react?: boolean; + selection?: boolean; } | boolean; @@ -85,20 +85,20 @@ export const PlateContent = < }: PlateProps) => { const { slateProps, editableProps } = usePlate(options); - if (!slateProps.editor) return null; + const editor = slateProps.editor as E | undefined; - const editable = ; + if (!editor) return null; return ( - {firstChildren} - - {renderEditable ? renderEditable(editable) : editable} - - - - - {children} + + editor={editor} + editableProps={editableProps} + editableRef={editableRef} + renderEditable={renderEditable} + > + {children} + ); }; diff --git a/packages/core/src/components/plate/SlateChildren.tsx b/packages/core/src/components/plate/SlateChildren.tsx new file mode 100644 index 0000000000..7cb7cf1fc5 --- /dev/null +++ b/packages/core/src/components/plate/SlateChildren.tsx @@ -0,0 +1,82 @@ +import React, { ReactElement, ReactNode } from 'react'; +import { Editable } from 'slate-react'; +import { TEditableProps, Value } from '../../slate/index'; +import { PlateEditor } from '../../types/index'; +import { EditorRefEffect } from './EditorRefEffect'; +import { EditorStateEffect } from './EditorStateEffect'; +import { PlateProps } from './Plate'; + +export const SlateChildren = < + V extends Value = Value, + E extends PlateEditor = PlateEditor +>({ + children, + renderEditable, + editableRef, + editableProps, + editor, + firstChildren, +}: Pick< + PlateProps, + 'children' | 'renderEditable' | 'editableRef' | 'firstChildren' +> & { + editor: E; + editableProps?: TEditableProps; +}) => { + const { plugins } = editor; + + const editable = ; + + let afterEditable: ReactNode = null; + let beforeEditable: ReactNode = null; + + plugins.forEach((plugin) => { + const { renderBeforeEditable, renderAfterEditable } = plugin; + + if (renderAfterEditable) { + afterEditable = ( + <> + {afterEditable} + {renderAfterEditable()} + + ); + } + + if (renderBeforeEditable) { + beforeEditable = ( + <> + {beforeEditable} + {renderBeforeEditable()} + + ); + } + }); + + let aboveEditable: ReactElement | null = ( + <> + {firstChildren} + + {beforeEditable} + + {renderEditable ? renderEditable(editable) : editable} + + + + + {afterEditable} + + {children} + + ); + + plugins.forEach((plugin) => { + const { renderAboveEditable } = plugin; + + if (renderAboveEditable) + aboveEditable = renderAboveEditable({ + children: aboveEditable, + }); + }); + + return aboveEditable; +}; diff --git a/packages/core/src/components/plate/index.ts b/packages/core/src/components/plate/index.ts index 08fc78c403..a9ce56ffed 100644 --- a/packages/core/src/components/plate/index.ts +++ b/packages/core/src/components/plate/index.ts @@ -10,3 +10,4 @@ export * from './Plate'; export * from './PlateEventProvider'; export * from './PlateProvider'; export * from './PlateTest'; +export * from './SlateChildren'; diff --git a/packages/core/src/hooks/plate/index.ts b/packages/core/src/hooks/plate/index.ts index 4d8738a79d..f9b4723178 100644 --- a/packages/core/src/hooks/plate/index.ts +++ b/packages/core/src/hooks/plate/index.ts @@ -3,6 +3,7 @@ */ export * from './useEditableProps'; +export * from './useElementProps'; export * from './usePlate'; export * from './usePlateEffects'; export * from './usePlateStoreEffects'; diff --git a/packages/core/src/hooks/plate/useElementProps.ts b/packages/core/src/hooks/plate/useElementProps.ts new file mode 100644 index 0000000000..d215c81ebe --- /dev/null +++ b/packages/core/src/hooks/plate/useElementProps.ts @@ -0,0 +1,39 @@ +import { TElement } from '../../slate/index'; +import { As, HTMLPropsAs, PlateRenderElementProps } from '../../types/index'; +import { useComposedRef } from '../react/index'; + +export type UseElementPropsOptions< + T extends TElement = TElement, + A extends As = 'div' +> = { + /** + * Get HTML attributes from Slate element. Alternative to `PlatePlugin.props`. + */ + elementToAttributes?: (element: T) => Partial>; +} & PlateRenderElementProps & + HTMLPropsAs; + +/** + * Get root element props for Slate element. + */ +export const useElementProps = < + T extends TElement = TElement, + A extends As = 'div' +>({ + attributes, + nodeProps, + element, + editor, + elementToAttributes, + ...props +}: UseElementPropsOptions): HTMLPropsAs => { + const htmlProps: HTMLPropsAs<'div'> = { + ...attributes, + ...props, + ...nodeProps, + ...(elementToAttributes?.(element as T) ?? {}), + ref: useComposedRef(props.ref, attributes.ref), + }; + + return htmlProps as HTMLPropsAs; +}; diff --git a/packages/core/src/hooks/react/index.ts b/packages/core/src/hooks/react/index.ts index 9b515bf351..316c4beb67 100644 --- a/packages/core/src/hooks/react/index.ts +++ b/packages/core/src/hooks/react/index.ts @@ -3,4 +3,5 @@ */ export * from './useComposedRef'; +export * from './useOnClickOutside'; export * from './useWrapElement'; diff --git a/packages/core/src/hooks/react/useOnClickOutside.ts b/packages/core/src/hooks/react/useOnClickOutside.ts new file mode 100644 index 0000000000..aefebe3b9a --- /dev/null +++ b/packages/core/src/hooks/react/useOnClickOutside.ts @@ -0,0 +1,162 @@ +import { RefObject, useCallback, useEffect, useRef, useState } from 'react'; + +const canUsePassiveEvents = (): boolean => { + if ( + typeof window === 'undefined' || + typeof window.addEventListener !== 'function' + ) + return false; + + let passive = false; + const options = Object.defineProperty({}, 'passive', { + // eslint-disable-next-line getter-return + get() { + passive = true; + }, + }); + const noop = () => null; + + window.addEventListener('test', noop, options); + window.removeEventListener('test', noop, options); + + return passive; +}; + +export const DEFAULT_IGNORE_CLASS = 'ignore-onclickoutside'; + +export interface UseOnClickOutsideCallback { + (event: T): void; +} +type El = HTMLElement; +type Refs = RefObject[]; +export interface UseOnClickOutsideOptions { + refs?: Refs; + disabled?: boolean; + eventTypes?: string[]; + excludeScrollbar?: boolean; + ignoreClass?: string | string[]; + detectIFrame?: boolean; +} + +export interface UseOnClickOutsideReturn { + (element: El | null): void; +} + +const checkClass = (el: HTMLElement, cl: string): boolean => + el.classList?.contains(cl); + +const hasIgnoreClass = (e: any, ignoreClass: string | string[]): boolean => { + let el = e.target || e; + + while (el) { + if (Array.isArray(ignoreClass)) { + // eslint-disable-next-line no-loop-func + if (ignoreClass.some((c) => checkClass(el, c))) return true; + } else if (checkClass(el, ignoreClass)) { + return true; + } + + el = el.parentElement; + } + + return false; +}; + +const clickedOnScrollbar = (e: MouseEvent): boolean => + document.documentElement.clientWidth <= e.clientX || + document.documentElement.clientHeight <= e.clientY; + +const getEventOptions = (type: string): { passive: boolean } | boolean => + type.includes('touch') && canUsePassiveEvents() ? { passive: true } : false; + +export const useOnClickOutside = ( + callback: UseOnClickOutsideCallback, + { + refs: refsOpt, + disabled, + eventTypes = ['mousedown', 'touchstart'], + excludeScrollbar, + ignoreClass = DEFAULT_IGNORE_CLASS, + detectIFrame = true, + }: UseOnClickOutsideOptions = {} +): UseOnClickOutsideReturn => { + const [refsState, setRefsState] = useState([]); + const callbackRef = useRef(callback); + callbackRef.current = callback; + + const ref: UseOnClickOutsideReturn = useCallback( + (el) => setRefsState((prevState) => [...prevState, { current: el }]), + [] + ); + + useEffect( + () => { + if (!refsOpt?.length && !refsState.length) return; + + const getEls = () => { + const els: El[] = []; + (refsOpt || refsState).forEach( + ({ current }) => current && els.push(current) + ); + return els; + }; + + const handler = (e: any) => { + if ( + !hasIgnoreClass(e, ignoreClass) && + !(excludeScrollbar && clickedOnScrollbar(e)) && + getEls().every((el) => !el.contains(e.target)) + ) + callbackRef.current(e); + }; + + const blurHandler = (e: FocusEvent) => + // On firefox the iframe becomes document.activeElement in the next event loop + setTimeout(() => { + const { activeElement } = document; + + if ( + activeElement?.tagName === 'IFRAME' && + !hasIgnoreClass(activeElement, ignoreClass) && + !getEls().includes(activeElement as HTMLIFrameElement) + ) + callbackRef.current(e); + }, 0); + + const removeEventListener = () => { + eventTypes.forEach((type) => + // @ts-ignore + document.removeEventListener(type, handler, getEventOptions(type)) + ); + + if (detectIFrame) window.removeEventListener('blur', blurHandler); + }; + + if (disabled) { + removeEventListener(); + return; + } + + eventTypes.forEach((type) => + document.addEventListener(type, handler, getEventOptions(type)) + ); + + if (detectIFrame) window.addEventListener('blur', blurHandler); + + // eslint-disable-next-line consistent-return + return () => removeEventListener(); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [ + refsState, + ignoreClass, + excludeScrollbar, + disabled, + detectIFrame, + // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(eventTypes), + ] + ); + + return ref; +}; diff --git a/packages/core/src/plugins/createSelectionPlugin.ts b/packages/core/src/plugins/createSelectionPlugin.ts new file mode 100644 index 0000000000..687ef193d8 --- /dev/null +++ b/packages/core/src/plugins/createSelectionPlugin.ts @@ -0,0 +1,23 @@ +import { TRange } from '../slate/index'; +import { createPluginFactory } from '../utils/plate/createPluginFactory'; + +export const KEY_SELECTION = 'selection'; + +export const createSelectionPlugin = createPluginFactory({ + key: KEY_SELECTION, + withOverrides: (editor) => { + const { apply } = editor; + + editor.apply = (operation) => { + if (operation.type === 'set_selection') { + const { properties } = operation; + + editor.prevSelection = properties as TRange | null; + } + + apply(operation); + }; + + return editor; + }, +}); diff --git a/packages/core/src/plugins/index.ts b/packages/core/src/plugins/index.ts index 8f92e18735..90ac3ebd4d 100644 --- a/packages/core/src/plugins/index.ts +++ b/packages/core/src/plugins/index.ts @@ -8,6 +8,7 @@ export * from './createHistoryPlugin'; export * from './createInlineVoidPlugin'; export * from './createInsertDataPlugin'; export * from './createReactPlugin'; +export * from './createSelectionPlugin'; export * from './onKeyDownToggleElement'; export * from './onKeyDownToggleMark'; export * from './withPlate'; diff --git a/packages/core/src/plugins/withPlate.spec.ts b/packages/core/src/plugins/withPlate.spec.ts index 19ab7d7cb6..92ccc5f799 100644 --- a/packages/core/src/plugins/withPlate.spec.ts +++ b/packages/core/src/plugins/withPlate.spec.ts @@ -8,6 +8,7 @@ import { KEY_DESERIALIZE_AST } from './createDeserializeAstPlugin'; import { KEY_EVENT_EDITOR } from './createEventEditorPlugin'; import { KEY_INLINE_VOID } from './createInlineVoidPlugin'; import { KEY_INSERT_DATA } from './createInsertDataPlugin'; +import { KEY_SELECTION } from './createSelectionPlugin'; import { withPlate } from './withPlate'; const coreKeys = [ @@ -16,6 +17,7 @@ const coreKeys = [ KEY_EVENT_EDITOR, KEY_INLINE_VOID, KEY_INSERT_DATA, + KEY_SELECTION, KEY_DESERIALIZE_HTML, KEY_DESERIALIZE_AST, ]; diff --git a/packages/core/src/plugins/withPlate.ts b/packages/core/src/plugins/withPlate.ts index 71c197e0d3..a5e2bdaf27 100644 --- a/packages/core/src/plugins/withPlate.ts +++ b/packages/core/src/plugins/withPlate.ts @@ -29,6 +29,7 @@ export const withPlate = < let editor = (e as any) as E & PlateEditor; editor.id = id as string; + editor.prevSelection = null; if (!editor.key) { editor.key = Math.random(); diff --git a/packages/core/src/queries/__tests__/getNextSiblingNodes/no-sibling.spec.tsx b/packages/core/src/queries/__tests__/getNextSiblingNodes/no-sibling.spec.tsx index 4a7d88ef3b..c9c3b3a2be 100644 --- a/packages/core/src/queries/__tests__/getNextSiblingNodes/no-sibling.spec.tsx +++ b/packages/core/src/queries/__tests__/getNextSiblingNodes/no-sibling.spec.tsx @@ -1,9 +1,8 @@ /** @jsx jsx */ -import { createLinkPlugin } from '@udecode/plate-link/src/createLinkPlugin'; +import { createLinkPlugin } from '@udecode/plate-link'; import { jsx } from '@udecode/plate-test-utils'; import { Range } from 'slate'; -import { Value } from '../../../slate/editor/TEditor'; import { TDescendant } from '../../../slate/node/TDescendant'; import { PlateEditor } from '../../../types/plate/PlateEditor'; import { createPlateEditor } from '../../../utils/plate/createPlateEditor'; diff --git a/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/empty-text-after.spec.tsx b/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/empty-text-after.spec.tsx index 425ae3ebb7..4f35094cf1 100644 --- a/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/empty-text-after.spec.tsx +++ b/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/empty-text-after.spec.tsx @@ -1,8 +1,7 @@ /** @jsx jsx */ -import { createLinkPlugin } from '@udecode/plate-link/src/createLinkPlugin'; +import { createLinkPlugin } from '@udecode/plate-link'; import { jsx } from '@udecode/plate-test-utils'; -import { Value } from '../../../slate/editor/TEditor'; import { PlateEditor } from '../../../types/plate/PlateEditor'; import { createPlateEditor } from '../../../utils/plate/createPlateEditor'; import { isBlockTextEmptyAfterSelection } from '../../isBlockTextEmptyAfterSelection'; diff --git a/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/text-after.spec.tsx b/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/text-after.spec.tsx index 66b055c06c..fd1ca24a25 100644 --- a/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/text-after.spec.tsx +++ b/packages/core/src/queries/__tests__/isBlockTextEmptyAfterSelection/text-after.spec.tsx @@ -1,8 +1,7 @@ /** @jsx jsx */ -import { createLinkPlugin } from '@udecode/plate-link/src/createLinkPlugin'; +import { createLinkPlugin } from '@udecode/plate-link'; import { jsx } from '@udecode/plate-test-utils'; -import { Value } from '../../../slate/editor/TEditor'; import { PlateEditor } from '../../../types/plate/PlateEditor'; import { createPlateEditor } from '../../../utils/plate/createPlateEditor'; import { isBlockTextEmptyAfterSelection } from '../../isBlockTextEmptyAfterSelection'; diff --git a/packages/core/src/queries/getNextNodeStartPoint.ts b/packages/core/src/queries/getNextNodeStartPoint.ts new file mode 100644 index 0000000000..e1c2fd7098 --- /dev/null +++ b/packages/core/src/queries/getNextNodeStartPoint.ts @@ -0,0 +1,18 @@ +import { Path } from 'slate'; +import { getNextNode, getStartPoint, Value } from '../slate/index'; +import { PlateEditor } from '../types/index'; + +/** + * Get the start point of the next node. + */ +export const getNextNodeStartPoint = ( + editor: PlateEditor, + at: Path +) => { + const nextEntry = getNextNode(editor, { + at, + }); + if (!nextEntry) return; + + return getStartPoint(editor, nextEntry[1]); +}; diff --git a/packages/core/src/queries/getPreviousNodeEndPoint.ts b/packages/core/src/queries/getPreviousNodeEndPoint.ts new file mode 100644 index 0000000000..02ee3a31fe --- /dev/null +++ b/packages/core/src/queries/getPreviousNodeEndPoint.ts @@ -0,0 +1,18 @@ +import { Path } from 'slate'; +import { getEndPoint, getPreviousNode, Value } from '../slate'; +import { PlateEditor } from '../types/index'; + +/** + * Get the end point of the previous node. + */ +export const getPreviousNodeEndPoint = ( + editor: PlateEditor, + at: Path +) => { + const prevEntry = getPreviousNode(editor, { + at, + }); + if (!prevEntry) return; + + return getEndPoint(editor, prevEntry[1]); +}; diff --git a/packages/core/src/queries/index.ts b/packages/core/src/queries/index.ts index 25e3849ca3..185dce47a1 100644 --- a/packages/core/src/queries/index.ts +++ b/packages/core/src/queries/index.ts @@ -10,12 +10,14 @@ export * from './getEdgeBlocksAbove'; export * from './getLastChild'; export * from './getLastNodeByLevel'; export * from './getMark'; +export * from './getNextNodeStartPoint'; export * from './getNextSiblingNodes'; export * from './getOperations'; export * from './getPointBeforeLocation'; export * from './getPointFromLocation'; export * from './getPointNextToVoid'; export * from './getPreviousBlockById'; +export * from './getPreviousNodeEndPoint'; export * from './getPreviousPath'; export * from './getRangeBefore'; export * from './getRangeFromBlockStart'; diff --git a/packages/core/src/queries/isRangeAcrossBlocks.spec.tsx b/packages/core/src/queries/isRangeAcrossBlocks.spec.tsx index 2e39e9c4d2..7a66c3d11d 100644 --- a/packages/core/src/queries/isRangeAcrossBlocks.spec.tsx +++ b/packages/core/src/queries/isRangeAcrossBlocks.spec.tsx @@ -1,6 +1,6 @@ /** @jsx jsx */ -import { createLinkPlugin } from '@udecode/plate-link/src/createLinkPlugin'; +import { createLinkPlugin } from '@udecode/plate-link'; import { jsx } from '@udecode/plate-test-utils'; import { createPlateUIEditor } from '@udecode/plate-ui/src/utils/createPlateUIEditor'; import { PlateEditor } from '../types/plate/PlateEditor'; diff --git a/packages/core/src/types/plate/PlateEditor.ts b/packages/core/src/types/plate/PlateEditor.ts index fc75354531..8043b618cd 100644 --- a/packages/core/src/types/plate/PlateEditor.ts +++ b/packages/core/src/types/plate/PlateEditor.ts @@ -1,5 +1,6 @@ import { TEditor, Value } from '../../slate/editor/TEditor'; import { THistoryEditor } from '../../slate/history-editor/THistoryEditor'; +import { TRange } from '../../slate/index'; import { TReactEditor } from '../../slate/react-editor/TReactEditor'; import { WithPlatePlugin } from '../plugin/PlatePlugin'; import { PluginKey } from '../plugin/PlatePluginKey'; @@ -11,4 +12,5 @@ export type PlateEditor = TEditor & id: string; plugins: WithPlatePlugin<{}, V>[]; pluginsByKey: Record>; + prevSelection: TRange | null; }; diff --git a/packages/core/src/types/plugin/PlatePlugin.ts b/packages/core/src/types/plugin/PlatePlugin.ts index 0f473ad958..2b58bfe5ae 100644 --- a/packages/core/src/types/plugin/PlatePlugin.ts +++ b/packages/core/src/types/plugin/PlatePlugin.ts @@ -1,3 +1,4 @@ +import { FC, ReactNode } from 'react'; import { Value } from '../../slate/editor/TEditor'; import { AnyObject } from '../misc/AnyObject'; import { Nullable } from '../misc/Nullable'; @@ -146,6 +147,23 @@ export type PlatePlugin< */ props?: PlatePluginProps; + /** + * Render a component above `Editable`. + */ + renderAboveEditable?: FC<{ + children: ReactNode; + }>; + + /** + * Render a component after `Editable`. + */ + renderAfterEditable?: () => JSX.Element | null; + + /** + * Render a component before `Editable`. + */ + renderBeforeEditable?: () => JSX.Element | null; + /** * Property used by `serializeHtml` util to replace `renderElement` and `renderLeaf` when serializing a node of this `type`. */ diff --git a/packages/core/src/utils/__tests__/normalizeDescendantsToDocumentFragment/default.spec.tsx b/packages/core/src/utils/__tests__/normalizeDescendantsToDocumentFragment/default.spec.tsx index 6d226f8336..87ed254c87 100644 --- a/packages/core/src/utils/__tests__/normalizeDescendantsToDocumentFragment/default.spec.tsx +++ b/packages/core/src/utils/__tests__/normalizeDescendantsToDocumentFragment/default.spec.tsx @@ -1,5 +1,5 @@ /** @jsx jsx */ -import { createPlateUIEditor } from '@udecode/plate/src/index'; +import { createPlateUIEditor } from '@udecode/plate'; import { createLinkPlugin } from '@udecode/plate-link'; import { jsx } from '@udecode/plate-test-utils'; import { normalizeDescendantsToDocumentFragment } from '../../index'; diff --git a/packages/core/src/utils/misc/index.ts b/packages/core/src/utils/misc/index.ts index 99f4e32f10..749ba1cfd7 100644 --- a/packages/core/src/utils/misc/index.ts +++ b/packages/core/src/utils/misc/index.ts @@ -12,5 +12,7 @@ export * from './hexToBase64'; export * from './hotkeys'; export * from './isUrl'; export * from './jotai'; +export * from './mergeProps'; +export * from './react-hotkeys-hook'; export * from './type-utils'; export * from './zustood'; diff --git a/packages/core/src/utils/misc/mergeProps.ts b/packages/core/src/utils/misc/mergeProps.ts new file mode 100644 index 0000000000..8beea54964 --- /dev/null +++ b/packages/core/src/utils/misc/mergeProps.ts @@ -0,0 +1,55 @@ +/** + * Merge props by composing handlers. + */ +export const mergeProps = ( + props?: T, + overrideProps?: T, + { + handlerKeys, + handlerQuery = (key) => key.indexOf('on') === 0, + }: { + /** + * The keys of the handlers to merge. + */ + handlerKeys?: string[]; + /** + * A function that returns true if it's a handler to merge. + * + * Default: keys having `on` prefix. + */ + handlerQuery?: ((key: string) => boolean) | null; + } = {} +): T => { + const map = new Map void>>(); + + const acc: any = {}; + + const mapProps = (_props?: T) => { + if (!_props) return; + + Object.entries(_props).forEach(([key, value]) => { + if ( + (!handlerKeys || handlerKeys.includes(key)) && + (!handlerQuery || handlerQuery(key)) && + typeof value === 'function' + ) { + if (!map.has(key)) { + map.set(key, []); + } + + map.get(key)?.push(value); + + acc[key] = (...args: unknown[]) => { + map.get(key)?.forEach((fn) => fn(...args)); + }; + } else { + acc[key] = value; + } + }); + }; + + mapProps(props); + mapProps(overrideProps); + + return acc; +}; diff --git a/packages/core/src/utils/misc/react-hotkeys-hook.ts b/packages/core/src/utils/misc/react-hotkeys-hook.ts new file mode 100644 index 0000000000..000b7be3b0 --- /dev/null +++ b/packages/core/src/utils/misc/react-hotkeys-hook.ts @@ -0,0 +1,2 @@ +export { isHotkeyPressed, useHotkeys } from 'react-hotkeys-hook'; +export type { Options as UseHotkeysOptions } from 'react-hotkeys-hook'; diff --git a/packages/core/src/utils/plate/createPlateElementComponent.ts b/packages/core/src/utils/plate/createPlateElementComponent.ts new file mode 100644 index 0000000000..1de4da4bc0 --- /dev/null +++ b/packages/core/src/utils/plate/createPlateElementComponent.ts @@ -0,0 +1,33 @@ +import { ElementType } from 'react'; +import { useElementProps, UseElementPropsOptions } from '../../hooks/index'; +import { TElement, Value } from '../../slate/index'; +import { As, HTMLPropsAs, PlateRenderElementProps } from '../../types/index'; +import { createComponentAs, createElementAs } from '../react/index'; + +export type CreatePlateElementComponentOptions< + T extends TElement = TElement, + A extends As = 'div' +> = { + as?: ElementType; +} & Pick, 'elementToAttributes'>; + +/** + * Create the top-level React component for a Slate element. + */ +export const createPlateElementComponent = < + T extends TElement = TElement, + A extends As = 'div' +>({ + as = 'div', + elementToAttributes, +}: CreatePlateElementComponentOptions = {}) => + createComponentAs & HTMLPropsAs>( + (props) => { + const htmlProps = useElementProps({ + ...(props as any), + elementToAttributes, + }); + + return createElementAs(as, htmlProps); + } + ); diff --git a/packages/core/src/utils/plate/createPluginFactory.spec.ts b/packages/core/src/utils/plate/createPluginFactory.spec.ts index 29ec4b8914..a017a4c2f9 100644 --- a/packages/core/src/utils/plate/createPluginFactory.spec.ts +++ b/packages/core/src/utils/plate/createPluginFactory.spec.ts @@ -1,8 +1,5 @@ import { createBasicElementsPlugin } from '@udecode/plate-basic-elements/src/createBasicElementsPlugin'; -import { - createLinkPlugin, - ELEMENT_LINK, -} from '@udecode/plate-link/src/createLinkPlugin'; +import { createLinkPlugin, ELEMENT_LINK } from '@udecode/plate-link/src/index'; import { createPlateEditor } from './createPlateEditor'; import { createPluginFactory } from './createPluginFactory'; import { getPlugin } from './getPlugin'; diff --git a/packages/core/src/utils/plate/index.ts b/packages/core/src/utils/plate/index.ts index 3d6053e924..ee9ac45e00 100644 --- a/packages/core/src/utils/plate/index.ts +++ b/packages/core/src/utils/plate/index.ts @@ -3,6 +3,7 @@ */ export * from './createPlateEditor'; +export * from './createPlateElementComponent'; export * from './createPluginFactory'; export * from './createPlugins'; export * from './flattenDeepPlugins'; diff --git a/packages/core/src/utils/plate/setPlatePlugins.ts b/packages/core/src/utils/plate/setPlatePlugins.ts index d7b2c35057..a0e8311862 100644 --- a/packages/core/src/utils/plate/setPlatePlugins.ts +++ b/packages/core/src/utils/plate/setPlatePlugins.ts @@ -17,6 +17,10 @@ import { KEY_INSERT_DATA, } from '../../plugins/createInsertDataPlugin'; import { createReactPlugin } from '../../plugins/createReactPlugin'; +import { + createSelectionPlugin, + KEY_SELECTION, +} from '../../plugins/createSelectionPlugin'; import { createDeserializeHtmlPlugin, KEY_DESERIALIZE_HTML, @@ -69,6 +73,11 @@ export const setPlatePlugins = ( createInsertDataPlugin() ); } + if (typeof dcp !== 'object' || !dcp.selection) { + plugins.push( + (editor.pluginsByKey?.[KEY_SELECTION] as any) ?? createSelectionPlugin() + ); + } if (typeof dcp !== 'object' || !dcp.deserializeHtml) { plugins.push( (editor.pluginsByKey?.[KEY_DESERIALIZE_HTML] as any) ?? diff --git a/packages/core/src/utils/react/createNodesHOC.tsx b/packages/core/src/utils/react/createNodesHOC.tsx index 59e341f768..77f77a01ba 100644 --- a/packages/core/src/utils/react/createNodesHOC.tsx +++ b/packages/core/src/utils/react/createNodesHOC.tsx @@ -3,7 +3,7 @@ import { castArray } from 'lodash'; import { AnyObject } from '../../types/misc/AnyObject'; import { createNodeHOC } from './createNodeHOC'; -export type Options = Partial & +export type CreateHOCOptions = Partial & AnyObject & { /** * Set HOC by key. @@ -17,11 +17,14 @@ export type Options = Partial & }; const createHOC = (withHOC: any) => { - return (components: any, options: Options | Options[]) => { + return ( + components: any, + options: CreateHOCOptions | CreateHOCOptions[] + ) => { const _components = { ...components }; const optionsByKey = {}; - const optionsList = castArray>(options); + const optionsList = castArray>(options); optionsList.forEach(({ key, keys, ...opt }) => { const _keys: string[] = key ? [key] : keys ?? Object.keys(_components); diff --git a/packages/editor/autoformat/src/__tests__/withAutoformat/trigger.spec.tsx b/packages/editor/autoformat/src/__tests__/withAutoformat/trigger.spec.tsx index 556e5a86eb..4fa959eee5 100644 --- a/packages/editor/autoformat/src/__tests__/withAutoformat/trigger.spec.tsx +++ b/packages/editor/autoformat/src/__tests__/withAutoformat/trigger.spec.tsx @@ -9,7 +9,7 @@ import { createAutoformatPlugin, KEY_AUTOFORMAT, } from '../../createAutoformatPlugin'; -import onKeyDownAutoformat from '../../onKeyDownAutoformat'; +import { onKeyDownAutoformat } from '../../onKeyDownAutoformat'; import { AutoformatPlugin } from '../../types'; jsx; diff --git a/packages/editor/autoformat/src/createAutoformatPlugin.ts b/packages/editor/autoformat/src/createAutoformatPlugin.ts index 82a4758906..ab8b5e5bbb 100644 --- a/packages/editor/autoformat/src/createAutoformatPlugin.ts +++ b/packages/editor/autoformat/src/createAutoformatPlugin.ts @@ -1,5 +1,5 @@ import { createPluginFactory } from '@udecode/plate-core'; -import onKeyDownAutoformat from './onKeyDownAutoformat'; +import { onKeyDownAutoformat } from './onKeyDownAutoformat'; import { AutoformatPlugin } from './types'; import { withAutoformat } from './withAutoformat'; diff --git a/packages/editor/autoformat/src/index.ts b/packages/editor/autoformat/src/index.ts index dd6b6b1209..3820fd6a66 100644 --- a/packages/editor/autoformat/src/index.ts +++ b/packages/editor/autoformat/src/index.ts @@ -3,6 +3,7 @@ */ export * from './createAutoformatPlugin'; +export * from './onKeyDownAutoformat'; export * from './types'; export * from './withAutoformat'; export * from './rules/index'; diff --git a/packages/editor/autoformat/src/onKeyDownAutoformat.ts b/packages/editor/autoformat/src/onKeyDownAutoformat.ts index b05cc2a9f7..40633bb02e 100644 --- a/packages/editor/autoformat/src/onKeyDownAutoformat.ts +++ b/packages/editor/autoformat/src/onKeyDownAutoformat.ts @@ -13,7 +13,7 @@ import isHotkey from 'is-hotkey'; import { Range } from 'slate'; import { AutoformatPlugin, AutoformatRule, AutoformatTextRule } from './types'; -const onKeyDownAutoformat = < +export const onKeyDownAutoformat = < V extends Value = Value, E extends PlateEditor = PlateEditor >( @@ -89,5 +89,3 @@ const onKeyDownAutoformat = < } return true; }; - -export default onKeyDownAutoformat; diff --git a/packages/editor/combobox/package.json b/packages/editor/combobox/package.json index 1b9e72cce0..07f5539c8b 100644 --- a/packages/editor/combobox/package.json +++ b/packages/editor/combobox/package.json @@ -20,6 +20,7 @@ "types": "dist/index.d.ts", "dependencies": { "@udecode/plate-core": "14.4.2", + "@udecode/plate-floating": "14.4.2", "downshift": "^6.1.7" }, "peerDependencies": { diff --git a/packages/editor/combobox/src/combobox.store.ts b/packages/editor/combobox/src/combobox.store.ts index 939e9ccebb..8f1397c440 100644 --- a/packages/editor/combobox/src/combobox.store.ts +++ b/packages/editor/combobox/src/combobox.store.ts @@ -1,4 +1,5 @@ import { createStore, StateActions, StoreApi } from '@udecode/plate-core'; +import { UseVirtualFloatingOptions } from '@udecode/plate-floating'; import { Range } from 'slate'; import { ComboboxOnSelectItem, NoData, TComboboxItem } from './types'; @@ -82,15 +83,9 @@ export type ComboboxState = { highlightedIndex: number; /** - * Parent element of the popper element (the one that has the scroll). - * @default document + * Overrides `useFloating` options. */ - popperContainer?: Document | HTMLElement; - - /** - * Overrides `usePopper` options. - */ - popperOptions?: any; + floatingOptions?: Partial; /** * Range from the trigger to the cursor. diff --git a/packages/floating/.npmignore b/packages/floating/.npmignore new file mode 100644 index 0000000000..7d3b305b17 --- /dev/null +++ b/packages/floating/.npmignore @@ -0,0 +1,3 @@ +__tests__ +__test-utils__ +__mocks__ diff --git a/packages/floating/README.md b/packages/floating/README.md new file mode 100644 index 0000000000..fe23a59535 --- /dev/null +++ b/packages/floating/README.md @@ -0,0 +1,15 @@ +# Plate floating UI + +This package implements the floating UI for Plate. + +## Documentation + +See Link, Mention. + +## API + +See the [API documentation](https://plate-api.udecode.io/globals.html). + +## License + +[MIT](../../LICENSE) diff --git a/packages/floating/package.json b/packages/floating/package.json new file mode 100644 index 0000000000..ac7fc08a67 --- /dev/null +++ b/packages/floating/package.json @@ -0,0 +1,40 @@ +{ + "name": "@udecode/plate-floating", + "version": "14.4.2", + "description": "Floating UI for Plate", + "license": "MIT", + "homepage": "https://plate.udecode.io", + "repository": { + "type": "git", + "url": "https://github.com/udecode/plate.git", + "directory": "packages/floating" + }, + "bugs": { + "url": "https://github.com/udecode/plate/issues" + }, + "main": "dist/index.js", + "module": "dist/index.es.js", + "files": [ + "dist" + ], + "types": "dist/index.d.ts", + "dependencies": { + "@floating-ui/react-dom-interactions": "^0.6.6", + "@udecode/plate-core": "14.4.2" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0", + "slate": ">=0.66.1", + "slate-history": ">=0.66.0", + "slate-react": ">=0.74.2" + }, + "keywords": [ + "plate", + "plugin", + "slate" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/floating/src/createVirtualElement.ts b/packages/floating/src/createVirtualElement.ts new file mode 100644 index 0000000000..344eb8bef1 --- /dev/null +++ b/packages/floating/src/createVirtualElement.ts @@ -0,0 +1,17 @@ +import { ClientRectObject } from '@floating-ui/core'; +import { VirtualElement } from '@floating-ui/react-dom-interactions'; + +export const getDefaultBoundingClientRect = (): ClientRectObject => ({ + width: 0, + height: 0, + x: 0, + y: 0, + top: -9999, + left: -9999, + right: 9999, + bottom: 9999, +}); + +export const createVirtualElement = (): VirtualElement => ({ + getBoundingClientRect: getDefaultBoundingClientRect, +}); diff --git a/packages/floating/src/floating-ui.ts b/packages/floating/src/floating-ui.ts new file mode 100644 index 0000000000..02ca5ad045 --- /dev/null +++ b/packages/floating/src/floating-ui.ts @@ -0,0 +1,85 @@ +export { + // core + inline, + limitShift, + offset, + // dom + arrow, + autoPlacement, + autoUpdate, + computePosition, + detectOverflow, + flip, + getOverflowAncestors, + hide, + shift, + size, + // react-dom-interactions + safePolygon, + useClick, + useDelayGroup, + useDelayGroupContext, + useDismiss, + useFloating, + useFloatingNodeId, + useFloatingParentNodeId, + useFloatingPortalNode, + useFloatingTree, + useFocus, + useHover, + useId, + useInteractions, + useListNavigation, + useRole, + useTypeahead, +} from '@floating-ui/react-dom-interactions'; + +export type { + AlignedPlacement, + AutoUpdateOptions, + Axis, + Boundary, + ClientRectObject, + ComputePositionConfig, + ComputePositionReturn, + ContextData, + Coords, + DetectOverflowOptions, + Dimensions, + ElementContext, + ElementProps, + ElementRects, + Elements, + FloatingContext, + FloatingDelayGroup, + FloatingElement, + FloatingEvents, + FloatingFocusManager, + FloatingNode, + FloatingNodeType, + FloatingOverlay, + FloatingPortal, + FloatingTree, + FloatingTreeType, + Length, + Middleware, + MiddlewareArguments, + MiddlewareData, + MiddlewareReturn, + NodeScroll, + Padding, + Placement, + Platform, + Rect, + ReferenceElement, + ReferenceType, + RootBoundary, + Side, + SideObject, + SizeOptions, + Strategy, + UseFloatingData, + UseFloatingProps, + UseFloatingReturn, + VirtualElement, +} from '@floating-ui/react-dom-interactions'; diff --git a/packages/floating/src/hooks/index.ts b/packages/floating/src/hooks/index.ts new file mode 100644 index 0000000000..f6e2d563fa --- /dev/null +++ b/packages/floating/src/hooks/index.ts @@ -0,0 +1,5 @@ +/** + * @file Automatically generated by barrelsby. + */ + +export * from './useVirtualFloating'; diff --git a/packages/floating/src/hooks/useVirtualFloating.ts b/packages/floating/src/hooks/useVirtualFloating.ts new file mode 100644 index 0000000000..41ad11696a --- /dev/null +++ b/packages/floating/src/hooks/useVirtualFloating.ts @@ -0,0 +1,99 @@ +import * as React from 'react'; +import { + CSSProperties, + MutableRefObject, + useLayoutEffect, + useRef, + useState, +} from 'react'; +import { ClientRectObject } from '@floating-ui/core'; +import { + autoUpdate, + ReferenceType, + useFloating, + UseFloatingProps, + UseFloatingReturn, + VirtualElement, +} from '@floating-ui/react-dom-interactions'; +import { createVirtualElement } from '../createVirtualElement'; +import { getSelectionBoundingClientRect } from '../utils/index'; + +export interface ExtendedRefs { + reference: React.MutableRefObject; + floating: React.MutableRefObject; + domReference: React.MutableRefObject; +} + +export interface UseVirtualFloatingOptions extends Partial { + getBoundingClientRect?: () => ClientRectObject; + open?: boolean; +} + +export interface UseVirtualFloatingReturn< + RT extends ReferenceType = ReferenceType +> extends Omit, 'refs'> { + refs: ExtendedRefs; + virtualElementRef: MutableRefObject; + style: CSSProperties; +} + +/** + * `useFloating` with a controlled virtual element. Used to follow cursor position. + * + * Default options: + * - `whileElementsMounted: autoUpdate` + * + * Additional options: + * - `getBoundingClientRect` to get the bounding client rect. + * - `hidden` to hide the floating element + * + * Additional returns: + * - `style` to apply to the floating element + * - `virtualElementRef` + * + * @see useFloating + * @see https://floating-ui.com/docs/react-dom#virtual-element + */ +export const useVirtualFloating = ({ + getBoundingClientRect = getSelectionBoundingClientRect, + ...floatingOptions +}: UseVirtualFloatingOptions): UseVirtualFloatingReturn => { + const virtualElementRef = useRef(createVirtualElement() as RT); + const [visible, setVisible] = useState(true); + + const floatingResult = useFloating({ + // update on scroll and resize + whileElementsMounted: autoUpdate, + ...floatingOptions, + }); + + const { reference, middlewareData, strategy, x, y, update } = floatingResult; + + useLayoutEffect(() => { + virtualElementRef.current.getBoundingClientRect = getBoundingClientRect; + }, [getBoundingClientRect, update]); + + useLayoutEffect(() => { + reference(virtualElementRef.current); + }, [reference]); + + useLayoutEffect(() => { + if (!middlewareData?.hide) return; + + const { referenceHidden } = middlewareData.hide; + + setVisible(!referenceHidden); + }, [middlewareData.hide]); + + return { + ...floatingResult, + virtualElementRef, + style: { + position: strategy, + top: y ?? 0, + left: x ?? 0, + display: floatingOptions.open === false ? 'none' : undefined, + visibility: !visible ? 'hidden' : undefined, + }, + }; +}; diff --git a/packages/floating/src/index.ts b/packages/floating/src/index.ts new file mode 100644 index 0000000000..092b5b63dc --- /dev/null +++ b/packages/floating/src/index.ts @@ -0,0 +1,8 @@ +/** + * @file Automatically generated by barrelsby. + */ + +export * from './createVirtualElement'; +export * from './floating-ui'; +export * from './hooks/index'; +export * from './utils/index'; diff --git a/packages/ui/popper/src/getRangeBoundingClientRect.ts b/packages/floating/src/utils/getRangeBoundingClientRect.ts similarity index 57% rename from packages/ui/popper/src/getRangeBoundingClientRect.ts rename to packages/floating/src/utils/getRangeBoundingClientRect.ts index 214ec12cc9..b6fb54b94a 100644 --- a/packages/ui/popper/src/getRangeBoundingClientRect.ts +++ b/packages/floating/src/utils/getRangeBoundingClientRect.ts @@ -1,5 +1,7 @@ +import { ClientRectObject } from '@floating-ui/core'; import { toDOMRange, TReactEditor, Value } from '@udecode/plate-core'; import { Range } from 'slate'; +import { getDefaultBoundingClientRect } from '../createVirtualElement'; /** * Get bounding client rect by slate range @@ -7,11 +9,11 @@ import { Range } from 'slate'; export const getRangeBoundingClientRect = ( editor: TReactEditor, at: Range | null -) => { - if (!at) return; +): ClientRectObject => { + if (!at) return getDefaultBoundingClientRect(); const domRange = toDOMRange(editor, at); - if (!domRange) return; + if (!domRange) return getDefaultBoundingClientRect(); return domRange.getBoundingClientRect(); }; diff --git a/packages/floating/src/utils/getSelectionBoundingClientRect.ts b/packages/floating/src/utils/getSelectionBoundingClientRect.ts new file mode 100644 index 0000000000..668b5dac71 --- /dev/null +++ b/packages/floating/src/utils/getSelectionBoundingClientRect.ts @@ -0,0 +1,17 @@ +import { ClientRectObject } from '@floating-ui/core'; +import { getDefaultBoundingClientRect } from '../createVirtualElement'; + +/** + * Get bounding client rect of the window selection + */ +export const getSelectionBoundingClientRect = (): ClientRectObject => { + const domSelection = window.getSelection(); + + if (!domSelection || domSelection.rangeCount < 1) { + return getDefaultBoundingClientRect(); + } + + const domRange = domSelection.getRangeAt(0); + + return domRange.getBoundingClientRect(); +}; diff --git a/packages/floating/src/utils/index.ts b/packages/floating/src/utils/index.ts new file mode 100644 index 0000000000..bc3b6955e8 --- /dev/null +++ b/packages/floating/src/utils/index.ts @@ -0,0 +1,6 @@ +/** + * @file Automatically generated by barrelsby. + */ + +export * from './getRangeBoundingClientRect'; +export * from './getSelectionBoundingClientRect'; diff --git a/packages/floating/tsconfig.json b/packages/floating/tsconfig.json new file mode 100644 index 0000000000..9f68b4628c --- /dev/null +++ b/packages/floating/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../config/tsconfig.build.json", + "compilerOptions": { + "declarationDir": "./dist" + }, + "include": ["src"] +} diff --git a/packages/headless/package.json b/packages/headless/package.json index 016e7c5234..fb0dfd5ed6 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -25,10 +25,12 @@ "@udecode/plate-basic-marks": "14.4.2", "@udecode/plate-block-quote": "14.4.2", "@udecode/plate-break": "14.4.2", + "@udecode/plate-button": "14.4.2", "@udecode/plate-code-block": "14.4.2", "@udecode/plate-combobox": "14.4.2", "@udecode/plate-core": "14.4.2", "@udecode/plate-find-replace": "14.4.2", + "@udecode/plate-floating": "14.4.2", "@udecode/plate-font": "14.4.2", "@udecode/plate-heading": "14.4.2", "@udecode/plate-highlight": "14.4.2", diff --git a/packages/headless/src/index.tsx b/packages/headless/src/index.tsx index 71f9f152d0..f63eaecfe1 100644 --- a/packages/headless/src/index.tsx +++ b/packages/headless/src/index.tsx @@ -8,10 +8,12 @@ export * from '@udecode/plate-basic-elements'; export * from '@udecode/plate-basic-marks'; export * from '@udecode/plate-block-quote'; export * from '@udecode/plate-break'; +export * from '@udecode/plate-button'; export * from '@udecode/plate-code-block'; export * from '@udecode/plate-combobox'; export * from '@udecode/plate-core'; export * from '@udecode/plate-find-replace'; +export * from '@udecode/plate-floating'; export * from '@udecode/plate-font'; export * from '@udecode/plate-heading'; export * from '@udecode/plate-highlight'; diff --git a/packages/nodes/image/src/components/Image.tsx b/packages/nodes/image/src/components/Image.tsx index 5d8ff2eb4d..50a70ff152 100644 --- a/packages/nodes/image/src/components/Image.tsx +++ b/packages/nodes/image/src/components/Image.tsx @@ -1,14 +1,9 @@ import { CSSProperties } from 'react'; import { createAtomStore, - createComponentAs, - createElementAs, + createPlateElementComponent, createStore, - HTMLPropsAs, - PlateRenderElementProps, TPath, - useComposedRef, - Value, } from '@udecode/plate-core'; import { TImageElement } from '../types'; import { ImageCaption } from './ImageCaption'; @@ -20,6 +15,7 @@ export const { imageStore, useImageStore } = createAtomStore( { width: 0 as CSSProperties['width'], }, + // NOTE: scope: ELEMENT_IMAGE is undefined (bundle issue) { name: 'image' as const, scope: 'img' } ); @@ -35,29 +31,7 @@ export const imageGlobalStore = createStore('image')({ focusStartCaptionPath: null as TPath | null, }); -export type ImageProps = PlateRenderElementProps & - HTMLPropsAs<'div'>; - -export const useElementProps = ({ - attributes, - nodeProps, - element, - editor, - ...props -}: ImageProps): HTMLPropsAs<'div'> => { - return { - ...attributes, - ...props, - ...nodeProps, - ref: useComposedRef(props.ref, attributes.ref), - }; -}; - -export const ImageRoot = createComponentAs((props) => { - const htmlProps = useElementProps(props as any); - - return createElementAs('div', htmlProps); -}); +export const ImageRoot = createPlateElementComponent(); export const Image = { Root: ImageRoot, diff --git a/packages/nodes/image/src/withImageUpload.spec.tsx b/packages/nodes/image/src/withImageUpload.spec.tsx index 644588faa1..c05f99e8c0 100644 --- a/packages/nodes/image/src/withImageUpload.spec.tsx +++ b/packages/nodes/image/src/withImageUpload.spec.tsx @@ -40,64 +40,63 @@ describe('withImageUpload', () => { }); }); - describe("when no files", () => { + describe('when no files', () => { const input = ( test ) as any; - + const output = ( test ) as any; - + it('should run default insertData', () => { jest.spyOn(JSON, 'parse').mockReturnValue(image.png); - + const editor = createPlateEditor({ editor: input, plugins: [createImagePlugin()], }); - + const data = { getData: () => 'test', }; editor.insertData(data as any); - + expect(input.children).toEqual(output.children); }); }); - describe("when inserting a non-image file", () => { + describe('when inserting a non-image file', () => { const input = ( test ) as any; - + const output = ( test ) as any; - + it('should insert image from the file(s)', () => { const editor = createPlateEditor({ editor: input, plugins: [createImagePlugin()], }); - + const data = { getData: () => 'test', files: [new File(['test'], 'not-an-image')], }; editor.insertData(data as any); - + expect(input.children).toEqual(output.children); }); - }); // it('should call uploadImage when provided', async () => { diff --git a/packages/nodes/link/package.json b/packages/nodes/link/package.json index f5318ca4b6..bff0ed3463 100644 --- a/packages/nodes/link/package.json +++ b/packages/nodes/link/package.json @@ -19,6 +19,7 @@ ], "types": "dist/index.d.ts", "dependencies": { + "@udecode/plate-button": "14.4.2", "@udecode/plate-core": "14.4.2", "@udecode/plate-normalizers": "14.4.2" }, diff --git a/packages/nodes/link/src/__tests__/getAndUpsertLink/insert.spec.tsx b/packages/nodes/link/src/__tests__/getAndUpsertLink/insert.spec.tsx deleted file mode 100644 index 098a33557a..0000000000 --- a/packages/nodes/link/src/__tests__/getAndUpsertLink/insert.spec.tsx +++ /dev/null @@ -1,44 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin, ELEMENT_LINK } from '../../createLinkPlugin'; -import { getAndUpsertLink } from '../../transforms/getAndUpsertLink'; - -jsx; - -const input = ( - - - insert link - here - . - - -) as any; - -const url = 'http://google.com'; - -const output = ( - - - insert link{' '} - - here - - . - - -) as any; - -it('should wrap the selection in a link', async () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - const getLinkUrl = jest.fn().mockResolvedValue(url); - - await getAndUpsertLink(editor, getLinkUrl); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/getAndUpsertLink/update.spec.tsx b/packages/nodes/link/src/__tests__/getAndUpsertLink/update.spec.tsx deleted file mode 100644 index b140c5404f..0000000000 --- a/packages/nodes/link/src/__tests__/getAndUpsertLink/update.spec.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin, ELEMENT_LINK } from '../../createLinkPlugin'; -import { getAndUpsertLink } from '../../transforms/getAndUpsertLink'; - -jsx; - -const urlInput = 'http://input.com'; - -const input = ( - - - insert link - - here - - . - - -) as any; - -const urlOutput = 'http://output.com'; - -const output = ( - - - insert link{' '} - - here - - . - - -) as any; - -it('should update an existing link', async () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - const getLinkUrl = jest.fn().mockResolvedValue(urlOutput); - await getAndUpsertLink(editor, getLinkUrl); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/collapsed.spec.tsx b/packages/nodes/link/src/__tests__/upsertLinkAtSelection/collapsed.spec.tsx deleted file mode 100644 index 0f2bd0fb3b..0000000000 --- a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/collapsed.spec.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../createLinkPlugin'; -import { upsertLinkAtSelection } from '../../transforms/upsertLinkAtSelection'; - -jsx; - -const input = ( - - insert link - -) as any; - -const url = 'http://google.com'; - -const output = ( - - insert link - -) as any; - -it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - upsertLinkAtSelection(editor, { url }); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/insert.spec.tsx b/packages/nodes/link/src/__tests__/upsertLinkAtSelection/insert.spec.tsx deleted file mode 100644 index 1028d7d268..0000000000 --- a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/insert.spec.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin, ELEMENT_LINK } from '../../createLinkPlugin'; -import { upsertLinkAtSelection } from '../../transforms/upsertLinkAtSelection'; - -jsx; - -const input = ( - - - insert link - here - . - - -) as any; - -const url = 'http://google.com'; - -const output = ( - - - insert link{' '} - - here - - . - - -) as any; - -it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - upsertLinkAtSelection(editor, { url }); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/update-cursor.spec.tsx b/packages/nodes/link/src/__tests__/upsertLinkAtSelection/update-cursor.spec.tsx deleted file mode 100644 index c23361d564..0000000000 --- a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/update-cursor.spec.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor, select } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin, ELEMENT_LINK } from '../../createLinkPlugin'; -import { upsertLinkAtSelection } from '../../transforms/upsertLinkAtSelection'; - -jsx; - -const urlInput = 'http://input.com'; - -const input = ( - - - insert link - - here - - . - - -) as any; - -const urlOutput = 'http://output.com'; - -const output = ( - - - insert link - - here - - . - - -) as any; - -it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - const selection = { - anchor: { path: [0, 1, 0], offset: 1 }, - focus: { path: [0, 1, 0], offset: 1 }, - }; - select(editor, selection); - - upsertLinkAtSelection(editor, { url: urlOutput, wrap: true }); - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/update.spec.tsx b/packages/nodes/link/src/__tests__/upsertLinkAtSelection/update.spec.tsx deleted file mode 100644 index c5adcd80cb..0000000000 --- a/packages/nodes/link/src/__tests__/upsertLinkAtSelection/update.spec.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin, ELEMENT_LINK } from '../../createLinkPlugin'; -import { upsertLinkAtSelection } from '../../transforms/upsertLinkAtSelection'; - -jsx; - -const urlInput = 'http://input.com'; - -const input = ( - - - insert link - - here - - . - - -) as any; - -const urlOutput = 'http://output.com'; - -const output = ( - - - insert link{' '} - - here - - . - - -) as any; - -it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - upsertLinkAtSelection(editor, { url: urlOutput }); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertData/insert-string-inside-url.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertData/insert-string-inside-url.spec.tsx deleted file mode 100644 index 7370548873..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertData/insert-string-inside-url.spec.tsx +++ /dev/null @@ -1,50 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -describe('when inserting string inside url', () => { - it('should run default insertText', () => { - const input = ( - - - test - - http:// - - google.com - - - - - ) as any; - - const data: any = { getData: () => 'docs' }; - - const output = ( - - - test - - http://docsgoogle.com - - - - - ) as any; - - jest.spyOn(JSON, 'parse').mockReturnValue(docs); - - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertData(data); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertData/insert-url-over-link.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertData/insert-url-over-link.spec.tsx deleted file mode 100644 index 1766925474..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertData/insert-url-over-link.spec.tsx +++ /dev/null @@ -1,49 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - test{' '} - - please - - click - {' '} - here - . - - -) as any; - -const data: any = { getData: () => 'http://google.com/test' }; - -const output = ( - - - test please - - click here - - . - - -) as any; - -it('should unwrap the existing link', () => { - jest.spyOn(JSON, 'parse').mockReturnValue(docs); - - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertData(data); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertData/not-url.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertData/not-url.spec.tsx deleted file mode 100644 index 571fde04cf..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertData/not-url.spec.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - test - - - -) as any; - -const data: any = { getData: () => 'test' }; - -const output = ( - - testtest - -) as any; - -it('should run default insertText', () => { - jest.spyOn(JSON, 'parse').mockReturnValue(test); - - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertData(data); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertData/url.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertData/url.spec.tsx deleted file mode 100644 index bf03cc6757..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertData/url.spec.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - test - - - -) as any; - -const data: any = { getData: () => 'http://google.com' }; - -const output = ( - - - test - - http://google.com - - - - -) as any; - -it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertData(data); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/not-space.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/not-space.spec.tsx deleted file mode 100644 index d6ceff2b63..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/not-space.spec.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - test - - - -) as any; - -const text = 'test'; - -const output = ( - - testtest - -) as any; - -describe('when inserting a character that is not a space', () => { - it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-link.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-after-link.spec.tsx deleted file mode 100644 index dc98783108..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-link.spec.tsx +++ /dev/null @@ -1,45 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { createLinkPlugin } from '@udecode/plate-link'; -import { jsx } from '@udecode/plate-test-utils'; - -jsx; - -const input = ( - - - link:{' '} - - http://google.com - - - - -) as any; - -const text = ' '; - -const output = ( - - - link:{' '} - - http://google.com - {' '} - - -) as any; - -describe('when inserting a space after a link', () => { - it('should upsert the link', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-text.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-after-text.spec.tsx deleted file mode 100644 index 1b7b59fcbe..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-text.spec.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - not a link - - - -) as any; - -const text = ' '; - -const output = ( - - not a link - -) as any; - -describe('when inserting a space after a text (not url)', () => { - it('should just insert a space', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-across-blocks.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-across-blocks.spec.tsx deleted file mode 100644 index fe7d92da18..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-across-blocks.spec.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - link:{' '} - - http://google.com - - - - test - - - -) as any; - -const text = ' '; - -const output = ( - - - link:{' '} - - http://google.com - - - - {'test '} - {/* keep above as string in quotes to force trailing space */} - - - -) as any; - -describe('when inserting a space with a link element in a preceeding block', () => { - it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-block-start-custom-href.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-block-start-custom-href.spec.tsx deleted file mode 100644 index e27d28082c..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-block-start-custom-href.spec.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - google.com - - - -) as any; - -const text = ' '; - -const output = ( - - - - - google.com - {' '} - - -) as any; - -describe('when inserting a space with a link element at the beginning of a block using a custom href', () => { - it('should wrap the url in a link', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [ - createLinkPlugin({ - options: { - isUrl: (url) => url === 'google.com', - getUrlHref: (url) => { - return 'http://google.com'; - }, - }, - }), - ], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-block-start.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-block-start.spec.tsx deleted file mode 100644 index b4298ccc19..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-block-start.spec.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - http://google.com - - - -) as any; - -const text = ' '; - -const output = ( - - - - - http://google.com - {' '} - - -) as any; - -describe('when inserting a space after a url text (without link element) placed at the start of a block', () => { - it('should wrap the url with a link element', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-custom-href.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-custom-href.spec.tsx deleted file mode 100644 index 3aed7a8932..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url-custom-href.spec.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - link: google.com - - - -) as any; - -const text = ' '; - -const output = ( - - - link:{' '} - - google.com - {' '} - - -) as any; - -describe('when inserting a space with a link element and using a custom href', () => { - it('should wrap the url in a link', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [ - createLinkPlugin({ - options: { - isUrl: (url) => url === 'google.com', - getUrlHref: (url) => { - return 'http://google.com'; - }, - }, - }), - ], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url.spec.tsx deleted file mode 100644 index c9212dceae..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-after-url.spec.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { createLinkPlugin } from '@udecode/plate-link'; -import { jsx } from '@udecode/plate-test-utils'; - -jsx; - -const input = ( - - - link: http://google.com - - - -) as any; - -const text = ' '; - -const output = ( - - - link:{' '} - - http://google.com - {' '} - - -) as any; - -describe('when inserting a space after a url text (without link element)', () => { - it('should wrap the url with a link', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/withLink/insertText/space-with-bold-url.spec.tsx b/packages/nodes/link/src/__tests__/withLink/insertText/space-with-bold-url.spec.tsx deleted file mode 100644 index d13ae165d2..0000000000 --- a/packages/nodes/link/src/__tests__/withLink/insertText/space-with-bold-url.spec.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin } from '../../../createLinkPlugin'; - -jsx; - -const input = ( - - - link: http://google.com - - - -) as any; - -const text = ' '; - -const output = ( - - - link:{' '} - - http://google.com - {' '} - - -) as any; - -describe('when inserting a space after a url text containing bold mark', () => { - it('should wrap the url with a link', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - - editor.insertText(text); - - expect(input.children).toEqual(output.children); - }); -}); diff --git a/packages/nodes/link/src/__tests__/wrapLink/link-active.spec.tsx b/packages/nodes/link/src/__tests__/wrapLink/link-active.spec.tsx deleted file mode 100644 index 0870699fbc..0000000000 --- a/packages/nodes/link/src/__tests__/wrapLink/link-active.spec.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/** @jsx jsx */ - -import { createPlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; -import { createLinkPlugin, ELEMENT_LINK } from '../../createLinkPlugin'; -import { wrapLink } from '../../transforms/wrapLink'; - -jsx; - -const input = ( - - - insert link - here - . - - -) as any; - -const url = 'http://google.com'; - -const output = ( - - - insert link{' '} - - here - - . - - -) as any; - -it('should run default insertText', () => { - const editor = createPlateEditor({ - editor: input, - plugins: [createLinkPlugin()], - }); - wrapLink(editor, { url }); - - expect(input.children).toEqual(output.children); -}); diff --git a/packages/nodes/link/src/components/FloatingLink/FloatingLink.tsx b/packages/nodes/link/src/components/FloatingLink/FloatingLink.tsx new file mode 100644 index 0000000000..a7a7bd3b44 --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/FloatingLink.tsx @@ -0,0 +1,51 @@ +import { + createComponentAs, + createElementAs, + HTMLPropsAs, +} from '@udecode/plate-core'; +import { UseVirtualFloatingOptions } from '@udecode/plate-floating'; +import { FloatingLinkEditButton } from './FloatingLinkEditButton'; +import { FloatingLinkTextInput } from './FloatingLinkTextInput'; +import { FloatingLinkUrlInput } from './FloatingLinkUrlInput'; +import { OpenLinkButton } from './OpenLinkButton'; +import { UnlinkButton } from './UnlinkButton'; +import { useFloatingLinkEdit } from './useFloatingLinkEdit'; +import { useFloatingLinkInsert } from './useFloatingLinkInsert'; + +export type FloatingLinkProps = HTMLPropsAs<'div'> & { + floatingOptions?: UseVirtualFloatingOptions; +}; + +export const FloatingLinkEditRoot = createComponentAs( + (props) => { + const htmlProps = useFloatingLinkEdit(props); + + if (htmlProps.style?.display === 'none') { + return null; + } + + return createElementAs('div', htmlProps); + } +); + +export const FloatingLinkInsertRoot = createComponentAs( + (props) => { + const htmlProps = useFloatingLinkInsert(props); + + if (htmlProps.style?.display === 'none') { + return null; + } + + return createElementAs('div', htmlProps); + } +); + +export const FloatingLink = { + EditRoot: FloatingLinkEditRoot, + InsertRoot: FloatingLinkInsertRoot, + UrlInput: FloatingLinkUrlInput, + TextInput: FloatingLinkTextInput, + EditButton: FloatingLinkEditButton, + UnlinkButton, + OpenLinkButton, +}; diff --git a/packages/nodes/link/src/components/FloatingLink/FloatingLinkEditButton.tsx b/packages/nodes/link/src/components/FloatingLink/FloatingLinkEditButton.tsx new file mode 100644 index 0000000000..49ab23afe3 --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/FloatingLinkEditButton.tsx @@ -0,0 +1,30 @@ +import { useCallback } from 'react'; +import { + AsProps, + createComponentAs, + createElementAs, + HTMLPropsAs, + useEditorRef, +} from '@udecode/plate-core'; +import { triggerFloatingLinkEdit } from '../../utils/triggerFloatingLinkEdit'; + +export const useFloatingLinkEditButton = ( + props: HTMLPropsAs<'button'> +): HTMLPropsAs<'button'> => { + const editor = useEditorRef(); + + return { + onClick: useCallback(() => { + triggerFloatingLinkEdit(editor); + }, [editor]), + ...props, + }; +}; + +export const FloatingLinkEditButton = createComponentAs>( + (props) => { + const htmlProps = useFloatingLinkEditButton(props); + + return createElementAs('button', htmlProps); + } +); diff --git a/packages/nodes/link/src/components/FloatingLink/FloatingLinkTextInput.tsx b/packages/nodes/link/src/components/FloatingLink/FloatingLinkTextInput.tsx new file mode 100644 index 0000000000..3466a062ed --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/FloatingLinkTextInput.tsx @@ -0,0 +1,36 @@ +import { ChangeEventHandler, useCallback } from 'react'; +import { + AsProps, + createComponentAs, + createElementAs, + HTMLPropsAs, + mergeProps, +} from '@udecode/plate-core'; +import { + floatingLinkActions, + floatingLinkSelectors, +} from './floatingLinkStore'; + +export const useFloatingLinkTextInput = ( + props: HTMLPropsAs<'input'> +): HTMLPropsAs<'input'> => { + const onChange: ChangeEventHandler = useCallback((e) => { + floatingLinkActions.text(e.target.value); + }, []); + + return mergeProps( + { + onChange, + defaultValue: floatingLinkSelectors.text(), + }, + props + ); +}; + +export const FloatingLinkTextInput = createComponentAs>( + (props) => { + const htmlProps = useFloatingLinkTextInput(props); + + return createElementAs('input', htmlProps); + } +); diff --git a/packages/nodes/link/src/components/FloatingLink/FloatingLinkUrlInput.tsx b/packages/nodes/link/src/components/FloatingLink/FloatingLinkUrlInput.tsx new file mode 100644 index 0000000000..189fa0308a --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/FloatingLinkUrlInput.tsx @@ -0,0 +1,47 @@ +import { ChangeEventHandler, useCallback, useEffect, useRef } from 'react'; +import { + AsProps, + createComponentAs, + createElementAs, + HTMLPropsAs, + mergeProps, + useComposedRef, +} from '@udecode/plate-core'; +import { + floatingLinkActions, + floatingLinkSelectors, + useFloatingLinkSelectors, +} from './floatingLinkStore'; + +export const useFloatingLinkUrlInput = ( + props: HTMLPropsAs<'input'> +): HTMLPropsAs<'input'> => { + const updated = useFloatingLinkSelectors().updated(); + const ref = useRef(null); + + useEffect(() => { + if (ref.current && updated) { + ref.current.focus(); + } + }, [updated]); + + const onChange: ChangeEventHandler = useCallback((e) => { + floatingLinkActions.url(e.target.value); + }, []); + + return mergeProps( + { + onChange, + defaultValue: floatingLinkSelectors.url(), + }, + { ...props, ref: useComposedRef(props.ref, ref) } + ); +}; + +export const FloatingLinkUrlInput = createComponentAs>( + (props) => { + const htmlProps = useFloatingLinkUrlInput(props); + + return createElementAs('input', htmlProps); + } +); diff --git a/packages/nodes/link/src/components/FloatingLink/OpenLinkButton.tsx b/packages/nodes/link/src/components/FloatingLink/OpenLinkButton.tsx new file mode 100644 index 0000000000..0e604d6de1 --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/OpenLinkButton.tsx @@ -0,0 +1,48 @@ +import { useMemo } from 'react'; +import { + AsProps, + createComponentAs, + createElementAs, + findNode, + getPluginType, + HTMLPropsAs, + useEditorRef, +} from '@udecode/plate-core'; +import { ELEMENT_LINK } from '../../createLinkPlugin'; +import { TLinkElement } from '../../types'; + +export const useOpenLinkButton = ( + props: HTMLPropsAs<'a'> +): HTMLPropsAs<'a'> => { + const editor = useEditorRef(); + + const entry = useMemo( + () => + findNode(editor, { + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }), + [editor] + ); + + if (!entry) { + return {}; + } + + const [link] = entry; + + return { + 'aria-label': 'Open link in a new tab', + target: '_blank', + href: link.url, + onMouseOver: (e) => { + e.stopPropagation(); + }, + ...props, + }; +}; + +export const OpenLinkButton = createComponentAs>((props) => { + const htmlProps = useOpenLinkButton(props); + + return createElementAs('a', htmlProps); +}); diff --git a/packages/nodes/link/src/components/FloatingLink/UnlinkButton.tsx b/packages/nodes/link/src/components/FloatingLink/UnlinkButton.tsx new file mode 100644 index 0000000000..b40e9f61d1 --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/UnlinkButton.tsx @@ -0,0 +1,31 @@ +import { useCallback } from 'react'; +import { Button } from '@udecode/plate-button'; +import { + AsProps, + createComponentAs, + createElementAs, + focusEditor, + HTMLPropsAs, + useEditorRef, +} from '@udecode/plate-core'; +import { unwrapLink } from '../../transforms/index'; + +export const useUnlinkButton = ( + props: HTMLPropsAs<'button'> +): HTMLPropsAs<'button'> => { + const editor = useEditorRef(); + + return { + onClick: useCallback(() => { + unwrapLink(editor); + focusEditor(editor, editor.selection!); + }, [editor]), + ...props, + }; +}; + +export const UnlinkButton = createComponentAs>((props) => { + const htmlProps = useUnlinkButton(props); + + return createElementAs(Button, htmlProps); +}); diff --git a/packages/nodes/link/src/components/FloatingLink/floatingLinkStore.ts b/packages/nodes/link/src/components/FloatingLink/floatingLinkStore.ts new file mode 100644 index 0000000000..93cca3d365 --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/floatingLinkStore.ts @@ -0,0 +1,36 @@ +import { createStore } from '@udecode/plate-core'; + +export type FloatingLinkMode = '' | 'insert' | 'edit'; + +export const floatingLinkStore = createStore('floatingLink')({ + open: false, + mouseDown: false, + updated: false, + url: '', + text: '', + mode: '' as FloatingLinkMode, + isEditing: false, +}) + .extendActions((set) => ({ + reset: () => { + set.url(''); + set.text(''); + set.mode(''); + set.isEditing(false); + }, + })) + .extendActions((set) => ({ + show: (mode: FloatingLinkMode) => { + set.mode(mode); + set.isEditing(false); + set.open(true); + }, + hide: () => { + set.open(false); + set.reset(); + }, + })); + +export const floatingLinkActions = floatingLinkStore.set; +export const floatingLinkSelectors = floatingLinkStore.get; +export const useFloatingLinkSelectors = () => floatingLinkStore.use; diff --git a/packages/nodes/link/src/components/FloatingLink/index.ts b/packages/nodes/link/src/components/FloatingLink/index.ts new file mode 100644 index 0000000000..024ecdc20c --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/index.ts @@ -0,0 +1,16 @@ +/** + * @file Automatically generated by barrelsby. + */ + +export * from './FloatingLink'; +export * from './FloatingLinkEditButton'; +export * from './FloatingLinkTextInput'; +export * from './FloatingLinkUrlInput'; +export * from './OpenLinkButton'; +export * from './UnlinkButton'; +export * from './floatingLinkStore'; +export * from './useFloatingLinkEdit'; +export * from './useFloatingLinkEnter'; +export * from './useFloatingLinkEscape'; +export * from './useFloatingLinkInsert'; +export * from './useVirtualFloatingLink'; diff --git a/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEdit.ts b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEdit.ts new file mode 100644 index 0000000000..cc0c83a134 --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEdit.ts @@ -0,0 +1,140 @@ +import { useCallback, useEffect } from 'react'; +import { + focusEditor, + getAboveNode, + getEndPoint, + getPluginOptions, + getPluginType, + getStartPoint, + HTMLPropsAs, + someNode, + useComposedRef, + useEditorRef, + useHotkeys, + usePlateSelectors, +} from '@udecode/plate-core'; +import { + getDefaultBoundingClientRect, + getRangeBoundingClientRect, +} from '@udecode/plate-floating'; +import { ELEMENT_LINK, LinkPlugin } from '../../createLinkPlugin'; +import { submitFloatingLink } from '../../transforms/submitFloatingLink'; +import { triggerFloatingLinkEdit } from '../../utils/triggerFloatingLinkEdit'; +import { FloatingLinkProps } from './FloatingLink'; +import { + floatingLinkActions, + floatingLinkSelectors, + useFloatingLinkSelectors, +} from './floatingLinkStore'; +import { useVirtualFloatingLink } from './useVirtualFloatingLink'; + +export const useFloatingLinkEdit = ({ + floatingOptions, + ...props +}: FloatingLinkProps): HTMLPropsAs<'div'> => { + const editor = useEditorRef(); + const keyEditor = usePlateSelectors(editor.id).keyEditor(); + const mode = useFloatingLinkSelectors().mode(); + const open = useFloatingLinkSelectors().open(); + + const { triggerFloatingLinkHotkeys } = getPluginOptions( + editor, + ELEMENT_LINK + ); + + const getBoundingClientRect = useCallback(() => { + const entry = getAboveNode(editor, { + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }); + + if (entry) { + const [, path] = entry; + return getRangeBoundingClientRect(editor, { + anchor: getStartPoint(editor, path), + focus: getEndPoint(editor, path), + }); + } + + return getDefaultBoundingClientRect(); + }, [editor]); + + const isOpen = open && mode === 'edit'; + + const { update, style, floating } = useVirtualFloatingLink({ + open: isOpen, + getBoundingClientRect, + ...floatingOptions, + }); + + useEffect(() => { + if ( + editor.selection && + someNode(editor, { + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }) + ) { + floatingLinkActions.show('edit'); + update(); + return; + } + + if (floatingLinkSelectors.mode() === 'edit') { + floatingLinkActions.hide(); + } + }, [editor, keyEditor, update]); + + useHotkeys( + triggerFloatingLinkHotkeys!, + () => { + if (floatingLinkSelectors.mode() === 'edit') { + triggerFloatingLinkEdit(editor); + } + }, + { + enableOnContentEditable: true, + }, + [] + ); + + useHotkeys( + 'enter', + (e) => { + if (submitFloatingLink(editor)) { + e.preventDefault(); + } + }, + { + enableOnTags: ['INPUT'], + }, + [] + ); + + useHotkeys( + 'escape', + () => { + if (floatingLinkSelectors.mode() !== 'edit') return; + + if (floatingLinkSelectors.isEditing()) { + floatingLinkActions.show('edit'); + focusEditor(editor, editor.selection!); + return; + } + + floatingLinkActions.hide(); + }, + { + enableOnTags: ['INPUT'], + enableOnContentEditable: true, + }, + [] + ); + + return { + style: { + ...style, + zIndex: 1, + }, + ...props, + ref: useComposedRef(props.ref, floating), + }; +}; diff --git a/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEnter.ts b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEnter.ts new file mode 100644 index 0000000000..5056e84ffd --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEnter.ts @@ -0,0 +1,19 @@ +import { useEditorRef, useHotkeys } from '@udecode/plate-core'; +import { submitFloatingLink } from '../../transforms/submitFloatingLink'; + +export const useFloatingLinkEnter = () => { + const editor = useEditorRef(); + + useHotkeys( + 'enter', + (e) => { + if (submitFloatingLink(editor)) { + e.preventDefault(); + } + }, + { + enableOnTags: ['INPUT'], + }, + [] + ); +}; diff --git a/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEscape.ts b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEscape.ts new file mode 100644 index 0000000000..3c8108649d --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkEscape.ts @@ -0,0 +1,24 @@ +import { focusEditor, useEditorRef, useHotkeys } from '@udecode/plate-core'; +import { + floatingLinkActions, + floatingLinkSelectors, +} from './floatingLinkStore'; + +export const useFloatingLinkEscape = () => { + const editor = useEditorRef(); + + useHotkeys( + 'escape', + () => { + if (floatingLinkSelectors.mode() !== 'insert') return; + + floatingLinkActions.hide(); + focusEditor(editor, editor.selection!); + }, + { + enableOnContentEditable: true, + enableOnTags: ['INPUT'], + }, + [] + ); +}; diff --git a/packages/nodes/link/src/components/FloatingLink/useFloatingLinkInsert.ts b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkInsert.ts new file mode 100644 index 0000000000..2827c1c99e --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/useFloatingLinkInsert.ts @@ -0,0 +1,83 @@ +import { useEffect } from 'react'; +import { + getPluginOptions, + HTMLPropsAs, + useComposedRef, + useEditorRef, + useHotkeys, + useOnClickOutside, +} from '@udecode/plate-core'; +import { getSelectionBoundingClientRect } from '@udecode/plate-floating'; +import { useFocused } from 'slate-react'; +import { ELEMENT_LINK, LinkPlugin } from '../../createLinkPlugin'; +import { triggerFloatingLinkInsert } from '../../utils/triggerFloatingLinkInsert'; +import { FloatingLinkProps } from './FloatingLink'; +import { + floatingLinkActions, + floatingLinkSelectors, + useFloatingLinkSelectors, +} from './floatingLinkStore'; +import { useFloatingLinkEscape } from './useFloatingLinkEscape'; +import { useVirtualFloatingLink } from './useVirtualFloatingLink'; + +export const useFloatingLinkInsert = ({ + floatingOptions, + ...props +}: FloatingLinkProps): HTMLPropsAs<'div'> => { + const editor = useEditorRef(); + const focused = useFocused(); + const mode = useFloatingLinkSelectors().mode(); + const open = useFloatingLinkSelectors().open(); + + const { triggerFloatingLinkHotkeys } = getPluginOptions( + editor, + ELEMENT_LINK + ); + + useHotkeys( + triggerFloatingLinkHotkeys!, + () => { + triggerFloatingLinkInsert(editor, { + focused, + }); + }, + { + enableOnContentEditable: true, + }, + [focused] + ); + + const ref = useOnClickOutside(() => { + if (floatingLinkSelectors.mode() === 'insert') { + floatingLinkActions.hide(); + } + }); + + const { update, style, floating } = useVirtualFloatingLink({ + open: open && mode === 'insert', + getBoundingClientRect: getSelectionBoundingClientRect, + whileElementsMounted: () => {}, + ...floatingOptions, + }); + + // wait for update before focusing input + useEffect(() => { + if (open) { + update(); + floatingLinkActions.updated(true); + } else { + floatingLinkActions.updated(false); + } + }, [open, update]); + + useFloatingLinkEscape(); + + return { + style: { + ...style, + zIndex: 1, + }, + ...props, + ref: useComposedRef(props.ref, floating, ref), + }; +}; diff --git a/packages/nodes/link/src/components/FloatingLink/useVirtualFloatingLink.ts b/packages/nodes/link/src/components/FloatingLink/useVirtualFloatingLink.ts new file mode 100644 index 0000000000..30b215c732 --- /dev/null +++ b/packages/nodes/link/src/components/FloatingLink/useVirtualFloatingLink.ts @@ -0,0 +1,23 @@ +import { + flip, + offset, + useVirtualFloating, + UseVirtualFloatingOptions, +} from '@udecode/plate-floating'; +import { floatingLinkActions } from './floatingLinkStore'; + +export const useVirtualFloatingLink = ( + floatingOptions?: UseVirtualFloatingOptions +) => { + return useVirtualFloating({ + placement: 'bottom-start', + onOpenChange: floatingLinkActions.open, + middleware: [ + offset(12), + flip({ + padding: 150, + }), + ], + ...floatingOptions, + }); +}; diff --git a/packages/nodes/link/src/components/LaunchIcon.tsx b/packages/nodes/link/src/components/LaunchIcon.tsx new file mode 100644 index 0000000000..559cfa99ad --- /dev/null +++ b/packages/nodes/link/src/components/LaunchIcon.tsx @@ -0,0 +1,15 @@ +import React, { SVGProps } from 'react'; + +export const LaunchIcon = (props: SVGProps) => ( + + + + +); diff --git a/packages/nodes/link/src/components/Link.tsx b/packages/nodes/link/src/components/Link.tsx new file mode 100644 index 0000000000..a67b3ec741 --- /dev/null +++ b/packages/nodes/link/src/components/Link.tsx @@ -0,0 +1,39 @@ +import { + createComponentAs, + createElementAs, + HTMLPropsAs, + PlateRenderElementProps, + useElementProps, + Value, +} from '@udecode/plate-core'; +import { TLinkElement } from '../types'; + +export type LinkRootProps = PlateRenderElementProps & + HTMLPropsAs<'a'>; + +export const useLink = (props: LinkRootProps): HTMLPropsAs<'a'> => { + const _props = useElementProps({ + ...props, + elementToAttributes: (element) => ({ + href: element.url, + }), + }); + + return { + ..._props, + // quick fix: hovering with href loses the editor focus + onMouseOver: (e) => { + e.stopPropagation(); + }, + }; +}; + +export const LinkRoot = createComponentAs((props) => { + const htmlProps = useLink(props); + + return createElementAs('a', htmlProps); +}); + +export const Link = { + Root: LinkRoot, +}; diff --git a/packages/nodes/link/src/components/LinkIcon.tsx b/packages/nodes/link/src/components/LinkIcon.tsx new file mode 100644 index 0000000000..4f935abe8b --- /dev/null +++ b/packages/nodes/link/src/components/LinkIcon.tsx @@ -0,0 +1,15 @@ +import React, { SVGProps } from 'react'; + +export const LinkIcon = (props: SVGProps) => ( + + + + +); diff --git a/packages/nodes/link/src/components/LinkOffIcon.tsx b/packages/nodes/link/src/components/LinkOffIcon.tsx new file mode 100644 index 0000000000..07a015fdf7 --- /dev/null +++ b/packages/nodes/link/src/components/LinkOffIcon.tsx @@ -0,0 +1,16 @@ +import React, { SVGProps } from 'react'; + +export const LinkOffIcon = (props: SVGProps) => ( + + + + + +); diff --git a/packages/nodes/link/src/components/ShortTextIcon.tsx b/packages/nodes/link/src/components/ShortTextIcon.tsx new file mode 100644 index 0000000000..7a23d1cc62 --- /dev/null +++ b/packages/nodes/link/src/components/ShortTextIcon.tsx @@ -0,0 +1,15 @@ +import React, { SVGProps } from 'react'; + +export const ShortTextIcon = (props: SVGProps) => ( + + + + +); diff --git a/packages/nodes/link/src/components/index.ts b/packages/nodes/link/src/components/index.ts new file mode 100644 index 0000000000..0ebd28a8f5 --- /dev/null +++ b/packages/nodes/link/src/components/index.ts @@ -0,0 +1,10 @@ +/** + * @file Automatically generated by barrelsby. + */ + +export * from './LaunchIcon'; +export * from './Link'; +export * from './LinkIcon'; +export * from './LinkOffIcon'; +export * from './ShortTextIcon'; +export * from './FloatingLink/index'; diff --git a/packages/nodes/link/src/createLinkPlugin.ts b/packages/nodes/link/src/createLinkPlugin.ts index ea7bf9e07d..2f92fd5b3f 100644 --- a/packages/nodes/link/src/createLinkPlugin.ts +++ b/packages/nodes/link/src/createLinkPlugin.ts @@ -1,13 +1,49 @@ import { createPluginFactory, isUrl as isUrlProtocol, + RangeBeforeOptions, } from '@udecode/plate-core'; -import { onKeyDownLink } from './onKeyDownLink'; -import { LinkPlugin } from './types'; import { withLink } from './withLink'; export const ELEMENT_LINK = 'a'; +export interface LinkPlugin { + /** + * Allow custom config for rangeBeforeOptions. + * @example default + * { + * matchString: ' ', + * skipInvalid: true, + * afterMatch: true, + * } + */ + rangeBeforeOptions?: RangeBeforeOptions; + + /** + * Hotkeys to trigger floating link. + * @default 'command+k, ctrl+k' + */ + triggerFloatingLinkHotkeys?: string; + + /** + * Callback to validate an url. + * @default isUrl + */ + isUrl?: (text: string) => boolean; + + /** + * Callback to optionally get the href for a url + * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com) + */ + getUrlHref?: (url: string) => string | undefined; + + /** + * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The + * default behavior is to use the browser's native `prompt`. + */ + getLinkUrl?: (prevUrl: string | null) => Promise; +} + /** * Enables support for hyperlinks. */ @@ -15,10 +51,7 @@ export const createLinkPlugin = createPluginFactory({ key: ELEMENT_LINK, isElement: true, isInline: true, - props: ({ element }) => ({ nodeProps: { url: element?.url } }), - handlers: { - onKeyDown: onKeyDownLink, - }, + props: ({ element }) => ({ nodeProps: { href: element?.url } }), withOverrides: withLink, options: { isUrl: isUrlProtocol, @@ -27,7 +60,7 @@ export const createLinkPlugin = createPluginFactory({ skipInvalid: true, afterMatch: true, }, - hotkey: 'mod+k', + triggerFloatingLinkHotkeys: 'command+k, ctrl+k', }, then: (editor, { type }) => ({ deserializeHtml: { diff --git a/packages/nodes/link/src/index.ts b/packages/nodes/link/src/index.ts index d05fe64fc3..f57fe718f7 100644 --- a/packages/nodes/link/src/index.ts +++ b/packages/nodes/link/src/index.ts @@ -3,7 +3,8 @@ */ export * from './createLinkPlugin'; -export * from './onKeyDownLink'; export * from './types'; export * from './withLink'; +export * from './components/index'; export * from './transforms/index'; +export * from './utils/index'; diff --git a/packages/nodes/link/src/onKeyDownLink.ts b/packages/nodes/link/src/onKeyDownLink.ts deleted file mode 100644 index de721ce801..0000000000 --- a/packages/nodes/link/src/onKeyDownLink.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - KeyboardHandlerReturnType, - PlateEditor, - Value, - WithPlatePlugin, -} from '@udecode/plate-core'; -import isHotkey from 'is-hotkey'; -import { getAndUpsertLink } from './transforms'; -import { LinkPlugin } from './types'; - -export const onKeyDownLink = < - V extends Value = Value, - E extends PlateEditor = PlateEditor ->( - editor: E, - { options: { getLinkUrl, hotkey } }: WithPlatePlugin -): KeyboardHandlerReturnType => (e) => { - if (!hotkey) return; - - if (isHotkey(hotkey, e as any)) { - e.preventDefault(); - e.stopPropagation(); - - getAndUpsertLink(editor, getLinkUrl); - } -}; diff --git a/packages/nodes/link/src/transforms/getAndUpsertLink.ts b/packages/nodes/link/src/transforms/getAndUpsertLink.ts deleted file mode 100644 index dc06cd067d..0000000000 --- a/packages/nodes/link/src/transforms/getAndUpsertLink.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - getAboveNode, - getPluginType, - isCollapsed, - PlateEditor, - unwrapNodes, - Value, -} from '@udecode/plate-core'; -import { ELEMENT_LINK } from '../createLinkPlugin'; -import { LinkPlugin } from '../types'; -import { upsertLinkAtSelection } from './upsertLinkAtSelection'; - -export const getAndUpsertLink = async ( - editor: PlateEditor, - getLinkUrl?: LinkPlugin['getLinkUrl'] -) => { - const type = getPluginType(editor, ELEMENT_LINK); - let prevUrl = ''; - - const linkNode = getAboveNode(editor, { - match: { type }, - }); - if (linkNode) { - prevUrl = linkNode[0].url as string; - } - - let url; - if (getLinkUrl) { - url = await getLinkUrl(prevUrl); - } else { - url = window.prompt(`Enter the URL of the link:`, prevUrl); - } - - if (!url) { - linkNode && - editor.selection && - unwrapNodes(editor, { - at: editor.selection, - match: { type: getPluginType(editor, ELEMENT_LINK) }, - }); - - return; - } - - // If our cursor is in middle of a link, then we don't want to insert it inline - const shouldWrap: boolean = - linkNode !== undefined && isCollapsed(editor.selection); - upsertLinkAtSelection(editor, { url, wrap: shouldWrap }); -}; diff --git a/packages/nodes/link/src/transforms/index.ts b/packages/nodes/link/src/transforms/index.ts index eecfc9cf7a..f57c30e161 100644 --- a/packages/nodes/link/src/transforms/index.ts +++ b/packages/nodes/link/src/transforms/index.ts @@ -2,6 +2,8 @@ * @file Automatically generated by barrelsby. */ -export * from './getAndUpsertLink'; -export * from './upsertLinkAtSelection'; +export * from './insertLink'; +export * from './submitFloatingLink'; +export * from './unwrapLink'; +export * from './upsertLink'; export * from './wrapLink'; diff --git a/packages/nodes/link/src/transforms/insertLink.ts b/packages/nodes/link/src/transforms/insertLink.ts new file mode 100644 index 0000000000..470e5330ec --- /dev/null +++ b/packages/nodes/link/src/transforms/insertLink.ts @@ -0,0 +1,24 @@ +import { + insertNodes, + InsertNodesOptions, + PlateEditor, + TText, + Value, +} from '@udecode/plate-core'; +import { TLinkElement } from '../types'; +import { createLinkNode, CreateLinkNodeOptions } from '../utils/index'; + +/** + * Insert a link node. + */ +export const insertLink = ( + editor: PlateEditor, + createLinkNodeOptions: CreateLinkNodeOptions, + options?: InsertNodesOptions +) => { + insertNodes( + editor, + [createLinkNode(editor, createLinkNodeOptions)], + options as any + ); +}; diff --git a/packages/nodes/link/src/transforms/submitFloatingLink.ts b/packages/nodes/link/src/transforms/submitFloatingLink.ts new file mode 100644 index 0000000000..c27b6c024d --- /dev/null +++ b/packages/nodes/link/src/transforms/submitFloatingLink.ts @@ -0,0 +1,44 @@ +import { + focusEditor, + getPluginOptions, + PlateEditor, + Value, +} from '@udecode/plate-core'; +import { + floatingLinkActions, + floatingLinkSelectors, +} from '../components/FloatingLink/floatingLinkStore'; +import { ELEMENT_LINK, LinkPlugin } from '../createLinkPlugin'; +import { upsertLink } from './index'; + +/** + * Insert link if url is valid. + * Text is url if empty. + * Close floating link. + * Focus editor. + */ +export const submitFloatingLink = (editor: PlateEditor) => { + if (!editor.selection) return; + + const { isUrl } = getPluginOptions(editor, ELEMENT_LINK); + + const url = floatingLinkSelectors.url(); + const isValid = isUrl?.(url); + if (!isValid) return; + + const text = floatingLinkSelectors.text(); + + floatingLinkActions.hide(); + + upsertLink(editor, { + url, + text, + update: true, + }); + + setTimeout(() => { + focusEditor(editor, editor.selection!); + }, 0); + + return true; +}; diff --git a/packages/nodes/link/src/transforms/unwrapLink.ts b/packages/nodes/link/src/transforms/unwrapLink.ts new file mode 100644 index 0000000000..dcdd6ffe15 --- /dev/null +++ b/packages/nodes/link/src/transforms/unwrapLink.ts @@ -0,0 +1,21 @@ +import { + getPluginType, + PlateEditor, + unwrapNodes, + UnwrapNodesOptions, + Value, +} from '@udecode/plate-core'; +import { ELEMENT_LINK } from '../createLinkPlugin'; + +/** + * Unwrap link node. + */ +export const unwrapLink = ( + editor: PlateEditor, + options?: UnwrapNodesOptions +) => { + unwrapNodes(editor, { + match: { type: getPluginType(editor, ELEMENT_LINK) }, + ...options, + }); +}; diff --git a/packages/nodes/link/src/transforms/upsertLink.spec.tsx b/packages/nodes/link/src/transforms/upsertLink.spec.tsx new file mode 100644 index 0000000000..f59915b583 --- /dev/null +++ b/packages/nodes/link/src/transforms/upsertLink.spec.tsx @@ -0,0 +1,198 @@ +/** @jsx jsx */ + +import { createPlateEditor } from '@udecode/plate-core'; +import { jsx } from '@udecode/plate-test-utils'; +import { createLinkPlugin } from '../createLinkPlugin'; +import { upsertLink } from './upsertLink'; + +jsx; + +const url = 'http://google.com'; + +const createEditor = (editor: any) => + createPlateEditor({ + editor, + plugins: [createLinkPlugin()], + }); + +describe('upsertLink', () => { + describe('when selection is collapsed', () => { + // done + describe('when not in link, url only', () => { + const input = ( + + + insert link + . + + + ) as any; + + const output = ( + + + insert link{url}. + + + ) as any; + + it('should insert link', () => { + const editor = createEditor(input); + upsertLink(editor, { url }); + + expect(input.children).toEqual(output.children); + }); + }); + + // https://github.com/udecode/editor-protocol/issues/35 + describe('when in a link', () => { + const input = ( + + + . + + insert link + + + . + + + ) as any; + + const output = ( + + + .insert link{url}. + + + ) as any; + + it('should insert text', () => { + const editor = createEditor(input); + upsertLink(editor, { url }); + + expect(input.children).toEqual(output.children); + }); + }); + }); + + describe('when selection is expanded', () => { + // https://github.com/udecode/editor-protocol/issues/43 + describe('when not in link, url only', () => { + const input = ( + + + . + insert link + . + + + ) as any; + + const output = ( + + + .insert link. + + + ) as any; + + it('should wrap link', () => { + const editor = createEditor(input); + upsertLink(editor, { url }); + + expect(input.children).toEqual(output.children); + }); + }); + + // done + describe('when not in link, url+text', () => { + const input = ( + + + . + insert link + . + + + ) as any; + + const output = ( + + + .another. + + + ) as any; + + it('should insert link', () => { + const editor = createEditor(input); + upsertLink(editor, { url, text: 'another' }); + + expect(input.children).toEqual(output.children); + }); + }); + + // done + describe('when in a link', () => { + const input = ( + + + . + + insert + link + + + . + + + ) as any; + + const output = ( + + + .insert {url}. + + + ) as any; + + it('should insert text', () => { + const editor = createEditor(input); + upsertLink(editor, { url }); + + expect(input.children).toEqual(output.children); + }); + }); + + // done + describe('when containing a link', () => { + const input = ( + + + insert link + here + . + + + ) as any; + + const urlOutput = 'http://output.com'; + + const output = ( + + + insert link here. + + + ) as any; + + it('should delete and insert link', () => { + const editor = createEditor(input); + upsertLink(editor, { url: urlOutput }); + + expect(input.children).toEqual(output.children); + }); + }); + }); +}); diff --git a/packages/nodes/link/src/transforms/upsertLink.ts b/packages/nodes/link/src/transforms/upsertLink.ts new file mode 100644 index 0000000000..5124c27a5c --- /dev/null +++ b/packages/nodes/link/src/transforms/upsertLink.ts @@ -0,0 +1,79 @@ +import { + getAboveNode, + getEditorString, + getNodeProps, + getPluginOptions, + getPluginType, + InsertNodesOptions, + isExpanded, + PlateEditor, + removeNodes, + UnwrapNodesOptions, + Value, + withoutNormalizing, + WrapNodesOptions, +} from '@udecode/plate-core'; +import { ELEMENT_LINK, LinkPlugin } from '../createLinkPlugin'; +import { CreateLinkNodeOptions } from '../utils/index'; +import { insertLink } from './insertLink'; + +export type UpsertLinkOptions< + V extends Value = Value +> = CreateLinkNodeOptions & { + /** + * Force update instead of insert. + */ + update?: boolean; + insertNodesOptions?: InsertNodesOptions; + unwrapNodesOptions?: UnwrapNodesOptions; + wrapNodesOptions?: WrapNodesOptions; +}; + +/** + * If selection in a link or is not url: + * - insert text with url, exit + * If selection is expanded or `update` in a link: + * - remove link node, get link text + * Then: + * - insert link node + */ +export const upsertLink = ( + editor: PlateEditor, + { url, text, update, insertNodesOptions }: UpsertLinkOptions +) => { + return withoutNormalizing(editor, () => { + const at = editor.selection; + + if (!at) return; + + const linkAbove = getAboveNode(editor, { + at, + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }); + + const { isUrl } = getPluginOptions(editor, ELEMENT_LINK); + + if ((linkAbove && !update) || !isUrl?.(url)) { + editor.insertText(url); + return true; + } + + const [linkNode, linkPath] = linkAbove ?? []; + + if (isExpanded(at) || update) { + // get text to insert in the link + text = text ?? getEditorString(editor, at); + + if (linkAbove) { + removeNodes(editor, { + at: linkPath, + }); + } + } + + const props = getNodeProps(linkNode ?? ({} as any)); + + insertLink(editor, { ...props, url, text }, insertNodesOptions); + return true; + }); +}; diff --git a/packages/nodes/link/src/transforms/upsertLinkAtSelection.ts b/packages/nodes/link/src/transforms/upsertLinkAtSelection.ts deleted file mode 100644 index 61a4aac16e..0000000000 --- a/packages/nodes/link/src/transforms/upsertLinkAtSelection.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { - collapseSelection, - getLeafNode, - getPluginType, - insertNodes, - isCollapsed, - PlateEditor, - select, - unwrapNodes, - Value, -} from '@udecode/plate-core'; -import { ELEMENT_LINK } from '../createLinkPlugin'; -import { TLinkElement } from '../types'; -import { wrapLink } from './wrapLink'; - -/** - * Unwrap link at a location (default: selection). - * Then, the focus of the location is set to selection focus. - * Then, wrap the link at the location. - */ -export const upsertLinkAtSelection = ( - editor: PlateEditor, - { - url, - wrap, - }: { - url: string; - /** - * If true, wrap the link at the location (default: selection) even if the selection is collapsed. - */ - wrap?: boolean; - } -) => { - if (!editor.selection) return; - - const type = getPluginType(editor, ELEMENT_LINK); - - if (!wrap && isCollapsed(editor.selection)) { - return insertNodes(editor, { - type, - url, - children: [{ text: url }], - }); - } - - // if our cursor is inside an existing link, but don't have the text selected, select it now - if (wrap && isCollapsed(editor.selection)) { - const linkLeaf = getLeafNode(editor, editor.selection); - const [, inlinePath] = linkLeaf; - select(editor, inlinePath); - } - - unwrapNodes(editor, { at: editor.selection, match: { type } }); - - wrapLink(editor, { at: editor.selection, url }); - - collapseSelection(editor, { edge: 'end' }); -}; diff --git a/packages/nodes/link/src/transforms/wrapLink.ts b/packages/nodes/link/src/transforms/wrapLink.ts index dcfe0abb71..5a8b0cc909 100644 --- a/packages/nodes/link/src/transforms/wrapLink.ts +++ b/packages/nodes/link/src/transforms/wrapLink.ts @@ -3,25 +3,25 @@ import { PlateEditor, Value, wrapNodes, + WrapNodesOptions, } from '@udecode/plate-core'; -import { Location } from 'slate'; import { ELEMENT_LINK } from '../createLinkPlugin'; import { TLinkElement } from '../types'; /** - * Wrap selected nodes with a link and collapse at the end. + * Wrap a link node with split. */ export const wrapLink = ( editor: PlateEditor, - { at, url }: { url: string; at?: Location } + { url, ...options }: { url: string } & WrapNodesOptions ) => { - wrapNodes( + wrapNodes( editor, { type: getPluginType(editor, ELEMENT_LINK), url, children: [], }, - { at, split: true } + { split: true, ...options } as any ); }; diff --git a/packages/nodes/link/src/types.ts b/packages/nodes/link/src/types.ts index 2d4a992fc4..dcddbf0751 100644 --- a/packages/nodes/link/src/types.ts +++ b/packages/nodes/link/src/types.ts @@ -1,33 +1,5 @@ -import { - HotkeyPlugin, - RangeBeforeOptions, - TElement, -} from '@udecode/plate-core'; +import { TElement } from '@udecode/plate-core'; export interface TLinkElement extends TElement { url: string; } - -export interface LinkPlugin extends HotkeyPlugin { - /** - * Allow custom config for rangeBeforeOptions. - */ - rangeBeforeOptions?: RangeBeforeOptions; - - /** - * Callback to validate an url. - */ - isUrl?: (text: string) => boolean; - - /** - * Callback to optionally get the href for a url - * @returns href: an optional link to be used that is different from the text content (example https://google.com for google.com) - */ - getUrlHref?: (url: string) => string | undefined; - - /** - * On keyboard shortcut or toolbar mousedown, get the link url by calling this promise. The - * default behavior is to use the browser's native `prompt`. - */ - getLinkUrl?: (prevUrl: string | null) => Promise; -} diff --git a/packages/nodes/link/src/utils/createLinkNode.ts b/packages/nodes/link/src/utils/createLinkNode.ts new file mode 100644 index 0000000000..b4013211a5 --- /dev/null +++ b/packages/nodes/link/src/utils/createLinkNode.ts @@ -0,0 +1,23 @@ +import { getPluginType, PlateEditor, Value } from '@udecode/plate-core'; +import { ELEMENT_LINK } from '../createLinkPlugin'; +import { TLinkElement } from '../types'; + +export interface CreateLinkNodeOptions { + url: string; + text?: string; +} + +export const createLinkNode = ( + editor: PlateEditor, + { url, text = '' }: CreateLinkNodeOptions +): TLinkElement => { + const type = getPluginType(editor, ELEMENT_LINK); + + if (!text.length) text = url; + + return { + type, + url, + children: [{ text }], + }; +}; diff --git a/packages/nodes/link/src/utils/index.ts b/packages/nodes/link/src/utils/index.ts new file mode 100644 index 0000000000..ae3a4a3bb8 --- /dev/null +++ b/packages/nodes/link/src/utils/index.ts @@ -0,0 +1,8 @@ +/** + * @file Automatically generated by barrelsby. + */ + +export * from './createLinkNode'; +export * from './triggerFloatingLink'; +export * from './triggerFloatingLinkEdit'; +export * from './triggerFloatingLinkInsert'; diff --git a/packages/nodes/link/src/utils/triggerFloatingLink.ts b/packages/nodes/link/src/utils/triggerFloatingLink.ts new file mode 100644 index 0000000000..d06bb72da2 --- /dev/null +++ b/packages/nodes/link/src/utils/triggerFloatingLink.ts @@ -0,0 +1,22 @@ +import { PlateEditor, Value } from '@udecode/plate-core'; +import { floatingLinkSelectors } from '../components/index'; +import { triggerFloatingLinkEdit } from './triggerFloatingLinkEdit'; +import { triggerFloatingLinkInsert } from './triggerFloatingLinkInsert'; + +export const triggerFloatingLink = ( + editor: PlateEditor, + { + focused, + }: { + focused?: boolean; + } = {} +) => { + if (floatingLinkSelectors.mode() === 'edit') { + triggerFloatingLinkEdit(editor); + return; + } + + triggerFloatingLinkInsert(editor, { + focused, + }); +}; diff --git a/packages/nodes/link/src/utils/triggerFloatingLinkEdit.ts b/packages/nodes/link/src/utils/triggerFloatingLinkEdit.ts new file mode 100644 index 0000000000..838f6411d8 --- /dev/null +++ b/packages/nodes/link/src/utils/triggerFloatingLinkEdit.ts @@ -0,0 +1,33 @@ +import { + findNode, + getEditorString, + getPluginType, + PlateEditor, + Value, +} from '@udecode/plate-core'; +import { floatingLinkActions } from '../components/FloatingLink/floatingLinkStore'; +import { ELEMENT_LINK } from '../createLinkPlugin'; +import { TLinkElement } from '../types'; + +export const triggerFloatingLinkEdit = ( + editor: PlateEditor +) => { + const entry = findNode(editor, { + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }); + if (!entry) return; + + const [link, path] = entry; + + let text = getEditorString(editor, path); + + floatingLinkActions.url(link.url); + + if (text === link.url) { + text = ''; + } + + floatingLinkActions.text(text); + + floatingLinkActions.isEditing(true); +}; diff --git a/packages/nodes/link/src/utils/triggerFloatingLinkInsert.ts b/packages/nodes/link/src/utils/triggerFloatingLinkInsert.ts new file mode 100644 index 0000000000..098e86a6d2 --- /dev/null +++ b/packages/nodes/link/src/utils/triggerFloatingLinkInsert.ts @@ -0,0 +1,59 @@ +import { + getEditorString, + getNodeEntries, + getPluginType, + isRangeAcrossBlocks, + isText, + PlateEditor, + someNode, + Value, +} from '@udecode/plate-core'; +import { + floatingLinkActions, + floatingLinkSelectors, +} from '../components/FloatingLink/floatingLinkStore'; +import { ELEMENT_LINK } from '../createLinkPlugin'; + +/** + * Trigger floating link. + * + * Do not trigger when: + * - selection is across blocks + * - selection has more than one leaf node + * - lowest selection is not text + * - selection has a link node + */ +export const triggerFloatingLinkInsert = ( + editor: PlateEditor, + { + focused, + }: { + focused?: boolean; + } = {} +) => { + if (floatingLinkSelectors.mode()) return; + + if (!focused) return; + + if (isRangeAcrossBlocks(editor, { at: editor.selection })) return; + + // get lowest nodes in selection + const _entries = getNodeEntries(editor, { + mode: 'lowest', + }); + const entries = [..._entries]; + if (entries.length !== 1) return; + + const [entry] = entries; + + // void node + if (!isText(entry[0])) return; + + const hasLink = someNode(editor, { + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }); + if (hasLink) return; + + floatingLinkActions.text(getEditorString(editor, editor.selection)); + floatingLinkActions.show('insert'); +}; diff --git a/packages/nodes/link/src/withLink.spec.tsx b/packages/nodes/link/src/withLink.spec.tsx new file mode 100644 index 0000000000..addbe0e7a1 --- /dev/null +++ b/packages/nodes/link/src/withLink.spec.tsx @@ -0,0 +1,420 @@ +/** @jsx jsx */ + +import { createPlateEditor } from '@udecode/plate-core'; +import { jsx } from '@udecode/plate-test-utils'; +import { createLinkPlugin } from './createLinkPlugin'; + +jsx; + +/** + * TODO: test + * https://github.com/udecode/editor-protocol/issues/44 + * https://github.com/udecode/editor-protocol/issues/45 + * https://github.com/udecode/editor-protocol/issues/46 + * https://github.com/udecode/editor-protocol/issues/47 + * https://github.com/udecode/editor-protocol/issues/48 + * https://github.com/udecode/editor-protocol/issues/49 + * https://github.com/udecode/editor-protocol/issues/50 + * https://github.com/udecode/editor-protocol/issues/51 + * https://github.com/udecode/editor-protocol/issues/52 + * https://github.com/udecode/editor-protocol/issues/53 + * https://github.com/udecode/editor-protocol/issues/54 + * https://github.com/udecode/editor-protocol/issues/55 + * https://github.com/udecode/editor-protocol/issues/56 + * https://github.com/udecode/editor-protocol/issues/57 + * https://github.com/udecode/editor-protocol/issues/58 + * https://github.com/udecode/editor-protocol/issues/59 + * https://github.com/udecode/editor-protocol/issues/60 + * https://github.com/udecode/editor-protocol/issues/61 + */ + +const url = 'http://google.com'; + +const createEditor = (editor: any) => + createPlateEditor({ + editor, + plugins: [createLinkPlugin()], + }); + +describe('withLink', () => { + describe('insertData', () => { + describe('when inserting url text', () => { + // https://github.com/udecode/editor-protocol/issues/34 + describe('when in a paragraph', () => { + const input = ( + + + test + + + + ) as any; + + const data: any = { getData: () => 'http://google.com' }; + + const output = ( + + + test + http://google.com + + + + ) as any; + + it('should insert link', () => { + const editor = createEditor(input); + + editor.insertData(data); + + expect(input.children).toEqual(output.children); + }); + }); + + // https://github.com/udecode/editor-protocol/issues/36 + describe('when only one edge in a link', () => { + const input = ( + + + test{' '} + + please + + click + {' '} + here + . + + + ) as any; + + const data: any = { getData: () => 'http://google.com/test' }; + + const output = ( + + + test please + + click here. + + + ) as any; + + it('should insert link', () => { + jest.spyOn(JSON, 'parse').mockReturnValue(docs); + + const editor = createEditor(input); + + editor.insertData(data); + + expect(input.children).toEqual(output.children); + }); + }); + + // https://github.com/udecode/editor-protocol/issues/37 + describe('when above a link', () => { + const input = ( + + + insert link + here + . + + + ) as any; + + const urlOutput = 'http://output.com'; + + const output = ( + + + insert link here. + + + ) as any; + + it('should delete and insert link', () => { + const editor = createEditor(input); + + const data: any = { getData: () => urlOutput }; + editor.insertData(data); + + expect(input.children).toEqual(output.children); + }); + }); + }); + + describe('when inserting non-url text', () => { + // https://github.com/udecode/editor-protocol/issues/38 + describe('when in a link', () => { + it('should run default insertText', () => { + const input = ( + + + test + + http:// + + google.com + + + + + ) as any; + + const data: any = { getData: () => 'docs' }; + + const output = ( + + + test + http://docsgoogle.com + + + + ) as any; + + jest.spyOn(JSON, 'parse').mockReturnValue(docs); + + const editor = createEditor(input); + + editor.insertData(data); + + expect(input.children).toEqual(output.children); + }); + }); + }); + + describe('when inserting space', () => { + // https://github.com/udecode/editor-protocol/issues/41 + describe('when after link', () => { + const input = ( + + + link: http://google.com + + + + ) as any; + + const text = ' '; + + const output = ( + + + link: http://google.com{' '} + + + ) as any; + + it('should insert text', () => { + const editor = createEditor(input); + + editor.insertText(text); + + expect(input.children).toEqual(output.children); + }); + }); + + // https://github.com/udecode/editor-protocol/issues/40 + describe('when after non-url text', () => { + const input = ( + + + google.com + + + + ) as any; + + const text = ' '; + + const output = ( + + google.com + + ) as any; + + it('should insert text', () => { + const editor = createEditor(input); + + editor.insertText(text); + + expect(input.children).toEqual(output.children); + }); + }); + + // https://github.com/udecode/editor-protocol/issues/39 + describe('when after url text', () => { + const input = ( + + + link: http://google.com + + + + ) as any; + + const text = ' '; + + const output = ( + + + link: http://google.com{' '} + + + ) as any; + + it('should wrap the url with a link', () => { + const editor = createEditor(input); + + editor.insertText(text); + + expect(input.children).toEqual(output.children); + }); + }); + + describe('when cursor is after link in next block', () => { + const input = ( + + + link: http://google.com + + + test + + + + ) as any; + + const text = ' '; + + const output = ( + + + link: http://google.com + + + {'test '} + {/* keep above as string in quotes to force trailing space */} + + + + ) as any; + + it('should run default insertText', () => { + const editor = createEditor(input); + + editor.insertText(text); + + expect(input.children).toEqual(output.children); + }); + }); + + // https://github.com/udecode/editor-protocol/issues/42 + describe('when after url at start of block', () => { + const input = ( + + + http://google.com + + + + ) as any; + + const text = ' '; + + const output = ( + + + + http://google.com{' '} + + + ) as any; + + it('should wrap the url with a link ha', () => { + const editor = createEditor(input); + + editor.insertText(text); + + expect(input.children).toEqual(output.children); + }); + }); + + describe('when getUrlHref', () => { + const input = ( + + + google.com + + + + ) as any; + + const text = ' '; + + const output = ( + + + + google.com{' '} + + + ) as any; + + it('should insert link', () => { + const editor = createPlateEditor({ + editor: input, + plugins: [ + createLinkPlugin({ + options: { + getUrlHref: (_url) => { + return 'http://google.com'; + }, + }, + }), + ], + }); + + editor.insertText(text); + + expect(input.children).toEqual(output.children); + }); + }); + }); + + describe('when url with bold mark', () => { + const input = ( + + + link: http://google.com + + + + ) as any; + + const text = ' '; + + const output = ( + + + link:{' '} + + {/* http://google.com */} + http://google.com + {' '} + + + ) as any; + + it('should wrap the url with a link', () => { + const editor = createEditor(input); + + editor.insertText(text); + + expect(input.children).toEqual(output.children); + }); + }); + }); +}); diff --git a/packages/nodes/link/src/withLink.ts b/packages/nodes/link/src/withLink.ts index 50d8f6125b..a8761b8732 100644 --- a/packages/nodes/link/src/withLink.ts +++ b/packages/nodes/link/src/withLink.ts @@ -1,66 +1,28 @@ import { + collapseSelection, + getAboveNode, getEditorString, + getNextNodeStartPoint, getPluginType, + getPreviousNodeEndPoint, getRangeBefore, getRangeFromBlockStart, + insertNodes, isCollapsed, + isEndPoint, + isStartPoint, mockPlugin, - moveSelection, PlateEditor, + select, someNode, - unwrapNodes, Value, + withoutNormalizing, WithPlatePlugin, } from '@udecode/plate-core'; import { withRemoveEmptyNodes } from '@udecode/plate-normalizers'; -import { Range } from 'slate'; -import { upsertLinkAtSelection } from './transforms/upsertLinkAtSelection'; -import { wrapLink } from './transforms/wrapLink'; -import { ELEMENT_LINK } from './createLinkPlugin'; -import { LinkPlugin } from './types'; - -const upsertLink = ( - editor: PlateEditor, - { - url, - at, - }: { - url: string; - at: Range; - } -) => { - unwrapNodes(editor, { - at, - match: { type: getPluginType(editor, ELEMENT_LINK) }, - }); - - const newSelection = editor.selection as Range; - - wrapLink(editor, { - at: { - ...at, - focus: newSelection.focus, - }, - url, - }); -}; - -const upsertLinkIfValid = ( - editor: PlateEditor, - { isUrl, getUrlHref }: { isUrl: any; getUrlHref: any } -) => { - const rangeFromBlockStart = getRangeFromBlockStart(editor); - const textFromBlockStart = getEditorString(editor, rangeFromBlockStart); - const hrefFromBlockStart = getUrlHref?.(textFromBlockStart); - - if (rangeFromBlockStart && isUrl(textFromBlockStart)) { - upsertLink(editor, { - url: hrefFromBlockStart || textFromBlockStart, - at: rangeFromBlockStart, - }); - return true; - } -}; +import { Path, Point, Range } from 'slate'; +import { upsertLink } from './transforms/index'; +import { ELEMENT_LINK, LinkPlugin } from './createLinkPlugin'; /** * Insert space after a url to wrap a link. @@ -81,35 +43,53 @@ export const withLink = < options: { isUrl, getUrlHref, rangeBeforeOptions }, }: WithPlatePlugin ) => { - const { insertData, insertText } = editor; + const { insertData, insertText, apply, normalizeNode } = editor; editor.insertText = (text) => { if (text === ' ' && isCollapsed(editor.selection)) { - const selection = editor.selection as Range; + withoutNormalizing(editor, () => { + const selection = editor.selection!; + + // get the range from first space before the cursor + let beforeWordRange = getRangeBefore( + editor, + selection, + rangeBeforeOptions + ); + + // if no space found before, get the range from block start + if (!beforeWordRange) { + beforeWordRange = getRangeFromBlockStart(editor); + } - if (upsertLinkIfValid(editor, { isUrl, getUrlHref })) { - moveSelection(editor, { unit: 'offset' }); - return insertText(text); - } + // if no word found before the cursor, exit + if (!beforeWordRange) return; - const beforeWordRange = getRangeBefore( - editor, - selection, - rangeBeforeOptions - ); - - if (beforeWordRange) { - const beforeWordText = getEditorString(editor, beforeWordRange); - const beforeWordHref = getUrlHref?.(beforeWordText); - - if (isUrl!(beforeWordText)) { - upsertLink(editor, { - url: beforeWordHref || beforeWordText, - at: beforeWordRange, - }); - moveSelection(editor, { unit: 'offset' }); - } - } + const hasLink = someNode(editor, { + at: beforeWordRange, + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }); + + // if word before the cursor has a link, exit + if (hasLink) return; + + let beforeWordText = getEditorString(editor, beforeWordRange); + beforeWordText = getUrlHref?.(beforeWordText) ?? beforeWordText; + + // if word before is not an url, exit + if (!isUrl!(beforeWordText)) return; + + // select the word to wrap link + select(editor, beforeWordRange); + + // wrap link + upsertLink(editor, { + url: beforeWordText, + }); + + // collapse selection + collapseSelection(editor, { edge: 'end' }); + }); } insertText(text); @@ -120,25 +100,74 @@ export const withLink = < const textHref = getUrlHref?.(text); if (text) { - if (isUrl!(text)) { - return upsertLinkAtSelection(editor, { url: textHref || text }); - } + const inserted = upsertLink(editor, { url: textHref || text }); + if (inserted) return; + } + + insertData(data); + }; + + // TODO: plugin + editor.apply = (operation) => { + if (operation.type === 'set_selection') { + const range = operation.newProperties as Range | null; + + if (range && range.focus && range.anchor && isCollapsed(range)) { + const entry = getAboveNode(editor, { + at: range, + match: { type: getPluginType(editor, ELEMENT_LINK) }, + }); + + if (entry) { + const [, path] = entry; + + let newPoint: Point | undefined; + + if (isStartPoint(editor, range.focus, path)) { + newPoint = getPreviousNodeEndPoint(editor, path); + } - if (someNode(editor, { match: { type } })) { - return insertText(text); + if (isEndPoint(editor, range.focus, path)) { + newPoint = getNextNodeStartPoint(editor, path); + } + + if (newPoint) { + operation.newProperties = { + anchor: newPoint, + focus: newPoint, + }; + } + } } } - insertData(data); + apply(operation); }; - // editor.insertBreak = () => { - // if (upsertLinkIfValid(editor, { link, isUrl })) { - // console.info('fix cursor'); - // } - // - // insertBreak(); - // }; + // TODO: plugin + editor.normalizeNode = ([node, path]) => { + if (node.type === getPluginType(editor, ELEMENT_LINK)) { + const range = editor.selection as Range | null; + + if (range && isCollapsed(range)) { + if (isEndPoint(editor, range.focus, path)) { + const nextPoint = getNextNodeStartPoint(editor, path); + + // select next text node if any + if (nextPoint) { + select(editor, nextPoint); + } else { + // insert text node then select + const nextPath = Path.next(path); + insertNodes(editor, { text: '' } as any, { at: nextPath }); + select(editor, nextPath); + } + } + } + } + + normalizeNode([node, path]); + }; editor = withRemoveEmptyNodes( editor, diff --git a/packages/nodes/table/src/transforms/addColumn.ts b/packages/nodes/table/src/transforms/addColumn.ts deleted file mode 100644 index 66d4e9c9fc..0000000000 --- a/packages/nodes/table/src/transforms/addColumn.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { - getAboveNode, - getPluginType, - insertElements, - PlateEditor, - someNode, - TElement, - Value, -} from '@udecode/plate-core'; -import { Path } from 'slate'; -import { ELEMENT_TABLE, ELEMENT_TD, ELEMENT_TH } from '../createTablePlugin'; -import { getEmptyCellNode } from '../utils/getEmptyCellNode'; - -/** - * @deprecated - Use `insertTableColumn` - */ -export const addColumn = ( - editor: PlateEditor, - { header }: { header?: boolean } = {} -) => { - if ( - someNode(editor, { - match: { type: getPluginType(editor, ELEMENT_TABLE) }, - }) - ) { - const currentCellItem = getAboveNode(editor, { - match: { - type: [ - getPluginType(editor, ELEMENT_TH), - getPluginType(editor, ELEMENT_TD), - ], - }, - }); - - const currentTableItem = getAboveNode(editor, { - match: { type: getPluginType(editor, ELEMENT_TABLE) }, - }); - - if (currentCellItem && currentTableItem) { - const nextCellPath = Path.next(currentCellItem[1]); - const newCellPath = nextCellPath.slice(); - const replacePathPos = newCellPath.length - 2; - const currentRowIdx = nextCellPath[replacePathPos]; - - currentTableItem[0].children.forEach((row, rowIdx) => { - newCellPath[replacePathPos] = rowIdx; - const isHeaderRow = - header === undefined - ? (row as TElement).children[0].type === - getPluginType(editor, ELEMENT_TH) - : header; - - insertElements( - editor, - getEmptyCellNode(editor, { header: isHeaderRow }), - { - at: newCellPath, - select: rowIdx === currentRowIdx, - } - ); - }); - } - } -}; diff --git a/packages/nodes/table/src/transforms/addRow.ts b/packages/nodes/table/src/transforms/addRow.ts deleted file mode 100644 index 49b0e69695..0000000000 --- a/packages/nodes/table/src/transforms/addRow.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - getAboveNode, - getPluginType, - insertElements, - PlateEditor, - someNode, - Value, -} from '@udecode/plate-core'; -import { Path } from 'slate'; -import { ELEMENT_TABLE, ELEMENT_TR } from '../createTablePlugin'; -import { getEmptyRowNode } from '../utils/getEmptyRowNode'; - -/** - * deprecated - use `insertTableRow` instead - */ -export const addRow = ( - editor: PlateEditor, - { header }: { header?: boolean } = {} -) => { - if ( - someNode(editor, { - match: { type: getPluginType(editor, ELEMENT_TABLE) }, - }) - ) { - const currentRowItem = getAboveNode(editor, { - match: { type: getPluginType(editor, ELEMENT_TR) }, - }); - if (currentRowItem) { - const [currentRowElem, currentRowPath] = currentRowItem; - insertElements( - editor, - getEmptyRowNode(editor, { - header, - colCount: currentRowElem.children.length, - }), - { - at: Path.next(currentRowPath), - select: true, - } - ); - } - } -}; diff --git a/packages/nodes/table/src/transforms/index.ts b/packages/nodes/table/src/transforms/index.ts index aca45a5afc..6cafbbe67d 100644 --- a/packages/nodes/table/src/transforms/index.ts +++ b/packages/nodes/table/src/transforms/index.ts @@ -2,8 +2,6 @@ * @file Automatically generated by barrelsby. */ -export * from './addColumn'; -export * from './addRow'; export * from './deleteColumn'; export * from './deleteRow'; export * from './deleteTable'; diff --git a/packages/serializers/html/src/__tests__/elements.spec.ts b/packages/serializers/html/src/__tests__/elements.spec.ts index d9ccd02a83..2eb25b52bf 100644 --- a/packages/serializers/html/src/__tests__/elements.spec.ts +++ b/packages/serializers/html/src/__tests__/elements.spec.ts @@ -56,7 +56,7 @@ it('serialize link to html', () => { ], }) ).toBe( - 'Some paragraph of text with link part.' + 'Some paragraph of text with link part.' ); }); diff --git a/packages/serializers/html/src/__tests__/node-to-props.spec.ts b/packages/serializers/html/src/__tests__/node-to-props.spec.ts index fd589fd1e0..68dd9549d4 100644 --- a/packages/serializers/html/src/__tests__/node-to-props.spec.ts +++ b/packages/serializers/html/src/__tests__/node-to-props.spec.ts @@ -43,7 +43,7 @@ it('serialize link to html with attributes', () => { ], }) ).toBe( - 'An external link and an internal link.' + 'An external link and an internal link.' ); }); diff --git a/packages/serializers/html/src/__tests__/with-attributes.spec.ts b/packages/serializers/html/src/__tests__/with-attributes.spec.ts index ad438b4571..88ed02acde 100644 --- a/packages/serializers/html/src/__tests__/with-attributes.spec.ts +++ b/packages/serializers/html/src/__tests__/with-attributes.spec.ts @@ -33,7 +33,7 @@ it('serialize link to html with attributes', () => { } ) ).toBe( - 'Some paragraph of text with link part.' + 'Some paragraph of text with link part.' ); }); diff --git a/packages/ui/button/package.json b/packages/ui/button/package.json index 63c284c4ff..e2f71c4d6a 100644 --- a/packages/ui/button/package.json +++ b/packages/ui/button/package.json @@ -19,6 +19,7 @@ ], "types": "dist/index.d.ts", "dependencies": { + "@udecode/plate-button": "14.4.2", "@udecode/plate-core": "14.4.2", "@udecode/plate-styled-components": "14.4.2" }, diff --git a/packages/ui/button/src/Button/Button.styles.ts b/packages/ui/button/src/Button/Button.styles.ts deleted file mode 100644 index eb673c942b..0000000000 --- a/packages/ui/button/src/Button/Button.styles.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { createStyles } from '@udecode/plate-styled-components'; -import { css } from 'styled-components'; -import tw from 'twin.macro'; -import { ButtonStyleProps } from './Button.types'; - -export const getButtonStyles = (props: ButtonStyleProps) => { - const { px, py, size } = props; - - return createStyles( - { prefixClassNames: 'Button', ...props }, - { - root: [ - tw`relative inline-flex justify-center items-center text-center max-w-full p-0`, - tw`border-0 font-medium cursor-pointer`, - tw`bg-white hover:bg-gray-100 active:bg-gray-200`, - !size - ? tw`px-2.5 py-1` - : { - width: size, - height: size, - }, - px && { - paddingLeft: px, - paddingRight: px, - }, - py && { - paddingTop: py, - paddingBottom: py, - }, - css` - font-family: inherit; - font-size: 14px; - border-radius: 3px; - `, - ], - } - ); -}; diff --git a/packages/ui/button/src/Button/Button.tsx b/packages/ui/button/src/Button/Button.tsx deleted file mode 100644 index b7dd45f3bd..0000000000 --- a/packages/ui/button/src/Button/Button.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable react/button-has-type */ -import React from 'react'; -import { getButtonStyles } from './Button.styles'; -import { ButtonProps } from './Button.types'; - -export const Button = ({ disabled, ...props }: ButtonProps) => { - const { root } = getButtonStyles(props); - - return ( - + ); }; diff --git a/packages/ui/button/src/Button/index.ts b/packages/ui/button/src/Button/index.ts index 77ee073544..0b3d7143a7 100644 --- a/packages/ui/button/src/Button/index.ts +++ b/packages/ui/button/src/Button/index.ts @@ -2,7 +2,5 @@ * @file Automatically generated by barrelsby. */ -export * from './Button.styles'; -export * from './Button'; -export * from './Button.types'; +export * from './PlateButton'; export * from './RemoveNodeButton'; diff --git a/packages/ui/button/src/Icon/DeleteIcon.tsx b/packages/ui/button/src/Icon/DeleteIcon.tsx index fcdc39503d..1d389a6ca8 100644 --- a/packages/ui/button/src/Icon/DeleteIcon.tsx +++ b/packages/ui/button/src/Icon/DeleteIcon.tsx @@ -3,7 +3,6 @@ import { StyledIcon, StyledIconProps } from './StyledIcon'; export const DeleteIcon = (props: StyledIconProps) => ( - Delete icon diff --git a/packages/ui/combobox/package.json b/packages/ui/combobox/package.json index c715c2d543..a25c7fb609 100644 --- a/packages/ui/combobox/package.json +++ b/packages/ui/combobox/package.json @@ -21,8 +21,8 @@ "dependencies": { "@udecode/plate-combobox": "14.4.2", "@udecode/plate-core": "14.4.2", - "@udecode/plate-styled-components": "14.4.2", - "@udecode/plate-ui-popper": "14.4.2" + "@udecode/plate-floating": "14.4.2", + "@udecode/plate-styled-components": "14.4.2" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/ui/combobox/src/Combobox.tsx b/packages/ui/combobox/src/Combobox.tsx index 30ac5a7b25..df76ba37ee 100644 --- a/packages/ui/combobox/src/Combobox.tsx +++ b/packages/ui/combobox/src/Combobox.tsx @@ -11,12 +11,12 @@ import { useComboboxSelectors, } from '@udecode/plate-combobox'; import { useEditorState, useEventEditorSelectors } from '@udecode/plate-core'; -import { PortalBody } from '@udecode/plate-styled-components'; import { getRangeBoundingClientRect, - usePopperPosition, - virtualReference, -} from '@udecode/plate-ui-popper'; + offset, + useVirtualFloating, +} from '@udecode/plate-floating'; +import { PortalBody } from '@udecode/plate-styled-components'; import { getComboboxStyles } from './Combobox.styles'; import { ComboboxProps } from './Combobox.types'; @@ -38,8 +38,7 @@ const ComboboxContent = ( const targetRange = useComboboxSelectors.targetRange(); const filteredItems = useComboboxSelectors.filteredItems(); const highlightedIndex = useComboboxSelectors.highlightedIndex(); - const popperContainer = useComboboxSelectors.popperContainer?.(); - const popperOptions = useComboboxSelectors.popperOptions?.(); + const floatingOptions = useComboboxSelectors.floatingOptions?.(); const editor = useEditorState(); const combobox = useComboboxControls(); const activeComboboxStore = useActiveComboboxStore()!; @@ -50,8 +49,6 @@ const ComboboxContent = ( const maxSuggestions = activeComboboxStore.use.maxSuggestions?.() ?? storeItems.length; - const popperRef = React.useRef(null); - // Update items useEffect(() => { items && comboboxActions.items(items); @@ -73,18 +70,16 @@ const ComboboxContent = ( // Get target range rect const getBoundingClientRect = useCallback( - () => getRangeBoundingClientRect(editor, targetRange) ?? virtualReference, + () => getRangeBoundingClientRect(editor, targetRange), [editor, targetRange] ); // Update popper position - const { styles: popperStyles, attributes } = usePopperPosition({ - popperElement: popperRef.current, - popperContainer, - popperOptions, + const { style, floating } = useVirtualFloating({ placement: 'bottom-start', getBoundingClientRect, - offset: [0, 4], + middleware: [offset(4)], + ...floatingOptions, }); const menuProps = combobox @@ -99,11 +94,10 @@ const ComboboxContent = (
    {Component ? Component({ store: activeComboboxStore }) : null} diff --git a/packages/ui/nodes/font/src/ColorPicker/ColorPicker.tsx b/packages/ui/nodes/font/src/ColorPicker/ColorPicker.tsx index f34e13ba7a..350d8071a7 100644 --- a/packages/ui/nodes/font/src/ColorPicker/ColorPicker.tsx +++ b/packages/ui/nodes/font/src/ColorPicker/ColorPicker.tsx @@ -1,6 +1,5 @@ import React, { ReactNode } from 'react'; -import { Button } from '@udecode/plate-ui-button'; -import tw from 'twin.macro'; +import { PlateButton } from '@udecode/plate-ui-button'; import { getColorPickerStyles } from './ColorPicker.styles'; import { Colors } from './Colors'; import { ColorType } from './ColorType'; @@ -38,21 +37,21 @@ const ColorPickerInternal = ({ updateColor={updateColor} updateCustomColor={updateCustomColor} /> -
    +
    - +
    ); }; diff --git a/packages/ui/nodes/font/src/ColorPicker/CustomColors.tsx b/packages/ui/nodes/font/src/ColorPicker/CustomColors.tsx index e2072c8e36..f15f90c7b1 100644 --- a/packages/ui/nodes/font/src/ColorPicker/CustomColors.tsx +++ b/packages/ui/nodes/font/src/ColorPicker/CustomColors.tsx @@ -5,9 +5,8 @@ import React, { useMemo, useState, } from 'react'; -import { Button } from '@udecode/plate-ui-button'; +import { PlateButton } from '@udecode/plate-ui-button'; import debounce from 'lodash/debounce'; -import tw from 'twin.macro'; import { ColorInput } from './ColorInput'; import { Colors } from './Colors'; import { ColorType } from './ColorType'; @@ -74,7 +73,7 @@ export const CustomColors = ({ updateCustomColorDebounced(e.target.value); }} > - + CUSTOM ( - props: ImageElementStyleProps -) => { +export const getImageElementStyles = (props: ImageElementStyleProps) => { const { focused, selected, diff --git a/packages/ui/nodes/image/src/ImageElement/ImageElement.tsx b/packages/ui/nodes/image/src/ImageElement/ImageElement.tsx index 83426aae17..1427bb2a3f 100644 --- a/packages/ui/nodes/image/src/ImageElement/ImageElement.tsx +++ b/packages/ui/nodes/image/src/ImageElement/ImageElement.tsx @@ -25,11 +25,7 @@ export const ImageElement = (props: ImageElementProps) => { const styles = getImageElementStyles({ ...props, align, focused, selected }); return ( - +
    - extends ImageElementProps { +export interface ImageElementStyleProps extends ImageElementProps { selected?: boolean; focused?: boolean; } @@ -40,8 +39,8 @@ export interface ImageElementPropsCaption { readOnly?: boolean; } -export interface ImageElementProps - extends StyledElementProps, +export interface ImageElementProps + extends StyledElementProps, Pick, 'align'> { resizableProps?: Omit; diff --git a/packages/ui/nodes/link/package.json b/packages/ui/nodes/link/package.json index 8c88cf9241..bba5027b3d 100644 --- a/packages/ui/nodes/link/package.json +++ b/packages/ui/nodes/link/package.json @@ -22,6 +22,7 @@ "@udecode/plate-core": "14.4.2", "@udecode/plate-link": "14.4.2", "@udecode/plate-styled-components": "14.4.2", + "@udecode/plate-ui-button": "14.4.2", "@udecode/plate-ui-toolbar": "14.4.2" }, "peerDependencies": { diff --git a/packages/ui/nodes/link/src/LinkElement/LinkElement.tsx b/packages/ui/nodes/link/src/LinkElement/LinkElement.tsx index 238161096f..d7c32b2701 100644 --- a/packages/ui/nodes/link/src/LinkElement/LinkElement.tsx +++ b/packages/ui/nodes/link/src/LinkElement/LinkElement.tsx @@ -1,30 +1,13 @@ import React from 'react'; import { Value } from '@udecode/plate-core'; -import { TLinkElement } from '@udecode/plate-link'; -import { - getRootProps, - StyledElementProps, -} from '@udecode/plate-styled-components'; +import { Link, TLinkElement } from '@udecode/plate-link'; +import { StyledElementProps } from '@udecode/plate-styled-components'; import { getLinkElementStyles } from './LinkElement.styles'; -export const LinkElement = ( - props: StyledElementProps -) => { - const { attributes, children, nodeProps, element } = props; +export const LinkElement = (props: StyledElementProps) => { + const { as, ...rootProps } = props; - const rootProps = getRootProps(props); const { root } = getLinkElementStyles(props); - return ( - - {children} - - ); + return ; }; diff --git a/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.fixtures.tsx b/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.fixtures.tsx deleted file mode 100644 index 07c55b6b10..0000000000 --- a/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.fixtures.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/** @jsx jsx */ -import React from 'react'; -import { PlateEditor } from '@udecode/plate-core'; -import { jsx } from '@udecode/plate-test-utils'; - -jsx; - -export const input1 = (( - - - test - - - -) as any) as PlateEditor; - -export const output1 = ( - - - test - - https://i.imgur.com/removed.png - - - - -) as any; - -export const input2 = (( - - - - - https://i.imgur.com/removed.png - - - -) as any) as PlateEditor; - -export const output2 = ( - - - - - - https://i.imgur.com/removed.png - - - - -) as any; - -export const input3 = (( - - - test - - - -) as any) as PlateEditor; - -export const output3 = ( - - - test - - - -) as any; diff --git a/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.spec.tsx b/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.spec.tsx deleted file mode 100644 index 54a241de9e..0000000000 --- a/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.spec.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react'; -import { fireEvent, render } from '@testing-library/react'; -import * as core from '@udecode/plate-core'; -import { ELEMENT_H1 } from '@udecode/plate-heading'; -import { createLinkPlugin } from '@udecode/plate-link'; -import { createPlateUIEditor } from '../../../../plate/src/utils/createPlateUIEditor'; -import { LinkToolbarButton } from './LinkToolbarButton'; -import { - input1, - input2, - input3, - output1, - output2, - output3, -} from './LinkToolbarButton.fixtures'; - -describe('LinkToolbarButton', () => { - describe('when default', () => { - it('should render', () => { - const editor = createPlateUIEditor({ - editor: input1, - plugins: [createLinkPlugin()], - }); - jest.spyOn(core, 'usePlateEditorState').mockReturnValue(editor as any); - jest - .spyOn(window, 'prompt') - .mockReturnValue('https://i.imgur.com/removed.png'); - - const { getByTestId } = render(); - - const element = getByTestId('ToolbarButton'); - fireEvent.mouseDown(element); - - expect(editor.children).toEqual(output1.children); - }); - }); - - describe('when with url', () => { - it('should render', () => { - const editor = createPlateUIEditor({ - editor: input2, - plugins: [createLinkPlugin()], - }); - jest.spyOn(core, 'usePlateEditorState').mockReturnValue(editor as any); - const prompt = jest - .spyOn(window, 'prompt') - .mockReturnValue('https://i.imgur.com/changed.png'); - - const { getByTestId } = render( - - ); - - const element = getByTestId('ToolbarButton'); - fireEvent.mouseDown(element); - - expect(prompt).toHaveBeenCalledWith( - 'Enter the URL of the link:', - 'https://i.imgur.com/removed.png' - ); - - expect(editor.children).toEqual(output2.children); - }); - }); - - describe('when without url', () => { - it('should render', () => { - const editor = input3; - jest.spyOn(core, 'usePlateEditorState').mockReturnValue(editor as any); - jest.spyOn(window, 'prompt').mockReturnValue(''); - - const { getByTestId } = render( - - ); - - const element = getByTestId('ToolbarButton'); - fireEvent.mouseDown(element); - - expect(editor.children).toEqual(output3.children); - }); - }); -}); diff --git a/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.tsx b/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.tsx index ab86ffdfc5..e651cb81ae 100644 --- a/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.tsx +++ b/packages/ui/nodes/link/src/LinkToolbarButton/LinkToolbarButton.tsx @@ -1,12 +1,13 @@ import React from 'react'; import { + focusEditor, getPluginType, someNode, useEventPlateId, usePlateEditorState, withPlateEventProvider, } from '@udecode/plate-core'; -import { ELEMENT_LINK, getAndUpsertLink } from '@udecode/plate-link'; +import { ELEMENT_LINK, triggerFloatingLink } from '@udecode/plate-link'; import { ToolbarButton, ToolbarButtonProps } from '@udecode/plate-ui-toolbar'; export interface LinkToolbarButtonProps extends ToolbarButtonProps { @@ -31,7 +32,13 @@ export const LinkToolbarButton = withPlateEventProvider( if (!editor) return; event.preventDefault(); - getAndUpsertLink(editor, getLinkUrl); + event.stopPropagation(); + + focusEditor(editor, editor.selection ?? editor.prevSelection!); + + setTimeout(() => { + triggerFloatingLink(editor, { focused: true }); + }, 0); }} {...props} /> diff --git a/packages/ui/nodes/link/src/PlateFloatingLink.tsx b/packages/ui/nodes/link/src/PlateFloatingLink.tsx new file mode 100644 index 0000000000..befe61c55a --- /dev/null +++ b/packages/ui/nodes/link/src/PlateFloatingLink.tsx @@ -0,0 +1,99 @@ +import React from 'react'; +import { + FloatingLink, + LaunchIcon, + LinkIcon, + LinkOffIcon, + ShortTextIcon, + useFloatingLinkSelectors, +} from '@udecode/plate-link'; +import { plateButtonCss } from '@udecode/plate-ui-button'; +import styled, { css } from 'styled-components'; +import tw from 'twin.macro'; + +const IconWrapper = styled.div` + ${tw`flex items-center px-2 text-gray-400`}; +`; + +const InputWrapper = styled.div` + ${tw`flex items-center py-1`}; +`; + +const inputCss = [ + tw`border-none bg-transparent h-8 flex-grow p-0`, + tw`focus:outline-none`, + css` + line-height: 20px; + `, +]; + +export const floatingLinkRootCss = css` + ${tw`bg-white !z-20`}; + + border-radius: 4px; + box-shadow: rgb(15 15 15 / 5%) 0 0 0 1px, rgb(15 15 15 / 10%) 0 3px 6px, + rgb(15 15 15 / 20%) 0 9px 24px; +`; + +const VerticalDivider = () =>
    ; + +const buttonCss = [...plateButtonCss, tw`px-1`]; + +export const PlateFloatingLink = () => { + const isEditing = useFloatingLinkSelectors().isEditing(); + + const input = ( +
    + + + + + + + + +
    + + + + + + + +
    + ); + + const editContent = !isEditing ? ( +
    + + Edit link + + + + + + + + + + + + + +
    + ) : ( + input + ); + + return ( + <> + + {input} + + + + {editContent} + + + ); +}; diff --git a/packages/ui/nodes/link/src/index.ts b/packages/ui/nodes/link/src/index.ts index de9364860b..cdfe8a5ee8 100644 --- a/packages/ui/nodes/link/src/index.ts +++ b/packages/ui/nodes/link/src/index.ts @@ -2,5 +2,6 @@ * @file Automatically generated by barrelsby. */ +export * from './PlateFloatingLink'; export * from './LinkElement/index'; export * from './LinkToolbarButton/index'; diff --git a/packages/ui/nodes/media-embed/src/MediaEmbedElement/utils/parseEmbedUrl.ts b/packages/ui/nodes/media-embed/src/MediaEmbedElement/utils/parseEmbedUrl.ts index f8a5614845..723176d25b 100644 --- a/packages/ui/nodes/media-embed/src/MediaEmbedElement/utils/parseEmbedUrl.ts +++ b/packages/ui/nodes/media-embed/src/MediaEmbedElement/utils/parseEmbedUrl.ts @@ -1,7 +1,13 @@ import { parseTwitterUrl } from './parseTwitterUrl'; import { parseVideoUrl } from './parseVideoUrl'; -export type EmbedProviders = 'twitter' | 'youtube' | 'vimeo' | 'dailymotion' | 'youku' | 'coub' +export type EmbedProviders = + | 'twitter' + | 'youtube' + | 'vimeo' + | 'dailymotion' + | 'youku' + | 'coub'; export type EmbedUrlData = { url?: string; diff --git a/packages/ui/plate/package.json b/packages/ui/plate/package.json index 55c3b4f8a8..9b124aaba0 100644 --- a/packages/ui/plate/package.json +++ b/packages/ui/plate/package.json @@ -38,7 +38,6 @@ "@udecode/plate-ui-mention": "14.4.2", "@udecode/plate-ui-placeholder": "14.4.2", "@udecode/plate-ui-popover": "14.4.2", - "@udecode/plate-ui-popper": "14.4.2", "@udecode/plate-ui-table": "14.4.2", "@udecode/plate-ui-toolbar": "14.4.2" }, diff --git a/packages/ui/plate/src/index.tsx b/packages/ui/plate/src/index.tsx index 75da336194..181b7878c5 100644 --- a/packages/ui/plate/src/index.tsx +++ b/packages/ui/plate/src/index.tsx @@ -19,7 +19,6 @@ export * from '@udecode/plate-ui-list'; export * from '@udecode/plate-ui-media-embed'; export * from '@udecode/plate-ui-mention'; export * from '@udecode/plate-ui-placeholder'; -export * from '@udecode/plate-ui-popper'; export * from '@udecode/plate-ui-table'; export * from '@udecode/plate-ui-toolbar'; export * from '@udecode/plate-ui-button'; diff --git a/packages/ui/popover/src/Popover/Popover.styles.ts b/packages/ui/popover/src/Popover/Popover.styles.ts index da16050f67..4e1807ae1f 100644 --- a/packages/ui/popover/src/Popover/Popover.styles.ts +++ b/packages/ui/popover/src/Popover/Popover.styles.ts @@ -12,8 +12,8 @@ export const getPopoverStyles = (props: StyledProps) => border-radius: 3px; max-width: 350px; font-size: 14px; - box-shadow: rgba(9, 30, 66, 0.31) 0 0 1px, - rgba(9, 30, 66, 0.25) 0 4px 8px -2px; + box-shadow: rgb(15 15 15 / 5%) 0 0 0 1px, + rgb(15 15 15 / 10%) 0 3px 6px, rgb(15 15 15 / 20%) 0 9px 24px; `, ], } diff --git a/packages/ui/popper/package.json b/packages/ui/popper/package.json index d52e3cb82f..d34293d573 100644 --- a/packages/ui/popper/package.json +++ b/packages/ui/popper/package.json @@ -19,9 +19,7 @@ ], "types": "dist/index.d.ts", "dependencies": { - "@popperjs/core": "^2.11.5", - "@udecode/plate-core": "14.4.2", - "react-popper": "^2.3.0" + "@udecode/plate-core": "14.4.2" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/ui/popper/src/getSelectionBoundingClientRect.ts b/packages/ui/popper/src/getSelectionBoundingClientRect.ts deleted file mode 100644 index 2daab6b7f6..0000000000 --- a/packages/ui/popper/src/getSelectionBoundingClientRect.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Get bounding client rect of the window selection - */ -export const getSelectionBoundingClientRect = () => { - const domSelection = window.getSelection(); - if (!domSelection || domSelection.rangeCount < 1) return; - - const domRange = domSelection.getRangeAt(0); - - return domRange.getBoundingClientRect(); -}; diff --git a/packages/ui/popper/src/index.ts b/packages/ui/popper/src/index.ts index f3972363f6..c5322bbbe1 100644 --- a/packages/ui/popper/src/index.ts +++ b/packages/ui/popper/src/index.ts @@ -2,6 +2,4 @@ * @file Automatically generated by barrelsby. */ -export * from './getRangeBoundingClientRect'; -export * from './getSelectionBoundingClientRect'; -export * from './usePopperPosition'; +export * from './popper'; diff --git a/packages/ui/popper/src/popper.ts b/packages/ui/popper/src/popper.ts new file mode 100644 index 0000000000..32f4056e4b --- /dev/null +++ b/packages/ui/popper/src/popper.ts @@ -0,0 +1 @@ +export const _popper = 0; diff --git a/packages/ui/popper/src/usePopperPosition.ts b/packages/ui/popper/src/usePopperPosition.ts deleted file mode 100644 index 122763e93c..0000000000 --- a/packages/ui/popper/src/usePopperPosition.ts +++ /dev/null @@ -1,131 +0,0 @@ -import React, { useCallback, useEffect } from 'react'; -import { usePopper } from 'react-popper'; -import * as PopperJS from '@popperjs/core'; -import { Modifier } from '@popperjs/core'; -import { getSelectionBoundingClientRect } from './getSelectionBoundingClientRect'; - -export type UsePopperOptions = Omit, 'modifiers'> & { - createPopper?: typeof PopperJS.createPopper; - modifiers?: ReadonlyArray>>; -}; - -export interface UsePopperReturnType { - styles: { [key: string]: React.CSSProperties }; - attributes: { [key: string]: { [key: string]: string } | undefined }; - state: PopperJS.State | null; - update: PopperJS.Instance['update'] | null; - forceUpdate: PopperJS.Instance['forceUpdate'] | null; -} - -export interface UsePopperPositionOptions { - popperElement: HTMLElement | null; - - /** - * Container element of editor popper, - * if no scroll container provided, it will take document.documentElement as scrolling container - */ - popperContainer?: Document | HTMLElement | null; - popperOptions?: Partial; - modifiers?: UsePopperOptions['modifiers']; - placement?: PopperJS.Placement; - isHidden?: boolean; - getBoundingClientRect?: any; - offset?: number[]; -} - -export const virtualReference: PopperJS.VirtualElement = { - getBoundingClientRect() { - return { - top: -9999, - left: -9999, - bottom: 9999, - right: 9999, - width: 90, - height: 10, - x: 0, - y: 0, - toJSON: () => null, - }; - }, -}; - -/** - * TODO: duplicate - */ -export const usePopperPosition = ({ - popperElement, - popperContainer = document, - popperOptions = {}, - modifiers = [], - offset = [0, 0], - placement = 'auto', - isHidden = false, - getBoundingClientRect = getSelectionBoundingClientRect, -}: UsePopperPositionOptions): UsePopperReturnType => { - const popperResult = usePopper(virtualReference, popperElement, { - placement, - modifiers: [ - // default modifiers to position the popper correctly - { - name: 'preventOverflow', - enabled: true, - options: { boundary: popperContainer }, - }, - { - name: 'flip', - enabled: true, - options: { padding: 8 }, - }, - { - name: 'eventListeners', - enabled: true, - options: { scroll: !isHidden, resize: true }, - }, - { - name: 'offset', - options: { - offset, - }, - }, - { - name: 'computeStyles', - options: { - gpuAcceleration: false, - }, - }, - // user modifiers to override the default - ...modifiers, - ], - strategy: 'absolute', - ...popperOptions, - }); - - const { update, state } = popperResult; - const isReady = !isHidden && !!state; - - const styles = isReady - ? popperResult.styles - : { - ...popperResult.styles, - popper: { ...popperResult.styles.popper, display: 'none' }, - }; - - const updatePosition = useCallback((): any => { - if (isHidden) return; - if (!popperElement) return; - - virtualReference.getBoundingClientRect = getBoundingClientRect; - update?.(); - }, [getBoundingClientRect, isHidden, popperElement, update]); - - useEffect(() => { - updatePosition(); - }, [updatePosition]); - - useEffect(() => { - popperContainer?.addEventListener('scroll', updatePosition); - return () => popperContainer?.removeEventListener('scroll', updatePosition); - }, [updatePosition, popperContainer]); - - return { ...popperResult, update: updatePosition, styles }; -}; diff --git a/packages/ui/toolbar/package.json b/packages/ui/toolbar/package.json index cc1086cdcc..fdb416b084 100644 --- a/packages/ui/toolbar/package.json +++ b/packages/ui/toolbar/package.json @@ -21,9 +21,8 @@ "dependencies": { "@tippyjs/react": "^4.2.6", "@udecode/plate-core": "14.4.2", + "@udecode/plate-floating": "14.4.2", "@udecode/plate-styled-components": "14.4.2", - "@udecode/plate-ui-popper": "14.4.2", - "react-popper": "^2.3.0", "react-use": "^17.3.2" }, "peerDependencies": { diff --git a/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.styles.ts b/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.styles.ts index de8d727527..071c27977a 100644 --- a/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.styles.ts +++ b/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.styles.ts @@ -17,7 +17,7 @@ export const getBalloonToolbarStyles = (props: BalloonToolbarStyleProps) => { borderColor = 'rgb(196, 196, 196)'; } - const { placement = 'top' } = props.popperOptions ?? {}; + const { placement = 'top' } = props; const arrowStyle: CSSProp = [ props.arrow && diff --git a/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.tsx b/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.tsx index a6dda04be6..881173a67d 100644 --- a/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.tsx +++ b/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.tsx @@ -1,11 +1,10 @@ -import React, { useRef } from 'react'; +import React from 'react'; import { withPlateEventProvider } from '@udecode/plate-core'; import { PortalBody } from '@udecode/plate-styled-components'; -import { UsePopperPositionOptions } from '@udecode/plate-ui-popper'; import { ToolbarBase } from '../Toolbar/Toolbar'; import { getBalloonToolbarStyles } from './BalloonToolbar.styles'; import { BalloonToolbarProps } from './BalloonToolbar.types'; -import { useBalloonToolbarPopper } from './useBalloonToolbarPopper'; +import { useFloatingToolbar } from './useFloatingToolbar'; export const BalloonToolbar = withPlateEventProvider( (props: BalloonToolbarProps) => { @@ -14,37 +13,29 @@ export const BalloonToolbar = withPlateEventProvider( theme = 'dark', arrow = false, portalElement, - popperOptions: _popperOptions = {}, + floatingOptions, } = props; - const popperRef = useRef(null); - - const popperOptions: UsePopperPositionOptions = { - popperElement: popperRef.current, - placement: 'top' as any, - offset: [0, 8], - ..._popperOptions, - }; - - const { styles: popperStyles, attributes } = useBalloonToolbarPopper( - popperOptions - ); + const { floating, style, placement, open } = useFloatingToolbar({ + floatingOptions, + }); const styles = getBalloonToolbarStyles({ - popperOptions, + placement, theme, arrow, ...props, }); + if (!open) return null; + return ( {children} diff --git a/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.types.ts b/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.types.ts index 9dd55ddb28..40c61c4661 100644 --- a/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.types.ts +++ b/packages/ui/toolbar/src/BalloonToolbar/BalloonToolbar.types.ts @@ -1,9 +1,11 @@ import { ReactNode } from 'react'; +import { UseVirtualFloatingOptions } from '@udecode/plate-floating'; import { StyledProps } from '@udecode/plate-styled-components'; -import { UsePopperPositionOptions } from '@udecode/plate-ui-popper'; import { ToolbarProps } from '../Toolbar/Toolbar.types'; -export interface BalloonToolbarStyleProps extends BalloonToolbarProps {} +export interface BalloonToolbarStyleProps extends BalloonToolbarProps { + placement?: string; +} export interface BalloonToolbarProps extends StyledProps { children: ReactNode; @@ -20,5 +22,5 @@ export interface BalloonToolbarProps extends StyledProps { portalElement?: Element; - popperOptions?: Partial; + floatingOptions?: UseVirtualFloatingOptions; } diff --git a/packages/ui/toolbar/src/BalloonToolbar/index.ts b/packages/ui/toolbar/src/BalloonToolbar/index.ts index 692e06a2e4..f04e6a2e56 100644 --- a/packages/ui/toolbar/src/BalloonToolbar/index.ts +++ b/packages/ui/toolbar/src/BalloonToolbar/index.ts @@ -5,4 +5,4 @@ export * from './BalloonToolbar.styles'; export * from './BalloonToolbar'; export * from './BalloonToolbar.types'; -export * from './useBalloonToolbarPopper'; +export * from './useFloatingToolbar'; diff --git a/packages/ui/toolbar/src/BalloonToolbar/useBalloonToolbarPopper.ts b/packages/ui/toolbar/src/BalloonToolbar/useBalloonToolbarPopper.ts deleted file mode 100644 index 02a01f5e4b..0000000000 --- a/packages/ui/toolbar/src/BalloonToolbar/useBalloonToolbarPopper.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { useEffect, useState } from 'react'; -import { - getSelectionText, - isSelectionExpanded, - useEditorState, - useEventEditorSelectors, -} from '@udecode/plate-core'; -import { - getSelectionBoundingClientRect, - usePopperPosition, - UsePopperPositionOptions, -} from '@udecode/plate-ui-popper'; -import { useFocused } from 'slate-react'; - -export const useBalloonToolbarPopper = (options: UsePopperPositionOptions) => { - const focusedEditorId = useEventEditorSelectors.focus(); - const editor = useEditorState(); - const focused = useFocused(); - - const [isHidden, setIsHidden] = useState(true); - - const selectionExpanded = editor && isSelectionExpanded(editor); - const selectionText = editor && getSelectionText(editor); - - useEffect(() => { - if ( - !selectionExpanded || - !selectionText || - !focused || - editor.id !== focusedEditorId - ) { - setIsHidden(true); - } else if (selectionText && selectionExpanded) { - setIsHidden(false); - } - }, [ - editor.id, - editor.selection, - focused, - focusedEditorId, - selectionExpanded, - selectionText, - ]); - - const popperResult = usePopperPosition({ - isHidden, - getBoundingClientRect: getSelectionBoundingClientRect, - ...options, - }); - - const selectionTextLength = selectionText?.length ?? 0; - const { update } = popperResult; - - useEffect(() => { - if (selectionTextLength > 0) { - update?.(); - } - }, [selectionTextLength, update]); - - return popperResult; -}; diff --git a/packages/ui/toolbar/src/BalloonToolbar/useFloatingToolbar.ts b/packages/ui/toolbar/src/BalloonToolbar/useFloatingToolbar.ts new file mode 100644 index 0000000000..f1bab147d8 --- /dev/null +++ b/packages/ui/toolbar/src/BalloonToolbar/useFloatingToolbar.ts @@ -0,0 +1,99 @@ +import { useEffect, useState } from 'react'; +import { + getSelectionText, + isSelectionExpanded, + mergeProps, + useEditorState, + useEventEditorSelectors, +} from '@udecode/plate-core'; +import { + flip, + getSelectionBoundingClientRect, + offset, + useVirtualFloating, + UseVirtualFloatingOptions, + UseVirtualFloatingReturn, +} from '@udecode/plate-floating'; +import { useFocused } from 'slate-react'; + +export const useFloatingToolbar = ({ + floatingOptions, +}: { + floatingOptions?: UseVirtualFloatingOptions; +} = {}): UseVirtualFloatingReturn & { + open: boolean; +} => { + const focusedEditorId = useEventEditorSelectors.focus(); + const editor = useEditorState(); + const focused = useFocused(); + + const [waitForCollapsedSelection, setWaitForCollapsedSelection] = useState( + false + ); + + const [open, setOpen] = useState(false); + + const selectionExpanded = editor && isSelectionExpanded(editor); + const selectionText = editor && getSelectionText(editor); + + // On refocus, the editor keeps the previous selection, + // so we need to wait it's collapsed at the new position before displaying the floating toolbar. + useEffect(() => { + if (!focused) { + setWaitForCollapsedSelection(true); + } + + if (!selectionExpanded) { + setWaitForCollapsedSelection(false); + } + }, [focused, selectionExpanded]); + + useEffect(() => { + if (!selectionExpanded || !selectionText || editor.id !== focusedEditorId) { + setOpen(false); + } else if ( + selectionText && + selectionExpanded && + !waitForCollapsedSelection + ) { + setOpen(true); + } + }, [ + editor.id, + editor.selection, + focusedEditorId, + selectionExpanded, + selectionText, + waitForCollapsedSelection, + ]); + + const floatingResult = useVirtualFloating( + mergeProps( + { + middleware: [ + offset(12), + flip({ + padding: 150, + }), + ], + placement: 'top', + getBoundingClientRect: getSelectionBoundingClientRect, + open, + onOpenChange: setOpen, + }, + floatingOptions + ) + ); + + const { update } = floatingResult; + + const selectionTextLength = selectionText?.length ?? 0; + + useEffect(() => { + if (selectionTextLength > 0) { + update?.(); + } + }, [selectionTextLength, update]); + + return { ...floatingResult, open }; +}; diff --git a/scripts/index.ts b/scripts/index.ts deleted file mode 100644 index b6b4d16432..0000000000 --- a/scripts/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @file Automatically generated by barrelsby. - */ - -export * from "./setupTests"; -export * from "./templates/menu/src/index"; -export * from "./templates/menu/src/Menu/index"; -export * from "./templates/menu/src/MenuButton/index"; -export * from "./types/twin"; diff --git a/yarn.lock b/yarn.lock index 5b94f2d94a..023ac34ddb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1972,6 +1972,49 @@ __metadata: languageName: node linkType: hard +"@floating-ui/core@npm:^0.7.3": + version: 0.7.3 + resolution: "@floating-ui/core@npm:0.7.3" + checksum: 8679a95a08393f8fcb7c7dfa6600b742e34b2795650316b55aa6f9c3d9298564166f133e138a8a224b102853e346a9cb8bf843ba839abf470e52d0d91fea1a54 + languageName: node + linkType: hard + +"@floating-ui/dom@npm:^0.5.3": + version: 0.5.4 + resolution: "@floating-ui/dom@npm:0.5.4" + dependencies: + "@floating-ui/core": "npm:^0.7.3" + checksum: 55e225e10a351de10553321b6581ebd63e8cd5f050fe3bc73ab7085ec966799dab55ba10a218d43206703ae5397fc4b11082aa620fad9de563a2b6b679455ea9 + languageName: node + linkType: hard + +"@floating-ui/react-dom-interactions@npm:^0.6.6": + version: 0.6.6 + resolution: "@floating-ui/react-dom-interactions@npm:0.6.6" + dependencies: + "@floating-ui/react-dom": "npm:^0.7.2" + aria-hidden: "npm:^1.1.3" + use-isomorphic-layout-effect: "npm:^1.1.1" + peerDependencies: + react: ">=16.8.0" + react-dom: ">=16.8.0" + checksum: 92638badb2d9039d2fd8ada001303539bb49a06664cb5067d9384334ea27b47a929db490640fc8693574fdb92fecd52c6c1f3b4061900b595561b8861ec24443 + languageName: node + linkType: hard + +"@floating-ui/react-dom@npm:^0.7.2": + version: 0.7.2 + resolution: "@floating-ui/react-dom@npm:0.7.2" + dependencies: + "@floating-ui/dom": "npm:^0.5.3" + use-isomorphic-layout-effect: "npm:^1.1.1" + peerDependencies: + react: ">=16.8.0" + react-dom: ">=16.8.0" + checksum: e60cb41affea77347c37515d02ced104a69b2bc69621d92a17b0526084b89c10a21a6617f0dd482aa4c6613fed81222794756225f7fb54e3c409716191290c08 + languageName: node + linkType: hard + "@gar/promisify@npm:^1.0.1, @gar/promisify@npm:^1.1.3": version: 1.1.3 resolution: "@gar/promisify@npm:1.1.3" @@ -3563,7 +3606,7 @@ __metadata: languageName: node linkType: hard -"@popperjs/core@npm:^2.11.5, @popperjs/core@npm:^2.9.0": +"@popperjs/core@npm:^2.9.0": version: 2.11.5 resolution: "@popperjs/core@npm:2.11.5" checksum: 868c9c5fc2765417d55e8a0a2449b9b8ec3f613b626a12905b9700f8413b433a1ee37ec581a929e0c51ea00a32a7fe5b58ea75d3772d7d85146ecdbd0288331b @@ -4850,11 +4893,11 @@ __metadata: languageName: node linkType: hard -"@udecode/plate-alignment@npm:14.0.2, @udecode/plate-alignment@workspace:packages/nodes/alignment": +"@udecode/plate-alignment@npm:14.4.2, @udecode/plate-alignment@workspace:packages/nodes/alignment": version: 0.0.0-use.local resolution: "@udecode/plate-alignment@workspace:packages/nodes/alignment" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -4864,11 +4907,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-autoformat@npm:14.3.0, @udecode/plate-autoformat@workspace:packages/editor/autoformat": +"@udecode/plate-autoformat@npm:14.4.2, @udecode/plate-autoformat@workspace:packages/editor/autoformat": version: 0.0.0-use.local resolution: "@udecode/plate-autoformat@workspace:packages/editor/autoformat" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -4878,15 +4921,15 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-basic-elements@npm:14.0.2, @udecode/plate-basic-elements@workspace:packages/nodes/basic-elements": +"@udecode/plate-basic-elements@npm:14.4.2, @udecode/plate-basic-elements@workspace:packages/nodes/basic-elements": version: 0.0.0-use.local resolution: "@udecode/plate-basic-elements@workspace:packages/nodes/basic-elements" dependencies: - "@udecode/plate-block-quote": "npm:14.0.2" - "@udecode/plate-code-block": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-heading": "npm:14.0.2" - "@udecode/plate-paragraph": "npm:14.0.2" + "@udecode/plate-block-quote": "npm:14.4.2" + "@udecode/plate-code-block": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-heading": "npm:14.4.2" + "@udecode/plate-paragraph": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -4896,11 +4939,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-basic-marks@npm:14.0.2, @udecode/plate-basic-marks@workspace:packages/nodes/basic-marks": +"@udecode/plate-basic-marks@npm:14.4.2, @udecode/plate-basic-marks@workspace:packages/nodes/basic-marks": version: 0.0.0-use.local resolution: "@udecode/plate-basic-marks@workspace:packages/nodes/basic-marks" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -4910,11 +4953,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-block-quote@npm:14.0.2, @udecode/plate-block-quote@workspace:packages/nodes/block-quote": +"@udecode/plate-block-quote@npm:14.4.2, @udecode/plate-block-quote@workspace:packages/nodes/block-quote": version: 0.0.0-use.local resolution: "@udecode/plate-block-quote@workspace:packages/nodes/block-quote" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -4924,11 +4967,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-break@npm:14.0.2, @udecode/plate-break@workspace:packages/editor/break": +"@udecode/plate-break@npm:14.4.2, @udecode/plate-break@workspace:packages/editor/break": version: 0.0.0-use.local resolution: "@udecode/plate-break@workspace:packages/editor/break" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -4938,11 +4981,25 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-code-block@npm:14.0.2, @udecode/plate-code-block@workspace:packages/nodes/code-block": +"@udecode/plate-button@npm:14.4.2, @udecode/plate-button@workspace:packages/button": + version: 0.0.0-use.local + resolution: "@udecode/plate-button@workspace:packages/button" + dependencies: + "@udecode/plate-core": "npm:14.4.2" + peerDependencies: + react: ">=16.8.0" + react-dom: ">=16.8.0" + slate: ">=0.66.1" + slate-history: ">=0.66.0" + slate-react: ">=0.74.2" + languageName: unknown + linkType: soft + +"@udecode/plate-code-block@npm:14.4.2, @udecode/plate-code-block@workspace:packages/nodes/code-block": version: 0.0.0-use.local resolution: "@udecode/plate-code-block@workspace:packages/nodes/code-block" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" prismjs: "npm:^1.25.0" peerDependencies: react: ">=16.8.0" @@ -4953,11 +5010,12 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-combobox@npm:14.0.2, @udecode/plate-combobox@workspace:packages/editor/combobox": +"@udecode/plate-combobox@npm:14.4.2, @udecode/plate-combobox@workspace:packages/editor/combobox": version: 0.0.0-use.local resolution: "@udecode/plate-combobox@workspace:packages/editor/combobox" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-floating": "npm:14.4.2" downshift: "npm:^6.1.7" peerDependencies: react: ">=16.8.0" @@ -4968,7 +5026,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-core@npm:14.0.2, @udecode/plate-core@workspace:packages/core": +"@udecode/plate-core@npm:14.4.2, @udecode/plate-core@workspace:packages/core": version: 0.0.0-use.local resolution: "@udecode/plate-core@workspace:packages/core" dependencies: @@ -4977,6 +5035,7 @@ __metadata: clsx: "npm:^1.1.1" jotai: "npm:^1.7.2" lodash: "npm:^4.17.21" + react-hotkeys-hook: "npm:^3.4.6" use-deep-compare: "npm:^1.1.0" zustand: "npm:^3.7.2" peerDependencies: @@ -4988,11 +5047,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-find-replace@npm:14.0.2, @udecode/plate-find-replace@workspace:packages/decorators/find-replace": +"@udecode/plate-find-replace@npm:14.4.2, @udecode/plate-find-replace@workspace:packages/decorators/find-replace": version: 0.0.0-use.local resolution: "@udecode/plate-find-replace@workspace:packages/decorators/find-replace" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5002,11 +5061,26 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-font@npm:14.0.2, @udecode/plate-font@workspace:packages/nodes/font": +"@udecode/plate-floating@npm:14.4.2, @udecode/plate-floating@workspace:packages/floating": + version: 0.0.0-use.local + resolution: "@udecode/plate-floating@workspace:packages/floating" + dependencies: + "@floating-ui/react-dom-interactions": "npm:^0.6.6" + "@udecode/plate-core": "npm:14.4.2" + peerDependencies: + react: ">=16.8.0" + react-dom: ">=16.8.0" + slate: ">=0.66.1" + slate-history: ">=0.66.0" + slate-react: ">=0.74.2" + languageName: unknown + linkType: soft + +"@udecode/plate-font@npm:14.4.2, @udecode/plate-font@workspace:packages/nodes/font": version: 0.0.0-use.local resolution: "@udecode/plate-font@workspace:packages/nodes/font" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5016,11 +5090,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-heading@npm:14.0.2, @udecode/plate-heading@workspace:packages/nodes/heading": +"@udecode/plate-heading@npm:14.4.2, @udecode/plate-heading@workspace:packages/nodes/heading": version: 0.0.0-use.local resolution: "@udecode/plate-heading@workspace:packages/nodes/heading" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5030,44 +5104,46 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-headless@npm:14.4.1, @udecode/plate-headless@workspace:packages/headless": +"@udecode/plate-headless@npm:14.4.3, @udecode/plate-headless@workspace:packages/headless": version: 0.0.0-use.local resolution: "@udecode/plate-headless@workspace:packages/headless" dependencies: - "@udecode/plate-alignment": "npm:14.0.2" - "@udecode/plate-autoformat": "npm:14.3.0" - "@udecode/plate-basic-elements": "npm:14.0.2" - "@udecode/plate-basic-marks": "npm:14.0.2" - "@udecode/plate-block-quote": "npm:14.0.2" - "@udecode/plate-break": "npm:14.0.2" - "@udecode/plate-code-block": "npm:14.0.2" - "@udecode/plate-combobox": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-find-replace": "npm:14.0.2" - "@udecode/plate-font": "npm:14.0.2" - "@udecode/plate-heading": "npm:14.0.2" - "@udecode/plate-highlight": "npm:14.0.2" - "@udecode/plate-horizontal-rule": "npm:14.0.2" - "@udecode/plate-image": "npm:14.2.0" - "@udecode/plate-indent": "npm:14.0.2" - "@udecode/plate-indent-list": "npm:14.4.0" - "@udecode/plate-kbd": "npm:14.0.2" - "@udecode/plate-line-height": "npm:14.0.2" - "@udecode/plate-link": "npm:14.4.1" - "@udecode/plate-list": "npm:14.4.0" - "@udecode/plate-media-embed": "npm:14.0.2" - "@udecode/plate-mention": "npm:14.0.2" - "@udecode/plate-node-id": "npm:14.0.2" - "@udecode/plate-normalizers": "npm:14.0.2" - "@udecode/plate-paragraph": "npm:14.0.2" - "@udecode/plate-reset-node": "npm:14.0.2" - "@udecode/plate-select": "npm:14.0.2" - "@udecode/plate-serializer-csv": "npm:14.0.2" - "@udecode/plate-serializer-docx": "npm:14.4.0" - "@udecode/plate-serializer-html": "npm:14.0.2" - "@udecode/plate-serializer-md": "npm:14.4.1" - "@udecode/plate-table": "npm:14.0.2" - "@udecode/plate-trailing-block": "npm:14.0.2" + "@udecode/plate-alignment": "npm:14.4.2" + "@udecode/plate-autoformat": "npm:14.4.2" + "@udecode/plate-basic-elements": "npm:14.4.2" + "@udecode/plate-basic-marks": "npm:14.4.2" + "@udecode/plate-block-quote": "npm:14.4.2" + "@udecode/plate-break": "npm:14.4.2" + "@udecode/plate-button": "npm:14.4.2" + "@udecode/plate-code-block": "npm:14.4.2" + "@udecode/plate-combobox": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-find-replace": "npm:14.4.2" + "@udecode/plate-floating": "npm:14.4.2" + "@udecode/plate-font": "npm:14.4.2" + "@udecode/plate-heading": "npm:14.4.2" + "@udecode/plate-highlight": "npm:14.4.2" + "@udecode/plate-horizontal-rule": "npm:14.4.2" + "@udecode/plate-image": "npm:14.4.2" + "@udecode/plate-indent": "npm:14.4.2" + "@udecode/plate-indent-list": "npm:14.4.3" + "@udecode/plate-kbd": "npm:14.4.2" + "@udecode/plate-line-height": "npm:14.4.2" + "@udecode/plate-link": "npm:14.4.2" + "@udecode/plate-list": "npm:14.4.3" + "@udecode/plate-media-embed": "npm:14.4.2" + "@udecode/plate-mention": "npm:14.4.2" + "@udecode/plate-node-id": "npm:14.4.2" + "@udecode/plate-normalizers": "npm:14.4.2" + "@udecode/plate-paragraph": "npm:14.4.2" + "@udecode/plate-reset-node": "npm:14.4.2" + "@udecode/plate-select": "npm:14.4.2" + "@udecode/plate-serializer-csv": "npm:14.4.2" + "@udecode/plate-serializer-docx": "npm:14.4.3" + "@udecode/plate-serializer-html": "npm:14.4.2" + "@udecode/plate-serializer-md": "npm:14.4.3" + "@udecode/plate-table": "npm:14.4.2" + "@udecode/plate-trailing-block": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5078,11 +5154,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-highlight@npm:14.0.2, @udecode/plate-highlight@workspace:packages/nodes/highlight": +"@udecode/plate-highlight@npm:14.4.2, @udecode/plate-highlight@workspace:packages/nodes/highlight": version: 0.0.0-use.local resolution: "@udecode/plate-highlight@workspace:packages/nodes/highlight" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5092,11 +5168,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-horizontal-rule@npm:14.0.2, @udecode/plate-horizontal-rule@workspace:packages/nodes/horizontal-rule": +"@udecode/plate-horizontal-rule@npm:14.4.2, @udecode/plate-horizontal-rule@workspace:packages/nodes/horizontal-rule": version: 0.0.0-use.local resolution: "@udecode/plate-horizontal-rule@workspace:packages/nodes/horizontal-rule" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5106,11 +5182,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-image@npm:14.2.0, @udecode/plate-image@workspace:packages/nodes/image": +"@udecode/plate-image@npm:14.4.2, @udecode/plate-image@workspace:packages/nodes/image": version: 0.0.0-use.local resolution: "@udecode/plate-image@workspace:packages/nodes/image" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" re-resizable: "npm:^6.9.9" react-textarea-autosize: "npm:^8.3.3" peerDependencies: @@ -5122,13 +5198,13 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-indent-list@npm:14.4.0, @udecode/plate-indent-list@workspace:packages/nodes/indent-list": +"@udecode/plate-indent-list@npm:14.4.3, @udecode/plate-indent-list@workspace:packages/nodes/indent-list": version: 0.0.0-use.local resolution: "@udecode/plate-indent-list@workspace:packages/nodes/indent-list" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-indent": "npm:14.0.2" - "@udecode/plate-list": "npm:14.4.0" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-indent": "npm:14.4.2" + "@udecode/plate-list": "npm:14.4.3" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5138,11 +5214,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-indent@npm:14.0.2, @udecode/plate-indent@workspace:packages/nodes/indent": +"@udecode/plate-indent@npm:14.4.2, @udecode/plate-indent@workspace:packages/nodes/indent": version: 0.0.0-use.local resolution: "@udecode/plate-indent@workspace:packages/nodes/indent" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5156,7 +5232,7 @@ __metadata: version: 0.0.0-use.local resolution: "@udecode/plate-juice@workspace:packages/serializers/juice" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" juice: "npm:^8.0.0" peerDependencies: react: ">=16.8.0" @@ -5167,11 +5243,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-kbd@npm:14.0.2, @udecode/plate-kbd@workspace:packages/nodes/kbd": +"@udecode/plate-kbd@npm:14.4.2, @udecode/plate-kbd@workspace:packages/nodes/kbd": version: 0.0.0-use.local resolution: "@udecode/plate-kbd@workspace:packages/nodes/kbd" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5181,11 +5257,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-line-height@npm:14.0.2, @udecode/plate-line-height@workspace:packages/nodes/line-height": +"@udecode/plate-line-height@npm:14.4.2, @udecode/plate-line-height@workspace:packages/nodes/line-height": version: 0.0.0-use.local resolution: "@udecode/plate-line-height@workspace:packages/nodes/line-height" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5195,12 +5271,13 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-link@npm:14.4.1, @udecode/plate-link@workspace:packages/nodes/link": +"@udecode/plate-link@npm:14.4.2, @udecode/plate-link@workspace:packages/nodes/link": version: 0.0.0-use.local resolution: "@udecode/plate-link@workspace:packages/nodes/link" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-normalizers": "npm:14.0.2" + "@udecode/plate-button": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-normalizers": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5210,12 +5287,12 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-list@npm:14.4.0, @udecode/plate-list@workspace:packages/nodes/list": +"@udecode/plate-list@npm:14.4.3, @udecode/plate-list@workspace:packages/nodes/list": version: 0.0.0-use.local resolution: "@udecode/plate-list@workspace:packages/nodes/list" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-reset-node": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-reset-node": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5225,11 +5302,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-media-embed@npm:14.0.2, @udecode/plate-media-embed@workspace:packages/nodes/media-embed": +"@udecode/plate-media-embed@npm:14.4.2, @udecode/plate-media-embed@workspace:packages/nodes/media-embed": version: 0.0.0-use.local resolution: "@udecode/plate-media-embed@workspace:packages/nodes/media-embed" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5239,12 +5316,12 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-mention@npm:14.0.2, @udecode/plate-mention@workspace:packages/nodes/mention": +"@udecode/plate-mention@npm:14.4.2, @udecode/plate-mention@workspace:packages/nodes/mention": version: 0.0.0-use.local resolution: "@udecode/plate-mention@workspace:packages/nodes/mention" dependencies: - "@udecode/plate-combobox": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-combobox": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5254,11 +5331,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-node-id@npm:14.0.2, @udecode/plate-node-id@workspace:packages/editor/node-id": +"@udecode/plate-node-id@npm:14.4.2, @udecode/plate-node-id@workspace:packages/editor/node-id": version: 0.0.0-use.local resolution: "@udecode/plate-node-id@workspace:packages/editor/node-id" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5268,11 +5345,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-normalizers@npm:14.0.2, @udecode/plate-normalizers@workspace:packages/editor/normalizers": +"@udecode/plate-normalizers@npm:14.4.2, @udecode/plate-normalizers@workspace:packages/editor/normalizers": version: 0.0.0-use.local resolution: "@udecode/plate-normalizers@workspace:packages/editor/normalizers" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5282,11 +5359,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-paragraph@npm:14.0.2, @udecode/plate-paragraph@workspace:packages/nodes/paragraph": +"@udecode/plate-paragraph@npm:14.4.2, @udecode/plate-paragraph@workspace:packages/nodes/paragraph": version: 0.0.0-use.local resolution: "@udecode/plate-paragraph@workspace:packages/nodes/paragraph" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5296,11 +5373,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-reset-node@npm:14.0.2, @udecode/plate-reset-node@workspace:packages/editor/reset-node": +"@udecode/plate-reset-node@npm:14.4.2, @udecode/plate-reset-node@workspace:packages/editor/reset-node": version: 0.0.0-use.local resolution: "@udecode/plate-reset-node@workspace:packages/editor/reset-node" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5310,11 +5387,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-select@npm:14.0.2, @udecode/plate-select@workspace:packages/editor/select": +"@udecode/plate-select@npm:14.4.2, @udecode/plate-select@workspace:packages/editor/select": version: 0.0.0-use.local resolution: "@udecode/plate-select@workspace:packages/editor/select" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5324,13 +5401,13 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-serializer-csv@npm:14.0.2, @udecode/plate-serializer-csv@workspace:packages/serializers/csv": +"@udecode/plate-serializer-csv@npm:14.4.2, @udecode/plate-serializer-csv@workspace:packages/serializers/csv": version: 0.0.0-use.local resolution: "@udecode/plate-serializer-csv@workspace:packages/serializers/csv" dependencies: "@types/papaparse": "npm:^5" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-table": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-table": "npm:14.4.2" papaparse: "npm:^5.3.2" peerDependencies: react: ">=16.8.0" @@ -5341,17 +5418,17 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-serializer-docx@npm:14.4.0, @udecode/plate-serializer-docx@workspace:packages/serializers/docx": +"@udecode/plate-serializer-docx@npm:14.4.3, @udecode/plate-serializer-docx@workspace:packages/serializers/docx": version: 0.0.0-use.local resolution: "@udecode/plate-serializer-docx@workspace:packages/serializers/docx" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-heading": "npm:14.0.2" - "@udecode/plate-image": "npm:14.2.0" - "@udecode/plate-indent": "npm:14.0.2" - "@udecode/plate-indent-list": "npm:14.4.0" - "@udecode/plate-paragraph": "npm:14.0.2" - "@udecode/plate-table": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-heading": "npm:14.4.2" + "@udecode/plate-image": "npm:14.4.2" + "@udecode/plate-indent": "npm:14.4.2" + "@udecode/plate-indent-list": "npm:14.4.3" + "@udecode/plate-paragraph": "npm:14.4.2" + "@udecode/plate-table": "npm:14.4.2" validator: "npm:^13.7.0" peerDependencies: react: ">=16.8.0" @@ -5363,12 +5440,12 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-serializer-html@npm:14.0.2, @udecode/plate-serializer-html@workspace:packages/serializers/html": +"@udecode/plate-serializer-html@npm:14.4.2, @udecode/plate-serializer-html@workspace:packages/serializers/html": version: 0.0.0-use.local resolution: "@udecode/plate-serializer-html@workspace:packages/serializers/html" dependencies: "@types/papaparse": "npm:^5" - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" html-entities: "npm:^2.3.3" peerDependencies: react: ">=16.8.0" @@ -5379,17 +5456,17 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-serializer-md@npm:14.4.1, @udecode/plate-serializer-md@workspace:packages/serializers/md": +"@udecode/plate-serializer-md@npm:14.4.3, @udecode/plate-serializer-md@workspace:packages/serializers/md": version: 0.0.0-use.local resolution: "@udecode/plate-serializer-md@workspace:packages/serializers/md" dependencies: - "@udecode/plate-block-quote": "npm:14.0.2" - "@udecode/plate-code-block": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-heading": "npm:14.0.2" - "@udecode/plate-link": "npm:14.4.1" - "@udecode/plate-list": "npm:14.4.0" - "@udecode/plate-paragraph": "npm:14.0.2" + "@udecode/plate-block-quote": "npm:14.4.2" + "@udecode/plate-code-block": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-heading": "npm:14.4.2" + "@udecode/plate-link": "npm:14.4.2" + "@udecode/plate-list": "npm:14.4.3" + "@udecode/plate-paragraph": "npm:14.4.2" remark-parse: "npm:^9.0.0" remark-slate: "npm:^1.8.6" unified: "npm:^9.2.1" @@ -5402,11 +5479,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-styled-components@npm:14.0.2, @udecode/plate-styled-components@workspace:packages/ui/styled-components": +"@udecode/plate-styled-components@npm:14.4.2, @udecode/plate-styled-components@workspace:packages/ui/styled-components": version: 0.0.0-use.local resolution: "@udecode/plate-styled-components@workspace:packages/ui/styled-components" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" clsx: "npm:^1.1.1" twin.macro: "npm:2.8.2" peerDependencies: @@ -5420,11 +5497,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-table@npm:14.0.2, @udecode/plate-table@workspace:packages/nodes/table": +"@udecode/plate-table@npm:14.4.2, @udecode/plate-table@workspace:packages/nodes/table": version: 0.0.0-use.local resolution: "@udecode/plate-table@workspace:packages/nodes/table" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5443,11 +5520,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-trailing-block@npm:14.0.2, @udecode/plate-trailing-block@workspace:packages/editor/trailing-block": +"@udecode/plate-trailing-block@npm:14.4.2, @udecode/plate-trailing-block@workspace:packages/editor/trailing-block": version: 0.0.0-use.local resolution: "@udecode/plate-trailing-block@workspace:packages/editor/trailing-block" dependencies: - "@udecode/plate-core": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5457,14 +5534,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-alignment@npm:14.0.2, @udecode/plate-ui-alignment@workspace:packages/ui/nodes/alignment": +"@udecode/plate-ui-alignment@npm:14.4.2, @udecode/plate-ui-alignment@workspace:packages/ui/nodes/alignment": version: 0.0.0-use.local resolution: "@udecode/plate-ui-alignment@workspace:packages/ui/nodes/alignment" dependencies: - "@udecode/plate-alignment": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-alignment": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5475,13 +5552,13 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-block-quote@npm:14.0.2, @udecode/plate-ui-block-quote@workspace:packages/ui/nodes/block-quote": +"@udecode/plate-ui-block-quote@npm:14.4.2, @udecode/plate-ui-block-quote@workspace:packages/ui/nodes/block-quote": version: 0.0.0-use.local resolution: "@udecode/plate-ui-block-quote@workspace:packages/ui/nodes/block-quote" dependencies: - "@udecode/plate-block-quote": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-block-quote": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5492,12 +5569,13 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-button@npm:14.0.2, @udecode/plate-ui-button@workspace:packages/ui/button": +"@udecode/plate-ui-button@npm:14.4.2, @udecode/plate-ui-button@workspace:packages/ui/button": version: 0.0.0-use.local resolution: "@udecode/plate-ui-button@workspace:packages/ui/button" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-button": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5508,14 +5586,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-code-block@npm:14.0.2, @udecode/plate-ui-code-block@workspace:packages/ui/nodes/code-block": +"@udecode/plate-ui-code-block@npm:14.4.2, @udecode/plate-ui-code-block@workspace:packages/ui/nodes/code-block": version: 0.0.0-use.local resolution: "@udecode/plate-ui-code-block@workspace:packages/ui/nodes/code-block" dependencies: - "@udecode/plate-code-block": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-code-block": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5526,14 +5604,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-combobox@npm:14.0.2, @udecode/plate-ui-combobox@workspace:packages/ui/combobox": +"@udecode/plate-ui-combobox@npm:14.4.2, @udecode/plate-ui-combobox@workspace:packages/ui/combobox": version: 0.0.0-use.local resolution: "@udecode/plate-ui-combobox@workspace:packages/ui/combobox" dependencies: - "@udecode/plate-combobox": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-popper": "npm:14.0.2" + "@udecode/plate-combobox": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-floating": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5544,12 +5622,12 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-cursor@npm:14.0.2, @udecode/plate-ui-cursor@workspace:packages/ui/cursor": +"@udecode/plate-ui-cursor@npm:14.4.2, @udecode/plate-ui-cursor@workspace:packages/ui/cursor": version: 0.0.0-use.local resolution: "@udecode/plate-ui-cursor@workspace:packages/ui/cursor" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5560,14 +5638,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-dnd@npm:14.0.2, @udecode/plate-ui-dnd@workspace:packages/ui/dnd": +"@udecode/plate-ui-dnd@npm:14.4.2, @udecode/plate-ui-dnd@workspace:packages/ui/dnd": version: 0.0.0-use.local resolution: "@udecode/plate-ui-dnd@workspace:packages/ui/dnd" dependencies: "@react-hook/merged-ref": "npm:^1.3.2" "@tippyjs/react": "npm:^4.2.6" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dnd: ">=14.0.0" @@ -5585,8 +5663,8 @@ __metadata: resolution: "@udecode/plate-ui-excalidraw@workspace:packages/ui/nodes/excalidraw" dependencies: "@excalidraw/excalidraw-next": "npm:0.8.0-69b6fbb" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5597,14 +5675,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-find-replace@npm:14.0.2, @udecode/plate-ui-find-replace@workspace:packages/ui/find-replace": +"@udecode/plate-ui-find-replace@npm:14.4.2, @udecode/plate-ui-find-replace@workspace:packages/ui/find-replace": version: 0.0.0-use.local resolution: "@udecode/plate-ui-find-replace@workspace:packages/ui/find-replace" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-find-replace": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-find-replace": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5615,15 +5693,15 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-font@npm:14.0.2, @udecode/plate-ui-font@workspace:packages/ui/nodes/font": +"@udecode/plate-ui-font@npm:14.4.2, @udecode/plate-ui-font@workspace:packages/ui/nodes/font": version: 0.0.0-use.local resolution: "@udecode/plate-ui-font@workspace:packages/ui/nodes/font" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-font": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-button": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-font": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-button": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5638,9 +5716,9 @@ __metadata: version: 0.0.0-use.local resolution: "@udecode/plate-ui-horizontal-rule@workspace:packages/ui/nodes/horizontal-rule" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-horizontal-rule": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-horizontal-rule": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5650,14 +5728,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-image@npm:14.2.0, @udecode/plate-ui-image@workspace:packages/ui/nodes/image": +"@udecode/plate-ui-image@npm:14.4.2, @udecode/plate-ui-image@workspace:packages/ui/nodes/image": version: 0.0.0-use.local resolution: "@udecode/plate-ui-image@workspace:packages/ui/nodes/image" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-image": "npm:14.2.0" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-image": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5668,14 +5746,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-line-height@npm:14.0.2, @udecode/plate-ui-line-height@workspace:packages/ui/nodes/line-height": +"@udecode/plate-ui-line-height@npm:14.4.2, @udecode/plate-ui-line-height@workspace:packages/ui/nodes/line-height": version: 0.0.0-use.local resolution: "@udecode/plate-ui-line-height@workspace:packages/ui/nodes/line-height" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-line-height": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-line-height": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5686,14 +5764,15 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-link@npm:14.4.1, @udecode/plate-ui-link@workspace:packages/ui/nodes/link": +"@udecode/plate-ui-link@npm:14.4.2, @udecode/plate-ui-link@workspace:packages/ui/nodes/link": version: 0.0.0-use.local resolution: "@udecode/plate-ui-link@workspace:packages/ui/nodes/link" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-link": "npm:14.4.1" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-link": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-button": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5704,14 +5783,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-list@npm:14.4.0, @udecode/plate-ui-list@workspace:packages/ui/nodes/list": +"@udecode/plate-ui-list@npm:14.4.3, @udecode/plate-ui-list@workspace:packages/ui/nodes/list": version: 0.0.0-use.local resolution: "@udecode/plate-ui-list@workspace:packages/ui/nodes/list" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-list": "npm:14.4.0" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-list": "npm:14.4.3" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5722,14 +5801,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-media-embed@npm:14.4.0, @udecode/plate-ui-media-embed@workspace:packages/ui/nodes/media-embed": +"@udecode/plate-ui-media-embed@npm:14.4.2, @udecode/plate-ui-media-embed@workspace:packages/ui/nodes/media-embed": version: 0.0.0-use.local resolution: "@udecode/plate-ui-media-embed@workspace:packages/ui/nodes/media-embed" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-media-embed": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-media-embed": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" js-video-url-parser: "npm:0.5.1" peerDependencies: react: ">=16.8.0" @@ -5741,15 +5820,15 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-mention@npm:14.0.2, @udecode/plate-ui-mention@workspace:packages/ui/nodes/mention": +"@udecode/plate-ui-mention@npm:14.4.2, @udecode/plate-ui-mention@workspace:packages/ui/nodes/mention": version: 0.0.0-use.local resolution: "@udecode/plate-ui-mention@workspace:packages/ui/nodes/mention" dependencies: - "@udecode/plate-combobox": "npm:14.0.2" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-mention": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-combobox": "npm:14.0.2" + "@udecode/plate-combobox": "npm:14.4.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-mention": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-combobox": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5760,12 +5839,12 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-placeholder@npm:14.0.2, @udecode/plate-ui-placeholder@workspace:packages/ui/placeholder": +"@udecode/plate-ui-placeholder@npm:14.4.2, @udecode/plate-ui-placeholder@workspace:packages/ui/placeholder": version: 0.0.0-use.local resolution: "@udecode/plate-ui-placeholder@workspace:packages/ui/placeholder" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5776,13 +5855,13 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-popover@npm:14.0.2, @udecode/plate-ui-popover@workspace:packages/ui/popover": +"@udecode/plate-ui-popover@npm:14.4.2, @udecode/plate-ui-popover@workspace:packages/ui/popover": version: 0.0.0-use.local resolution: "@udecode/plate-ui-popover@workspace:packages/ui/popover" dependencies: "@tippyjs/react": "npm:^4.2.6" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5793,13 +5872,11 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-popper@npm:14.0.2, @udecode/plate-ui-popper@workspace:packages/ui/popper": +"@udecode/plate-ui-popper@workspace:packages/ui/popper": version: 0.0.0-use.local resolution: "@udecode/plate-ui-popper@workspace:packages/ui/popper" dependencies: - "@popperjs/core": "npm:^2.11.5" - "@udecode/plate-core": "npm:14.0.2" - react-popper: "npm:^2.3.0" + "@udecode/plate-core": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -5809,16 +5886,16 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-table@npm:14.0.2, @udecode/plate-ui-table@workspace:packages/ui/nodes/table": +"@udecode/plate-ui-table@npm:14.4.2, @udecode/plate-ui-table@workspace:packages/ui/nodes/table": version: 0.0.0-use.local resolution: "@udecode/plate-ui-table@workspace:packages/ui/nodes/table" dependencies: - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-table": "npm:14.0.2" - "@udecode/plate-ui-button": "npm:14.0.2" - "@udecode/plate-ui-popover": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-table": "npm:14.4.2" + "@udecode/plate-ui-button": "npm:14.4.2" + "@udecode/plate-ui-popover": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" re-resizable: "npm:^6.9.9" peerDependencies: react: ">=16.8.0" @@ -5830,15 +5907,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui-toolbar@npm:14.0.2, @udecode/plate-ui-toolbar@workspace:packages/ui/toolbar": +"@udecode/plate-ui-toolbar@npm:14.4.2, @udecode/plate-ui-toolbar@workspace:packages/ui/toolbar": version: 0.0.0-use.local resolution: "@udecode/plate-ui-toolbar@workspace:packages/ui/toolbar" dependencies: "@tippyjs/react": "npm:^4.2.6" - "@udecode/plate-core": "npm:14.0.2" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-popper": "npm:14.0.2" - react-popper: "npm:^2.3.0" + "@udecode/plate-core": "npm:14.4.2" + "@udecode/plate-floating": "npm:14.4.2" + "@udecode/plate-styled-components": "npm:14.4.2" react-use: "npm:^17.3.2" peerDependencies: react: ">=16.8.0" @@ -5850,32 +5926,31 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-ui@npm:14.4.1, @udecode/plate-ui@workspace:packages/ui/plate": +"@udecode/plate-ui@npm:14.4.3, @udecode/plate-ui@workspace:packages/ui/plate": version: 0.0.0-use.local resolution: "@udecode/plate-ui@workspace:packages/ui/plate" dependencies: - "@udecode/plate-headless": "npm:14.4.1" - "@udecode/plate-styled-components": "npm:14.0.2" - "@udecode/plate-ui-alignment": "npm:14.0.2" - "@udecode/plate-ui-block-quote": "npm:14.0.2" - "@udecode/plate-ui-button": "npm:14.0.2" - "@udecode/plate-ui-code-block": "npm:14.0.2" - "@udecode/plate-ui-combobox": "npm:14.0.2" - "@udecode/plate-ui-cursor": "npm:14.0.2" - "@udecode/plate-ui-dnd": "npm:14.0.2" - "@udecode/plate-ui-find-replace": "npm:14.0.2" - "@udecode/plate-ui-font": "npm:14.0.2" - "@udecode/plate-ui-image": "npm:14.2.0" - "@udecode/plate-ui-line-height": "npm:14.0.2" - "@udecode/plate-ui-link": "npm:14.4.1" - "@udecode/plate-ui-list": "npm:14.4.0" - "@udecode/plate-ui-media-embed": "npm:14.4.0" - "@udecode/plate-ui-mention": "npm:14.0.2" - "@udecode/plate-ui-placeholder": "npm:14.0.2" - "@udecode/plate-ui-popover": "npm:14.0.2" - "@udecode/plate-ui-popper": "npm:14.0.2" - "@udecode/plate-ui-table": "npm:14.0.2" - "@udecode/plate-ui-toolbar": "npm:14.0.2" + "@udecode/plate-headless": "npm:14.4.3" + "@udecode/plate-styled-components": "npm:14.4.2" + "@udecode/plate-ui-alignment": "npm:14.4.2" + "@udecode/plate-ui-block-quote": "npm:14.4.2" + "@udecode/plate-ui-button": "npm:14.4.2" + "@udecode/plate-ui-code-block": "npm:14.4.2" + "@udecode/plate-ui-combobox": "npm:14.4.2" + "@udecode/plate-ui-cursor": "npm:14.4.2" + "@udecode/plate-ui-dnd": "npm:14.4.2" + "@udecode/plate-ui-find-replace": "npm:14.4.2" + "@udecode/plate-ui-font": "npm:14.4.2" + "@udecode/plate-ui-image": "npm:14.4.2" + "@udecode/plate-ui-line-height": "npm:14.4.2" + "@udecode/plate-ui-link": "npm:14.4.2" + "@udecode/plate-ui-list": "npm:14.4.3" + "@udecode/plate-ui-media-embed": "npm:14.4.2" + "@udecode/plate-ui-mention": "npm:14.4.2" + "@udecode/plate-ui-placeholder": "npm:14.4.2" + "@udecode/plate-ui-popover": "npm:14.4.2" + "@udecode/plate-ui-table": "npm:14.4.2" + "@udecode/plate-ui-toolbar": "npm:14.4.2" peerDependencies: react: ">=16.8.0" react-dnd: ">=14.0.0" @@ -5893,8 +5968,8 @@ __metadata: version: 0.0.0-use.local resolution: "@udecode/plate@workspace:packages/plate" dependencies: - "@udecode/plate-headless": "npm:14.4.1" - "@udecode/plate-ui": "npm:14.4.1" + "@udecode/plate-headless": "npm:14.4.3" + "@udecode/plate-ui": "npm:14.4.3" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -6542,6 +6617,15 @@ __metadata: languageName: node linkType: hard +"aria-hidden@npm:^1.1.3": + version: 1.1.3 + resolution: "aria-hidden@npm:1.1.3" + dependencies: + tslib: "npm:^1.0.0" + checksum: 5cfe132b55ef86adf4e7e66e23cb3f096cdf37e6c714724f1770a0a8734690211ac4cf12228de902aefdef15916a0d477373d25fae79de0c060c8eef8bab3ed1 + languageName: node + linkType: hard + "aria-query@npm:^4.2.2": version: 4.2.2 resolution: "aria-query@npm:4.2.2" @@ -12846,6 +12930,13 @@ __metadata: languageName: node linkType: hard +"hotkeys-js@npm:3.9.3": + version: 3.9.3 + resolution: "hotkeys-js@npm:3.9.3" + checksum: 891ffbff94fdec6e3f087569d1bf33af46bd6a3097b37a95c75ea28404ee7aa4a07497d001c14645c01e8867f25dcf67194fdabf952eaa87b11becad2def4285 + languageName: node + linkType: hard + "hpack.js@npm:^2.1.6": version: 2.1.6 resolution: "hpack.js@npm:2.1.6" @@ -15781,7 +15872,7 @@ __metadata: languageName: node linkType: hard -"loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0, loose-envify@npm:^1.4.0": +"loose-envify@npm:^1.1.0, loose-envify@npm:^1.4.0": version: 1.4.0 resolution: "loose-envify@npm:1.4.0" dependencies: @@ -19923,10 +20014,15 @@ __metadata: languageName: node linkType: hard -"react-fast-compare@npm:^3.0.1": - version: 3.2.0 - resolution: "react-fast-compare@npm:3.2.0" - checksum: 83b544e0c35aa1db9d815a22d6a56ae53c619752488e3d989629ed078091a4182fe79c8c2a93aa67a61abcc56b91b9def57da1522670be9016bd54f508196258 +"react-hotkeys-hook@npm:^3.4.6": + version: 3.4.6 + resolution: "react-hotkeys-hook@npm:3.4.6" + dependencies: + hotkeys-js: "npm:3.9.3" + peerDependencies: + react: ">=16.8.1" + react-dom: ">=16.8.1" + checksum: d5b92713b2c7aab6bf162c800af76bb6a146cc15f9b8b78f5af1daf5241c8c7b907e5650ffcfcf02e56a9c1a1ec33df927fdb3d7231e75fc705ab6b789515603 languageName: node linkType: hard @@ -19951,20 +20047,6 @@ __metadata: languageName: node linkType: hard -"react-popper@npm:^2.3.0": - version: 2.3.0 - resolution: "react-popper@npm:2.3.0" - dependencies: - react-fast-compare: "npm:^3.0.1" - warning: "npm:^4.0.2" - peerDependencies: - "@popperjs/core": ^2.0.0 - react: ^16.8.0 || ^17 || ^18 - react-dom: ^16.8.0 || ^17 || ^18 - checksum: c90b40f0a7b2e95e411cb444786f4b17abc03ad4d75c2a9700858ce2d2665c8545c0e5bf3ba17d271ce67f87001ce6fb902319a94d1b6915f85604862aa8332c - languageName: node - linkType: hard - "react-refresh@npm:^0.8.3": version: 0.8.3 resolution: "react-refresh@npm:0.8.3" @@ -23537,7 +23619,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^1.8.1, tslib@npm:^1.9.0": +"tslib@npm:^1.0.0, tslib@npm:^1.8.1, tslib@npm:^1.9.0": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: 441af59dc42ad4ae57140e62cb362369620c6076845c2c2b0ecc863c1d719ce24fdbc301e9053433fef43075e061bf84b702318ff1204b496a5bba10baf9eb9f @@ -24507,15 +24589,6 @@ __metadata: languageName: node linkType: hard -"warning@npm:^4.0.2": - version: 4.0.3 - resolution: "warning@npm:4.0.3" - dependencies: - loose-envify: "npm:^1.0.0" - checksum: a8a2ebdd8fb207ea69d9db8f5e02e2b74399cd3b6df3b0cc8c536ea3b8bd4d1c6da6605ea30eee25f5cd1acb44ceecf9b0a1eb7f1d3537e20212f4b3f218d688 - languageName: node - linkType: hard - "watchpack-chokidar2@npm:^2.0.1": version: 2.0.1 resolution: "watchpack-chokidar2@npm:2.0.1"