@atlaskit/editor-common 74.0.1 → 74.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/cjs/event-dispatcher/index.js +6 -3
- package/dist/cjs/insert/index.js +274 -0
- package/dist/cjs/monitoring/error.js +106 -0
- package/dist/cjs/monitoring/index.js +12 -0
- package/dist/cjs/node-width/index.js +5 -0
- package/dist/cjs/paste/index.js +12 -0
- package/dist/cjs/paste/md-plugins/ignore-list-heading-md-plugin.js +47 -0
- package/dist/cjs/paste/md-plugins/linkify-md-plugin.js +135 -0
- package/dist/cjs/paste/md-plugins/newline-md-plugin.js +67 -0
- package/dist/cjs/paste/md-plugins/paragraph-md-plugin.js +73 -0
- package/dist/cjs/paste/md.js +31 -0
- package/dist/cjs/preset/plugin-injection-api.js +4 -2
- package/dist/cjs/resizer.js +13 -0
- package/dist/cjs/styles/index.js +8 -1
- package/dist/cjs/styles/shared/blockquote.js +1 -2
- package/dist/cjs/styles/shared/code-block.js +5 -5
- package/dist/cjs/styles/shared/extension.js +4 -0
- package/dist/cjs/styles/shared/layout.js +4 -0
- package/dist/cjs/styles/shared/panel.js +4 -1
- package/dist/cjs/styles/shared/resizer.js +31 -0
- package/dist/cjs/styles/shared/smart-card.js +5 -0
- package/dist/cjs/styles/shared/table.js +2 -3
- package/dist/cjs/types/performance-tracking.js +5 -0
- package/dist/cjs/ui/DropList/index.js +6 -4
- package/dist/cjs/ui/ErrorBoundary/index.js +7 -0
- package/dist/cjs/ui/Expand/index.js +11 -8
- package/dist/cjs/ui/FloatingToolbar/Button.js +93 -0
- package/dist/cjs/ui/FloatingToolbar/styles.js +79 -0
- package/dist/cjs/ui/MediaSingle/grid.js +52 -1
- package/dist/cjs/ui/MediaSingle/index.js +2 -4
- package/dist/cjs/ui/Messages/index.js +2 -3
- package/dist/cjs/ui/Resizer/index.js +97 -0
- package/dist/cjs/ui/Resizer/types.js +5 -0
- package/dist/cjs/ui/Resizer/utils.js +8 -0
- package/dist/cjs/ui/index.js +14 -1
- package/dist/cjs/ui-color/ColorPalette/styles.js +1 -2
- package/dist/cjs/utils/editor-core-utils.js +9 -1
- package/dist/cjs/utils/hyperlink.js +200 -0
- package/dist/cjs/utils/index.js +96 -8
- package/dist/cjs/utils/list.js +19 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/event-dispatcher/index.js +4 -2
- package/dist/es2019/insert/index.js +264 -0
- package/dist/es2019/monitoring/error.js +68 -0
- package/dist/es2019/monitoring/index.js +1 -0
- package/dist/es2019/node-width/index.js +4 -0
- package/dist/es2019/paste/index.js +1 -0
- package/dist/es2019/paste/md-plugins/ignore-list-heading-md-plugin.js +43 -0
- package/dist/es2019/paste/md-plugins/linkify-md-plugin.js +128 -0
- package/dist/es2019/paste/md-plugins/newline-md-plugin.js +58 -0
- package/dist/es2019/paste/md-plugins/paragraph-md-plugin.js +64 -0
- package/dist/es2019/paste/md.js +22 -0
- package/dist/es2019/preset/plugin-injection-api.js +4 -2
- package/dist/es2019/resizer.js +1 -0
- package/dist/es2019/styles/index.js +2 -1
- package/dist/es2019/styles/shared/blockquote.js +2 -3
- package/dist/es2019/styles/shared/code-block.js +8 -7
- package/dist/es2019/styles/shared/extension.js +4 -0
- package/dist/es2019/styles/shared/layout.js +4 -0
- package/dist/es2019/styles/shared/panel.js +7 -4
- package/dist/es2019/styles/shared/resizer.js +72 -0
- package/dist/es2019/styles/shared/smart-card.js +4 -0
- package/dist/es2019/styles/shared/table.js +2 -3
- package/dist/es2019/types/performance-tracking.js +1 -0
- package/dist/es2019/ui/DropList/index.js +7 -3
- package/dist/es2019/ui/ErrorBoundary/index.js +7 -0
- package/dist/es2019/ui/Expand/index.js +14 -9
- package/dist/es2019/ui/FloatingToolbar/Button.js +85 -0
- package/dist/es2019/ui/FloatingToolbar/styles.js +64 -0
- package/dist/es2019/ui/MediaSingle/grid.js +50 -0
- package/dist/es2019/ui/MediaSingle/index.js +1 -2
- package/dist/es2019/ui/Messages/index.js +2 -3
- package/dist/es2019/ui/Resizer/index.js +92 -0
- package/dist/es2019/ui/Resizer/types.js +1 -0
- package/dist/es2019/ui/Resizer/utils.js +1 -0
- package/dist/es2019/ui/index.js +4 -3
- package/dist/es2019/ui-color/ColorPalette/styles.js +1 -2
- package/dist/es2019/utils/editor-core-utils.js +7 -0
- package/dist/es2019/utils/hyperlink.js +165 -0
- package/dist/es2019/utils/index.js +6 -3
- package/dist/es2019/utils/list.js +13 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/event-dispatcher/index.js +4 -2
- package/dist/esm/insert/index.js +262 -0
- package/dist/esm/monitoring/error.js +91 -0
- package/dist/esm/monitoring/index.js +1 -0
- package/dist/esm/node-width/index.js +4 -0
- package/dist/esm/paste/index.js +1 -0
- package/dist/esm/paste/md-plugins/ignore-list-heading-md-plugin.js +41 -0
- package/dist/esm/paste/md-plugins/linkify-md-plugin.js +128 -0
- package/dist/esm/paste/md-plugins/newline-md-plugin.js +60 -0
- package/dist/esm/paste/md-plugins/paragraph-md-plugin.js +66 -0
- package/dist/esm/paste/md.js +22 -0
- package/dist/esm/preset/plugin-injection-api.js +4 -2
- package/dist/esm/resizer.js +1 -0
- package/dist/esm/styles/index.js +2 -1
- package/dist/esm/styles/shared/blockquote.js +1 -2
- package/dist/esm/styles/shared/code-block.js +6 -6
- package/dist/esm/styles/shared/extension.js +4 -0
- package/dist/esm/styles/shared/layout.js +4 -0
- package/dist/esm/styles/shared/panel.js +4 -1
- package/dist/esm/styles/shared/resizer.js +18 -0
- package/dist/esm/styles/shared/smart-card.js +4 -0
- package/dist/esm/styles/shared/table.js +2 -3
- package/dist/esm/types/performance-tracking.js +1 -0
- package/dist/esm/ui/DropList/index.js +6 -3
- package/dist/esm/ui/ErrorBoundary/index.js +7 -0
- package/dist/esm/ui/Expand/index.js +11 -8
- package/dist/esm/ui/FloatingToolbar/Button.js +85 -0
- package/dist/esm/ui/FloatingToolbar/styles.js +68 -0
- package/dist/esm/ui/MediaSingle/grid.js +48 -0
- package/dist/esm/ui/MediaSingle/index.js +1 -2
- package/dist/esm/ui/Messages/index.js +2 -3
- package/dist/esm/ui/Resizer/index.js +90 -0
- package/dist/esm/ui/Resizer/types.js +1 -0
- package/dist/esm/ui/Resizer/utils.js +1 -0
- package/dist/esm/ui/index.js +4 -3
- package/dist/esm/ui-color/ColorPalette/styles.js +1 -2
- package/dist/esm/utils/editor-core-utils.js +7 -0
- package/dist/esm/utils/hyperlink.js +184 -0
- package/dist/esm/utils/index.js +6 -3
- package/dist/esm/utils/list.js +13 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/api.d.ts +1 -1
- package/dist/types/event-dispatcher/index.d.ts +3 -1
- package/dist/types/insert/index.d.ts +25 -0
- package/dist/types/monitoring/error.d.ts +4 -0
- package/dist/types/monitoring/index.d.ts +1 -0
- package/dist/types/paste/index.d.ts +1 -0
- package/dist/types/paste/md-plugins/ignore-list-heading-md-plugin.d.ts +2 -0
- package/dist/types/paste/md-plugins/linkify-md-plugin.d.ts +2 -0
- package/dist/types/paste/md-plugins/newline-md-plugin.d.ts +2 -0
- package/dist/types/paste/md-plugins/paragraph-md-plugin.d.ts +2 -0
- package/dist/types/paste/md.d.ts +2 -0
- package/dist/types/resizer.d.ts +1 -0
- package/dist/types/styles/index.d.ts +1 -0
- package/dist/types/styles/shared/resizer.d.ts +6 -0
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/next-editor-plugin.d.ts +1 -1
- package/dist/types/types/performance-tracking.d.ts +343 -0
- package/dist/types/ui/DropList/index.d.ts +1 -1
- package/dist/types/ui/FloatingToolbar/Button.d.ts +30 -0
- package/dist/types/ui/FloatingToolbar/styles.d.ts +20 -0
- package/dist/types/ui/MediaSingle/grid.d.ts +14 -0
- package/dist/types/ui/MediaSingle/index.d.ts +0 -1
- package/dist/types/ui/Resizer/index.d.ts +22 -0
- package/dist/types/ui/Resizer/types.d.ts +18 -0
- package/dist/types/ui/Resizer/utils.d.ts +1 -0
- package/dist/types/ui/index.d.ts +3 -2
- package/dist/types/utils/editor-core-utils.d.ts +4 -0
- package/dist/types/utils/hyperlink.d.ts +27 -0
- package/dist/types/utils/index.d.ts +4 -3
- package/dist/types/utils/list.d.ts +4 -0
- package/dist/types-ts4.5/__tests_external__/cases/fundamentals/collection.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/fundamentals/test-cases/editor-is-present.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/fundamentals/test-cases/editor-typing.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/index.d.ts +4 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/block/delete.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/block/edit.d.ts +4 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/block/index.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/block/insert.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/embed/delete.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/embed/edit.d.ts +4 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/embed/index.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/embed/insert.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/inline/delete.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/inline/edit.d.ts +4 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/inline/index.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/inline/insert.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/inline/unlink.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/types.d.ts +4 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/url/index.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/smart-links/test-cases/url/insert.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/cases/types.d.ts +7 -0
- package/dist/types-ts4.5/__tests_external__/index.d.ts +3 -0
- package/dist/types-ts4.5/__tests_external__/page-objects/Editor.d.ts +9 -0
- package/dist/types-ts4.5/__tests_external__/page-objects/EditorSmartLink.d.ts +40 -0
- package/dist/types-ts4.5/__tests_external__/page-objects/Renderer.d.ts +6 -0
- package/dist/types-ts4.5/analytics/analytics-queue.d.ts +10 -0
- package/dist/types-ts4.5/analytics/api.d.ts +5 -0
- package/dist/types-ts4.5/analytics/fire-analytics-event.d.ts +2 -0
- package/dist/types-ts4.5/analytics/index.d.ts +5 -0
- package/dist/types-ts4.5/analytics/types/avatar.d.ts +5 -0
- package/dist/types-ts4.5/analytics/types/block.d.ts +3 -0
- package/dist/types-ts4.5/analytics/types/config-panel-events.d.ts +17 -0
- package/dist/types-ts4.5/analytics/types/cut-copy-events.d.ts +12 -0
- package/dist/types-ts4.5/analytics/types/date-events.d.ts +17 -0
- package/dist/types-ts4.5/analytics/types/dispatch-analytics-event.d.ts +2 -0
- package/dist/types-ts4.5/analytics/types/element-browser-events.d.ts +11 -0
- package/dist/types-ts4.5/analytics/types/enums.d.ts +357 -0
- package/dist/types-ts4.5/analytics/types/events.d.ts +130 -0
- package/dist/types-ts4.5/analytics/types/experimental-events.d.ts +16 -0
- package/dist/types-ts4.5/analytics/types/extension-events.d.ts +37 -0
- package/dist/types-ts4.5/analytics/types/find-replace-events.d.ts +23 -0
- package/dist/types-ts4.5/analytics/types/format-events.d.ts +49 -0
- package/dist/types-ts4.5/analytics/types/general-events.d.ts +187 -0
- package/dist/types-ts4.5/analytics/types/index.d.ts +36 -0
- package/dist/types-ts4.5/analytics/types/inline-comment-events.d.ts +17 -0
- package/dist/types-ts4.5/analytics/types/insert-events.d.ts +128 -0
- package/dist/types-ts4.5/analytics/types/link-tool-bar-events.d.ts +76 -0
- package/dist/types-ts4.5/analytics/types/list-events.d.ts +66 -0
- package/dist/types-ts4.5/analytics/types/media-events.d.ts +18 -0
- package/dist/types-ts4.5/analytics/types/node-events.d.ts +56 -0
- package/dist/types-ts4.5/analytics/types/paste-events.d.ts +39 -0
- package/dist/types-ts4.5/analytics/types/performance-report.d.ts +24 -0
- package/dist/types-ts4.5/analytics/types/referentiality-events.d.ts +52 -0
- package/dist/types-ts4.5/analytics/types/selection-events.d.ts +18 -0
- package/dist/types-ts4.5/analytics/types/smart-links.d.ts +14 -0
- package/dist/types-ts4.5/analytics/types/substitute-events.d.ts +26 -0
- package/dist/types-ts4.5/analytics/types/table-events.d.ts +102 -0
- package/dist/types-ts4.5/analytics/types/toolbar-button.d.ts +22 -0
- package/dist/types-ts4.5/analytics/types/type-ahead.d.ts +27 -0
- package/dist/types-ts4.5/analytics/types/utils.d.ts +46 -0
- package/dist/types-ts4.5/analytics/utils.d.ts +3 -0
- package/dist/types-ts4.5/card/cardOptions.d.ts +12 -0
- package/dist/types-ts4.5/card/index.d.ts +2 -0
- package/dist/types-ts4.5/card/utils.d.ts +18 -0
- package/dist/types-ts4.5/collab/types.d.ts +101 -0
- package/dist/types-ts4.5/collab.d.ts +1 -0
- package/dist/types-ts4.5/core-utils/index.d.ts +1 -0
- package/dist/types-ts4.5/core-utils/inside.d.ts +2 -0
- package/dist/types-ts4.5/emoji.d.ts +3 -0
- package/dist/types-ts4.5/event-dispatcher/index.d.ts +21 -0
- package/dist/types-ts4.5/extensions/combine-extension-providers.d.ts +7 -0
- package/dist/types-ts4.5/extensions/default-extension-provider.d.ts +17 -0
- package/dist/types-ts4.5/extensions/extension-fields-helpers.d.ts +10 -0
- package/dist/types-ts4.5/extensions/extension-handlers.d.ts +13 -0
- package/dist/types-ts4.5/extensions/index.d.ts +8 -0
- package/dist/types-ts4.5/extensions/manifest-helpers.d.ts +9 -0
- package/dist/types-ts4.5/extensions/module-helpers.d.ts +11 -0
- package/dist/types-ts4.5/extensions/types/extension-handler.d.ts +40 -0
- package/dist/types-ts4.5/extensions/types/extension-manifest-common.d.ts +8 -0
- package/dist/types-ts4.5/extensions/types/extension-manifest-toolbar-item.d.ts +45 -0
- package/dist/types-ts4.5/extensions/types/extension-manifest.d.ts +101 -0
- package/dist/types-ts4.5/extensions/types/extension-parameters.d.ts +5 -0
- package/dist/types-ts4.5/extensions/types/extension-provider.d.ts +8 -0
- package/dist/types-ts4.5/extensions/types/field-definitions.d.ts +171 -0
- package/dist/types-ts4.5/extensions/types/index.d.ts +8 -0
- package/dist/types-ts4.5/extensions/types/utils.d.ts +18 -0
- package/dist/types-ts4.5/extensions.d.ts +2 -0
- package/dist/types-ts4.5/hooks/index.d.ts +3 -0
- package/dist/types-ts4.5/hooks/useConstructor.d.ts +9 -0
- package/dist/types-ts4.5/hooks/usePreviousState.d.ts +11 -0
- package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +39 -0
- package/dist/types-ts4.5/i18n/cs.d.ts +133 -0
- package/dist/types-ts4.5/i18n/da.d.ts +133 -0
- package/dist/types-ts4.5/i18n/de.d.ts +133 -0
- package/dist/types-ts4.5/i18n/en.d.ts +133 -0
- package/dist/types-ts4.5/i18n/en_GB.d.ts +133 -0
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +115 -0
- package/dist/types-ts4.5/i18n/es.d.ts +133 -0
- package/dist/types-ts4.5/i18n/et.d.ts +8 -0
- package/dist/types-ts4.5/i18n/fi.d.ts +133 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +133 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +133 -0
- package/dist/types-ts4.5/i18n/index.d.ts +32 -0
- package/dist/types-ts4.5/i18n/it.d.ts +133 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +133 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +133 -0
- package/dist/types-ts4.5/i18n/languages.d.ts +35 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +133 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +133 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +133 -0
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +133 -0
- package/dist/types-ts4.5/i18n/pt_PT.d.ts +8 -0
- package/dist/types-ts4.5/i18n/ru.d.ts +133 -0
- package/dist/types-ts4.5/i18n/sk.d.ts +8 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +133 -0
- package/dist/types-ts4.5/i18n/th.d.ts +133 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +133 -0
- package/dist/types-ts4.5/i18n/uk.d.ts +133 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +133 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +133 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +133 -0
- package/dist/types-ts4.5/icons/index.d.ts +10 -0
- package/dist/types-ts4.5/icons/shared/BorderIcon.d.ts +3 -0
- package/dist/types-ts4.5/icons/shared/PanelErrorIcon.d.ts +3 -0
- package/dist/types-ts4.5/icons/shared/PanelInfoIcon.d.ts +3 -0
- package/dist/types-ts4.5/icons/shared/PanelNoteIcon.d.ts +3 -0
- package/dist/types-ts4.5/icons/shared/PanelSuccessIcon.d.ts +3 -0
- package/dist/types-ts4.5/icons/shared/PanelWarningIcon.d.ts +3 -0
- package/dist/types-ts4.5/icons/shared/table.d.ts +2 -0
- package/dist/types-ts4.5/in-product.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/insert/index.d.ts +25 -0
- package/dist/types-ts4.5/keymaps/consts.d.ts +12 -0
- package/dist/types-ts4.5/keymaps/index.d.ts +91 -0
- package/dist/types-ts4.5/mention.d.ts +2 -0
- package/dist/types-ts4.5/messages/codeBidiWarning.d.ts +11 -0
- package/dist/types-ts4.5/messages/codeBlockButton.d.ts +22 -0
- package/dist/types-ts4.5/messages/index.d.ts +128 -0
- package/dist/types-ts4.5/messages/insert-block.d.ts +172 -0
- package/dist/types-ts4.5/messages/link.d.ts +7 -0
- package/dist/types-ts4.5/messages/unsupportedContent.d.ts +17 -0
- package/dist/types-ts4.5/monitoring/error.d.ts +4 -0
- package/dist/types-ts4.5/monitoring/index.d.ts +1 -0
- package/dist/types-ts4.5/node-width/index.d.ts +7 -0
- package/dist/types-ts4.5/normalize-feature-flags.d.ts +27 -0
- package/dist/types-ts4.5/panel.d.ts +1 -0
- package/dist/types-ts4.5/paste/index.d.ts +1 -0
- package/dist/types-ts4.5/paste/md-plugins/ignore-list-heading-md-plugin.d.ts +2 -0
- package/dist/types-ts4.5/paste/md-plugins/linkify-md-plugin.d.ts +2 -0
- package/dist/types-ts4.5/paste/md-plugins/newline-md-plugin.d.ts +2 -0
- package/dist/types-ts4.5/paste/md-plugins/paragraph-md-plugin.d.ts +2 -0
- package/dist/types-ts4.5/paste/md.d.ts +2 -0
- package/dist/types-ts4.5/preset/builder.d.ts +36 -0
- package/dist/types-ts4.5/preset/index.d.ts +2 -0
- package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +50 -0
- package/dist/types-ts4.5/provider-factory/autoformatting-provider.d.ts +9 -0
- package/dist/types-ts4.5/provider-factory/card-provider.d.ts +7 -0
- package/dist/types-ts4.5/provider-factory/context-identifier-provider.d.ts +6 -0
- package/dist/types-ts4.5/provider-factory/context.d.ts +6 -0
- package/dist/types-ts4.5/provider-factory/image-upload-provider.d.ts +6 -0
- package/dist/types-ts4.5/provider-factory/macro-provider.d.ts +25 -0
- package/dist/types-ts4.5/provider-factory/media-provider.d.ts +15 -0
- package/dist/types-ts4.5/provider-factory/profile-card-provider.d.ts +6 -0
- package/dist/types-ts4.5/provider-factory/provider-factory.d.ts +17 -0
- package/dist/types-ts4.5/provider-factory/quick-insert-provider.d.ts +24 -0
- package/dist/types-ts4.5/provider-factory/search-provider.d.ts +12 -0
- package/dist/types-ts4.5/provider-factory/types.d.ts +37 -0
- package/dist/types-ts4.5/provider-factory/with-providers.d.ts +18 -0
- package/dist/types-ts4.5/provider-factory.d.ts +13 -0
- package/dist/types-ts4.5/provider-helpers/combine-providers.d.ts +9 -0
- package/dist/types-ts4.5/provider-helpers/index.d.ts +1 -0
- package/dist/types-ts4.5/provider-helpers/promise-helpers.d.ts +32 -0
- package/dist/types-ts4.5/react-node-view/index.d.ts +52 -0
- package/dist/types-ts4.5/react-node-view/types.d.ts +12 -0
- package/dist/types-ts4.5/resizer.d.ts +1 -0
- package/dist/types-ts4.5/safe-plugin/index.d.ts +6 -0
- package/dist/types-ts4.5/selection/gap-cursor/selection.d.ts +40 -0
- package/dist/types-ts4.5/selection/gap-cursor/utils/index.d.ts +2 -0
- package/dist/types-ts4.5/selection/gap-cursor/utils/is-ignored.d.ts +2 -0
- package/dist/types-ts4.5/selection/gap-cursor/utils/is-valid-target-node.d.ts +2 -0
- package/dist/types-ts4.5/selection/index.d.ts +5 -0
- package/dist/types-ts4.5/selection/types.d.ts +26 -0
- package/dist/types-ts4.5/selection/utils.d.ts +4 -0
- package/dist/types-ts4.5/styles/index.d.ts +25 -0
- package/dist/types-ts4.5/styles/shared/annotation.d.ts +12 -0
- package/dist/types-ts4.5/styles/shared/block-marks.d.ts +1 -0
- package/dist/types-ts4.5/styles/shared/blockquote.d.ts +1 -0
- package/dist/types-ts4.5/styles/shared/code-block.d.ts +12 -0
- package/dist/types-ts4.5/styles/shared/code-mark.d.ts +2 -0
- package/dist/types-ts4.5/styles/shared/column-layout.d.ts +2 -0
- package/dist/types-ts4.5/styles/shared/date.d.ts +5 -0
- package/dist/types-ts4.5/styles/shared/dropdown-menu.d.ts +4 -0
- package/dist/types-ts4.5/styles/shared/emoji.d.ts +7 -0
- package/dist/types-ts4.5/styles/shared/extension.d.ts +2 -0
- package/dist/types-ts4.5/styles/shared/headings.d.ts +2 -0
- package/dist/types-ts4.5/styles/shared/indentation.d.ts +1 -0
- package/dist/types-ts4.5/styles/shared/layout.d.ts +2 -0
- package/dist/types-ts4.5/styles/shared/link.d.ts +2 -0
- package/dist/types-ts4.5/styles/shared/lists.d.ts +4 -0
- package/dist/types-ts4.5/styles/shared/media-single.d.ts +3 -0
- package/dist/types-ts4.5/styles/shared/mention.d.ts +3 -0
- package/dist/types-ts4.5/styles/shared/panel.d.ts +85 -0
- package/dist/types-ts4.5/styles/shared/paragraph.d.ts +1 -0
- package/dist/types-ts4.5/styles/shared/resizer.d.ts +6 -0
- package/dist/types-ts4.5/styles/shared/rule.d.ts +2 -0
- package/dist/types-ts4.5/styles/shared/shadow.d.ts +15 -0
- package/dist/types-ts4.5/styles/shared/smart-card.d.ts +7 -0
- package/dist/types-ts4.5/styles/shared/status.d.ts +4 -0
- package/dist/types-ts4.5/styles/shared/table.d.ts +31 -0
- package/dist/types-ts4.5/styles/shared/tableCell.d.ts +1 -0
- package/dist/types-ts4.5/styles/shared/task-decision.d.ts +4 -0
- package/dist/types-ts4.5/styles/shared/text-color.d.ts +1 -0
- package/dist/types-ts4.5/styles/shared/whitespace.d.ts +2 -0
- package/dist/types-ts4.5/transforms/expand.d.ts +5 -0
- package/dist/types-ts4.5/transforms/extension.d.ts +6 -0
- package/dist/types-ts4.5/transforms/index.d.ts +3 -0
- package/dist/types-ts4.5/transforms/layout.d.ts +15 -0
- package/dist/types-ts4.5/type-ahead/index.d.ts +12 -0
- package/dist/types-ts4.5/types/annotation/emitter.d.ts +33 -0
- package/dist/types-ts4.5/types/annotation/index.d.ts +84 -0
- package/dist/types-ts4.5/types/collab.d.ts +8 -0
- package/dist/types-ts4.5/types/command.d.ts +5 -0
- package/dist/types-ts4.5/types/context-panel.d.ts +3 -0
- package/dist/types-ts4.5/types/copy-button.d.ts +24 -0
- package/dist/types-ts4.5/types/editor-actions.d.ts +21 -0
- package/dist/types-ts4.5/types/editor-appearance.d.ts +1 -0
- package/dist/types-ts4.5/types/editor-container-width.d.ts +20 -0
- package/dist/types-ts4.5/types/editor-plugin.d.ts +83 -0
- package/dist/types-ts4.5/types/editor-react-context.d.ts +6 -0
- package/dist/types-ts4.5/types/empty-state-handler.d.ts +7 -0
- package/dist/types-ts4.5/types/feature-flags.d.ts +432 -0
- package/dist/types-ts4.5/types/floating-toolbar.d.ts +256 -0
- package/dist/types-ts4.5/types/index.d.ts +36 -0
- package/dist/types-ts4.5/types/next-editor-plugin.d.ts +113 -0
- package/dist/types-ts4.5/types/performance-tracking.d.ts +343 -0
- package/dist/types-ts4.5/types/plugin-factory.d.ts +27 -0
- package/dist/types-ts4.5/types/prosemirror-config.d.ts +14 -0
- package/dist/types-ts4.5/types/quick-insert.d.ts +26 -0
- package/dist/types-ts4.5/types/supported-browsers.d.ts +15 -0
- package/dist/types-ts4.5/types/toolbar.d.ts +30 -0
- package/dist/types-ts4.5/types/type-ahead.d.ts +72 -0
- package/dist/types-ts4.5/types/ui-components.d.ts +22 -0
- package/dist/types-ts4.5/ufo/experience-store.d.ts +33 -0
- package/dist/types-ts4.5/ufo/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/BaseTheme/index.d.ts +15 -0
- package/dist/types-ts4.5/ui/Caption/index.d.ts +19 -0
- package/dist/types-ts4.5/ui/Caption/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/DropList/index.d.ts +20 -0
- package/dist/types-ts4.5/ui/Emoji/index.d.ts +22 -0
- package/dist/types-ts4.5/ui/ErrorBoundary/index.d.ts +24 -0
- package/dist/types-ts4.5/ui/EventHandlers/index.d.ts +36 -0
- package/dist/types-ts4.5/ui/Expand/index.d.ts +43 -0
- package/dist/types-ts4.5/ui/FloatingToolbar/Button.d.ts +30 -0
- package/dist/types-ts4.5/ui/FloatingToolbar/styles.d.ts +20 -0
- package/dist/types-ts4.5/ui/IntlErrorBoundary/index.d.ts +15 -0
- package/dist/types-ts4.5/ui/IntlProviderIfMissingWrapper/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/Layer/index.d.ts +47 -0
- package/dist/types-ts4.5/ui/Layer/internal/helpers.d.ts +5 -0
- package/dist/types-ts4.5/ui/MediaSingle/grid.d.ts +24 -0
- package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +23 -0
- package/dist/types-ts4.5/ui/MediaSingle/link.d.ts +1 -0
- package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +43 -0
- package/dist/types-ts4.5/ui/Mention/index.d.ts +21 -0
- package/dist/types-ts4.5/ui/Mention/mention-with-profilecard.d.ts +15 -0
- package/dist/types-ts4.5/ui/Mention/mention-with-providers.d.ts +22 -0
- package/dist/types-ts4.5/ui/Mention/types.d.ts +2 -0
- package/dist/types-ts4.5/ui/Messages/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/OverflowShadow/index.d.ts +103 -0
- package/dist/types-ts4.5/ui/OverflowShadow/shadowObserver.d.ts +27 -0
- package/dist/types-ts4.5/ui/Popup/index.d.ts +83 -0
- package/dist/types-ts4.5/ui/Popup/utils.d.ts +42 -0
- package/dist/types-ts4.5/ui/PortalProvider/PortalProviderThemesProvider.d.ts +6 -0
- package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +51 -0
- package/dist/types-ts4.5/ui/Resizer/index.d.ts +22 -0
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +18 -0
- package/dist/types-ts4.5/ui/Resizer/utils.d.ts +1 -0
- package/dist/types-ts4.5/ui/UnsupportedBlock/index.d.ts +14 -0
- package/dist/types-ts4.5/ui/UnsupportedInline/index.d.ts +14 -0
- package/dist/types-ts4.5/ui/WidthProvider/index.d.ts +29 -0
- package/dist/types-ts4.5/ui/WithCreateAnalyticsEvent/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/clear-next-sibling-margin-top.d.ts +2 -0
- package/dist/types-ts4.5/ui/index.d.ts +28 -0
- package/dist/types-ts4.5/ui/unsupported-content-helper.d.ts +3 -0
- package/dist/types-ts4.5/ui/with-outer-listeners.d.ts +8 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Color/index.d.ts +20 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Color/styles.d.ts +4 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/borderColorPalette.d.ts +3 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.d.ts +3 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/common.d.ts +2 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/getColorMessage.d.ts +2 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/index.d.ts +3 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/paletteMessages.d.ts +123 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +1444 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/panelBackgroundPalette.d.ts +4 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/statusColorPalette.d.ts +4 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/textColorPalette.d.ts +2 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/type.d.ts +12 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/index.d.ts +50 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/styles.d.ts +1 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/utils.d.ts +11 -0
- package/dist/types-ts4.5/ui-color/index.d.ts +12 -0
- package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/ColorPaletteArrowKeyNavigationProvider/index.d.ts +7 -0
- package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.d.ts +7 -0
- package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/index.d.ts +3 -0
- package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/types.d.ts +36 -0
- package/dist/types-ts4.5/ui-menu/Dropdown/index.d.ts +40 -0
- package/dist/types-ts4.5/ui-menu/DropdownMenu/index.d.ts +22 -0
- package/dist/types-ts4.5/ui-menu/DropdownMenu/types.d.ts +52 -0
- package/dist/types-ts4.5/ui-menu/ToolbarButton/index.d.ts +57 -0
- package/dist/types-ts4.5/ui-menu/ToolbarButton/styles.d.ts +4 -0
- package/dist/types-ts4.5/ui-menu/index.d.ts +8 -0
- package/dist/types-ts4.5/ui-react/ReactEditorViewContext.d.ts +8 -0
- package/dist/types-ts4.5/ui-react/index.d.ts +2 -0
- package/dist/types-ts4.5/ui-react/with-react-editor-view-outer-listeners.d.ts +11 -0
- package/dist/types-ts4.5/utils/analytics.d.ts +29 -0
- package/dist/types-ts4.5/utils/annotation/index.d.ts +8 -0
- package/dist/types-ts4.5/utils/breakout.d.ts +43 -0
- package/dist/types-ts4.5/utils/browser-extensions.d.ts +43 -0
- package/dist/types-ts4.5/utils/browser.d.ts +4 -0
- package/dist/types-ts4.5/utils/collab.d.ts +2 -0
- package/dist/types-ts4.5/utils/compare-props.d.ts +32 -0
- package/dist/types-ts4.5/utils/compareNodes.d.ts +47 -0
- package/dist/types-ts4.5/utils/compose.d.ts +30 -0
- package/dist/types-ts4.5/utils/date.d.ts +18 -0
- package/dist/types-ts4.5/utils/dom.d.ts +40 -0
- package/dist/types-ts4.5/utils/editor-core-utils.d.ts +28 -0
- package/dist/types-ts4.5/utils/error-reporter.d.ts +13 -0
- package/dist/types-ts4.5/utils/extension-handler.d.ts +2 -0
- package/dist/types-ts4.5/utils/get-performance-options.d.ts +18 -0
- package/dist/types-ts4.5/utils/getModeFromTheme.d.ts +1 -0
- package/dist/types-ts4.5/utils/hyperlink.d.ts +27 -0
- package/dist/types-ts4.5/utils/imageLoader.d.ts +14 -0
- package/dist/types-ts4.5/utils/index.d.ts +51 -0
- package/dist/types-ts4.5/utils/is-text-input.d.ts +2 -0
- package/dist/types-ts4.5/utils/list.d.ts +14 -0
- package/dist/types-ts4.5/utils/macro.d.ts +10 -0
- package/dist/types-ts4.5/utils/nodes.d.ts +49 -0
- package/dist/types-ts4.5/utils/outdated-browsers.d.ts +1 -0
- package/dist/types-ts4.5/utils/performance/hooks/use-component-render-tracking/index.d.ts +19 -0
- package/dist/types-ts4.5/utils/performance/is-performance-api-available.d.ts +3 -0
- package/dist/types-ts4.5/utils/performance/measure-render.d.ts +53 -0
- package/dist/types-ts4.5/utils/performance/measure-tti.d.ts +14 -0
- package/dist/types-ts4.5/utils/performance/measure.d.ts +3 -0
- package/dist/types-ts4.5/utils/performance/navigation.d.ts +1 -0
- package/dist/types-ts4.5/utils/plugin-state-factory.d.ts +16 -0
- package/dist/types-ts4.5/utils/profiler/render-count.d.ts +50 -0
- package/dist/types-ts4.5/utils/referentiality.d.ts +18 -0
- package/dist/types-ts4.5/utils/should-force-tracking.d.ts +1 -0
- package/dist/types-ts4.5/utils/slice.d.ts +11 -0
- package/dist/types-ts4.5/utils/table.d.ts +4 -0
- package/dist/types-ts4.5/utils/track-unsupported-content.d.ts +20 -0
- package/dist/types-ts4.5/utils/traversor.d.ts +9 -0
- package/dist/types-ts4.5/utils/types.d.ts +2 -0
- package/dist/types-ts4.5/utils/unsupportedContent/get-unsupported-content-level-data.d.ts +57 -0
- package/dist/types-ts4.5/utils/validate-using-spec.d.ts +19 -0
- package/dist/types-ts4.5/utils/validator.d.ts +42 -0
- package/dist/types-ts4.5/utils/whitespace.d.ts +2 -0
- package/dist/types-ts4.5/validator.d.ts +2 -0
- package/dist/types-ts4.5/with-plugin-state/index.d.ts +88 -0
- package/dist/types-ts4.5/with-plugin-state/types.d.ts +10 -0
- package/insert/package.json +15 -0
- package/monitoring/package.json +15 -0
- package/package.json +30 -12
- package/paste/package.json +15 -0
- package/report.api.md +1 -1
- package/resizer/package.json +15 -0
- package/dist/cjs/utils/sendLogs.js +0 -17
- package/dist/es2019/utils/sendLogs.js +0 -8
- package/dist/esm/utils/sendLogs.js +0 -10
- package/dist/types/utils/sendLogs.d.ts +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { Resizable } from 're-resizable';
|
|
4
|
+
import { resizerHandleLeftClassName, resizerHandlePadding, resizerHandleRightClassName, resizerHandleZIndex, resizerItemClassName } from '../../styles/shared/resizer';
|
|
5
|
+
import { handleSides } from './utils';
|
|
6
|
+
export default function ResizerNext(props) {
|
|
7
|
+
const resizable = React.useRef(null);
|
|
8
|
+
const {
|
|
9
|
+
handleResize,
|
|
10
|
+
handleResizeStart,
|
|
11
|
+
handleResizeStop
|
|
12
|
+
} = props;
|
|
13
|
+
const onResizeStart = React.useCallback(event => {
|
|
14
|
+
// prevent creating a drag event on Firefox
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
handleResizeStart();
|
|
17
|
+
}, [handleResizeStart]);
|
|
18
|
+
const onResize = React.useCallback((_event, _direction, _elementRef, delta) => {
|
|
19
|
+
const resizableCurrent = resizable.current;
|
|
20
|
+
if (!resizableCurrent || !resizableCurrent.state.original) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const originalState = {
|
|
24
|
+
x: resizableCurrent.state.original.x,
|
|
25
|
+
y: resizableCurrent.state.original.y,
|
|
26
|
+
width: resizableCurrent.state.original.width,
|
|
27
|
+
height: resizableCurrent.state.original.height
|
|
28
|
+
};
|
|
29
|
+
handleResize(originalState, delta);
|
|
30
|
+
}, [handleResize]);
|
|
31
|
+
const onResizeStop = React.useCallback((_event, _direction, _elementRef, delta) => {
|
|
32
|
+
const resizableCurrent = resizable.current;
|
|
33
|
+
if (!resizableCurrent || !resizableCurrent.state.original) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const originalState = {
|
|
37
|
+
x: resizableCurrent.state.original.x,
|
|
38
|
+
y: resizableCurrent.state.original.y,
|
|
39
|
+
width: resizableCurrent.state.original.width,
|
|
40
|
+
height: resizableCurrent.state.original.height
|
|
41
|
+
};
|
|
42
|
+
handleResizeStop(originalState, delta);
|
|
43
|
+
}, [handleResizeStop]);
|
|
44
|
+
let handles = {};
|
|
45
|
+
if (props.handleClassName) {
|
|
46
|
+
handleSides.forEach(side => {
|
|
47
|
+
handles[side] = `${props.handleClassName}-${side}`;
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
handles = {
|
|
51
|
+
left: resizerHandleLeftClassName,
|
|
52
|
+
right: resizerHandleRightClassName
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const innerPadding = props.innerPadding || resizerHandlePadding;
|
|
56
|
+
const handleStyles = {
|
|
57
|
+
left: {
|
|
58
|
+
width: '24px',
|
|
59
|
+
left: `-${innerPadding}px`,
|
|
60
|
+
zIndex: resizerHandleZIndex,
|
|
61
|
+
pointerEvents: 'auto'
|
|
62
|
+
},
|
|
63
|
+
right: {
|
|
64
|
+
width: '24px',
|
|
65
|
+
right: `-${innerPadding}px`,
|
|
66
|
+
zIndex: resizerHandleZIndex,
|
|
67
|
+
pointerEvents: 'auto'
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const className = classnames(props.className, resizerItemClassName);
|
|
71
|
+
return /*#__PURE__*/React.createElement(Resizable, {
|
|
72
|
+
ref: resizable,
|
|
73
|
+
size: {
|
|
74
|
+
width: props.width,
|
|
75
|
+
// just content itself (no paddings)
|
|
76
|
+
height: 'auto'
|
|
77
|
+
},
|
|
78
|
+
maxWidth: props.maxWidth,
|
|
79
|
+
minWidth: props.minWidth,
|
|
80
|
+
className: className,
|
|
81
|
+
enable: props.enable,
|
|
82
|
+
handleClasses: handles,
|
|
83
|
+
handleStyles: handleStyles,
|
|
84
|
+
handleWrapperStyle: props.handleWrapperStyle // is used to override the style of resize handles wrapper, needed for media when it is selected and caption appears makes sure the handlers won't jump.
|
|
85
|
+
,
|
|
86
|
+
handleComponent: props.handleComponent // in media was added as a workaround to fix Up arrow key bug when media has caption and the cursor is place below the image. Our epic has a separate ticket to address this problem.
|
|
87
|
+
,
|
|
88
|
+
onResizeStart: onResizeStart,
|
|
89
|
+
onResize: onResize,
|
|
90
|
+
onResizeStop: onResizeStop
|
|
91
|
+
}, props.children);
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const handleSides = ['left', 'right'];
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
|
-
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT,
|
|
2
|
+
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, shouldAddDefaultWrappedWidth } from './MediaSingle';
|
|
3
3
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
4
|
-
export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid } from './MediaSingle/grid';
|
|
4
|
+
export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts } from './MediaSingle/grid';
|
|
5
5
|
export { mediaLinkStyle } from './MediaSingle/link';
|
|
6
6
|
export { default as Popup, findOverflowScrollParent } from './Popup';
|
|
7
7
|
export { default as UnsupportedBlock } from './UnsupportedBlock';
|
|
@@ -16,4 +16,5 @@ export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expa
|
|
|
16
16
|
export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
|
|
17
17
|
export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from './clear-next-sibling-margin-top';
|
|
18
18
|
export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
|
|
19
|
-
export { default as IntlProviderIfMissingWrapper } from './IntlProviderIfMissingWrapper';
|
|
19
|
+
export { default as IntlProviderIfMissingWrapper } from './IntlProviderIfMissingWrapper';
|
|
20
|
+
export { default as FloatingToolbarButton } from './FloatingToolbar/Button';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { gridSize } from '@atlaskit/theme/constants';
|
|
3
2
|
export const colorPaletteWrapper = css`
|
|
4
|
-
padding: 0 ${
|
|
3
|
+
padding: 0 ${"var(--ds-space-100, 8px)"};
|
|
5
4
|
/* Firefox bug fix: https://product-fabric.atlassian.net/browse/ED-1789 */
|
|
6
5
|
display: flex;
|
|
7
6
|
`;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
2
2
|
import { ReplaceAroundStep, ReplaceStep } from 'prosemirror-transform';
|
|
3
3
|
import { closest } from './dom';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks if node is an empty paragraph.
|
|
7
|
+
*/
|
|
8
|
+
export function isEmptyParagraph(node) {
|
|
9
|
+
return !!node && node.type.name === 'paragraph' && !node.childCount;
|
|
10
|
+
}
|
|
4
11
|
export const stepHasSlice = step => step && step.hasOwnProperty('slice');
|
|
5
12
|
|
|
6
13
|
/**
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/utils/hyperlink.ts
|
|
2
|
+
// If changes are made to this file, please make the same update in the linked file.
|
|
3
|
+
|
|
4
|
+
import { isSafeUrl, linkify, normalizeUrl as normaliseLinkHref } from '@atlaskit/adf-schema';
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics/types';
|
|
6
|
+
import { mapSlice } from './slice';
|
|
7
|
+
|
|
8
|
+
// Regular expression for a windows filepath in the format <DRIVE LETTER>:\<folder name>\
|
|
9
|
+
export const FILEPATH_REGEXP = /([a-zA-Z]:|\\)([^\/:*?<>"|]+\\)?([^\/:*?<>"| ]+(?=\s?))?/gim;
|
|
10
|
+
|
|
11
|
+
// Don't linkify if starts with $ or {
|
|
12
|
+
export const DONTLINKIFY_REGEXP = /^(\$|{)/;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Instance of class LinkMatcher are used in autoformatting in place of Regex.
|
|
16
|
+
* Hence it has been made similar to regex with an exec method.
|
|
17
|
+
* Extending it directly from class Regex was introducing some issues, thus that has been avoided.
|
|
18
|
+
*/
|
|
19
|
+
export class LinkMatcher {
|
|
20
|
+
static create() {
|
|
21
|
+
class LinkMatcherRegex {
|
|
22
|
+
exec(str) {
|
|
23
|
+
const stringsBySpace = str.slice(0, str.length - 1).split(' ');
|
|
24
|
+
const lastStringBeforeSpace = stringsBySpace[stringsBySpace.length - 1];
|
|
25
|
+
const isLastStringValid = lastStringBeforeSpace.length > 0;
|
|
26
|
+
if (!str.endsWith(' ') || !isLastStringValid) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
if (DONTLINKIFY_REGEXP.test(lastStringBeforeSpace)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const links = linkify.match(lastStringBeforeSpace);
|
|
33
|
+
if (!links || links.length === 0) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const lastMatch = links[links.length - 1];
|
|
37
|
+
const lastLink = links[links.length - 1];
|
|
38
|
+
lastLink.input = str.substring(lastMatch.index);
|
|
39
|
+
lastLink.length = lastLink.lastIndex - lastLink.index + 1;
|
|
40
|
+
lastLink.index = str.lastIndexOf(lastStringBeforeSpace) + lastMatch.index;
|
|
41
|
+
return lastLink;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return new LinkMatcherRegex();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Adds protocol to url if needed.
|
|
50
|
+
*/
|
|
51
|
+
export function normalizeUrl(url) {
|
|
52
|
+
if (!url) {
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
if (isSafeUrl(url)) {
|
|
56
|
+
return url;
|
|
57
|
+
}
|
|
58
|
+
return normaliseLinkHref(url);
|
|
59
|
+
}
|
|
60
|
+
export function linkifyContent(schema) {
|
|
61
|
+
return slice => mapSlice(slice, (node, parent) => {
|
|
62
|
+
const isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
63
|
+
const link = node.type.schema.marks.link;
|
|
64
|
+
if (link === undefined) {
|
|
65
|
+
throw new Error('Link not in schema - unable to linkify content');
|
|
66
|
+
}
|
|
67
|
+
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
68
|
+
const linkified = [];
|
|
69
|
+
const text = node.text;
|
|
70
|
+
const matches = findLinkMatches(text);
|
|
71
|
+
let pos = 0;
|
|
72
|
+
const filepaths = findFilepaths(text);
|
|
73
|
+
matches.forEach(match => {
|
|
74
|
+
if (isLinkInMatches(match.start, filepaths)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (match.start > 0) {
|
|
78
|
+
linkified.push(node.cut(pos, match.start));
|
|
79
|
+
}
|
|
80
|
+
linkified.push(node.cut(match.start, match.end).mark(link.create({
|
|
81
|
+
href: normalizeUrl(match.href)
|
|
82
|
+
}).addToSet(node.marks)));
|
|
83
|
+
pos = match.end;
|
|
84
|
+
});
|
|
85
|
+
if (pos < text.length) {
|
|
86
|
+
linkified.push(node.cut(pos));
|
|
87
|
+
}
|
|
88
|
+
return linkified;
|
|
89
|
+
}
|
|
90
|
+
return node;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function getLinkDomain(url) {
|
|
94
|
+
// Remove protocol and www., if either exists
|
|
95
|
+
const withoutProtocol = url.toLowerCase().replace(/^(.*):\/\//, '');
|
|
96
|
+
const withoutWWW = withoutProtocol.replace(/^(www\.)/, '');
|
|
97
|
+
|
|
98
|
+
// Remove port, fragment, path, query string
|
|
99
|
+
return withoutWWW.replace(/[:\/?#](.*)$/, '');
|
|
100
|
+
}
|
|
101
|
+
export function isFromCurrentDomain(url) {
|
|
102
|
+
if (!window || !window.location) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const currentDomain = window.location.hostname;
|
|
106
|
+
const linkDomain = getLinkDomain(url);
|
|
107
|
+
return currentDomain === linkDomain;
|
|
108
|
+
}
|
|
109
|
+
function findLinkMatches(text) {
|
|
110
|
+
const matches = [];
|
|
111
|
+
let linkMatches = text && linkify.match(text);
|
|
112
|
+
if (linkMatches && linkMatches.length > 0) {
|
|
113
|
+
linkMatches.forEach(match => {
|
|
114
|
+
matches.push({
|
|
115
|
+
start: match.index,
|
|
116
|
+
end: match.lastIndex,
|
|
117
|
+
title: match.raw,
|
|
118
|
+
href: match.url
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return matches;
|
|
123
|
+
}
|
|
124
|
+
export const findFilepaths = (text, offset = 0) => {
|
|
125
|
+
// Creation of a copy of the RegExp is necessary as lastIndex is stored on it when we run .exec()
|
|
126
|
+
const localRegExp = new RegExp(FILEPATH_REGEXP);
|
|
127
|
+
let match;
|
|
128
|
+
const matchesList = [];
|
|
129
|
+
const maxFilepathSize = 260;
|
|
130
|
+
while ((match = localRegExp.exec(text)) !== null) {
|
|
131
|
+
const start = match.index + offset;
|
|
132
|
+
let end = localRegExp.lastIndex + offset;
|
|
133
|
+
if (end - start > maxFilepathSize) {
|
|
134
|
+
end = start + maxFilepathSize;
|
|
135
|
+
} // We don't care about big strings of text that are pretending to be filepaths!!
|
|
136
|
+
matchesList.push({
|
|
137
|
+
startIndex: start,
|
|
138
|
+
endIndex: end
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return matchesList;
|
|
142
|
+
};
|
|
143
|
+
export const isLinkInMatches = (linkStart, matchesList) => {
|
|
144
|
+
for (let i = 0; i < matchesList.length; i++) {
|
|
145
|
+
if (linkStart >= matchesList[i].startIndex && linkStart < matchesList[i].endIndex) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
};
|
|
151
|
+
export function getLinkCreationAnalyticsEvent(inputMethod, url) {
|
|
152
|
+
return {
|
|
153
|
+
action: ACTION.INSERTED,
|
|
154
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
155
|
+
actionSubjectId: ACTION_SUBJECT_ID.LINK,
|
|
156
|
+
attributes: {
|
|
157
|
+
inputMethod,
|
|
158
|
+
fromCurrentDomain: isFromCurrentDomain(url)
|
|
159
|
+
},
|
|
160
|
+
eventType: EVENT_TYPE.TRACK,
|
|
161
|
+
nonPrivacySafeAttributes: {
|
|
162
|
+
linkDomain: getLinkDomain(url)
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
@@ -3,7 +3,7 @@ export { getExtensionLozengeData } from './macro';
|
|
|
3
3
|
export { default as browser } from './browser';
|
|
4
4
|
export { default as ErrorReporter } from './error-reporter';
|
|
5
5
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
|
|
6
|
-
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition } from './editor-core-utils';
|
|
6
|
+
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph } from './editor-core-utils';
|
|
7
7
|
export { withImageLoader } from './imageLoader';
|
|
8
8
|
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx } from './breakout';
|
|
9
9
|
export { findChangedNodesFromTransaction, validNode, validateNodes, isType, isParagraph, isText, isLinkMark, SelectedState, isNodeSelectedOrInRange, isSupportedInParent, isMediaNode, isNodeBeforeMediaNode } from './nodes';
|
|
@@ -34,5 +34,8 @@ export { getShallowPropsDifference, getPropsDifference } from './compare-props';
|
|
|
34
34
|
export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
|
|
35
35
|
export { isOutdatedBrowser } from './outdated-browsers';
|
|
36
36
|
export { isReferencedSource, removeConnectedNodes, getChildrenInfo, getNodeName } from './referentiality';
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
37
|
+
export { getItemCounterDigitsSize, getOrderFromOrderedListNode, resolveOrder, isListNode, isParagraphNode, isListItemNode, isBulletList } from './list';
|
|
38
|
+
export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLinkDomain, findFilepaths, isLinkInMatches, FILEPATH_REGEXP, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent } from './hyperlink';
|
|
39
|
+
|
|
40
|
+
// prosemirror-history does not export its plugin key
|
|
41
|
+
export const pmHistoryPluginKey = 'history$';
|
|
@@ -27,4 +27,16 @@ export const getItemCounterDigitsSize = options => {
|
|
|
27
27
|
const itemsCount = typeof options.itemsCount === 'number' ? options.itemsCount : 0;
|
|
28
28
|
const largestCounter = order + (itemsCount - 1);
|
|
29
29
|
return (_String = String(largestCounter)) === null || _String === void 0 ? void 0 : (_String$split = _String.split('.')) === null || _String$split === void 0 ? void 0 : (_String$split$ = _String$split[0]) === null || _String$split$ === void 0 ? void 0 : _String$split$.length;
|
|
30
|
-
};
|
|
30
|
+
};
|
|
31
|
+
export function isListNode(node) {
|
|
32
|
+
return Boolean(node && node.type && ['orderedList', 'bulletList'].includes(node.type.name));
|
|
33
|
+
}
|
|
34
|
+
export function isParagraphNode(node) {
|
|
35
|
+
return Boolean(node && node.type && 'paragraph' === node.type.name);
|
|
36
|
+
}
|
|
37
|
+
export function isListItemNode(node) {
|
|
38
|
+
return Boolean(node && node.type && 'listItem' === node.type.name);
|
|
39
|
+
}
|
|
40
|
+
export function isBulletList(node) {
|
|
41
|
+
return Boolean(node && node.type && 'bulletList' === node.type.name);
|
|
42
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -50,6 +50,9 @@ export var EventDispatcher = /*#__PURE__*/function () {
|
|
|
50
50
|
}]);
|
|
51
51
|
return EventDispatcher;
|
|
52
52
|
}();
|
|
53
|
+
function getEventFromEventName(eventName) {
|
|
54
|
+
return typeof eventName === 'string' ? eventName : eventName.key;
|
|
55
|
+
}
|
|
53
56
|
|
|
54
57
|
/**
|
|
55
58
|
* Creates a dispatch function that can be called inside ProseMirror Plugin
|
|
@@ -60,7 +63,6 @@ export function createDispatch(eventDispatcher) {
|
|
|
60
63
|
if (!eventName) {
|
|
61
64
|
throw new Error('event name is required!');
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
eventDispatcher.emit(event, data);
|
|
66
|
+
eventDispatcher.emit(getEventFromEventName(eventName), data);
|
|
65
67
|
};
|
|
66
68
|
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
import { Fragment, Node, Slice } from 'prosemirror-model';
|
|
5
|
+
import { NodeSelection, Selection, TextSelection } from 'prosemirror-state';
|
|
6
|
+
import { ReplaceAroundStep, ReplaceStep } from 'prosemirror-transform';
|
|
7
|
+
import { canInsert, findParentNodeOfType, hasParentNodeOfType, isNodeSelection, safeInsert as pmSafeInsert } from 'prosemirror-utils';
|
|
8
|
+
import { GapCursorSelection, Side } from '../selection';
|
|
9
|
+
import { isEmptyParagraph, isListItemNode } from '../utils';
|
|
10
|
+
export var LookDirection = /*#__PURE__*/function (LookDirection) {
|
|
11
|
+
LookDirection["Before"] = "before";
|
|
12
|
+
LookDirection["After"] = "after";
|
|
13
|
+
return LookDirection;
|
|
14
|
+
}({});
|
|
15
|
+
export var normaliseNestedLayout = function normaliseNestedLayout(_ref, node) {
|
|
16
|
+
var selection = _ref.selection,
|
|
17
|
+
doc = _ref.doc;
|
|
18
|
+
if (selection.$from.depth > 1) {
|
|
19
|
+
if (node.attrs.layout && node.attrs.layout !== 'default') {
|
|
20
|
+
return node.type.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
21
|
+
layout: 'default'
|
|
22
|
+
}), node.content, node.marks);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// If its a breakout layout, we can remove the mark
|
|
26
|
+
// Since default isn't a valid breakout mode.
|
|
27
|
+
var breakoutMark = doc.type.schema.marks.breakout;
|
|
28
|
+
if (breakoutMark && breakoutMark.isInSet(node.marks)) {
|
|
29
|
+
var newMarks = breakoutMark.removeFromSet(node.marks);
|
|
30
|
+
return node.type.createChecked(node.attrs, node.content, newMarks);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return node;
|
|
34
|
+
};
|
|
35
|
+
var isLastChild = function isLastChild($pos, doc) {
|
|
36
|
+
return doc.resolve($pos.after()).node().lastChild === $pos.node();
|
|
37
|
+
};
|
|
38
|
+
var isFirstChild = function isFirstChild($pos, doc) {
|
|
39
|
+
return doc.resolve($pos.before()).node().firstChild === $pos.node();
|
|
40
|
+
};
|
|
41
|
+
var nodeIsInsideAList = function nodeIsInsideAList(tr) {
|
|
42
|
+
var nodes = tr.doc.type.schema.nodes;
|
|
43
|
+
return hasParentNodeOfType([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
44
|
+
};
|
|
45
|
+
var selectionIsInsideAPanel = function selectionIsInsideAPanel(tr) {
|
|
46
|
+
var nodes = tr.doc.type.schema.nodes;
|
|
47
|
+
return hasParentNodeOfType(nodes.panel)(tr.selection);
|
|
48
|
+
};
|
|
49
|
+
var selectionIsInNestedList = function selectionIsInNestedList(tr) {
|
|
50
|
+
var nodes = tr.doc.type.schema.nodes;
|
|
51
|
+
var parentListNode = findParentNodeOfType([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
52
|
+
if (!parentListNode) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return isListItemNode(tr.doc.resolve(parentListNode.pos).parent);
|
|
56
|
+
};
|
|
57
|
+
var insertBeforeOrAfter = function insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content) {
|
|
58
|
+
/**
|
|
59
|
+
* This block caters for the first item in a parent with the cursor being at the very start
|
|
60
|
+
* or the last item with the cursor being at the very end
|
|
61
|
+
*
|
|
62
|
+
* e.g.
|
|
63
|
+
* ul
|
|
64
|
+
* li {<>}Scenario one
|
|
65
|
+
* li
|
|
66
|
+
* li Scenario two{<>}
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
if (isFirstChild($proposedPosition, tr.doc) && lookDirection === LookDirection.Before || isLastChild($proposedPosition, tr.doc) && lookDirection === LookDirection.After) {
|
|
70
|
+
return tr.insert($parentPos[lookDirection](), content);
|
|
71
|
+
}
|
|
72
|
+
return tr.insert($proposedPosition[lookDirection](), content);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// FIXME: A more sustainable and configurable way to choose when to split
|
|
76
|
+
var shouldSplit = function shouldSplit(nodeType, schemaNodes) {
|
|
77
|
+
return [schemaNodes.bulletList, schemaNodes.orderedList, schemaNodes.panel].includes(nodeType);
|
|
78
|
+
};
|
|
79
|
+
export var safeInsert = function safeInsert(content, position) {
|
|
80
|
+
return function (tr) {
|
|
81
|
+
var _tr$selection$$from$n;
|
|
82
|
+
var nodes = tr.doc.type.schema.nodes;
|
|
83
|
+
var whitelist = [nodes.rule, nodes.mediaSingle];
|
|
84
|
+
if (content instanceof Fragment || !whitelist.includes(content.type)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Check for selection
|
|
89
|
+
if (!tr.selection.empty || isNodeSelection(tr.selection)) {
|
|
90
|
+
// NOT IMPLEMENTED
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
var $from = tr.selection.$from;
|
|
94
|
+
var $insertPos = position ? tr.doc.resolve(position) : isNodeSelection(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;
|
|
95
|
+
var lookDirection;
|
|
96
|
+
var insertPosEnd = $insertPos.end();
|
|
97
|
+
var insertPosStart = $insertPos.start();
|
|
98
|
+
|
|
99
|
+
// When parent node is an empty paragraph,
|
|
100
|
+
// check the empty paragraph is the first or last node of its parent.
|
|
101
|
+
if (isEmptyParagraph($insertPos.parent)) {
|
|
102
|
+
if (isLastChild($insertPos, tr.doc)) {
|
|
103
|
+
lookDirection = LookDirection.After;
|
|
104
|
+
} else if (isFirstChild($insertPos, tr.doc)) {
|
|
105
|
+
lookDirection = LookDirection.Before;
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
if ($insertPos.pos === insertPosEnd) {
|
|
109
|
+
lookDirection = LookDirection.After;
|
|
110
|
+
} else if ($insertPos.pos === insertPosStart) {
|
|
111
|
+
lookDirection = LookDirection.Before;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var grandParentNodeType = (_tr$selection$$from$n = tr.selection.$from.node(-1)) === null || _tr$selection$$from$n === void 0 ? void 0 : _tr$selection$$from$n.type;
|
|
115
|
+
var parentNodeType = tr.selection.$from.parent.type;
|
|
116
|
+
|
|
117
|
+
// if there is no direction, and cannot split for this particular node
|
|
118
|
+
var noDirectionAndShouldNotSplit = !lookDirection && !shouldSplitSelectedNodeOnNodeInsertion({
|
|
119
|
+
parentNodeType: parentNodeType,
|
|
120
|
+
grandParentNodeType: grandParentNodeType,
|
|
121
|
+
content: content
|
|
122
|
+
});
|
|
123
|
+
var ruleNodeInANestedListNode = content.type === nodes.rule && selectionIsInNestedList(tr);
|
|
124
|
+
var nonRuleNodeInListNode = !(content.type === nodes.rule) && nodeIsInsideAList(tr);
|
|
125
|
+
if (ruleNodeInANestedListNode || noDirectionAndShouldNotSplit && nonRuleNodeInListNode || noDirectionAndShouldNotSplit && !nodeIsInsideAList(tr)) {
|
|
126
|
+
// node to be inserted is an invalid child of selection so insert below selected node
|
|
127
|
+
return pmSafeInsert(content, tr.selection.from)(tr);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// if node is a rule and that is a flat list splitting and not at the end of a list
|
|
131
|
+
var _tr$selection = tr.selection,
|
|
132
|
+
from = _tr$selection.from,
|
|
133
|
+
to = _tr$selection.to;
|
|
134
|
+
var ruleTypeInAList = content.type === nodes.rule && nodeIsInsideAList(tr);
|
|
135
|
+
if (ruleTypeInAList && !($insertPos.pos === insertPosEnd)) {
|
|
136
|
+
return tr.replaceRange(from, to, new Slice(Fragment.from(nodes.rule.createChecked()), 0, 0));
|
|
137
|
+
}
|
|
138
|
+
if (!lookDirection) {
|
|
139
|
+
// fallback to consumer for now
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Replace empty paragraph
|
|
144
|
+
if (isEmptyParagraph($insertPos.parent) && canInsert(tr.doc.resolve($insertPos[lookDirection]()), content)) {
|
|
145
|
+
return finaliseInsert(tr.replaceWith($insertPos.before(), $insertPos.after(), content), -1);
|
|
146
|
+
}
|
|
147
|
+
var $proposedPosition = $insertPos;
|
|
148
|
+
while ($proposedPosition.depth > 0) {
|
|
149
|
+
var $parentPos = tr.doc.resolve($proposedPosition[lookDirection]());
|
|
150
|
+
var parentNode = $parentPos.node();
|
|
151
|
+
|
|
152
|
+
// Insert at position (before or after target pos)
|
|
153
|
+
if (canInsert($proposedPosition, content)) {
|
|
154
|
+
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// If we can't insert, and we think we should split, we fallback to consumer for now
|
|
158
|
+
if (shouldSplit(parentNode.type, tr.doc.type.schema.nodes)) {
|
|
159
|
+
var nextTr = finaliseInsert(insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content), content.nodeSize);
|
|
160
|
+
|
|
161
|
+
// Move selection to the closest text node, otherwise it defaults to the whatever the lookDirection is set to above
|
|
162
|
+
if ([nodes.orderedList, nodes.bulletList].includes(parentNode.type) && nextTr) {
|
|
163
|
+
return nextTr.setSelection(TextSelection.between(nextTr.selection.$from, nextTr.selection.$from));
|
|
164
|
+
} else {
|
|
165
|
+
return nextTr;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Can not insert into current parent, step up one parent
|
|
170
|
+
$proposedPosition = $parentPos;
|
|
171
|
+
}
|
|
172
|
+
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
var finaliseInsert = function finaliseInsert(tr, nodeLength) {
|
|
176
|
+
var lastStep = tr.steps[tr.steps.length - 1];
|
|
177
|
+
if (!(lastStep instanceof ReplaceStep || lastStep instanceof ReplaceAroundStep)) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Place gap cursor after the newly inserted node
|
|
182
|
+
var gapCursorPos = lastStep.to + lastStep.slice.openStart + nodeLength;
|
|
183
|
+
return tr.setSelection(new GapCursorSelection(tr.doc.resolve(gapCursorPos), Side.RIGHT)).scrollIntoView();
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Method extracted from typeahed plugin to be shared with the element browser on handling element insertion.
|
|
188
|
+
*/
|
|
189
|
+
export var insertSelectedItem = function insertSelectedItem(maybeNode) {
|
|
190
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
191
|
+
return function (state, tr, start) {
|
|
192
|
+
if (!maybeNode) {
|
|
193
|
+
return tr;
|
|
194
|
+
}
|
|
195
|
+
var isInputFragment = maybeNode instanceof Fragment;
|
|
196
|
+
var node;
|
|
197
|
+
try {
|
|
198
|
+
node = maybeNode instanceof Node || isInputFragment ? maybeNode : typeof maybeNode === 'string' ? state.schema.text(maybeNode) : Node.fromJSON(state.schema, maybeNode);
|
|
199
|
+
} catch (e) {
|
|
200
|
+
// eslint-disable-next-line no-console
|
|
201
|
+
console.error(e);
|
|
202
|
+
return tr;
|
|
203
|
+
}
|
|
204
|
+
if (node.isText) {
|
|
205
|
+
tr = tr.replaceWith(start, start, node);
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
*
|
|
209
|
+
* Replacing a type ahead query mark with a block node.
|
|
210
|
+
*
|
|
211
|
+
*/
|
|
212
|
+
} else if (node.isBlock) {
|
|
213
|
+
/**
|
|
214
|
+
*
|
|
215
|
+
* Rule has unique insertion behaviour
|
|
216
|
+
* so using this safeInsert function in order to handle specific cases in flat list vs nested list
|
|
217
|
+
* instead of a generic pmSafeInsert (i.e appending at the end)
|
|
218
|
+
*
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
var selectionInsideAPanel = selectionIsInsideAPanel(tr);
|
|
222
|
+
if (node.type.name === 'rule' && !selectionInsideAPanel) {
|
|
223
|
+
var _safeInsert;
|
|
224
|
+
tr = (_safeInsert = safeInsert(node, tr.selection.from)(tr)) !== null && _safeInsert !== void 0 ? _safeInsert : tr;
|
|
225
|
+
} else {
|
|
226
|
+
tr = pmSafeInsert(normaliseNestedLayout(state, node), undefined, true)(tr);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
*
|
|
231
|
+
* Replacing a type ahead query mark with an inline node.
|
|
232
|
+
*
|
|
233
|
+
*/
|
|
234
|
+
} else if (node.isInline || isInputFragment) {
|
|
235
|
+
var fragment = isInputFragment ? node : Fragment.fromArray([node, state.schema.text(' ')]);
|
|
236
|
+
tr = tr.replaceWith(start, start, fragment);
|
|
237
|
+
if (opts.selectInlineNode) {
|
|
238
|
+
// Select inserted node
|
|
239
|
+
tr = tr.setSelection(NodeSelection.create(tr.doc, start));
|
|
240
|
+
} else {
|
|
241
|
+
// Placing cursor after node + space.
|
|
242
|
+
tr = tr.setSelection(Selection.near(tr.doc.resolve(start + fragment.size)));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return tr;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* ED-14584: Util to check if the destination node is a paragraph & the
|
|
251
|
+
* content being inserted is a valid child of the grandparent node.
|
|
252
|
+
* In this case, the destination node should split
|
|
253
|
+
*/
|
|
254
|
+
export var shouldSplitSelectedNodeOnNodeInsertion = function shouldSplitSelectedNodeOnNodeInsertion(_ref2) {
|
|
255
|
+
var parentNodeType = _ref2.parentNodeType,
|
|
256
|
+
grandParentNodeType = _ref2.grandParentNodeType,
|
|
257
|
+
content = _ref2.content;
|
|
258
|
+
if (parentNodeType.name === 'doc' || parentNodeType.name === 'paragraph' && grandParentNodeType.validContent(Fragment.from(content))) {
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
return false;
|
|
262
|
+
};
|