@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,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ED-15646
|
|
3
|
-
* Headings in list items are not supported in our schema.
|
|
4
|
-
* As the markdown transformer is used by the paste plugin,
|
|
5
|
-
* certain pastes will strip invalid lines as
|
|
6
|
-
* prosemirror-markdown cannot conform to the schema
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
function handleHeadingOpen(state, token, acc, index) {
|
|
10
|
-
var _state$tokens;
|
|
11
|
-
const isInListItem = ((_state$tokens = state.tokens[index - 1]) === null || _state$tokens === void 0 ? void 0 : _state$tokens.type) === 'list_item_open';
|
|
12
|
-
if (isInListItem) {
|
|
13
|
-
acc.push(new state.Token('paragraph_open', 'p', 1));
|
|
14
|
-
} else {
|
|
15
|
-
acc.push(token);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function handleHeadingClose(state, token, acc, index) {
|
|
19
|
-
var _state$tokens2;
|
|
20
|
-
const isInListItem = ((_state$tokens2 = state.tokens[index + 1]) === null || _state$tokens2 === void 0 ? void 0 : _state$tokens2.type) === 'list_item_close';
|
|
21
|
-
if (isInListItem) {
|
|
22
|
-
acc.push(new state.Token('paragraph_close', 'p', -1));
|
|
23
|
-
} else {
|
|
24
|
-
acc.push(token);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export default function (md) {
|
|
28
|
-
md.core.ruler.after('inline', 'ignore-list-heading-md-plugin', function (state) {
|
|
29
|
-
state.tokens = state.tokens.reduce((acc, token, index) => {
|
|
30
|
-
const {
|
|
31
|
-
type
|
|
32
|
-
} = token;
|
|
33
|
-
if (type === 'heading_open') {
|
|
34
|
-
handleHeadingOpen(state, token, acc, index);
|
|
35
|
-
} else if (type === 'heading_close') {
|
|
36
|
-
handleHeadingClose(state, token, acc, index);
|
|
37
|
-
} else {
|
|
38
|
-
acc.push(token);
|
|
39
|
-
}
|
|
40
|
-
return acc;
|
|
41
|
-
}, []);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
@@ -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
|
-
const arrayReplaceAt = (src, pos, newElements) => {
|
|
11
|
-
return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
|
|
12
|
-
};
|
|
13
|
-
const isLinkOpen = str => {
|
|
14
|
-
return /^<a[>\s]/i.test(str);
|
|
15
|
-
};
|
|
16
|
-
const isLinkClose = str => {
|
|
17
|
-
return /^<\/a\s*>/i.test(str);
|
|
18
|
-
};
|
|
19
|
-
const linkify = state => {
|
|
20
|
-
const blockTokens = state.tokens;
|
|
21
|
-
const linkify = new LinkifyIt();
|
|
22
|
-
for (let j = 0, l = blockTokens.length; j < l; j++) {
|
|
23
|
-
if (blockTokens[j].type !== 'inline' || !linkify.pretest(blockTokens[j].content)) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
let tokens = blockTokens[j].children;
|
|
27
|
-
let 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 (let i = tokens.length - 1; i >= 0; i--) {
|
|
32
|
-
const 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
|
-
const text = currentToken.content;
|
|
57
|
-
let links = linkifyMatch(text);
|
|
58
|
-
if (!links.length) {
|
|
59
|
-
links = linkify.match(text) || [];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Now split string to nodes
|
|
63
|
-
const nodes = [];
|
|
64
|
-
let level = currentToken.level;
|
|
65
|
-
let lastPos = 0;
|
|
66
|
-
const filepaths = findFilepaths(text);
|
|
67
|
-
for (let ln = 0; ln < links.length; ln++) {
|
|
68
|
-
if (isLinkInMatches(links[ln].index, filepaths)) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
const {
|
|
72
|
-
url
|
|
73
|
-
} = links[ln];
|
|
74
|
-
const fullUrl = state.md.normalizeLink(url);
|
|
75
|
-
if (!state.md.validateLink(fullUrl)) {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
let urlText = links[ln].text;
|
|
79
|
-
|
|
80
|
-
// Linkifier might send raw hostnames like "example.com", where url
|
|
81
|
-
// starts with domain name. So we prepend http:// in those cases,
|
|
82
|
-
// and remove it afterwards.
|
|
83
|
-
//
|
|
84
|
-
if (!links[ln].schema) {
|
|
85
|
-
urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
|
|
86
|
-
} else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
|
|
87
|
-
urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
|
|
88
|
-
} else {
|
|
89
|
-
urlText = state.md.normalizeLinkText(urlText);
|
|
90
|
-
}
|
|
91
|
-
const pos = links[ln].index;
|
|
92
|
-
if (pos > lastPos) {
|
|
93
|
-
const token = new state.Token('text', '', 0);
|
|
94
|
-
token.content = text.slice(lastPos, pos);
|
|
95
|
-
token.level = level;
|
|
96
|
-
nodes.push(token);
|
|
97
|
-
}
|
|
98
|
-
let token = new state.Token('link_open', 'a', 1);
|
|
99
|
-
token.attrs = [['href', fullUrl]];
|
|
100
|
-
token.level = level++;
|
|
101
|
-
token.markup = 'linkify';
|
|
102
|
-
token.info = 'auto';
|
|
103
|
-
nodes.push(token);
|
|
104
|
-
token = new state.Token('text', '', 0);
|
|
105
|
-
token.content = urlText;
|
|
106
|
-
token.level = level;
|
|
107
|
-
nodes.push(token);
|
|
108
|
-
token = new state.Token('link_close', 'a', -1);
|
|
109
|
-
token.level = --level;
|
|
110
|
-
token.markup = 'linkify';
|
|
111
|
-
token.info = 'auto';
|
|
112
|
-
nodes.push(token);
|
|
113
|
-
lastPos = links[ln].lastIndex;
|
|
114
|
-
}
|
|
115
|
-
if (lastPos < text.length) {
|
|
116
|
-
const token = new state.Token('text', '', 0);
|
|
117
|
-
token.content = text.slice(lastPos);
|
|
118
|
-
token.level = level;
|
|
119
|
-
nodes.push(token);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// replace current node
|
|
123
|
-
blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
export default (md => md.core.ruler.push('custom-linkify', linkify));
|
|
@@ -1,58 +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
|
-
const newline = (state, silent) => {
|
|
7
|
-
let 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 (md => md.inline.ruler.at('newline', newline));
|
|
@@ -1,64 +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
|
-
const paragraph = (state, startLine) => {
|
|
8
|
-
let 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 (md => md.block.ruler.at('paragraph', paragraph));
|
|
@@ -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 const 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,17 +0,0 @@
|
|
|
1
|
-
import { pluginKey as undoRedoPluginKey } from './pm-plugins/plugin-key';
|
|
2
|
-
const getUndoRedoInputSource = tr => {
|
|
3
|
-
return tr.getMeta(undoRedoPluginKey) || null;
|
|
4
|
-
};
|
|
5
|
-
export const generateUndoRedoInputSoucePayload = tr => {
|
|
6
|
-
const undoRedoPluginInputSource = getUndoRedoInputSource(tr);
|
|
7
|
-
return payload => {
|
|
8
|
-
const shouldAddHistoryTriggerMethodAttribute = undoRedoPluginInputSource && ['undid', 'redid'].includes(payload.action);
|
|
9
|
-
return !shouldAddHistoryTriggerMethodAttribute ? payload : {
|
|
10
|
-
...payload,
|
|
11
|
-
attributes: {
|
|
12
|
-
...payload.attributes,
|
|
13
|
-
historyTriggerMethod: undoRedoPluginInputSource
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import createPluginsList from '../create-editor/create-plugins-list';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Retrieve the editor props using createPluginList default behaviour.
|
|
6
|
-
*
|
|
7
|
-
* @param GetEditorPlugins props used to initialise the plugins
|
|
8
|
-
* @returns list of editor plugins
|
|
9
|
-
*/
|
|
10
|
-
const getEditorPlugins = ({
|
|
11
|
-
props,
|
|
12
|
-
prevAppearance,
|
|
13
|
-
createAnalyticsEvent,
|
|
14
|
-
insertNodeAPI,
|
|
15
|
-
editorAnalyticsAPI
|
|
16
|
-
}) => {
|
|
17
|
-
var _props$dangerouslyApp, _props$dangerouslyApp2;
|
|
18
|
-
const 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 [...createPluginsList(props, {
|
|
20
|
-
appearance: prevAppearance
|
|
21
|
-
}, createAnalyticsEvent), ...dangerouslyAppendedPlugins];
|
|
22
|
-
};
|
|
23
|
-
export default getEditorPlugins;
|
|
@@ -1,244 +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 let LookDirection = /*#__PURE__*/function (LookDirection) {
|
|
10
|
-
LookDirection["Before"] = "before";
|
|
11
|
-
LookDirection["After"] = "after";
|
|
12
|
-
return LookDirection;
|
|
13
|
-
}({});
|
|
14
|
-
const isLastChild = ($pos, doc) => doc.resolve($pos.after()).node().lastChild === $pos.node();
|
|
15
|
-
const isFirstChild = ($pos, doc) => doc.resolve($pos.before()).node().firstChild === $pos.node();
|
|
16
|
-
const nodeIsInsideAList = tr => {
|
|
17
|
-
const {
|
|
18
|
-
nodes
|
|
19
|
-
} = tr.doc.type.schema;
|
|
20
|
-
return hasParentNodeOfType([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
21
|
-
};
|
|
22
|
-
const selectionIsInsideAPanel = tr => {
|
|
23
|
-
const {
|
|
24
|
-
nodes
|
|
25
|
-
} = tr.doc.type.schema;
|
|
26
|
-
return hasParentNodeOfType(nodes.panel)(tr.selection);
|
|
27
|
-
};
|
|
28
|
-
const selectionIsInNestedList = tr => {
|
|
29
|
-
const {
|
|
30
|
-
nodes
|
|
31
|
-
} = tr.doc.type.schema;
|
|
32
|
-
const parentListNode = findParentNodeOfType([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
33
|
-
if (!parentListNode) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return isListItemNode(tr.doc.resolve(parentListNode.pos).parent);
|
|
37
|
-
};
|
|
38
|
-
const insertBeforeOrAfter = (tr, lookDirection, $parentPos, $proposedPosition, content) => {
|
|
39
|
-
/**
|
|
40
|
-
* This block caters for the first item in a parent with the cursor being at the very start
|
|
41
|
-
* or the last item with the cursor being at the very end
|
|
42
|
-
*
|
|
43
|
-
* e.g.
|
|
44
|
-
* ul
|
|
45
|
-
* li {<>}Scenario one
|
|
46
|
-
* li
|
|
47
|
-
* li Scenario two{<>}
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
if (isFirstChild($proposedPosition, tr.doc) && lookDirection === LookDirection.Before || isLastChild($proposedPosition, tr.doc) && lookDirection === LookDirection.After) {
|
|
51
|
-
return tr.insert($parentPos[lookDirection](), content);
|
|
52
|
-
}
|
|
53
|
-
return tr.insert($proposedPosition[lookDirection](), content);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// FIXME: A more sustainable and configurable way to choose when to split
|
|
57
|
-
const shouldSplit = (nodeType, schemaNodes) => {
|
|
58
|
-
return [schemaNodes.bulletList, schemaNodes.orderedList, schemaNodes.panel].includes(nodeType);
|
|
59
|
-
};
|
|
60
|
-
export const safeInsert = (content, position) => tr => {
|
|
61
|
-
var _tr$selection$$from$n;
|
|
62
|
-
const {
|
|
63
|
-
nodes
|
|
64
|
-
} = tr.doc.type.schema;
|
|
65
|
-
const whitelist = [nodes.rule, nodes.mediaSingle];
|
|
66
|
-
if (content instanceof Fragment || !whitelist.includes(content.type)) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Check for selection
|
|
71
|
-
if (!tr.selection.empty || isNodeSelection(tr.selection)) {
|
|
72
|
-
// NOT IMPLEMENTED
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
const {
|
|
76
|
-
$from
|
|
77
|
-
} = tr.selection;
|
|
78
|
-
const $insertPos = position ? tr.doc.resolve(position) : isNodeSelection(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;
|
|
79
|
-
let lookDirection;
|
|
80
|
-
const insertPosEnd = $insertPos.end();
|
|
81
|
-
const insertPosStart = $insertPos.start();
|
|
82
|
-
|
|
83
|
-
// When parent node is an empty paragraph,
|
|
84
|
-
// check the empty paragraph is the first or last node of its parent.
|
|
85
|
-
if (isEmptyParagraph($insertPos.parent)) {
|
|
86
|
-
if (isLastChild($insertPos, tr.doc)) {
|
|
87
|
-
lookDirection = LookDirection.After;
|
|
88
|
-
} else if (isFirstChild($insertPos, tr.doc)) {
|
|
89
|
-
lookDirection = LookDirection.Before;
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
if ($insertPos.pos === insertPosEnd) {
|
|
93
|
-
lookDirection = LookDirection.After;
|
|
94
|
-
} else if ($insertPos.pos === insertPosStart) {
|
|
95
|
-
lookDirection = LookDirection.Before;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const grandParentNodeType = (_tr$selection$$from$n = tr.selection.$from.node(-1)) === null || _tr$selection$$from$n === void 0 ? void 0 : _tr$selection$$from$n.type;
|
|
99
|
-
const parentNodeType = tr.selection.$from.parent.type;
|
|
100
|
-
|
|
101
|
-
// if there is no direction, and cannot split for this particular node
|
|
102
|
-
const noDirectionAndShouldNotSplit = !lookDirection && !shouldSplitSelectedNodeOnNodeInsertion({
|
|
103
|
-
parentNodeType,
|
|
104
|
-
grandParentNodeType,
|
|
105
|
-
content
|
|
106
|
-
});
|
|
107
|
-
const ruleNodeInANestedListNode = content.type === nodes.rule && selectionIsInNestedList(tr);
|
|
108
|
-
const nonRuleNodeInListNode = !(content.type === nodes.rule) && nodeIsInsideAList(tr);
|
|
109
|
-
if (ruleNodeInANestedListNode || noDirectionAndShouldNotSplit && nonRuleNodeInListNode || noDirectionAndShouldNotSplit && !nodeIsInsideAList(tr)) {
|
|
110
|
-
// node to be inserted is an invalid child of selection so insert below selected node
|
|
111
|
-
return pmSafeInsert(content, tr.selection.from)(tr);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// if node is a rule and that is a flat list splitting and not at the end of a list
|
|
115
|
-
const {
|
|
116
|
-
from,
|
|
117
|
-
to
|
|
118
|
-
} = tr.selection;
|
|
119
|
-
const ruleTypeInAList = content.type === nodes.rule && nodeIsInsideAList(tr);
|
|
120
|
-
if (ruleTypeInAList && !($insertPos.pos === insertPosEnd)) {
|
|
121
|
-
return tr.replaceRange(from, to, new Slice(Fragment.from(nodes.rule.createChecked()), 0, 0));
|
|
122
|
-
}
|
|
123
|
-
if (!lookDirection) {
|
|
124
|
-
// fallback to consumer for now
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Replace empty paragraph
|
|
129
|
-
if (isEmptyParagraph($insertPos.parent) && canInsert(tr.doc.resolve($insertPos[lookDirection]()), content)) {
|
|
130
|
-
return finaliseInsert(tr.replaceWith($insertPos.before(), $insertPos.after(), content), -1);
|
|
131
|
-
}
|
|
132
|
-
let $proposedPosition = $insertPos;
|
|
133
|
-
while ($proposedPosition.depth > 0) {
|
|
134
|
-
const $parentPos = tr.doc.resolve($proposedPosition[lookDirection]());
|
|
135
|
-
const parentNode = $parentPos.node();
|
|
136
|
-
|
|
137
|
-
// Insert at position (before or after target pos)
|
|
138
|
-
if (canInsert($proposedPosition, content)) {
|
|
139
|
-
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// If we can't insert, and we think we should split, we fallback to consumer for now
|
|
143
|
-
if (shouldSplit(parentNode.type, tr.doc.type.schema.nodes)) {
|
|
144
|
-
const nextTr = finaliseInsert(insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content), content.nodeSize);
|
|
145
|
-
|
|
146
|
-
// Move selection to the closest text node, otherwise it defaults to the whatever the lookDirection is set to above
|
|
147
|
-
if ([nodes.orderedList, nodes.bulletList].includes(parentNode.type) && nextTr) {
|
|
148
|
-
return nextTr.setSelection(TextSelection.between(nextTr.selection.$from, nextTr.selection.$from));
|
|
149
|
-
} else {
|
|
150
|
-
return nextTr;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Can not insert into current parent, step up one parent
|
|
155
|
-
$proposedPosition = $parentPos;
|
|
156
|
-
}
|
|
157
|
-
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
158
|
-
};
|
|
159
|
-
const finaliseInsert = (tr, nodeLength) => {
|
|
160
|
-
const lastStep = tr.steps[tr.steps.length - 1];
|
|
161
|
-
if (!(lastStep instanceof ReplaceStep || lastStep instanceof ReplaceAroundStep)) {
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Place gap cursor after the newly inserted node
|
|
166
|
-
const gapCursorPos = lastStep.to + lastStep.slice.openStart + nodeLength;
|
|
167
|
-
return tr.setSelection(new GapCursorSelection(tr.doc.resolve(gapCursorPos), Side.RIGHT)).scrollIntoView();
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Method extracted from typeahed plugin to be shared with the element browser on handling element insertion.
|
|
172
|
-
*/
|
|
173
|
-
export const insertSelectedItem = (maybeNode, opts = {}) => (state, tr, start) => {
|
|
174
|
-
if (!maybeNode) {
|
|
175
|
-
return tr;
|
|
176
|
-
}
|
|
177
|
-
const isInputFragment = maybeNode instanceof Fragment;
|
|
178
|
-
let node;
|
|
179
|
-
try {
|
|
180
|
-
node = maybeNode instanceof Node || isInputFragment ? maybeNode : typeof maybeNode === 'string' ? state.schema.text(maybeNode) : Node.fromJSON(state.schema, maybeNode);
|
|
181
|
-
} catch (e) {
|
|
182
|
-
// eslint-disable-next-line no-console
|
|
183
|
-
console.error(e);
|
|
184
|
-
return tr;
|
|
185
|
-
}
|
|
186
|
-
if (node.isText) {
|
|
187
|
-
tr = tr.replaceWith(start, start, node);
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
*
|
|
191
|
-
* Replacing a type ahead query mark with a block node.
|
|
192
|
-
*
|
|
193
|
-
*/
|
|
194
|
-
} else if (node.isBlock) {
|
|
195
|
-
/**
|
|
196
|
-
*
|
|
197
|
-
* Rule has unique insertion behaviour
|
|
198
|
-
* so using this safeInsert function in order to handle specific cases in flat list vs nested list
|
|
199
|
-
* instead of a generic pmSafeInsert (i.e appending at the end)
|
|
200
|
-
*
|
|
201
|
-
*/
|
|
202
|
-
|
|
203
|
-
const selectionInsideAPanel = selectionIsInsideAPanel(tr);
|
|
204
|
-
if (node.type.name === 'rule' && !selectionInsideAPanel) {
|
|
205
|
-
var _safeInsert;
|
|
206
|
-
tr = (_safeInsert = safeInsert(node, tr.selection.from)(tr)) !== null && _safeInsert !== void 0 ? _safeInsert : tr;
|
|
207
|
-
} else {
|
|
208
|
-
tr = pmSafeInsert(normaliseNestedLayout(state, node), undefined, true)(tr);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
*
|
|
213
|
-
* Replacing a type ahead query mark with an inline node.
|
|
214
|
-
*
|
|
215
|
-
*/
|
|
216
|
-
} else if (node.isInline || isInputFragment) {
|
|
217
|
-
const fragment = isInputFragment ? node : Fragment.fromArray([node, state.schema.text(' ')]);
|
|
218
|
-
tr = tr.replaceWith(start, start, fragment);
|
|
219
|
-
if (opts.selectInlineNode) {
|
|
220
|
-
// Select inserted node
|
|
221
|
-
tr = tr.setSelection(NodeSelection.create(tr.doc, start));
|
|
222
|
-
} else {
|
|
223
|
-
// Placing cursor after node + space.
|
|
224
|
-
tr = tr.setSelection(Selection.near(tr.doc.resolve(start + fragment.size)));
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return tr;
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* ED-14584: Util to check if the destination node is a paragraph & the
|
|
232
|
-
* content being inserted is a valid child of the grandparent node.
|
|
233
|
-
* In this case, the destination node should split
|
|
234
|
-
*/
|
|
235
|
-
export const shouldSplitSelectedNodeOnNodeInsertion = ({
|
|
236
|
-
parentNodeType,
|
|
237
|
-
grandParentNodeType,
|
|
238
|
-
content
|
|
239
|
-
}) => {
|
|
240
|
-
if (parentNodeType.name === 'doc' || parentNodeType.name === 'paragraph' && grandParentNodeType.validContent(Fragment.from(content))) {
|
|
241
|
-
return true;
|
|
242
|
-
}
|
|
243
|
-
return false;
|
|
244
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { sendLogs } from '@atlaskit/editor-common/utils';
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
2
|
-
import { attachPayloadIntoTransaction } from './attach-payload-into-transaction';
|
|
3
|
-
export var createEditorAnalyticsAPI = function createEditorAnalyticsAPI(_ref) {
|
|
4
|
-
var getEditorView = _ref.getEditorView,
|
|
5
|
-
getCreateUIAnalyticsEvent = _ref.getCreateUIAnalyticsEvent;
|
|
6
|
-
return {
|
|
7
|
-
attachAnalyticsEvent: function attachAnalyticsEvent(payload) {
|
|
8
|
-
return function (tr) {
|
|
9
|
-
var createAnalyticsEvent = getCreateUIAnalyticsEvent();
|
|
10
|
-
var editorView = getEditorView();
|
|
11
|
-
if (!tr || !createAnalyticsEvent || !editorView) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
var editorState = editorView.state;
|
|
15
|
-
attachPayloadIntoTransaction({
|
|
16
|
-
tr: tr,
|
|
17
|
-
editorState: editorState,
|
|
18
|
-
payload: payload,
|
|
19
|
-
channel: FabricChannel.editor
|
|
20
|
-
});
|
|
21
|
-
return true;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { getStateContext } from './editor-state-context';
|
|
2
|
-
import { mapActionSubjectIdToAttributes } from './map-attributes';
|
|
3
|
-
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
4
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
var actionsToIgnore = [ACTION.INVOKED, ACTION.OPENED];
|
|
6
|
-
// This utils was taken as reference in packages/editor/editor-plugin-ai/src/analytics/utils.ts
|
|
7
|
-
// to create new util attachPayloadIntoTransaction in above file.
|
|
8
|
-
// If you make a change here, please review attachPayloadIntoTransaction in above
|
|
9
|
-
// file and update it as well if needed.
|
|
10
|
-
export var attachPayloadIntoTransaction = function attachPayloadIntoTransaction(_ref) {
|
|
11
|
-
var payload = _ref.payload,
|
|
12
|
-
editorState = _ref.editorState,
|
|
13
|
-
tr = _ref.tr,
|
|
14
|
-
channel = _ref.channel;
|
|
15
|
-
payload = getStateContext(editorState, payload);
|
|
16
|
-
payload = mapActionSubjectIdToAttributes(payload);
|
|
17
|
-
var storedMarks = tr.storedMarks;
|
|
18
|
-
var pos = tr.mapping.map(editorState.selection.$from.pos, -1);
|
|
19
|
-
tr.step(new AnalyticsStep([{
|
|
20
|
-
payload: payload,
|
|
21
|
-
channel: channel
|
|
22
|
-
}], actionsToIgnore, pos) // We need to create the step based on a position, this prevent split history for relative changes.
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
// When you add a new step all the storedMarks are removed it
|
|
26
|
-
if (storedMarks) {
|
|
27
|
-
tr.setStoredMarks(storedMarks);
|
|
28
|
-
}
|
|
29
|
-
};
|