@atlaskit/editor-core 183.0.12 → 183.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 +35 -0
- package/dist/cjs/actions/index.js +1 -16
- package/dist/cjs/create-editor/ErrorBoundary.js +19 -8
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +40 -21
- package/dist/cjs/editor-next/editor-internal.js +6 -1
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +1 -41
- package/dist/cjs/labs/next/presets/default.js +23 -1
- package/dist/cjs/labs/next/presets/universal.js +9 -18
- package/dist/cjs/plugins/analytics/index.js +0 -24
- package/dist/cjs/plugins/analytics/plugin-key.js +7 -1
- package/dist/cjs/plugins/analytics/plugin.js +17 -45
- package/dist/cjs/plugins/analytics/utils.js +24 -34
- package/dist/cjs/plugins/base/index.js +7 -1
- package/dist/cjs/plugins/base/pm-plugins/decoration.js +8 -0
- package/dist/cjs/plugins/block-type/commands/block-type.js +1 -1
- package/dist/cjs/plugins/caption/index.js +3 -2
- package/dist/cjs/plugins/caption/pm-plugins/main.js +8 -7
- package/dist/cjs/plugins/card/index.js +2 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +103 -70
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +3 -2
- package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +36 -20
- package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +48 -9
- package/dist/cjs/plugins/card/pm-plugins/doc.js +19 -19
- package/dist/cjs/plugins/card/pm-plugins/main.js +5 -3
- package/dist/cjs/plugins/card/pm-plugins/shouldReplaceLink.js +4 -4
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +6 -6
- package/dist/cjs/plugins/card/toolbar.js +86 -68
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +19 -13
- package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +9 -3
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +6 -5
- package/dist/cjs/plugins/card/ui/LinkToolbarButtonGroup.js +2 -2
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +1 -2
- package/dist/cjs/plugins/collab-edit/ui/styles.js +2 -3
- package/dist/cjs/plugins/date/index.js +4 -3
- package/dist/cjs/plugins/expand/ui/styles.js +4 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +3 -3
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +4 -6
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -5
- package/dist/cjs/plugins/grid/index.js +73 -39
- package/dist/cjs/plugins/history/pm-history-types.js +1 -5
- package/dist/cjs/plugins/history/utils.js +2 -2
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +4 -2
- package/dist/cjs/plugins/hyperlink/Toolbar.js +4 -3
- package/dist/cjs/plugins/hyperlink/commands.js +14 -14
- package/dist/cjs/plugins/hyperlink/index.js +7 -5
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +5 -5
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +2 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -3
- package/dist/cjs/plugins/insert-block/index.js +1 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +40 -44
- package/dist/cjs/plugins/layout/styles.js +2 -2
- package/dist/cjs/plugins/list/actions/conversions.js +1 -1
- package/dist/cjs/plugins/list/commands/listBackspace.js +5 -5
- package/dist/cjs/plugins/list/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/list/transforms.js +2 -2
- package/dist/cjs/plugins/list/utils/analytics.js +2 -2
- package/dist/cjs/plugins/list/utils/find.js +6 -6
- package/dist/cjs/plugins/list/utils/indentation.js +3 -3
- package/dist/cjs/plugins/list/utils/node.js +32 -23
- package/dist/cjs/plugins/list/utils/selection.js +11 -11
- package/dist/cjs/plugins/macro/actions.js +2 -2
- package/dist/cjs/plugins/media/commands/linking.js +1 -1
- package/dist/cjs/plugins/media/index.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +31 -17
- package/dist/cjs/plugins/media/pm-plugins/alt-text/index.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +3 -4
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +2 -2
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +4 -4
- package/dist/cjs/plugins/media/ui/ImageBorder/styles.js +4 -1
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +3 -4
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +13 -4
- package/dist/cjs/plugins/media/utils/media-single.js +10 -57
- package/dist/cjs/plugins/paste/edge-cases/index.js +3 -3
- package/dist/cjs/plugins/paste/edge-cases/lists.js +1 -1
- package/dist/cjs/plugins/paste/handlers.js +16 -10
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/cjs/plugins/paste/pm-plugins/main.js +13 -20
- package/dist/cjs/plugins/quick-insert/commands.js +1 -1
- package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/cjs/plugins/selection/commands.js +24 -23
- package/dist/cjs/plugins/selection/utils.js +2 -2
- package/dist/cjs/plugins/status/plugin.js +13 -7
- package/dist/cjs/plugins/status/ui/statusPicker.js +1 -1
- package/dist/cjs/plugins/type-ahead/insert-utils.js +2 -3
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -1
- package/dist/cjs/plugins/width/index.js +12 -0
- package/dist/cjs/ui/Alignment/styles.js +1 -2
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +2 -3
- package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +1 -2
- package/dist/cjs/ui/ColorPickerButton/index.js +16 -9
- package/dist/cjs/ui/ConfigPanel/ErrorMessage/ErrorImage.js +1 -2
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -3
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +3 -4
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +1 -2
- package/dist/cjs/ui/ConfigPanel/Fields/SelectItem.js +1 -2
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +1 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +4 -0
- package/dist/cjs/ui/ErrorBoundary/index.js +7 -0
- package/dist/cjs/ui/Resizer/index.js +4 -4
- package/dist/cjs/utils/commands.js +2 -2
- package/dist/cjs/utils/document.js +4 -12
- package/dist/cjs/utils/index.js +1 -14
- package/dist/cjs/utils/selection.js +1 -26
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +1 -16
- package/dist/es2019/create-editor/ErrorBoundary.js +18 -7
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +44 -27
- package/dist/es2019/editor-next/editor-internal.js +6 -1
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +1 -39
- package/dist/es2019/labs/next/presets/default.js +27 -1
- package/dist/es2019/labs/next/presets/universal.js +9 -19
- package/dist/es2019/plugins/analytics/index.js +1 -1
- package/dist/es2019/plugins/analytics/plugin-key.js +8 -1
- package/dist/es2019/plugins/analytics/plugin.js +15 -38
- package/dist/es2019/plugins/analytics/utils.js +24 -11
- package/dist/es2019/plugins/base/index.js +4 -1
- package/dist/es2019/plugins/base/pm-plugins/decoration.js +9 -0
- package/dist/es2019/plugins/block-type/commands/block-type.js +1 -1
- package/dist/es2019/plugins/caption/index.js +3 -2
- package/dist/es2019/plugins/caption/pm-plugins/main.js +8 -7
- package/dist/es2019/plugins/card/index.js +2 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +105 -70
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +3 -2
- package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +33 -16
- package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +43 -7
- package/dist/es2019/plugins/card/pm-plugins/doc.js +19 -19
- package/dist/es2019/plugins/card/pm-plugins/main.js +7 -3
- package/dist/es2019/plugins/card/pm-plugins/shouldReplaceLink.js +1 -1
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +6 -6
- package/dist/es2019/plugins/card/toolbar.js +51 -30
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +11 -5
- package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +6 -0
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +6 -5
- package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +1 -1
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/es2019/plugins/collab-edit/ui/styles.js +3 -4
- package/dist/es2019/plugins/date/index.js +4 -3
- package/dist/es2019/plugins/expand/ui/styles.js +1 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +6 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +3 -5
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +9 -9
- package/dist/es2019/plugins/grid/index.js +76 -39
- package/dist/es2019/plugins/history/pm-history-types.js +1 -2
- package/dist/es2019/plugins/history/utils.js +1 -1
- package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +4 -2
- package/dist/es2019/plugins/hyperlink/Toolbar.js +4 -3
- package/dist/es2019/plugins/hyperlink/commands.js +3 -3
- package/dist/es2019/plugins/hyperlink/index.js +7 -5
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +3 -3
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/es2019/plugins/insert-block/index.js +1 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +16 -19
- package/dist/es2019/plugins/layout/styles.js +4 -0
- package/dist/es2019/plugins/list/actions/conversions.js +1 -1
- package/dist/es2019/plugins/list/commands/listBackspace.js +1 -1
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/transforms.js +1 -1
- package/dist/es2019/plugins/list/utils/analytics.js +1 -1
- package/dist/es2019/plugins/list/utils/find.js +1 -1
- package/dist/es2019/plugins/list/utils/indentation.js +1 -1
- package/dist/es2019/plugins/list/utils/node.js +2 -12
- package/dist/es2019/plugins/list/utils/selection.js +1 -1
- package/dist/es2019/plugins/macro/actions.js +1 -1
- package/dist/es2019/plugins/media/commands/linking.js +1 -1
- package/dist/es2019/plugins/media/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +20 -6
- package/dist/es2019/plugins/media/pm-plugins/alt-text/index.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -1
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +1 -1
- package/dist/es2019/plugins/media/ui/ImageBorder/styles.js +4 -0
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +15 -3
- package/dist/es2019/plugins/media/utils/media-single.js +5 -53
- package/dist/es2019/plugins/paste/edge-cases/index.js +1 -1
- package/dist/es2019/plugins/paste/edge-cases/lists.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +11 -4
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/es2019/plugins/paste/pm-plugins/main.js +2 -3
- package/dist/es2019/plugins/quick-insert/commands.js +1 -1
- package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/plugins/selection/commands.js +2 -1
- package/dist/es2019/plugins/selection/utils.js +1 -1
- package/dist/es2019/plugins/status/plugin.js +9 -3
- package/dist/es2019/plugins/status/ui/statusPicker.js +2 -2
- package/dist/es2019/plugins/type-ahead/insert-utils.js +1 -2
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/es2019/plugins/width/index.js +12 -0
- package/dist/es2019/ui/Alignment/styles.js +1 -2
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +2 -3
- package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +3 -4
- package/dist/es2019/ui/ColorPickerButton/index.js +18 -9
- package/dist/es2019/ui/ConfigPanel/ErrorMessage/ErrorImage.js +1 -2
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +7 -3
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +5 -6
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -3
- package/dist/es2019/ui/ConfigPanel/Fields/SelectItem.js +1 -2
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/es2019/ui/ContentStyles/index.js +2 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +2 -2
- package/dist/es2019/ui/ElementBrowser/constants.js +3 -0
- package/dist/es2019/ui/ErrorBoundary/index.js +7 -0
- package/dist/es2019/ui/Resizer/index.js +4 -4
- package/dist/es2019/utils/commands.js +1 -1
- package/dist/es2019/utils/document.js +1 -8
- package/dist/es2019/utils/index.js +2 -2
- package/dist/es2019/utils/selection.js +0 -22
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +1 -16
- package/dist/esm/create-editor/ErrorBoundary.js +19 -8
- package/dist/esm/create-editor/ReactEditorViewInternal.js +40 -21
- package/dist/esm/editor-next/editor-internal.js +6 -1
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +1 -41
- package/dist/esm/labs/next/presets/default.js +23 -1
- package/dist/esm/labs/next/presets/universal.js +9 -18
- package/dist/esm/plugins/analytics/index.js +1 -1
- package/dist/esm/plugins/analytics/plugin-key.js +8 -1
- package/dist/esm/plugins/analytics/plugin.js +17 -45
- package/dist/esm/plugins/analytics/utils.js +24 -11
- package/dist/esm/plugins/base/index.js +4 -1
- package/dist/esm/plugins/base/pm-plugins/decoration.js +9 -0
- package/dist/esm/plugins/block-type/commands/block-type.js +1 -1
- package/dist/esm/plugins/caption/index.js +3 -2
- package/dist/esm/plugins/caption/pm-plugins/main.js +8 -7
- package/dist/esm/plugins/card/index.js +2 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +103 -70
- package/dist/esm/plugins/card/nodeviews/genericCard.js +3 -2
- package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +36 -20
- package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +43 -7
- package/dist/esm/plugins/card/pm-plugins/doc.js +19 -19
- package/dist/esm/plugins/card/pm-plugins/main.js +5 -3
- package/dist/esm/plugins/card/pm-plugins/shouldReplaceLink.js +1 -1
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +6 -6
- package/dist/esm/plugins/card/toolbar.js +86 -68
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +19 -13
- package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +9 -3
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +6 -5
- package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +1 -1
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/esm/plugins/collab-edit/ui/styles.js +2 -3
- package/dist/esm/plugins/date/index.js +4 -3
- package/dist/esm/plugins/expand/ui/styles.js +2 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +2 -4
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -5
- package/dist/esm/plugins/grid/index.js +72 -36
- package/dist/esm/plugins/history/pm-history-types.js +1 -2
- package/dist/esm/plugins/history/utils.js +1 -1
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +4 -2
- package/dist/esm/plugins/hyperlink/Toolbar.js +4 -3
- package/dist/esm/plugins/hyperlink/commands.js +3 -3
- package/dist/esm/plugins/hyperlink/index.js +7 -5
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +3 -3
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -2
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/esm/plugins/insert-block/index.js +1 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +40 -44
- package/dist/esm/plugins/layout/styles.js +3 -1
- package/dist/esm/plugins/list/actions/conversions.js +1 -1
- package/dist/esm/plugins/list/commands/listBackspace.js +1 -1
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/transforms.js +1 -1
- package/dist/esm/plugins/list/utils/analytics.js +1 -1
- package/dist/esm/plugins/list/utils/find.js +1 -1
- package/dist/esm/plugins/list/utils/indentation.js +1 -1
- package/dist/esm/plugins/list/utils/node.js +2 -12
- package/dist/esm/plugins/list/utils/selection.js +1 -1
- package/dist/esm/plugins/macro/actions.js +1 -1
- package/dist/esm/plugins/media/commands/linking.js +1 -1
- package/dist/esm/plugins/media/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +31 -17
- package/dist/esm/plugins/media/pm-plugins/alt-text/index.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -1
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +1 -1
- package/dist/esm/plugins/media/ui/ImageBorder/styles.js +4 -0
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +13 -3
- package/dist/esm/plugins/media/utils/media-single.js +5 -51
- package/dist/esm/plugins/paste/edge-cases/index.js +1 -1
- package/dist/esm/plugins/paste/edge-cases/lists.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +11 -4
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/esm/plugins/paste/pm-plugins/main.js +2 -3
- package/dist/esm/plugins/quick-insert/commands.js +1 -1
- package/dist/esm/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/esm/plugins/selection/commands.js +2 -1
- package/dist/esm/plugins/selection/utils.js +1 -1
- package/dist/esm/plugins/status/plugin.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +2 -2
- package/dist/esm/plugins/type-ahead/insert-utils.js +1 -2
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/esm/plugins/width/index.js +12 -0
- package/dist/esm/ui/Alignment/styles.js +1 -2
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +2 -3
- package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +1 -2
- package/dist/esm/ui/ColorPickerButton/index.js +16 -9
- package/dist/esm/ui/ConfigPanel/ErrorMessage/ErrorImage.js +1 -2
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +6 -2
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +3 -4
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +1 -2
- package/dist/esm/ui/ConfigPanel/Fields/SelectItem.js +1 -2
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/esm/ui/ContentStyles/index.js +3 -3
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +2 -2
- package/dist/esm/ui/ElementBrowser/constants.js +3 -0
- package/dist/esm/ui/ErrorBoundary/index.js +7 -0
- package/dist/esm/ui/Resizer/index.js +4 -4
- package/dist/esm/utils/commands.js +1 -1
- package/dist/esm/utils/document.js +1 -8
- package/dist/esm/utils/index.js +2 -2
- package/dist/esm/utils/selection.js +0 -23
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +2 -0
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +2 -1
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +0 -3
- package/dist/types/labs/next/presets/cxhtml.d.ts +63 -3
- package/dist/types/labs/next/presets/default.d.ts +129 -6
- package/dist/types/labs/next/presets/mobile.d.ts +63 -3
- package/dist/types/plugins/analytics/index.d.ts +1 -1
- package/dist/types/plugins/analytics/plugin-key.d.ts +6 -0
- package/dist/types/plugins/analytics/plugin.d.ts +9 -2
- package/dist/types/plugins/analytics/utils.d.ts +16 -3
- package/dist/types/plugins/base/index.d.ts +4 -0
- package/dist/types/plugins/base/pm-plugins/decoration.d.ts +8 -0
- package/dist/types/plugins/caption/index.d.ts +4 -1
- package/dist/types/plugins/caption/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/card/index.d.ts +11 -1
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +1 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +3 -0
- package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +2 -0
- package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +8 -2
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +7 -7
- package/dist/types/plugins/card/pm-plugins/main.d.ts +3 -1
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types/plugins/card/toolbar.d.ts +7 -4
- package/dist/types/plugins/card/types.d.ts +1 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -2
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -0
- package/dist/types/plugins/date/index.d.ts +3 -2
- package/dist/types/plugins/date/ui/DatePicker/date-picker-input.d.ts +1 -1
- package/dist/types/plugins/date/ui/DatePicker/index.d.ts +1 -1
- package/dist/types/plugins/grid/index.d.ts +14 -7
- package/dist/types/plugins/grid/types.d.ts +3 -2
- package/dist/types/plugins/history/pm-history-types.d.ts +0 -1
- package/dist/types/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types/plugins/hyperlink/commands.d.ts +1 -1
- package/dist/types/plugins/hyperlink/index.d.ts +6 -2
- package/dist/types/plugins/insert-block/index.d.ts +6 -4
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +3 -3
- package/dist/types/plugins/list/utils/node.d.ts +2 -6
- package/dist/types/plugins/media/index.d.ts +2 -1
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +4 -1
- package/dist/types/plugins/media/nodeviews/types.d.ts +4 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -1
- package/dist/types/plugins/media/utils/media-single.d.ts +2 -15
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +0 -1
- package/dist/types/plugins/width/index.d.ts +9 -1
- package/dist/types/types/performance-tracking.d.ts +1 -323
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types/ui/ColorPickerButton/index.d.ts +6 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ElementBrowser/components/CategoryList.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +1 -1
- package/dist/types/ui/Resizer/types.d.ts +1 -1
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/selection.d.ts +1 -2
- package/dist/types-ts4.5/create-editor/ErrorBoundary.d.ts +2 -0
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +2 -1
- package/dist/types-ts4.5/labs/next/presets/create-stub-internal-apis.d.ts +0 -3
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +73 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +149 -6
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +73 -3
- package/dist/types-ts4.5/plugins/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/analytics/plugin-key.d.ts +6 -0
- package/dist/types-ts4.5/plugins/analytics/plugin.d.ts +10 -2
- package/dist/types-ts4.5/plugins/analytics/utils.d.ts +16 -3
- package/dist/types-ts4.5/plugins/base/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +8 -0
- package/dist/types-ts4.5/plugins/caption/index.d.ts +6 -1
- package/dist/types-ts4.5/plugins/caption/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/index.d.ts +9 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/utils.d.ts +8 -2
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +7 -7
- package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +7 -4
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +4 -2
- package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -0
- package/dist/types-ts4.5/plugins/date/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/date-picker-input.d.ts +1 -1
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/grid/index.d.ts +16 -7
- package/dist/types-ts4.5/plugins/grid/types.d.ts +3 -2
- package/dist/types-ts4.5/plugins/history/pm-history-types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/insert-block/index.d.ts +4 -4
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +3 -3
- package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -6
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +4 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +2 -15
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +0 -1
- package/dist/types-ts4.5/plugins/width/index.d.ts +9 -1
- package/dist/types-ts4.5/types/performance-tracking.d.ts +1 -323
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +6 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ElementBrowser/components/CategoryList.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementList/ElementList.d.ts +1 -1
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/document.d.ts +0 -4
- package/dist/types-ts4.5/utils/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/selection.d.ts +1 -2
- package/package.json +30 -23
- package/report.api.md +80 -151
- package/dist/cjs/analytics-api/api.js +0 -32
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +0 -36
- package/dist/cjs/analytics-api/editor-state-context.js +0 -77
- package/dist/cjs/analytics-api/map-attributes.js +0 -23
- package/dist/cjs/insert-api/api.js +0 -43
- package/dist/cjs/insert-api/insert-content-handlers.js +0 -94
- package/dist/cjs/insert-api/insert-node-helpers.js +0 -133
- package/dist/cjs/insert-api/types.js +0 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +0 -93
- package/dist/cjs/plugins/hyperlink/analytics.js +0 -23
- package/dist/cjs/plugins/hyperlink/utils.js +0 -183
- package/dist/cjs/plugins/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -47
- package/dist/cjs/plugins/paste/md-plugins/linkify-md-plugin.js +0 -135
- package/dist/cjs/plugins/paste/md-plugins/newline-md-plugin.js +0 -67
- package/dist/cjs/plugins/paste/md-plugins/paragraph-md-plugin.js +0 -73
- package/dist/cjs/plugins/paste/md.js +0 -31
- package/dist/cjs/plugins/undo-redo/undo-redo-input-source.js +0 -26
- package/dist/cjs/types/get-editor-props.js +0 -5
- package/dist/cjs/utils/get-editor-plugins.js +0 -30
- package/dist/cjs/utils/insert.js +0 -251
- package/dist/cjs/utils/sendLogs.js +0 -12
- package/dist/es2019/analytics-api/api.js +0 -28
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +0 -32
- package/dist/es2019/analytics-api/editor-state-context.js +0 -74
- package/dist/es2019/analytics-api/map-attributes.js +0 -14
- package/dist/es2019/insert-api/api.js +0 -42
- package/dist/es2019/insert-api/insert-content-handlers.js +0 -84
- package/dist/es2019/insert-api/insert-node-helpers.js +0 -137
- package/dist/es2019/insert-api/types.js +0 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +0 -85
- package/dist/es2019/plugins/hyperlink/analytics.js +0 -17
- package/dist/es2019/plugins/hyperlink/utils.js +0 -149
- package/dist/es2019/plugins/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -43
- package/dist/es2019/plugins/paste/md-plugins/linkify-md-plugin.js +0 -128
- package/dist/es2019/plugins/paste/md-plugins/newline-md-plugin.js +0 -58
- package/dist/es2019/plugins/paste/md-plugins/paragraph-md-plugin.js +0 -64
- package/dist/es2019/plugins/paste/md.js +0 -23
- package/dist/es2019/plugins/undo-redo/undo-redo-input-source.js +0 -17
- package/dist/es2019/types/get-editor-props.js +0 -1
- package/dist/es2019/utils/get-editor-plugins.js +0 -23
- package/dist/es2019/utils/insert.js +0 -244
- package/dist/es2019/utils/sendLogs.js +0 -1
- package/dist/esm/analytics-api/api.js +0 -25
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +0 -29
- package/dist/esm/analytics-api/editor-state-context.js +0 -69
- package/dist/esm/analytics-api/map-attributes.js +0 -16
- package/dist/esm/insert-api/api.js +0 -36
- package/dist/esm/insert-api/insert-content-handlers.js +0 -86
- package/dist/esm/insert-api/insert-node-helpers.js +0 -123
- package/dist/esm/insert-api/types.js +0 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +0 -85
- package/dist/esm/plugins/hyperlink/analytics.js +0 -17
- package/dist/esm/plugins/hyperlink/utils.js +0 -168
- package/dist/esm/plugins/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -41
- package/dist/esm/plugins/paste/md-plugins/linkify-md-plugin.js +0 -128
- package/dist/esm/plugins/paste/md-plugins/newline-md-plugin.js +0 -60
- package/dist/esm/plugins/paste/md-plugins/paragraph-md-plugin.js +0 -66
- package/dist/esm/plugins/paste/md.js +0 -23
- package/dist/esm/plugins/undo-redo/undo-redo-input-source.js +0 -18
- package/dist/esm/types/get-editor-props.js +0 -1
- package/dist/esm/utils/get-editor-plugins.js +0 -23
- package/dist/esm/utils/insert.js +0 -241
- package/dist/esm/utils/sendLogs.js +0 -1
- package/dist/types/analytics-api/api.d.ts +0 -9
- package/dist/types/analytics-api/attach-payload-into-transaction.d.ts +0 -10
- package/dist/types/analytics-api/editor-state-context.d.ts +0 -9
- package/dist/types/analytics-api/map-attributes.d.ts +0 -2
- package/dist/types/insert-api/api.d.ts +0 -9
- package/dist/types/insert-api/insert-content-handlers.d.ts +0 -9
- package/dist/types/insert-api/insert-node-helpers.d.ts +0 -30
- package/dist/types/insert-api/types.d.ts +0 -16
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +0 -30
- package/dist/types/plugins/hyperlink/analytics.d.ts +0 -2
- package/dist/types/plugins/hyperlink/utils.d.ts +0 -25
- package/dist/types/plugins/paste/md-plugins/ignore-list-heading-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md-plugins/linkify-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md-plugins/newline-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md-plugins/paragraph-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md.d.ts +0 -2
- package/dist/types/plugins/undo-redo/undo-redo-input-source.d.ts +0 -3
- package/dist/types/types/get-editor-props.d.ts +0 -12
- package/dist/types/utils/get-editor-plugins.d.ts +0 -10
- package/dist/types/utils/insert.d.ts +0 -24
- package/dist/types/utils/sendLogs.d.ts +0 -1
- package/dist/types-ts4.5/analytics-api/api.d.ts +0 -9
- package/dist/types-ts4.5/analytics-api/attach-payload-into-transaction.d.ts +0 -10
- package/dist/types-ts4.5/analytics-api/editor-state-context.d.ts +0 -9
- package/dist/types-ts4.5/analytics-api/map-attributes.d.ts +0 -2
- package/dist/types-ts4.5/insert-api/api.d.ts +0 -9
- package/dist/types-ts4.5/insert-api/insert-content-handlers.d.ts +0 -9
- package/dist/types-ts4.5/insert-api/insert-node-helpers.d.ts +0 -30
- package/dist/types-ts4.5/insert-api/types.d.ts +0 -16
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Button.d.ts +0 -30
- package/dist/types-ts4.5/plugins/hyperlink/analytics.d.ts +0 -2
- package/dist/types-ts4.5/plugins/hyperlink/utils.d.ts +0 -25
- package/dist/types-ts4.5/plugins/paste/md-plugins/ignore-list-heading-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md-plugins/linkify-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md-plugins/newline-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md-plugins/paragraph-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md.d.ts +0 -2
- package/dist/types-ts4.5/plugins/undo-redo/undo-redo-input-source.d.ts +0 -3
- package/dist/types-ts4.5/types/get-editor-props.d.ts +0 -12
- package/dist/types-ts4.5/utils/get-editor-plugins.d.ts +0 -10
- package/dist/types-ts4.5/utils/insert.d.ts +0 -24
- package/dist/types-ts4.5/utils/sendLogs.d.ts +0 -1
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/linkify-md-plugin.ts
|
|
2
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
3
|
-
|
|
4
|
-
import { linkifyMatch } from '@atlaskit/adf-schema';
|
|
5
|
-
import LinkifyIt from 'linkify-it';
|
|
6
|
-
import { findFilepaths, isLinkInMatches } from '../../hyperlink/utils';
|
|
7
|
-
|
|
8
|
-
// modified version of the original Linkify plugin
|
|
9
|
-
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js
|
|
10
|
-
var arrayReplaceAt = function arrayReplaceAt(src, pos, newElements) {
|
|
11
|
-
return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
|
|
12
|
-
};
|
|
13
|
-
var isLinkOpen = function isLinkOpen(str) {
|
|
14
|
-
return /^<a[>\s]/i.test(str);
|
|
15
|
-
};
|
|
16
|
-
var isLinkClose = function isLinkClose(str) {
|
|
17
|
-
return /^<\/a\s*>/i.test(str);
|
|
18
|
-
};
|
|
19
|
-
var linkify = function linkify(state) {
|
|
20
|
-
var blockTokens = state.tokens;
|
|
21
|
-
var linkify = new LinkifyIt();
|
|
22
|
-
for (var j = 0, l = blockTokens.length; j < l; j++) {
|
|
23
|
-
if (blockTokens[j].type !== 'inline' || !linkify.pretest(blockTokens[j].content)) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
var tokens = blockTokens[j].children;
|
|
27
|
-
var htmlLinkLevel = 0;
|
|
28
|
-
|
|
29
|
-
// We scan from the end, to keep position when new tags added.
|
|
30
|
-
// Use reversed logic in links start/end match
|
|
31
|
-
for (var i = tokens.length - 1; i >= 0; i--) {
|
|
32
|
-
var currentToken = tokens[i];
|
|
33
|
-
|
|
34
|
-
// Skip content of markdown links
|
|
35
|
-
if (currentToken.type === 'link_close') {
|
|
36
|
-
i--;
|
|
37
|
-
while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
|
|
38
|
-
i--;
|
|
39
|
-
}
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Skip content of html tag links
|
|
44
|
-
if (currentToken.type === 'html_inline') {
|
|
45
|
-
if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
|
|
46
|
-
htmlLinkLevel--;
|
|
47
|
-
}
|
|
48
|
-
if (isLinkClose(currentToken.content)) {
|
|
49
|
-
htmlLinkLevel++;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (htmlLinkLevel > 0) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (currentToken.type === 'text' && linkify.test(currentToken.content)) {
|
|
56
|
-
var text = currentToken.content;
|
|
57
|
-
var links = linkifyMatch(text);
|
|
58
|
-
if (!links.length) {
|
|
59
|
-
links = linkify.match(text) || [];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Now split string to nodes
|
|
63
|
-
var nodes = [];
|
|
64
|
-
var level = currentToken.level;
|
|
65
|
-
var lastPos = 0;
|
|
66
|
-
var filepaths = findFilepaths(text);
|
|
67
|
-
for (var ln = 0; ln < links.length; ln++) {
|
|
68
|
-
if (isLinkInMatches(links[ln].index, filepaths)) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
var url = links[ln].url;
|
|
72
|
-
var fullUrl = state.md.normalizeLink(url);
|
|
73
|
-
if (!state.md.validateLink(fullUrl)) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
var urlText = links[ln].text;
|
|
77
|
-
|
|
78
|
-
// Linkifier might send raw hostnames like "example.com", where url
|
|
79
|
-
// starts with domain name. So we prepend http:// in those cases,
|
|
80
|
-
// and remove it afterwards.
|
|
81
|
-
//
|
|
82
|
-
if (!links[ln].schema) {
|
|
83
|
-
urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
|
|
84
|
-
} else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
|
|
85
|
-
urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
|
|
86
|
-
} else {
|
|
87
|
-
urlText = state.md.normalizeLinkText(urlText);
|
|
88
|
-
}
|
|
89
|
-
var pos = links[ln].index;
|
|
90
|
-
if (pos > lastPos) {
|
|
91
|
-
var _token = new state.Token('text', '', 0);
|
|
92
|
-
_token.content = text.slice(lastPos, pos);
|
|
93
|
-
_token.level = level;
|
|
94
|
-
nodes.push(_token);
|
|
95
|
-
}
|
|
96
|
-
var token = new state.Token('link_open', 'a', 1);
|
|
97
|
-
token.attrs = [['href', fullUrl]];
|
|
98
|
-
token.level = level++;
|
|
99
|
-
token.markup = 'linkify';
|
|
100
|
-
token.info = 'auto';
|
|
101
|
-
nodes.push(token);
|
|
102
|
-
token = new state.Token('text', '', 0);
|
|
103
|
-
token.content = urlText;
|
|
104
|
-
token.level = level;
|
|
105
|
-
nodes.push(token);
|
|
106
|
-
token = new state.Token('link_close', 'a', -1);
|
|
107
|
-
token.level = --level;
|
|
108
|
-
token.markup = 'linkify';
|
|
109
|
-
token.info = 'auto';
|
|
110
|
-
nodes.push(token);
|
|
111
|
-
lastPos = links[ln].lastIndex;
|
|
112
|
-
}
|
|
113
|
-
if (lastPos < text.length) {
|
|
114
|
-
var _token2 = new state.Token('text', '', 0);
|
|
115
|
-
_token2.content = text.slice(lastPos);
|
|
116
|
-
_token2.level = level;
|
|
117
|
-
nodes.push(_token2);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// replace current node
|
|
121
|
-
blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
export default (function (md) {
|
|
127
|
-
return md.core.ruler.push('custom-linkify', linkify);
|
|
128
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/newline-md-plugin.ts
|
|
2
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
3
|
-
|
|
4
|
-
// ED-15363: modified version of the original newline plugin
|
|
5
|
-
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_inline/newline.js
|
|
6
|
-
var newline = function newline(state, silent) {
|
|
7
|
-
var pmax,
|
|
8
|
-
// ED-15363: unread variables
|
|
9
|
-
// max,
|
|
10
|
-
// ws,
|
|
11
|
-
pos = state.pos;
|
|
12
|
-
if (state.src.charCodeAt(pos) !== 0x0a /* \n */) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
pmax = state.pending.length - 1;
|
|
16
|
-
// ED-15363: unread variable
|
|
17
|
-
// max = state.posMax;
|
|
18
|
-
|
|
19
|
-
// ' \n' -> hardbreak
|
|
20
|
-
// Lookup in pending chars is bad practice! Don't copy to other rules!
|
|
21
|
-
// Pending string is stored in concat mode, indexed lookups will cause
|
|
22
|
-
// convertion to flat mode.
|
|
23
|
-
if (!silent) {
|
|
24
|
-
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
|
|
25
|
-
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
|
|
26
|
-
// ED-15363: We commented out this logic to preserve trailing whitespaces
|
|
27
|
-
// for each line of text when pasting plain text
|
|
28
|
-
|
|
29
|
-
// // Find whitespaces tail of pending chars.
|
|
30
|
-
// ws = pmax - 1;
|
|
31
|
-
// while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) {
|
|
32
|
-
// ws--;
|
|
33
|
-
// }
|
|
34
|
-
// state.pending = state.pending.slice(0, ws);
|
|
35
|
-
state.push('hardbreak', 'br', 0);
|
|
36
|
-
} else {
|
|
37
|
-
state.pending = state.pending.slice(0, -1);
|
|
38
|
-
state.push('softbreak', 'br', 0);
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
state.push('softbreak', 'br', 0);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
pos++;
|
|
45
|
-
|
|
46
|
-
// ED-15363: We commented out this logic from the original library to
|
|
47
|
-
// preserve leading whitespaces for each line of text when pasting plain
|
|
48
|
-
// text (to preserve whitespace-based indentation).
|
|
49
|
-
|
|
50
|
-
// // skip heading spaces for next line
|
|
51
|
-
// while (pos < max && isSpace(state.src.charCodeAt(pos))) {
|
|
52
|
-
// pos++;
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
|
-
state.pos = pos;
|
|
56
|
-
return true;
|
|
57
|
-
};
|
|
58
|
-
export default (function (md) {
|
|
59
|
-
return md.inline.ruler.at('newline', newline);
|
|
60
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/paragraph-md-plugin.ts
|
|
2
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
3
|
-
|
|
4
|
-
// ED-15363: modified version of the original paragraph plugin
|
|
5
|
-
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_block/paragraph.js
|
|
6
|
-
|
|
7
|
-
var paragraph = function paragraph(state, startLine) {
|
|
8
|
-
var content,
|
|
9
|
-
terminate,
|
|
10
|
-
i,
|
|
11
|
-
l,
|
|
12
|
-
token,
|
|
13
|
-
oldParentType,
|
|
14
|
-
nextLine = startLine + 1,
|
|
15
|
-
terminatorRules = state.md.block.ruler.getRules('paragraph'),
|
|
16
|
-
endLine = state.lineMax;
|
|
17
|
-
oldParentType = state.parentType;
|
|
18
|
-
state.parentType = 'paragraph';
|
|
19
|
-
|
|
20
|
-
// jump line-by-line until empty one or EOF
|
|
21
|
-
for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
|
|
22
|
-
// this would be a code block normally, but after paragraph
|
|
23
|
-
// it's considered a lazy continuation regardless of what's there
|
|
24
|
-
if (state.sCount[nextLine] - state.blkIndent > 3) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// quirk for blockquotes, this line should already be checked by that rule
|
|
29
|
-
if (state.sCount[nextLine] < 0) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Some tags can terminate paragraph without empty line.
|
|
34
|
-
terminate = false;
|
|
35
|
-
for (i = 0, l = terminatorRules.length; i < l; i++) {
|
|
36
|
-
if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
37
|
-
terminate = true;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (terminate) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ED-15363: We removed .trim() from this logic from the original library to
|
|
47
|
-
// preserve leading whitespaces at the beginning and end of paragraph blocks
|
|
48
|
-
// when pasting plain text (to preserve whitespace-based indentation, at the
|
|
49
|
-
// beginning and end of paragraphs).
|
|
50
|
-
|
|
51
|
-
// content = state.getLines(startLine, nextLine, state.blkIndent, false) .trim()
|
|
52
|
-
content = state.getLines(startLine, nextLine, state.blkIndent, false);
|
|
53
|
-
state.line = nextLine;
|
|
54
|
-
token = state.push('paragraph_open', 'p', 1);
|
|
55
|
-
token.map = [startLine, state.line];
|
|
56
|
-
token = state.push('inline', '', 0);
|
|
57
|
-
token.content = content;
|
|
58
|
-
token.map = [startLine, state.line];
|
|
59
|
-
token.children = [];
|
|
60
|
-
token = state.push('paragraph_close', 'p', -1);
|
|
61
|
-
state.parentType = oldParentType;
|
|
62
|
-
return true;
|
|
63
|
-
};
|
|
64
|
-
export default (function (md) {
|
|
65
|
-
return md.block.ruler.at('paragraph', paragraph);
|
|
66
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/index.ts
|
|
2
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
3
|
-
|
|
4
|
-
import MarkdownIt from 'markdown-it';
|
|
5
|
-
import linkify from './md-plugins/linkify-md-plugin';
|
|
6
|
-
import newline from './md-plugins/newline-md-plugin';
|
|
7
|
-
import paragraph from './md-plugins/paragraph-md-plugin';
|
|
8
|
-
import ignoreListHeading from './md-plugins/ignore-list-heading-md-plugin';
|
|
9
|
-
export var md = MarkdownIt('zero', {
|
|
10
|
-
html: false
|
|
11
|
-
});
|
|
12
|
-
md.enable([
|
|
13
|
-
// Process html entity - {, ¯, ", ...
|
|
14
|
-
'entity',
|
|
15
|
-
// Process escaped chars and hardbreaks
|
|
16
|
-
'escape', 'newline']);
|
|
17
|
-
md.use(paragraph);
|
|
18
|
-
|
|
19
|
-
// enable modified version of linkify plugin
|
|
20
|
-
// @see https://product-fabric.atlassian.net/browse/ED-3097
|
|
21
|
-
md.use(linkify);
|
|
22
|
-
md.use(newline);
|
|
23
|
-
md.use(ignoreListHeading);
|
|
@@ -1,18 +0,0 @@
|
|
|
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 { pluginKey as undoRedoPluginKey } from './pm-plugins/plugin-key';
|
|
5
|
-
var getUndoRedoInputSource = function getUndoRedoInputSource(tr) {
|
|
6
|
-
return tr.getMeta(undoRedoPluginKey) || null;
|
|
7
|
-
};
|
|
8
|
-
export var generateUndoRedoInputSoucePayload = function generateUndoRedoInputSoucePayload(tr) {
|
|
9
|
-
var undoRedoPluginInputSource = getUndoRedoInputSource(tr);
|
|
10
|
-
return function (payload) {
|
|
11
|
-
var shouldAddHistoryTriggerMethodAttribute = undoRedoPluginInputSource && ['undid', 'redid'].includes(payload.action);
|
|
12
|
-
return !shouldAddHistoryTriggerMethodAttribute ? payload : _objectSpread(_objectSpread({}, payload), {}, {
|
|
13
|
-
attributes: _objectSpread(_objectSpread({}, payload.attributes), {}, {
|
|
14
|
-
historyTriggerMethod: undoRedoPluginInputSource
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import createPluginsList from '../create-editor/create-plugins-list';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* Retrieve the editor props using createPluginList default behaviour.
|
|
7
|
-
*
|
|
8
|
-
* @param GetEditorPlugins props used to initialise the plugins
|
|
9
|
-
* @returns list of editor plugins
|
|
10
|
-
*/
|
|
11
|
-
var getEditorPlugins = function getEditorPlugins(_ref) {
|
|
12
|
-
var _props$dangerouslyApp, _props$dangerouslyApp2;
|
|
13
|
-
var props = _ref.props,
|
|
14
|
-
prevAppearance = _ref.prevAppearance,
|
|
15
|
-
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
16
|
-
insertNodeAPI = _ref.insertNodeAPI,
|
|
17
|
-
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
18
|
-
var dangerouslyAppendedPlugins = (_props$dangerouslyApp = (_props$dangerouslyApp2 = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp2 === void 0 ? void 0 : _props$dangerouslyApp2.__plugins) !== null && _props$dangerouslyApp !== void 0 ? _props$dangerouslyApp : [];
|
|
19
|
-
return [].concat(_toConsumableArray(createPluginsList(props, {
|
|
20
|
-
appearance: prevAppearance
|
|
21
|
-
}, createAnalyticsEvent)), _toConsumableArray(dangerouslyAppendedPlugins));
|
|
22
|
-
};
|
|
23
|
-
export default getEditorPlugins;
|
package/dist/esm/utils/insert.js
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { isNodeSelection, canInsert, safeInsert as pmSafeInsert, hasParentNodeOfType, findParentNodeOfType } from 'prosemirror-utils';
|
|
2
|
-
import { Node, Fragment, Slice } from 'prosemirror-model';
|
|
3
|
-
import { NodeSelection, Selection, TextSelection } from 'prosemirror-state';
|
|
4
|
-
import { ReplaceStep, ReplaceAroundStep } from 'prosemirror-transform';
|
|
5
|
-
import { isEmptyParagraph } from './document';
|
|
6
|
-
import { GapCursorSelection, Side } from '../plugins/selection/gap-cursor-selection';
|
|
7
|
-
import { normaliseNestedLayout } from './selection';
|
|
8
|
-
import { isListItemNode } from '../plugins/list/utils/node';
|
|
9
|
-
export var LookDirection = /*#__PURE__*/function (LookDirection) {
|
|
10
|
-
LookDirection["Before"] = "before";
|
|
11
|
-
LookDirection["After"] = "after";
|
|
12
|
-
return LookDirection;
|
|
13
|
-
}({});
|
|
14
|
-
var isLastChild = function isLastChild($pos, doc) {
|
|
15
|
-
return doc.resolve($pos.after()).node().lastChild === $pos.node();
|
|
16
|
-
};
|
|
17
|
-
var isFirstChild = function isFirstChild($pos, doc) {
|
|
18
|
-
return doc.resolve($pos.before()).node().firstChild === $pos.node();
|
|
19
|
-
};
|
|
20
|
-
var nodeIsInsideAList = function nodeIsInsideAList(tr) {
|
|
21
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
22
|
-
return hasParentNodeOfType([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
23
|
-
};
|
|
24
|
-
var selectionIsInsideAPanel = function selectionIsInsideAPanel(tr) {
|
|
25
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
26
|
-
return hasParentNodeOfType(nodes.panel)(tr.selection);
|
|
27
|
-
};
|
|
28
|
-
var selectionIsInNestedList = function selectionIsInNestedList(tr) {
|
|
29
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
30
|
-
var parentListNode = findParentNodeOfType([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
31
|
-
if (!parentListNode) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return isListItemNode(tr.doc.resolve(parentListNode.pos).parent);
|
|
35
|
-
};
|
|
36
|
-
var insertBeforeOrAfter = function insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content) {
|
|
37
|
-
/**
|
|
38
|
-
* This block caters for the first item in a parent with the cursor being at the very start
|
|
39
|
-
* or the last item with the cursor being at the very end
|
|
40
|
-
*
|
|
41
|
-
* e.g.
|
|
42
|
-
* ul
|
|
43
|
-
* li {<>}Scenario one
|
|
44
|
-
* li
|
|
45
|
-
* li Scenario two{<>}
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
if (isFirstChild($proposedPosition, tr.doc) && lookDirection === LookDirection.Before || isLastChild($proposedPosition, tr.doc) && lookDirection === LookDirection.After) {
|
|
49
|
-
return tr.insert($parentPos[lookDirection](), content);
|
|
50
|
-
}
|
|
51
|
-
return tr.insert($proposedPosition[lookDirection](), content);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// FIXME: A more sustainable and configurable way to choose when to split
|
|
55
|
-
var shouldSplit = function shouldSplit(nodeType, schemaNodes) {
|
|
56
|
-
return [schemaNodes.bulletList, schemaNodes.orderedList, schemaNodes.panel].includes(nodeType);
|
|
57
|
-
};
|
|
58
|
-
export var safeInsert = function safeInsert(content, position) {
|
|
59
|
-
return function (tr) {
|
|
60
|
-
var _tr$selection$$from$n;
|
|
61
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
62
|
-
var whitelist = [nodes.rule, nodes.mediaSingle];
|
|
63
|
-
if (content instanceof Fragment || !whitelist.includes(content.type)) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Check for selection
|
|
68
|
-
if (!tr.selection.empty || isNodeSelection(tr.selection)) {
|
|
69
|
-
// NOT IMPLEMENTED
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
var $from = tr.selection.$from;
|
|
73
|
-
var $insertPos = position ? tr.doc.resolve(position) : isNodeSelection(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;
|
|
74
|
-
var lookDirection;
|
|
75
|
-
var insertPosEnd = $insertPos.end();
|
|
76
|
-
var insertPosStart = $insertPos.start();
|
|
77
|
-
|
|
78
|
-
// When parent node is an empty paragraph,
|
|
79
|
-
// check the empty paragraph is the first or last node of its parent.
|
|
80
|
-
if (isEmptyParagraph($insertPos.parent)) {
|
|
81
|
-
if (isLastChild($insertPos, tr.doc)) {
|
|
82
|
-
lookDirection = LookDirection.After;
|
|
83
|
-
} else if (isFirstChild($insertPos, tr.doc)) {
|
|
84
|
-
lookDirection = LookDirection.Before;
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
if ($insertPos.pos === insertPosEnd) {
|
|
88
|
-
lookDirection = LookDirection.After;
|
|
89
|
-
} else if ($insertPos.pos === insertPosStart) {
|
|
90
|
-
lookDirection = LookDirection.Before;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
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;
|
|
94
|
-
var parentNodeType = tr.selection.$from.parent.type;
|
|
95
|
-
|
|
96
|
-
// if there is no direction, and cannot split for this particular node
|
|
97
|
-
var noDirectionAndShouldNotSplit = !lookDirection && !shouldSplitSelectedNodeOnNodeInsertion({
|
|
98
|
-
parentNodeType: parentNodeType,
|
|
99
|
-
grandParentNodeType: grandParentNodeType,
|
|
100
|
-
content: content
|
|
101
|
-
});
|
|
102
|
-
var ruleNodeInANestedListNode = content.type === nodes.rule && selectionIsInNestedList(tr);
|
|
103
|
-
var nonRuleNodeInListNode = !(content.type === nodes.rule) && nodeIsInsideAList(tr);
|
|
104
|
-
if (ruleNodeInANestedListNode || noDirectionAndShouldNotSplit && nonRuleNodeInListNode || noDirectionAndShouldNotSplit && !nodeIsInsideAList(tr)) {
|
|
105
|
-
// node to be inserted is an invalid child of selection so insert below selected node
|
|
106
|
-
return pmSafeInsert(content, tr.selection.from)(tr);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// if node is a rule and that is a flat list splitting and not at the end of a list
|
|
110
|
-
var _tr$selection = tr.selection,
|
|
111
|
-
from = _tr$selection.from,
|
|
112
|
-
to = _tr$selection.to;
|
|
113
|
-
var ruleTypeInAList = content.type === nodes.rule && nodeIsInsideAList(tr);
|
|
114
|
-
if (ruleTypeInAList && !($insertPos.pos === insertPosEnd)) {
|
|
115
|
-
return tr.replaceRange(from, to, new Slice(Fragment.from(nodes.rule.createChecked()), 0, 0));
|
|
116
|
-
}
|
|
117
|
-
if (!lookDirection) {
|
|
118
|
-
// fallback to consumer for now
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Replace empty paragraph
|
|
123
|
-
if (isEmptyParagraph($insertPos.parent) && canInsert(tr.doc.resolve($insertPos[lookDirection]()), content)) {
|
|
124
|
-
return finaliseInsert(tr.replaceWith($insertPos.before(), $insertPos.after(), content), -1);
|
|
125
|
-
}
|
|
126
|
-
var $proposedPosition = $insertPos;
|
|
127
|
-
while ($proposedPosition.depth > 0) {
|
|
128
|
-
var $parentPos = tr.doc.resolve($proposedPosition[lookDirection]());
|
|
129
|
-
var parentNode = $parentPos.node();
|
|
130
|
-
|
|
131
|
-
// Insert at position (before or after target pos)
|
|
132
|
-
if (canInsert($proposedPosition, content)) {
|
|
133
|
-
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// If we can't insert, and we think we should split, we fallback to consumer for now
|
|
137
|
-
if (shouldSplit(parentNode.type, tr.doc.type.schema.nodes)) {
|
|
138
|
-
var nextTr = finaliseInsert(insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content), content.nodeSize);
|
|
139
|
-
|
|
140
|
-
// Move selection to the closest text node, otherwise it defaults to the whatever the lookDirection is set to above
|
|
141
|
-
if ([nodes.orderedList, nodes.bulletList].includes(parentNode.type) && nextTr) {
|
|
142
|
-
return nextTr.setSelection(TextSelection.between(nextTr.selection.$from, nextTr.selection.$from));
|
|
143
|
-
} else {
|
|
144
|
-
return nextTr;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Can not insert into current parent, step up one parent
|
|
149
|
-
$proposedPosition = $parentPos;
|
|
150
|
-
}
|
|
151
|
-
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
var finaliseInsert = function finaliseInsert(tr, nodeLength) {
|
|
155
|
-
var lastStep = tr.steps[tr.steps.length - 1];
|
|
156
|
-
if (!(lastStep instanceof ReplaceStep || lastStep instanceof ReplaceAroundStep)) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Place gap cursor after the newly inserted node
|
|
161
|
-
var gapCursorPos = lastStep.to + lastStep.slice.openStart + nodeLength;
|
|
162
|
-
return tr.setSelection(new GapCursorSelection(tr.doc.resolve(gapCursorPos), Side.RIGHT)).scrollIntoView();
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Method extracted from typeahed plugin to be shared with the element browser on handling element insertion.
|
|
167
|
-
*/
|
|
168
|
-
export var insertSelectedItem = function insertSelectedItem(maybeNode) {
|
|
169
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
170
|
-
return function (state, tr, start) {
|
|
171
|
-
if (!maybeNode) {
|
|
172
|
-
return tr;
|
|
173
|
-
}
|
|
174
|
-
var isInputFragment = maybeNode instanceof Fragment;
|
|
175
|
-
var node;
|
|
176
|
-
try {
|
|
177
|
-
node = maybeNode instanceof Node || isInputFragment ? maybeNode : typeof maybeNode === 'string' ? state.schema.text(maybeNode) : Node.fromJSON(state.schema, maybeNode);
|
|
178
|
-
} catch (e) {
|
|
179
|
-
// eslint-disable-next-line no-console
|
|
180
|
-
console.error(e);
|
|
181
|
-
return tr;
|
|
182
|
-
}
|
|
183
|
-
if (node.isText) {
|
|
184
|
-
tr = tr.replaceWith(start, start, node);
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
*
|
|
188
|
-
* Replacing a type ahead query mark with a block node.
|
|
189
|
-
*
|
|
190
|
-
*/
|
|
191
|
-
} else if (node.isBlock) {
|
|
192
|
-
/**
|
|
193
|
-
*
|
|
194
|
-
* Rule has unique insertion behaviour
|
|
195
|
-
* so using this safeInsert function in order to handle specific cases in flat list vs nested list
|
|
196
|
-
* instead of a generic pmSafeInsert (i.e appending at the end)
|
|
197
|
-
*
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
var selectionInsideAPanel = selectionIsInsideAPanel(tr);
|
|
201
|
-
if (node.type.name === 'rule' && !selectionInsideAPanel) {
|
|
202
|
-
var _safeInsert;
|
|
203
|
-
tr = (_safeInsert = safeInsert(node, tr.selection.from)(tr)) !== null && _safeInsert !== void 0 ? _safeInsert : tr;
|
|
204
|
-
} else {
|
|
205
|
-
tr = pmSafeInsert(normaliseNestedLayout(state, node), undefined, true)(tr);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
*
|
|
210
|
-
* Replacing a type ahead query mark with an inline node.
|
|
211
|
-
*
|
|
212
|
-
*/
|
|
213
|
-
} else if (node.isInline || isInputFragment) {
|
|
214
|
-
var fragment = isInputFragment ? node : Fragment.fromArray([node, state.schema.text(' ')]);
|
|
215
|
-
tr = tr.replaceWith(start, start, fragment);
|
|
216
|
-
if (opts.selectInlineNode) {
|
|
217
|
-
// Select inserted node
|
|
218
|
-
tr = tr.setSelection(NodeSelection.create(tr.doc, start));
|
|
219
|
-
} else {
|
|
220
|
-
// Placing cursor after node + space.
|
|
221
|
-
tr = tr.setSelection(Selection.near(tr.doc.resolve(start + fragment.size)));
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return tr;
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* ED-14584: Util to check if the destination node is a paragraph & the
|
|
230
|
-
* content being inserted is a valid child of the grandparent node.
|
|
231
|
-
* In this case, the destination node should split
|
|
232
|
-
*/
|
|
233
|
-
export var shouldSplitSelectedNodeOnNodeInsertion = function shouldSplitSelectedNodeOnNodeInsertion(_ref) {
|
|
234
|
-
var parentNodeType = _ref.parentNodeType,
|
|
235
|
-
grandParentNodeType = _ref.grandParentNodeType,
|
|
236
|
-
content = _ref.content;
|
|
237
|
-
if (parentNodeType.name === 'doc' || parentNodeType.name === 'paragraph' && grandParentNodeType.validContent(Fragment.from(content))) {
|
|
238
|
-
return true;
|
|
239
|
-
}
|
|
240
|
-
return false;
|
|
241
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { sendLogs } from '@atlaskit/editor-common/utils';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EditorView } from 'prosemirror-view';
|
|
2
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
type Props = {
|
|
5
|
-
getEditorView: () => EditorView | undefined | null;
|
|
6
|
-
getCreateUIAnalyticsEvent: () => CreateUIAnalyticsEvent | undefined | null;
|
|
7
|
-
};
|
|
8
|
-
export declare const createEditorAnalyticsAPI: ({ getEditorView, getCreateUIAnalyticsEvent, }: Props) => EditorAnalyticsAPI;
|
|
9
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Transaction, EditorState } from 'prosemirror-state';
|
|
3
|
-
type AttachPayloadIntoTransaction = (props: {
|
|
4
|
-
payload: AnalyticsEventPayload;
|
|
5
|
-
editorState: EditorState;
|
|
6
|
-
tr: Transaction;
|
|
7
|
-
channel: string;
|
|
8
|
-
}) => void;
|
|
9
|
-
export declare const attachPayloadIntoTransaction: AttachPayloadIntoTransaction;
|
|
10
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { EditorState } from 'prosemirror-state';
|
|
3
|
-
import { SELECTION_TYPE, SELECTION_POSITION } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
export declare function getSelectionType(state: EditorState): {
|
|
5
|
-
type: SELECTION_TYPE;
|
|
6
|
-
position?: SELECTION_POSITION;
|
|
7
|
-
};
|
|
8
|
-
export declare function findInsertLocation(state: EditorState): string;
|
|
9
|
-
export declare function getStateContext(state: EditorState, payload: AnalyticsEventPayload): AnalyticsEventPayload;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EditorView } from 'prosemirror-view';
|
|
2
|
-
import type { EditorPlugin } from '../types/editor-plugin';
|
|
3
|
-
import type { InsertNodeAPI } from './types';
|
|
4
|
-
type Props = {
|
|
5
|
-
getEditorView: () => EditorView | undefined | null;
|
|
6
|
-
getEditorPlugins: () => EditorPlugin[];
|
|
7
|
-
};
|
|
8
|
-
export declare const createInsertNodeAPI: ({ getEditorView, getEditorPlugins, }: Props) => InsertNodeAPI;
|
|
9
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Transaction } from 'prosemirror-state';
|
|
2
|
-
import type { EditorPlugin } from '../types/editor-plugin';
|
|
3
|
-
import type { InsertNodeConfig, CreateNodeHandler } from './types';
|
|
4
|
-
export declare const findCreateNodeHandler: ({ node, editorPlugins, }: Pick<InsertContentProps, 'node' | 'editorPlugins'>) => CreateNodeHandler | null;
|
|
5
|
-
type InsertContentProps = {
|
|
6
|
-
editorPlugins: EditorPlugin[];
|
|
7
|
-
} & InsertNodeConfig;
|
|
8
|
-
export declare const handleInsertContent: ({ node, options, editorPlugins }: InsertContentProps) => (tr: Transaction) => boolean;
|
|
9
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Transaction } from 'prosemirror-state';
|
|
2
|
-
import { Node as PMNode, Fragment, ResolvedPos } from 'prosemirror-model';
|
|
3
|
-
type Position = {
|
|
4
|
-
$from: ResolvedPos;
|
|
5
|
-
$to: ResolvedPos;
|
|
6
|
-
};
|
|
7
|
-
type InsertBlockNodeProps = {
|
|
8
|
-
node: PMNode;
|
|
9
|
-
tr: Transaction;
|
|
10
|
-
position: Position;
|
|
11
|
-
};
|
|
12
|
-
export declare const insertBlockNode: ({ node, tr, position, }: InsertBlockNodeProps) => Transaction;
|
|
13
|
-
type InsertInlineNodeOrFragmentProps = {
|
|
14
|
-
maybeFragment: Fragment | PMNode;
|
|
15
|
-
tr: Transaction;
|
|
16
|
-
position: Position;
|
|
17
|
-
selectInlineNode: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare const insertInlineNodeOrFragment: ({ maybeFragment, tr, position, selectInlineNode, }: InsertInlineNodeOrFragmentProps) => Transaction;
|
|
20
|
-
type InsertProseMirrorContentProps = {
|
|
21
|
-
tr: Transaction;
|
|
22
|
-
node: PMNode | Fragment;
|
|
23
|
-
position: {
|
|
24
|
-
$from: ResolvedPos;
|
|
25
|
-
$to: ResolvedPos;
|
|
26
|
-
};
|
|
27
|
-
selectNodeInserted: boolean;
|
|
28
|
-
};
|
|
29
|
-
export declare const insertProseMirrorContent: ({ tr, node, position, selectNodeInserted, }: InsertProseMirrorContentProps) => void;
|
|
30
|
-
export {};
|