@atlaskit/editor-core 183.0.12 → 183.1.0
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 +28 -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 +22 -15
- 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,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
/*
|
|
8
|
-
* ED-15646
|
|
9
|
-
* Headings in list items are not supported in our schema.
|
|
10
|
-
* As the markdown transformer is used by the paste plugin,
|
|
11
|
-
* certain pastes will strip invalid lines as
|
|
12
|
-
* prosemirror-markdown cannot conform to the schema
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
function handleHeadingOpen(state, token, acc, index) {
|
|
16
|
-
var _state$tokens;
|
|
17
|
-
var isInListItem = ((_state$tokens = state.tokens[index - 1]) === null || _state$tokens === void 0 ? void 0 : _state$tokens.type) === 'list_item_open';
|
|
18
|
-
if (isInListItem) {
|
|
19
|
-
acc.push(new state.Token('paragraph_open', 'p', 1));
|
|
20
|
-
} else {
|
|
21
|
-
acc.push(token);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function handleHeadingClose(state, token, acc, index) {
|
|
25
|
-
var _state$tokens2;
|
|
26
|
-
var isInListItem = ((_state$tokens2 = state.tokens[index + 1]) === null || _state$tokens2 === void 0 ? void 0 : _state$tokens2.type) === 'list_item_close';
|
|
27
|
-
if (isInListItem) {
|
|
28
|
-
acc.push(new state.Token('paragraph_close', 'p', -1));
|
|
29
|
-
} else {
|
|
30
|
-
acc.push(token);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function _default(md) {
|
|
34
|
-
md.core.ruler.after('inline', 'ignore-list-heading-md-plugin', function (state) {
|
|
35
|
-
state.tokens = state.tokens.reduce(function (acc, token, index) {
|
|
36
|
-
var type = token.type;
|
|
37
|
-
if (type === 'heading_open') {
|
|
38
|
-
handleHeadingOpen(state, token, acc, index);
|
|
39
|
-
} else if (type === 'heading_close') {
|
|
40
|
-
handleHeadingClose(state, token, acc, index);
|
|
41
|
-
} else {
|
|
42
|
-
acc.push(token);
|
|
43
|
-
}
|
|
44
|
-
return acc;
|
|
45
|
-
}, []);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
|
-
var _linkifyIt = _interopRequireDefault(require("linkify-it"));
|
|
10
|
-
var _utils = require("../../hyperlink/utils");
|
|
11
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/linkify-md-plugin.ts
|
|
12
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
13
|
-
|
|
14
|
-
// modified version of the original Linkify plugin
|
|
15
|
-
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js
|
|
16
|
-
var arrayReplaceAt = function arrayReplaceAt(src, pos, newElements) {
|
|
17
|
-
return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
|
|
18
|
-
};
|
|
19
|
-
var isLinkOpen = function isLinkOpen(str) {
|
|
20
|
-
return /^<a[>\s]/i.test(str);
|
|
21
|
-
};
|
|
22
|
-
var isLinkClose = function isLinkClose(str) {
|
|
23
|
-
return /^<\/a\s*>/i.test(str);
|
|
24
|
-
};
|
|
25
|
-
var linkify = function linkify(state) {
|
|
26
|
-
var blockTokens = state.tokens;
|
|
27
|
-
var linkify = new _linkifyIt.default();
|
|
28
|
-
for (var j = 0, l = blockTokens.length; j < l; j++) {
|
|
29
|
-
if (blockTokens[j].type !== 'inline' || !linkify.pretest(blockTokens[j].content)) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
var tokens = blockTokens[j].children;
|
|
33
|
-
var htmlLinkLevel = 0;
|
|
34
|
-
|
|
35
|
-
// We scan from the end, to keep position when new tags added.
|
|
36
|
-
// Use reversed logic in links start/end match
|
|
37
|
-
for (var i = tokens.length - 1; i >= 0; i--) {
|
|
38
|
-
var currentToken = tokens[i];
|
|
39
|
-
|
|
40
|
-
// Skip content of markdown links
|
|
41
|
-
if (currentToken.type === 'link_close') {
|
|
42
|
-
i--;
|
|
43
|
-
while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
|
|
44
|
-
i--;
|
|
45
|
-
}
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Skip content of html tag links
|
|
50
|
-
if (currentToken.type === 'html_inline') {
|
|
51
|
-
if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
|
|
52
|
-
htmlLinkLevel--;
|
|
53
|
-
}
|
|
54
|
-
if (isLinkClose(currentToken.content)) {
|
|
55
|
-
htmlLinkLevel++;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (htmlLinkLevel > 0) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (currentToken.type === 'text' && linkify.test(currentToken.content)) {
|
|
62
|
-
var text = currentToken.content;
|
|
63
|
-
var links = (0, _adfSchema.linkifyMatch)(text);
|
|
64
|
-
if (!links.length) {
|
|
65
|
-
links = linkify.match(text) || [];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Now split string to nodes
|
|
69
|
-
var nodes = [];
|
|
70
|
-
var level = currentToken.level;
|
|
71
|
-
var lastPos = 0;
|
|
72
|
-
var filepaths = (0, _utils.findFilepaths)(text);
|
|
73
|
-
for (var ln = 0; ln < links.length; ln++) {
|
|
74
|
-
if ((0, _utils.isLinkInMatches)(links[ln].index, filepaths)) {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
var url = links[ln].url;
|
|
78
|
-
var fullUrl = state.md.normalizeLink(url);
|
|
79
|
-
if (!state.md.validateLink(fullUrl)) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
var urlText = links[ln].text;
|
|
83
|
-
|
|
84
|
-
// Linkifier might send raw hostnames like "example.com", where url
|
|
85
|
-
// starts with domain name. So we prepend http:// in those cases,
|
|
86
|
-
// and remove it afterwards.
|
|
87
|
-
//
|
|
88
|
-
if (!links[ln].schema) {
|
|
89
|
-
urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
|
|
90
|
-
} else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
|
|
91
|
-
urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
|
|
92
|
-
} else {
|
|
93
|
-
urlText = state.md.normalizeLinkText(urlText);
|
|
94
|
-
}
|
|
95
|
-
var pos = links[ln].index;
|
|
96
|
-
if (pos > lastPos) {
|
|
97
|
-
var _token = new state.Token('text', '', 0);
|
|
98
|
-
_token.content = text.slice(lastPos, pos);
|
|
99
|
-
_token.level = level;
|
|
100
|
-
nodes.push(_token);
|
|
101
|
-
}
|
|
102
|
-
var token = new state.Token('link_open', 'a', 1);
|
|
103
|
-
token.attrs = [['href', fullUrl]];
|
|
104
|
-
token.level = level++;
|
|
105
|
-
token.markup = 'linkify';
|
|
106
|
-
token.info = 'auto';
|
|
107
|
-
nodes.push(token);
|
|
108
|
-
token = new state.Token('text', '', 0);
|
|
109
|
-
token.content = urlText;
|
|
110
|
-
token.level = level;
|
|
111
|
-
nodes.push(token);
|
|
112
|
-
token = new state.Token('link_close', 'a', -1);
|
|
113
|
-
token.level = --level;
|
|
114
|
-
token.markup = 'linkify';
|
|
115
|
-
token.info = 'auto';
|
|
116
|
-
nodes.push(token);
|
|
117
|
-
lastPos = links[ln].lastIndex;
|
|
118
|
-
}
|
|
119
|
-
if (lastPos < text.length) {
|
|
120
|
-
var _token2 = new state.Token('text', '', 0);
|
|
121
|
-
_token2.content = text.slice(lastPos);
|
|
122
|
-
_token2.level = level;
|
|
123
|
-
nodes.push(_token2);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// replace current node
|
|
127
|
-
blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
var _default = function _default(md) {
|
|
133
|
-
return md.core.ruler.push('custom-linkify', linkify);
|
|
134
|
-
};
|
|
135
|
-
exports.default = _default;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/newline-md-plugin.ts
|
|
8
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
9
|
-
|
|
10
|
-
// ED-15363: modified version of the original newline plugin
|
|
11
|
-
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_inline/newline.js
|
|
12
|
-
var newline = function newline(state, silent) {
|
|
13
|
-
var pmax,
|
|
14
|
-
// ED-15363: unread variables
|
|
15
|
-
// max,
|
|
16
|
-
// ws,
|
|
17
|
-
pos = state.pos;
|
|
18
|
-
if (state.src.charCodeAt(pos) !== 0x0a /* \n */) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
pmax = state.pending.length - 1;
|
|
22
|
-
// ED-15363: unread variable
|
|
23
|
-
// max = state.posMax;
|
|
24
|
-
|
|
25
|
-
// ' \n' -> hardbreak
|
|
26
|
-
// Lookup in pending chars is bad practice! Don't copy to other rules!
|
|
27
|
-
// Pending string is stored in concat mode, indexed lookups will cause
|
|
28
|
-
// convertion to flat mode.
|
|
29
|
-
if (!silent) {
|
|
30
|
-
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
|
|
31
|
-
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
|
|
32
|
-
// ED-15363: We commented out this logic to preserve trailing whitespaces
|
|
33
|
-
// for each line of text when pasting plain text
|
|
34
|
-
|
|
35
|
-
// // Find whitespaces tail of pending chars.
|
|
36
|
-
// ws = pmax - 1;
|
|
37
|
-
// while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) {
|
|
38
|
-
// ws--;
|
|
39
|
-
// }
|
|
40
|
-
// state.pending = state.pending.slice(0, ws);
|
|
41
|
-
state.push('hardbreak', 'br', 0);
|
|
42
|
-
} else {
|
|
43
|
-
state.pending = state.pending.slice(0, -1);
|
|
44
|
-
state.push('softbreak', 'br', 0);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
state.push('softbreak', 'br', 0);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
pos++;
|
|
51
|
-
|
|
52
|
-
// ED-15363: We commented out this logic from the original library to
|
|
53
|
-
// preserve leading whitespaces for each line of text when pasting plain
|
|
54
|
-
// text (to preserve whitespace-based indentation).
|
|
55
|
-
|
|
56
|
-
// // skip heading spaces for next line
|
|
57
|
-
// while (pos < max && isSpace(state.src.charCodeAt(pos))) {
|
|
58
|
-
// pos++;
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
state.pos = pos;
|
|
62
|
-
return true;
|
|
63
|
-
};
|
|
64
|
-
var _default = function _default(md) {
|
|
65
|
-
return md.inline.ruler.at('newline', newline);
|
|
66
|
-
};
|
|
67
|
-
exports.default = _default;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/paragraph-md-plugin.ts
|
|
8
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
9
|
-
|
|
10
|
-
// ED-15363: modified version of the original paragraph plugin
|
|
11
|
-
// https://github.com/markdown-it/markdown-it/blob/master/lib/rules_block/paragraph.js
|
|
12
|
-
|
|
13
|
-
var paragraph = function paragraph(state, startLine) {
|
|
14
|
-
var content,
|
|
15
|
-
terminate,
|
|
16
|
-
i,
|
|
17
|
-
l,
|
|
18
|
-
token,
|
|
19
|
-
oldParentType,
|
|
20
|
-
nextLine = startLine + 1,
|
|
21
|
-
terminatorRules = state.md.block.ruler.getRules('paragraph'),
|
|
22
|
-
endLine = state.lineMax;
|
|
23
|
-
oldParentType = state.parentType;
|
|
24
|
-
state.parentType = 'paragraph';
|
|
25
|
-
|
|
26
|
-
// jump line-by-line until empty one or EOF
|
|
27
|
-
for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
|
|
28
|
-
// this would be a code block normally, but after paragraph
|
|
29
|
-
// it's considered a lazy continuation regardless of what's there
|
|
30
|
-
if (state.sCount[nextLine] - state.blkIndent > 3) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// quirk for blockquotes, this line should already be checked by that rule
|
|
35
|
-
if (state.sCount[nextLine] < 0) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Some tags can terminate paragraph without empty line.
|
|
40
|
-
terminate = false;
|
|
41
|
-
for (i = 0, l = terminatorRules.length; i < l; i++) {
|
|
42
|
-
if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
43
|
-
terminate = true;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (terminate) {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ED-15363: We removed .trim() from this logic from the original library to
|
|
53
|
-
// preserve leading whitespaces at the beginning and end of paragraph blocks
|
|
54
|
-
// when pasting plain text (to preserve whitespace-based indentation, at the
|
|
55
|
-
// beginning and end of paragraphs).
|
|
56
|
-
|
|
57
|
-
// content = state.getLines(startLine, nextLine, state.blkIndent, false) .trim()
|
|
58
|
-
content = state.getLines(startLine, nextLine, state.blkIndent, false);
|
|
59
|
-
state.line = nextLine;
|
|
60
|
-
token = state.push('paragraph_open', 'p', 1);
|
|
61
|
-
token.map = [startLine, state.line];
|
|
62
|
-
token = state.push('inline', '', 0);
|
|
63
|
-
token.content = content;
|
|
64
|
-
token.map = [startLine, state.line];
|
|
65
|
-
token.children = [];
|
|
66
|
-
token = state.push('paragraph_close', 'p', -1);
|
|
67
|
-
state.parentType = oldParentType;
|
|
68
|
-
return true;
|
|
69
|
-
};
|
|
70
|
-
var _default = function _default(md) {
|
|
71
|
-
return md.block.ruler.at('paragraph', paragraph);
|
|
72
|
-
};
|
|
73
|
-
exports.default = _default;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.md = void 0;
|
|
8
|
-
var _markdownIt = _interopRequireDefault(require("markdown-it"));
|
|
9
|
-
var _linkifyMdPlugin = _interopRequireDefault(require("./md-plugins/linkify-md-plugin"));
|
|
10
|
-
var _newlineMdPlugin = _interopRequireDefault(require("./md-plugins/newline-md-plugin"));
|
|
11
|
-
var _paragraphMdPlugin = _interopRequireDefault(require("./md-plugins/paragraph-md-plugin"));
|
|
12
|
-
var _ignoreListHeadingMdPlugin = _interopRequireDefault(require("./md-plugins/ignore-list-heading-md-plugin"));
|
|
13
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/md/index.ts
|
|
14
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
15
|
-
|
|
16
|
-
var md = (0, _markdownIt.default)('zero', {
|
|
17
|
-
html: false
|
|
18
|
-
});
|
|
19
|
-
exports.md = md;
|
|
20
|
-
md.enable([
|
|
21
|
-
// Process html entity - {, ¯, ", ...
|
|
22
|
-
'entity',
|
|
23
|
-
// Process escaped chars and hardbreaks
|
|
24
|
-
'escape', 'newline']);
|
|
25
|
-
md.use(_paragraphMdPlugin.default);
|
|
26
|
-
|
|
27
|
-
// enable modified version of linkify plugin
|
|
28
|
-
// @see https://product-fabric.atlassian.net/browse/ED-3097
|
|
29
|
-
md.use(_linkifyMdPlugin.default);
|
|
30
|
-
md.use(_newlineMdPlugin.default);
|
|
31
|
-
md.use(_ignoreListHeadingMdPlugin.default);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.generateUndoRedoInputSoucePayload = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
10
|
-
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; }
|
|
11
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
12
|
-
var getUndoRedoInputSource = function getUndoRedoInputSource(tr) {
|
|
13
|
-
return tr.getMeta(_pluginKey.pluginKey) || null;
|
|
14
|
-
};
|
|
15
|
-
var generateUndoRedoInputSoucePayload = function generateUndoRedoInputSoucePayload(tr) {
|
|
16
|
-
var undoRedoPluginInputSource = getUndoRedoInputSource(tr);
|
|
17
|
-
return function (payload) {
|
|
18
|
-
var shouldAddHistoryTriggerMethodAttribute = undoRedoPluginInputSource && ['undid', 'redid'].includes(payload.action);
|
|
19
|
-
return !shouldAddHistoryTriggerMethodAttribute ? payload : _objectSpread(_objectSpread({}, payload), {}, {
|
|
20
|
-
attributes: _objectSpread(_objectSpread({}, payload.attributes), {}, {
|
|
21
|
-
historyTriggerMethod: undoRedoPluginInputSource
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
exports.generateUndoRedoInputSoucePayload = generateUndoRedoInputSoucePayload;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _createPluginsList = _interopRequireDefault(require("../create-editor/create-plugins-list"));
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* Retrieve the editor props using createPluginList default behaviour.
|
|
13
|
-
*
|
|
14
|
-
* @param GetEditorPlugins props used to initialise the plugins
|
|
15
|
-
* @returns list of editor plugins
|
|
16
|
-
*/
|
|
17
|
-
var getEditorPlugins = function getEditorPlugins(_ref) {
|
|
18
|
-
var _props$dangerouslyApp, _props$dangerouslyApp2;
|
|
19
|
-
var props = _ref.props,
|
|
20
|
-
prevAppearance = _ref.prevAppearance,
|
|
21
|
-
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
22
|
-
insertNodeAPI = _ref.insertNodeAPI,
|
|
23
|
-
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
24
|
-
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 : [];
|
|
25
|
-
return [].concat((0, _toConsumableArray2.default)((0, _createPluginsList.default)(props, {
|
|
26
|
-
appearance: prevAppearance
|
|
27
|
-
}, createAnalyticsEvent)), (0, _toConsumableArray2.default)(dangerouslyAppendedPlugins));
|
|
28
|
-
};
|
|
29
|
-
var _default = getEditorPlugins;
|
|
30
|
-
exports.default = _default;
|
package/dist/cjs/utils/insert.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.shouldSplitSelectedNodeOnNodeInsertion = exports.safeInsert = exports.insertSelectedItem = exports.LookDirection = void 0;
|
|
7
|
-
var _prosemirrorUtils = require("prosemirror-utils");
|
|
8
|
-
var _prosemirrorModel = require("prosemirror-model");
|
|
9
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
10
|
-
var _prosemirrorTransform = require("prosemirror-transform");
|
|
11
|
-
var _document = require("./document");
|
|
12
|
-
var _gapCursorSelection = require("../plugins/selection/gap-cursor-selection");
|
|
13
|
-
var _selection = require("./selection");
|
|
14
|
-
var _node = require("../plugins/list/utils/node");
|
|
15
|
-
var LookDirection = /*#__PURE__*/function (LookDirection) {
|
|
16
|
-
LookDirection["Before"] = "before";
|
|
17
|
-
LookDirection["After"] = "after";
|
|
18
|
-
return LookDirection;
|
|
19
|
-
}({});
|
|
20
|
-
exports.LookDirection = LookDirection;
|
|
21
|
-
var isLastChild = function isLastChild($pos, doc) {
|
|
22
|
-
return doc.resolve($pos.after()).node().lastChild === $pos.node();
|
|
23
|
-
};
|
|
24
|
-
var isFirstChild = function isFirstChild($pos, doc) {
|
|
25
|
-
return doc.resolve($pos.before()).node().firstChild === $pos.node();
|
|
26
|
-
};
|
|
27
|
-
var nodeIsInsideAList = function nodeIsInsideAList(tr) {
|
|
28
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
29
|
-
return (0, _prosemirrorUtils.hasParentNodeOfType)([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
30
|
-
};
|
|
31
|
-
var selectionIsInsideAPanel = function selectionIsInsideAPanel(tr) {
|
|
32
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
33
|
-
return (0, _prosemirrorUtils.hasParentNodeOfType)(nodes.panel)(tr.selection);
|
|
34
|
-
};
|
|
35
|
-
var selectionIsInNestedList = function selectionIsInNestedList(tr) {
|
|
36
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
37
|
-
var parentListNode = (0, _prosemirrorUtils.findParentNodeOfType)([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
38
|
-
if (!parentListNode) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return (0, _node.isListItemNode)(tr.doc.resolve(parentListNode.pos).parent);
|
|
42
|
-
};
|
|
43
|
-
var insertBeforeOrAfter = function insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content) {
|
|
44
|
-
/**
|
|
45
|
-
* This block caters for the first item in a parent with the cursor being at the very start
|
|
46
|
-
* or the last item with the cursor being at the very end
|
|
47
|
-
*
|
|
48
|
-
* e.g.
|
|
49
|
-
* ul
|
|
50
|
-
* li {<>}Scenario one
|
|
51
|
-
* li
|
|
52
|
-
* li Scenario two{<>}
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
if (isFirstChild($proposedPosition, tr.doc) && lookDirection === LookDirection.Before || isLastChild($proposedPosition, tr.doc) && lookDirection === LookDirection.After) {
|
|
56
|
-
return tr.insert($parentPos[lookDirection](), content);
|
|
57
|
-
}
|
|
58
|
-
return tr.insert($proposedPosition[lookDirection](), content);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// FIXME: A more sustainable and configurable way to choose when to split
|
|
62
|
-
var shouldSplit = function shouldSplit(nodeType, schemaNodes) {
|
|
63
|
-
return [schemaNodes.bulletList, schemaNodes.orderedList, schemaNodes.panel].includes(nodeType);
|
|
64
|
-
};
|
|
65
|
-
var safeInsert = function safeInsert(content, position) {
|
|
66
|
-
return function (tr) {
|
|
67
|
-
var _tr$selection$$from$n;
|
|
68
|
-
var nodes = tr.doc.type.schema.nodes;
|
|
69
|
-
var whitelist = [nodes.rule, nodes.mediaSingle];
|
|
70
|
-
if (content instanceof _prosemirrorModel.Fragment || !whitelist.includes(content.type)) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Check for selection
|
|
75
|
-
if (!tr.selection.empty || (0, _prosemirrorUtils.isNodeSelection)(tr.selection)) {
|
|
76
|
-
// NOT IMPLEMENTED
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
var $from = tr.selection.$from;
|
|
80
|
-
var $insertPos = position ? tr.doc.resolve(position) : (0, _prosemirrorUtils.isNodeSelection)(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;
|
|
81
|
-
var lookDirection;
|
|
82
|
-
var insertPosEnd = $insertPos.end();
|
|
83
|
-
var insertPosStart = $insertPos.start();
|
|
84
|
-
|
|
85
|
-
// When parent node is an empty paragraph,
|
|
86
|
-
// check the empty paragraph is the first or last node of its parent.
|
|
87
|
-
if ((0, _document.isEmptyParagraph)($insertPos.parent)) {
|
|
88
|
-
if (isLastChild($insertPos, tr.doc)) {
|
|
89
|
-
lookDirection = LookDirection.After;
|
|
90
|
-
} else if (isFirstChild($insertPos, tr.doc)) {
|
|
91
|
-
lookDirection = LookDirection.Before;
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
if ($insertPos.pos === insertPosEnd) {
|
|
95
|
-
lookDirection = LookDirection.After;
|
|
96
|
-
} else if ($insertPos.pos === insertPosStart) {
|
|
97
|
-
lookDirection = LookDirection.Before;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
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;
|
|
101
|
-
var parentNodeType = tr.selection.$from.parent.type;
|
|
102
|
-
|
|
103
|
-
// if there is no direction, and cannot split for this particular node
|
|
104
|
-
var noDirectionAndShouldNotSplit = !lookDirection && !shouldSplitSelectedNodeOnNodeInsertion({
|
|
105
|
-
parentNodeType: parentNodeType,
|
|
106
|
-
grandParentNodeType: grandParentNodeType,
|
|
107
|
-
content: content
|
|
108
|
-
});
|
|
109
|
-
var ruleNodeInANestedListNode = content.type === nodes.rule && selectionIsInNestedList(tr);
|
|
110
|
-
var nonRuleNodeInListNode = !(content.type === nodes.rule) && nodeIsInsideAList(tr);
|
|
111
|
-
if (ruleNodeInANestedListNode || noDirectionAndShouldNotSplit && nonRuleNodeInListNode || noDirectionAndShouldNotSplit && !nodeIsInsideAList(tr)) {
|
|
112
|
-
// node to be inserted is an invalid child of selection so insert below selected node
|
|
113
|
-
return (0, _prosemirrorUtils.safeInsert)(content, tr.selection.from)(tr);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// if node is a rule and that is a flat list splitting and not at the end of a list
|
|
117
|
-
var _tr$selection = tr.selection,
|
|
118
|
-
from = _tr$selection.from,
|
|
119
|
-
to = _tr$selection.to;
|
|
120
|
-
var ruleTypeInAList = content.type === nodes.rule && nodeIsInsideAList(tr);
|
|
121
|
-
if (ruleTypeInAList && !($insertPos.pos === insertPosEnd)) {
|
|
122
|
-
return tr.replaceRange(from, to, new _prosemirrorModel.Slice(_prosemirrorModel.Fragment.from(nodes.rule.createChecked()), 0, 0));
|
|
123
|
-
}
|
|
124
|
-
if (!lookDirection) {
|
|
125
|
-
// fallback to consumer for now
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Replace empty paragraph
|
|
130
|
-
if ((0, _document.isEmptyParagraph)($insertPos.parent) && (0, _prosemirrorUtils.canInsert)(tr.doc.resolve($insertPos[lookDirection]()), content)) {
|
|
131
|
-
return finaliseInsert(tr.replaceWith($insertPos.before(), $insertPos.after(), content), -1);
|
|
132
|
-
}
|
|
133
|
-
var $proposedPosition = $insertPos;
|
|
134
|
-
while ($proposedPosition.depth > 0) {
|
|
135
|
-
var $parentPos = tr.doc.resolve($proposedPosition[lookDirection]());
|
|
136
|
-
var parentNode = $parentPos.node();
|
|
137
|
-
|
|
138
|
-
// Insert at position (before or after target pos)
|
|
139
|
-
if ((0, _prosemirrorUtils.canInsert)($proposedPosition, content)) {
|
|
140
|
-
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// If we can't insert, and we think we should split, we fallback to consumer for now
|
|
144
|
-
if (shouldSplit(parentNode.type, tr.doc.type.schema.nodes)) {
|
|
145
|
-
var nextTr = finaliseInsert(insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content), content.nodeSize);
|
|
146
|
-
|
|
147
|
-
// Move selection to the closest text node, otherwise it defaults to the whatever the lookDirection is set to above
|
|
148
|
-
if ([nodes.orderedList, nodes.bulletList].includes(parentNode.type) && nextTr) {
|
|
149
|
-
return nextTr.setSelection(_prosemirrorState.TextSelection.between(nextTr.selection.$from, nextTr.selection.$from));
|
|
150
|
-
} else {
|
|
151
|
-
return nextTr;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Can not insert into current parent, step up one parent
|
|
156
|
-
$proposedPosition = $parentPos;
|
|
157
|
-
}
|
|
158
|
-
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
exports.safeInsert = safeInsert;
|
|
162
|
-
var finaliseInsert = function finaliseInsert(tr, nodeLength) {
|
|
163
|
-
var lastStep = tr.steps[tr.steps.length - 1];
|
|
164
|
-
if (!(lastStep instanceof _prosemirrorTransform.ReplaceStep || lastStep instanceof _prosemirrorTransform.ReplaceAroundStep)) {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Place gap cursor after the newly inserted node
|
|
169
|
-
var gapCursorPos = lastStep.to + lastStep.slice.openStart + nodeLength;
|
|
170
|
-
return tr.setSelection(new _gapCursorSelection.GapCursorSelection(tr.doc.resolve(gapCursorPos), _gapCursorSelection.Side.RIGHT)).scrollIntoView();
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Method extracted from typeahed plugin to be shared with the element browser on handling element insertion.
|
|
175
|
-
*/
|
|
176
|
-
var insertSelectedItem = function insertSelectedItem(maybeNode) {
|
|
177
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
178
|
-
return function (state, tr, start) {
|
|
179
|
-
if (!maybeNode) {
|
|
180
|
-
return tr;
|
|
181
|
-
}
|
|
182
|
-
var isInputFragment = maybeNode instanceof _prosemirrorModel.Fragment;
|
|
183
|
-
var node;
|
|
184
|
-
try {
|
|
185
|
-
node = maybeNode instanceof _prosemirrorModel.Node || isInputFragment ? maybeNode : typeof maybeNode === 'string' ? state.schema.text(maybeNode) : _prosemirrorModel.Node.fromJSON(state.schema, maybeNode);
|
|
186
|
-
} catch (e) {
|
|
187
|
-
// eslint-disable-next-line no-console
|
|
188
|
-
console.error(e);
|
|
189
|
-
return tr;
|
|
190
|
-
}
|
|
191
|
-
if (node.isText) {
|
|
192
|
-
tr = tr.replaceWith(start, start, node);
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
*
|
|
196
|
-
* Replacing a type ahead query mark with a block node.
|
|
197
|
-
*
|
|
198
|
-
*/
|
|
199
|
-
} else if (node.isBlock) {
|
|
200
|
-
/**
|
|
201
|
-
*
|
|
202
|
-
* Rule has unique insertion behaviour
|
|
203
|
-
* so using this safeInsert function in order to handle specific cases in flat list vs nested list
|
|
204
|
-
* instead of a generic pmSafeInsert (i.e appending at the end)
|
|
205
|
-
*
|
|
206
|
-
*/
|
|
207
|
-
|
|
208
|
-
var selectionInsideAPanel = selectionIsInsideAPanel(tr);
|
|
209
|
-
if (node.type.name === 'rule' && !selectionInsideAPanel) {
|
|
210
|
-
var _safeInsert;
|
|
211
|
-
tr = (_safeInsert = safeInsert(node, tr.selection.from)(tr)) !== null && _safeInsert !== void 0 ? _safeInsert : tr;
|
|
212
|
-
} else {
|
|
213
|
-
tr = (0, _prosemirrorUtils.safeInsert)((0, _selection.normaliseNestedLayout)(state, node), undefined, true)(tr);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
*
|
|
218
|
-
* Replacing a type ahead query mark with an inline node.
|
|
219
|
-
*
|
|
220
|
-
*/
|
|
221
|
-
} else if (node.isInline || isInputFragment) {
|
|
222
|
-
var fragment = isInputFragment ? node : _prosemirrorModel.Fragment.fromArray([node, state.schema.text(' ')]);
|
|
223
|
-
tr = tr.replaceWith(start, start, fragment);
|
|
224
|
-
if (opts.selectInlineNode) {
|
|
225
|
-
// Select inserted node
|
|
226
|
-
tr = tr.setSelection(_prosemirrorState.NodeSelection.create(tr.doc, start));
|
|
227
|
-
} else {
|
|
228
|
-
// Placing cursor after node + space.
|
|
229
|
-
tr = tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(start + fragment.size)));
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return tr;
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* ED-14584: Util to check if the destination node is a paragraph & the
|
|
238
|
-
* content being inserted is a valid child of the grandparent node.
|
|
239
|
-
* In this case, the destination node should split
|
|
240
|
-
*/
|
|
241
|
-
exports.insertSelectedItem = insertSelectedItem;
|
|
242
|
-
var shouldSplitSelectedNodeOnNodeInsertion = function shouldSplitSelectedNodeOnNodeInsertion(_ref) {
|
|
243
|
-
var parentNodeType = _ref.parentNodeType,
|
|
244
|
-
grandParentNodeType = _ref.grandParentNodeType,
|
|
245
|
-
content = _ref.content;
|
|
246
|
-
if (parentNodeType.name === 'doc' || parentNodeType.name === 'paragraph' && grandParentNodeType.validContent(_prosemirrorModel.Fragment.from(content))) {
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
return false;
|
|
250
|
-
};
|
|
251
|
-
exports.shouldSplitSelectedNodeOnNodeInsertion = shouldSplitSelectedNodeOnNodeInsertion;
|