@atlaskit/editor-core 183.0.12 → 183.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/cjs/actions/index.js +1 -16
- package/dist/cjs/create-editor/ErrorBoundary.js +19 -8
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +40 -21
- package/dist/cjs/editor-next/editor-internal.js +6 -1
- package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +1 -41
- package/dist/cjs/labs/next/presets/default.js +23 -1
- package/dist/cjs/labs/next/presets/universal.js +9 -18
- package/dist/cjs/plugins/analytics/index.js +0 -24
- package/dist/cjs/plugins/analytics/plugin-key.js +7 -1
- package/dist/cjs/plugins/analytics/plugin.js +17 -45
- package/dist/cjs/plugins/analytics/utils.js +24 -34
- package/dist/cjs/plugins/base/index.js +7 -1
- package/dist/cjs/plugins/base/pm-plugins/decoration.js +8 -0
- package/dist/cjs/plugins/block-type/commands/block-type.js +1 -1
- package/dist/cjs/plugins/caption/index.js +3 -2
- package/dist/cjs/plugins/caption/pm-plugins/main.js +8 -7
- package/dist/cjs/plugins/card/index.js +2 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +103 -70
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +3 -2
- package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +36 -20
- package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +48 -9
- package/dist/cjs/plugins/card/pm-plugins/doc.js +19 -19
- package/dist/cjs/plugins/card/pm-plugins/main.js +5 -3
- package/dist/cjs/plugins/card/pm-plugins/shouldReplaceLink.js +4 -4
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +6 -6
- package/dist/cjs/plugins/card/toolbar.js +86 -68
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +19 -13
- package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +9 -3
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +6 -5
- package/dist/cjs/plugins/card/ui/LinkToolbarButtonGroup.js +2 -2
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +1 -2
- package/dist/cjs/plugins/collab-edit/ui/styles.js +2 -3
- package/dist/cjs/plugins/date/index.js +4 -3
- package/dist/cjs/plugins/expand/ui/styles.js +4 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +3 -3
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +5 -1
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +4 -6
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -5
- package/dist/cjs/plugins/grid/index.js +73 -39
- package/dist/cjs/plugins/history/pm-history-types.js +1 -5
- package/dist/cjs/plugins/history/utils.js +2 -2
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +4 -2
- package/dist/cjs/plugins/hyperlink/Toolbar.js +4 -3
- package/dist/cjs/plugins/hyperlink/commands.js +14 -14
- package/dist/cjs/plugins/hyperlink/index.js +7 -5
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +5 -5
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +2 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -3
- package/dist/cjs/plugins/insert-block/index.js +1 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +40 -44
- package/dist/cjs/plugins/layout/styles.js +2 -2
- package/dist/cjs/plugins/list/actions/conversions.js +1 -1
- package/dist/cjs/plugins/list/commands/listBackspace.js +5 -5
- package/dist/cjs/plugins/list/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/list/transforms.js +2 -2
- package/dist/cjs/plugins/list/utils/analytics.js +2 -2
- package/dist/cjs/plugins/list/utils/find.js +6 -6
- package/dist/cjs/plugins/list/utils/indentation.js +3 -3
- package/dist/cjs/plugins/list/utils/node.js +32 -23
- package/dist/cjs/plugins/list/utils/selection.js +11 -11
- package/dist/cjs/plugins/macro/actions.js +2 -2
- package/dist/cjs/plugins/media/commands/linking.js +1 -1
- package/dist/cjs/plugins/media/index.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +31 -17
- package/dist/cjs/plugins/media/pm-plugins/alt-text/index.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +3 -4
- package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +2 -2
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +4 -4
- package/dist/cjs/plugins/media/ui/ImageBorder/styles.js +4 -1
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +3 -4
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +13 -4
- package/dist/cjs/plugins/media/utils/media-single.js +10 -57
- package/dist/cjs/plugins/paste/edge-cases/index.js +3 -3
- package/dist/cjs/plugins/paste/edge-cases/lists.js +1 -1
- package/dist/cjs/plugins/paste/handlers.js +16 -10
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/cjs/plugins/paste/pm-plugins/main.js +13 -20
- package/dist/cjs/plugins/quick-insert/commands.js +1 -1
- package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/cjs/plugins/selection/commands.js +24 -23
- package/dist/cjs/plugins/selection/utils.js +2 -2
- package/dist/cjs/plugins/status/plugin.js +13 -7
- package/dist/cjs/plugins/status/ui/statusPicker.js +1 -1
- package/dist/cjs/plugins/type-ahead/insert-utils.js +2 -3
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -1
- package/dist/cjs/plugins/width/index.js +12 -0
- package/dist/cjs/ui/Alignment/styles.js +1 -2
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +2 -3
- package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +1 -2
- package/dist/cjs/ui/ColorPickerButton/index.js +16 -9
- package/dist/cjs/ui/ConfigPanel/ErrorMessage/ErrorImage.js +1 -2
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -3
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +3 -4
- package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +1 -2
- package/dist/cjs/ui/ConfigPanel/Fields/SelectItem.js +1 -2
- package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +1 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +4 -0
- package/dist/cjs/ui/ErrorBoundary/index.js +7 -0
- package/dist/cjs/ui/Resizer/index.js +4 -4
- package/dist/cjs/utils/commands.js +2 -2
- package/dist/cjs/utils/document.js +4 -12
- package/dist/cjs/utils/index.js +1 -14
- package/dist/cjs/utils/selection.js +1 -26
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +1 -16
- package/dist/es2019/create-editor/ErrorBoundary.js +18 -7
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +44 -27
- package/dist/es2019/editor-next/editor-internal.js +6 -1
- package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +1 -39
- package/dist/es2019/labs/next/presets/default.js +27 -1
- package/dist/es2019/labs/next/presets/universal.js +9 -19
- package/dist/es2019/plugins/analytics/index.js +1 -1
- package/dist/es2019/plugins/analytics/plugin-key.js +8 -1
- package/dist/es2019/plugins/analytics/plugin.js +15 -38
- package/dist/es2019/plugins/analytics/utils.js +24 -11
- package/dist/es2019/plugins/base/index.js +4 -1
- package/dist/es2019/plugins/base/pm-plugins/decoration.js +9 -0
- package/dist/es2019/plugins/block-type/commands/block-type.js +1 -1
- package/dist/es2019/plugins/caption/index.js +3 -2
- package/dist/es2019/plugins/caption/pm-plugins/main.js +8 -7
- package/dist/es2019/plugins/card/index.js +2 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +105 -70
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +3 -2
- package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +33 -16
- package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +43 -7
- package/dist/es2019/plugins/card/pm-plugins/doc.js +19 -19
- package/dist/es2019/plugins/card/pm-plugins/main.js +7 -3
- package/dist/es2019/plugins/card/pm-plugins/shouldReplaceLink.js +1 -1
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +6 -6
- package/dist/es2019/plugins/card/toolbar.js +51 -30
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +11 -5
- package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +6 -0
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +6 -5
- package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +1 -1
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/es2019/plugins/collab-edit/ui/styles.js +3 -4
- package/dist/es2019/plugins/date/index.js +4 -3
- package/dist/es2019/plugins/expand/ui/styles.js +1 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +6 -2
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +3 -5
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +9 -9
- package/dist/es2019/plugins/grid/index.js +76 -39
- package/dist/es2019/plugins/history/pm-history-types.js +1 -2
- package/dist/es2019/plugins/history/utils.js +1 -1
- package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +4 -2
- package/dist/es2019/plugins/hyperlink/Toolbar.js +4 -3
- package/dist/es2019/plugins/hyperlink/commands.js +3 -3
- package/dist/es2019/plugins/hyperlink/index.js +7 -5
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +3 -3
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/es2019/plugins/insert-block/index.js +1 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +16 -19
- package/dist/es2019/plugins/layout/styles.js +4 -0
- package/dist/es2019/plugins/list/actions/conversions.js +1 -1
- package/dist/es2019/plugins/list/commands/listBackspace.js +1 -1
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/transforms.js +1 -1
- package/dist/es2019/plugins/list/utils/analytics.js +1 -1
- package/dist/es2019/plugins/list/utils/find.js +1 -1
- package/dist/es2019/plugins/list/utils/indentation.js +1 -1
- package/dist/es2019/plugins/list/utils/node.js +2 -12
- package/dist/es2019/plugins/list/utils/selection.js +1 -1
- package/dist/es2019/plugins/macro/actions.js +1 -1
- package/dist/es2019/plugins/media/commands/linking.js +1 -1
- package/dist/es2019/plugins/media/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +20 -6
- package/dist/es2019/plugins/media/pm-plugins/alt-text/index.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +1 -1
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +1 -1
- package/dist/es2019/plugins/media/ui/ImageBorder/styles.js +4 -0
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +15 -3
- package/dist/es2019/plugins/media/utils/media-single.js +5 -53
- package/dist/es2019/plugins/paste/edge-cases/index.js +1 -1
- package/dist/es2019/plugins/paste/edge-cases/lists.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +11 -4
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/es2019/plugins/paste/pm-plugins/main.js +2 -3
- package/dist/es2019/plugins/quick-insert/commands.js +1 -1
- package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/plugins/selection/commands.js +2 -1
- package/dist/es2019/plugins/selection/utils.js +1 -1
- package/dist/es2019/plugins/status/plugin.js +9 -3
- package/dist/es2019/plugins/status/ui/statusPicker.js +2 -2
- package/dist/es2019/plugins/type-ahead/insert-utils.js +1 -2
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/es2019/plugins/width/index.js +12 -0
- package/dist/es2019/ui/Alignment/styles.js +1 -2
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +2 -3
- package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +3 -4
- package/dist/es2019/ui/ColorPickerButton/index.js +18 -9
- package/dist/es2019/ui/ConfigPanel/ErrorMessage/ErrorImage.js +1 -2
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +7 -3
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +5 -6
- package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -3
- package/dist/es2019/ui/ConfigPanel/Fields/SelectItem.js +1 -2
- package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/es2019/ui/ContentStyles/index.js +2 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +2 -2
- package/dist/es2019/ui/ElementBrowser/constants.js +3 -0
- package/dist/es2019/ui/ErrorBoundary/index.js +7 -0
- package/dist/es2019/ui/Resizer/index.js +4 -4
- package/dist/es2019/utils/commands.js +1 -1
- package/dist/es2019/utils/document.js +1 -8
- package/dist/es2019/utils/index.js +2 -2
- package/dist/es2019/utils/selection.js +0 -22
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +1 -16
- package/dist/esm/create-editor/ErrorBoundary.js +19 -8
- package/dist/esm/create-editor/ReactEditorViewInternal.js +40 -21
- package/dist/esm/editor-next/editor-internal.js +6 -1
- package/dist/esm/labs/next/presets/create-stub-internal-apis.js +1 -41
- package/dist/esm/labs/next/presets/default.js +23 -1
- package/dist/esm/labs/next/presets/universal.js +9 -18
- package/dist/esm/plugins/analytics/index.js +1 -1
- package/dist/esm/plugins/analytics/plugin-key.js +8 -1
- package/dist/esm/plugins/analytics/plugin.js +17 -45
- package/dist/esm/plugins/analytics/utils.js +24 -11
- package/dist/esm/plugins/base/index.js +4 -1
- package/dist/esm/plugins/base/pm-plugins/decoration.js +9 -0
- package/dist/esm/plugins/block-type/commands/block-type.js +1 -1
- package/dist/esm/plugins/caption/index.js +3 -2
- package/dist/esm/plugins/caption/pm-plugins/main.js +8 -7
- package/dist/esm/plugins/card/index.js +2 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +103 -70
- package/dist/esm/plugins/card/nodeviews/genericCard.js +3 -2
- package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +36 -20
- package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +43 -7
- package/dist/esm/plugins/card/pm-plugins/doc.js +19 -19
- package/dist/esm/plugins/card/pm-plugins/main.js +5 -3
- package/dist/esm/plugins/card/pm-plugins/shouldReplaceLink.js +1 -1
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +6 -6
- package/dist/esm/plugins/card/toolbar.js +86 -68
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +19 -13
- package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +9 -3
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +6 -5
- package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +1 -1
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/esm/plugins/collab-edit/ui/styles.js +2 -3
- package/dist/esm/plugins/date/index.js +4 -3
- package/dist/esm/plugins/expand/ui/styles.js +2 -3
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +5 -1
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +2 -4
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -5
- package/dist/esm/plugins/grid/index.js +72 -36
- package/dist/esm/plugins/history/pm-history-types.js +1 -2
- package/dist/esm/plugins/history/utils.js +1 -1
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +4 -2
- package/dist/esm/plugins/hyperlink/Toolbar.js +4 -3
- package/dist/esm/plugins/hyperlink/commands.js +3 -3
- package/dist/esm/plugins/hyperlink/index.js +7 -5
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +3 -3
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -2
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
- package/dist/esm/plugins/insert-block/index.js +1 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +40 -44
- package/dist/esm/plugins/layout/styles.js +3 -1
- package/dist/esm/plugins/list/actions/conversions.js +1 -1
- package/dist/esm/plugins/list/commands/listBackspace.js +1 -1
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/transforms.js +1 -1
- package/dist/esm/plugins/list/utils/analytics.js +1 -1
- package/dist/esm/plugins/list/utils/find.js +1 -1
- package/dist/esm/plugins/list/utils/indentation.js +1 -1
- package/dist/esm/plugins/list/utils/node.js +2 -12
- package/dist/esm/plugins/list/utils/selection.js +1 -1
- package/dist/esm/plugins/macro/actions.js +1 -1
- package/dist/esm/plugins/media/commands/linking.js +1 -1
- package/dist/esm/plugins/media/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +31 -17
- package/dist/esm/plugins/media/pm-plugins/alt-text/index.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/toolbar/filePreviewItem.js +1 -1
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +1 -1
- package/dist/esm/plugins/media/ui/ImageBorder/styles.js +4 -0
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +13 -3
- package/dist/esm/plugins/media/utils/media-single.js +5 -51
- package/dist/esm/plugins/paste/edge-cases/index.js +1 -1
- package/dist/esm/plugins/paste/edge-cases/lists.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +11 -4
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/esm/plugins/paste/pm-plugins/main.js +2 -3
- package/dist/esm/plugins/quick-insert/commands.js +1 -1
- package/dist/esm/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/esm/plugins/selection/commands.js +2 -1
- package/dist/esm/plugins/selection/utils.js +1 -1
- package/dist/esm/plugins/status/plugin.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +2 -2
- package/dist/esm/plugins/type-ahead/insert-utils.js +1 -2
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/esm/plugins/width/index.js +12 -0
- package/dist/esm/ui/Alignment/styles.js +1 -2
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +2 -3
- package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +1 -2
- package/dist/esm/ui/ColorPickerButton/index.js +16 -9
- package/dist/esm/ui/ConfigPanel/ErrorMessage/ErrorImage.js +1 -2
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +6 -2
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +3 -4
- package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +1 -2
- package/dist/esm/ui/ConfigPanel/Fields/SelectItem.js +1 -2
- package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
- package/dist/esm/ui/ContentStyles/index.js +3 -3
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +2 -2
- package/dist/esm/ui/ElementBrowser/constants.js +3 -0
- package/dist/esm/ui/ErrorBoundary/index.js +7 -0
- package/dist/esm/ui/Resizer/index.js +4 -4
- package/dist/esm/utils/commands.js +1 -1
- package/dist/esm/utils/document.js +1 -8
- package/dist/esm/utils/index.js +2 -2
- package/dist/esm/utils/selection.js +0 -23
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ErrorBoundary.d.ts +2 -0
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +2 -1
- package/dist/types/labs/next/presets/create-stub-internal-apis.d.ts +0 -3
- package/dist/types/labs/next/presets/cxhtml.d.ts +63 -3
- package/dist/types/labs/next/presets/default.d.ts +129 -6
- package/dist/types/labs/next/presets/mobile.d.ts +63 -3
- package/dist/types/plugins/analytics/index.d.ts +1 -1
- package/dist/types/plugins/analytics/plugin-key.d.ts +6 -0
- package/dist/types/plugins/analytics/plugin.d.ts +9 -2
- package/dist/types/plugins/analytics/utils.d.ts +16 -3
- package/dist/types/plugins/base/index.d.ts +4 -0
- package/dist/types/plugins/base/pm-plugins/decoration.d.ts +8 -0
- package/dist/types/plugins/caption/index.d.ts +4 -1
- package/dist/types/plugins/caption/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/card/index.d.ts +11 -1
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +1 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +3 -0
- package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +2 -0
- package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +8 -2
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +7 -7
- package/dist/types/plugins/card/pm-plugins/main.d.ts +3 -1
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types/plugins/card/toolbar.d.ts +7 -4
- package/dist/types/plugins/card/types.d.ts +1 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -2
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -0
- package/dist/types/plugins/date/index.d.ts +3 -2
- package/dist/types/plugins/date/ui/DatePicker/date-picker-input.d.ts +1 -1
- package/dist/types/plugins/date/ui/DatePicker/index.d.ts +1 -1
- package/dist/types/plugins/grid/index.d.ts +14 -7
- package/dist/types/plugins/grid/types.d.ts +3 -2
- package/dist/types/plugins/history/pm-history-types.d.ts +0 -1
- package/dist/types/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types/plugins/hyperlink/commands.d.ts +1 -1
- package/dist/types/plugins/hyperlink/index.d.ts +6 -2
- package/dist/types/plugins/insert-block/index.d.ts +6 -4
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +3 -3
- package/dist/types/plugins/list/utils/node.d.ts +2 -6
- package/dist/types/plugins/media/index.d.ts +2 -1
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +4 -1
- package/dist/types/plugins/media/nodeviews/types.d.ts +4 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -1
- package/dist/types/plugins/media/utils/media-single.d.ts +2 -15
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +0 -1
- package/dist/types/plugins/width/index.d.ts +9 -1
- package/dist/types/types/performance-tracking.d.ts +1 -323
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types/ui/ColorPickerButton/index.d.ts +6 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ElementBrowser/components/CategoryList.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +1 -1
- package/dist/types/ui/Resizer/types.d.ts +1 -1
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/selection.d.ts +1 -2
- package/dist/types-ts4.5/create-editor/ErrorBoundary.d.ts +2 -0
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +2 -1
- package/dist/types-ts4.5/labs/next/presets/create-stub-internal-apis.d.ts +0 -3
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +73 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +149 -6
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +73 -3
- package/dist/types-ts4.5/plugins/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/analytics/plugin-key.d.ts +6 -0
- package/dist/types-ts4.5/plugins/analytics/plugin.d.ts +10 -2
- package/dist/types-ts4.5/plugins/analytics/utils.d.ts +16 -3
- package/dist/types-ts4.5/plugins/base/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +8 -0
- package/dist/types-ts4.5/plugins/caption/index.d.ts +6 -1
- package/dist/types-ts4.5/plugins/caption/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/index.d.ts +9 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/utils.d.ts +8 -2
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +7 -7
- package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +7 -4
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +4 -2
- package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -0
- package/dist/types-ts4.5/plugins/date/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/date-picker-input.d.ts +1 -1
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/grid/index.d.ts +16 -7
- package/dist/types-ts4.5/plugins/grid/types.d.ts +3 -2
- package/dist/types-ts4.5/plugins/history/pm-history-types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/insert-block/index.d.ts +4 -4
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +3 -3
- package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -6
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +4 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +2 -15
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +0 -1
- package/dist/types-ts4.5/plugins/width/index.d.ts +9 -1
- package/dist/types-ts4.5/types/performance-tracking.d.ts +1 -323
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +6 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ElementBrowser/components/CategoryList.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementList/ElementList.d.ts +1 -1
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/document.d.ts +0 -4
- package/dist/types-ts4.5/utils/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/selection.d.ts +1 -2
- package/package.json +30 -23
- package/report.api.md +80 -151
- package/dist/cjs/analytics-api/api.js +0 -32
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +0 -36
- package/dist/cjs/analytics-api/editor-state-context.js +0 -77
- package/dist/cjs/analytics-api/map-attributes.js +0 -23
- package/dist/cjs/insert-api/api.js +0 -43
- package/dist/cjs/insert-api/insert-content-handlers.js +0 -94
- package/dist/cjs/insert-api/insert-node-helpers.js +0 -133
- package/dist/cjs/insert-api/types.js +0 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Button.js +0 -93
- package/dist/cjs/plugins/hyperlink/analytics.js +0 -23
- package/dist/cjs/plugins/hyperlink/utils.js +0 -183
- package/dist/cjs/plugins/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -47
- package/dist/cjs/plugins/paste/md-plugins/linkify-md-plugin.js +0 -135
- package/dist/cjs/plugins/paste/md-plugins/newline-md-plugin.js +0 -67
- package/dist/cjs/plugins/paste/md-plugins/paragraph-md-plugin.js +0 -73
- package/dist/cjs/plugins/paste/md.js +0 -31
- package/dist/cjs/plugins/undo-redo/undo-redo-input-source.js +0 -26
- package/dist/cjs/types/get-editor-props.js +0 -5
- package/dist/cjs/utils/get-editor-plugins.js +0 -30
- package/dist/cjs/utils/insert.js +0 -251
- package/dist/cjs/utils/sendLogs.js +0 -12
- package/dist/es2019/analytics-api/api.js +0 -28
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +0 -32
- package/dist/es2019/analytics-api/editor-state-context.js +0 -74
- package/dist/es2019/analytics-api/map-attributes.js +0 -14
- package/dist/es2019/insert-api/api.js +0 -42
- package/dist/es2019/insert-api/insert-content-handlers.js +0 -84
- package/dist/es2019/insert-api/insert-node-helpers.js +0 -137
- package/dist/es2019/insert-api/types.js +0 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Button.js +0 -85
- package/dist/es2019/plugins/hyperlink/analytics.js +0 -17
- package/dist/es2019/plugins/hyperlink/utils.js +0 -149
- package/dist/es2019/plugins/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -43
- package/dist/es2019/plugins/paste/md-plugins/linkify-md-plugin.js +0 -128
- package/dist/es2019/plugins/paste/md-plugins/newline-md-plugin.js +0 -58
- package/dist/es2019/plugins/paste/md-plugins/paragraph-md-plugin.js +0 -64
- package/dist/es2019/plugins/paste/md.js +0 -23
- package/dist/es2019/plugins/undo-redo/undo-redo-input-source.js +0 -17
- package/dist/es2019/types/get-editor-props.js +0 -1
- package/dist/es2019/utils/get-editor-plugins.js +0 -23
- package/dist/es2019/utils/insert.js +0 -244
- package/dist/es2019/utils/sendLogs.js +0 -1
- package/dist/esm/analytics-api/api.js +0 -25
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +0 -29
- package/dist/esm/analytics-api/editor-state-context.js +0 -69
- package/dist/esm/analytics-api/map-attributes.js +0 -16
- package/dist/esm/insert-api/api.js +0 -36
- package/dist/esm/insert-api/insert-content-handlers.js +0 -86
- package/dist/esm/insert-api/insert-node-helpers.js +0 -123
- package/dist/esm/insert-api/types.js +0 -1
- package/dist/esm/plugins/floating-toolbar/ui/Button.js +0 -85
- package/dist/esm/plugins/hyperlink/analytics.js +0 -17
- package/dist/esm/plugins/hyperlink/utils.js +0 -168
- package/dist/esm/plugins/paste/md-plugins/ignore-list-heading-md-plugin.js +0 -41
- package/dist/esm/plugins/paste/md-plugins/linkify-md-plugin.js +0 -128
- package/dist/esm/plugins/paste/md-plugins/newline-md-plugin.js +0 -60
- package/dist/esm/plugins/paste/md-plugins/paragraph-md-plugin.js +0 -66
- package/dist/esm/plugins/paste/md.js +0 -23
- package/dist/esm/plugins/undo-redo/undo-redo-input-source.js +0 -18
- package/dist/esm/types/get-editor-props.js +0 -1
- package/dist/esm/utils/get-editor-plugins.js +0 -23
- package/dist/esm/utils/insert.js +0 -241
- package/dist/esm/utils/sendLogs.js +0 -1
- package/dist/types/analytics-api/api.d.ts +0 -9
- package/dist/types/analytics-api/attach-payload-into-transaction.d.ts +0 -10
- package/dist/types/analytics-api/editor-state-context.d.ts +0 -9
- package/dist/types/analytics-api/map-attributes.d.ts +0 -2
- package/dist/types/insert-api/api.d.ts +0 -9
- package/dist/types/insert-api/insert-content-handlers.d.ts +0 -9
- package/dist/types/insert-api/insert-node-helpers.d.ts +0 -30
- package/dist/types/insert-api/types.d.ts +0 -16
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +0 -30
- package/dist/types/plugins/hyperlink/analytics.d.ts +0 -2
- package/dist/types/plugins/hyperlink/utils.d.ts +0 -25
- package/dist/types/plugins/paste/md-plugins/ignore-list-heading-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md-plugins/linkify-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md-plugins/newline-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md-plugins/paragraph-md-plugin.d.ts +0 -2
- package/dist/types/plugins/paste/md.d.ts +0 -2
- package/dist/types/plugins/undo-redo/undo-redo-input-source.d.ts +0 -3
- package/dist/types/types/get-editor-props.d.ts +0 -12
- package/dist/types/utils/get-editor-plugins.d.ts +0 -10
- package/dist/types/utils/insert.d.ts +0 -24
- package/dist/types/utils/sendLogs.d.ts +0 -1
- package/dist/types-ts4.5/analytics-api/api.d.ts +0 -9
- package/dist/types-ts4.5/analytics-api/attach-payload-into-transaction.d.ts +0 -10
- package/dist/types-ts4.5/analytics-api/editor-state-context.d.ts +0 -9
- package/dist/types-ts4.5/analytics-api/map-attributes.d.ts +0 -2
- package/dist/types-ts4.5/insert-api/api.d.ts +0 -9
- package/dist/types-ts4.5/insert-api/insert-content-handlers.d.ts +0 -9
- package/dist/types-ts4.5/insert-api/insert-node-helpers.d.ts +0 -30
- package/dist/types-ts4.5/insert-api/types.d.ts +0 -16
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Button.d.ts +0 -30
- package/dist/types-ts4.5/plugins/hyperlink/analytics.d.ts +0 -2
- package/dist/types-ts4.5/plugins/hyperlink/utils.d.ts +0 -25
- package/dist/types-ts4.5/plugins/paste/md-plugins/ignore-list-heading-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md-plugins/linkify-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md-plugins/newline-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md-plugins/paragraph-md-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/paste/md.d.ts +0 -2
- package/dist/types-ts4.5/plugins/undo-redo/undo-redo-input-source.d.ts +0 -3
- package/dist/types-ts4.5/types/get-editor-props.d.ts +0 -12
- package/dist/types-ts4.5/utils/get-editor-plugins.d.ts +0 -10
- package/dist/types-ts4.5/utils/insert.d.ts +0 -24
- package/dist/types-ts4.5/utils/sendLogs.d.ts +0 -1
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, SELECTION_TYPE, SELECTION_POSITION } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
|
-
import { findParentNode } from 'prosemirror-utils';
|
|
4
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
5
|
-
export function getSelectionType(state) {
|
|
6
|
-
var _selection$constructo;
|
|
7
|
-
var selection = state.selection;
|
|
8
|
-
var type;
|
|
9
|
-
var position;
|
|
10
|
-
if ((selection === null || selection === void 0 ? void 0 : (_selection$constructo = selection.constructor) === null || _selection$constructo === void 0 ? void 0 : _selection$constructo.name) === 'GapCursorSelection') {
|
|
11
|
-
type = SELECTION_TYPE.GAP_CURSOR;
|
|
12
|
-
position = selection.side;
|
|
13
|
-
} else if (selection instanceof CellSelection) {
|
|
14
|
-
type = SELECTION_TYPE.CELL;
|
|
15
|
-
} else if (selection instanceof NodeSelection) {
|
|
16
|
-
type = SELECTION_TYPE.NODE;
|
|
17
|
-
} else if (selection.from !== selection.to) {
|
|
18
|
-
type = SELECTION_TYPE.RANGED;
|
|
19
|
-
} else {
|
|
20
|
-
type = SELECTION_TYPE.CURSOR;
|
|
21
|
-
var from = selection.from,
|
|
22
|
-
$from = selection.$from;
|
|
23
|
-
if (from === $from.start()) {
|
|
24
|
-
position = SELECTION_POSITION.START;
|
|
25
|
-
} else if (from === $from.end()) {
|
|
26
|
-
position = SELECTION_POSITION.END;
|
|
27
|
-
} else {
|
|
28
|
-
position = SELECTION_POSITION.MIDDLE;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
type: type,
|
|
33
|
-
position: position
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export function findInsertLocation(state) {
|
|
37
|
-
var selection = state.selection;
|
|
38
|
-
if (selection instanceof NodeSelection) {
|
|
39
|
-
return selection.node.type.name;
|
|
40
|
-
}
|
|
41
|
-
if (selection instanceof CellSelection) {
|
|
42
|
-
return state.schema.nodes.table.name;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Text selection
|
|
46
|
-
var parentNodeInfo = findParentNode(function (node) {
|
|
47
|
-
return node.type !== state.schema.nodes.paragraph;
|
|
48
|
-
})(state.selection);
|
|
49
|
-
return parentNodeInfo ? parentNodeInfo.node.type.name : state.doc.type.name;
|
|
50
|
-
}
|
|
51
|
-
export function getStateContext(state, payload) {
|
|
52
|
-
if (!payload.attributes) {
|
|
53
|
-
return payload;
|
|
54
|
-
}
|
|
55
|
-
var _getSelectionType = getSelectionType(state),
|
|
56
|
-
type = _getSelectionType.type,
|
|
57
|
-
position = _getSelectionType.position;
|
|
58
|
-
payload.attributes.selectionType = type;
|
|
59
|
-
if (position) {
|
|
60
|
-
payload.attributes.selectionPosition = position;
|
|
61
|
-
}
|
|
62
|
-
var insertLocation = findInsertLocation(state);
|
|
63
|
-
if (payload.action === ACTION.INSERTED && payload.actionSubject === ACTION_SUBJECT.DOCUMENT && payload.attributes) {
|
|
64
|
-
payload.attributes.insertLocation = insertLocation;
|
|
65
|
-
} else {
|
|
66
|
-
payload.attributes.nodeLocation = insertLocation;
|
|
67
|
-
}
|
|
68
|
-
return payload;
|
|
69
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
export function mapActionSubjectIdToAttributes(payload) {
|
|
6
|
-
var documentInserted = payload.action === ACTION.INSERTED && payload.actionSubject === ACTION_SUBJECT.DOCUMENT;
|
|
7
|
-
var textFormatted = payload.action === ACTION.FORMATTED && payload.actionSubject === ACTION_SUBJECT.TEXT;
|
|
8
|
-
var hasActionSubjectId = !!payload.actionSubjectId;
|
|
9
|
-
if (hasActionSubjectId && (documentInserted || textFormatted)) {
|
|
10
|
-
payload.attributes = _objectSpread(_objectSpread({}, payload.attributes), {}, {
|
|
11
|
-
// @ts-expect-error
|
|
12
|
-
actionSubjectId: payload.actionSubjectId
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
return payload;
|
|
16
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { handleInsertContent } from './insert-content-handlers';
|
|
2
|
-
import { addAnalytics } from '../plugins/analytics';
|
|
3
|
-
export var createInsertNodeAPI = function createInsertNodeAPI(_ref) {
|
|
4
|
-
var getEditorView = _ref.getEditorView,
|
|
5
|
-
getEditorPlugins = _ref.getEditorPlugins;
|
|
6
|
-
return {
|
|
7
|
-
insert: function insert(_ref2) {
|
|
8
|
-
var node = _ref2.node,
|
|
9
|
-
options = _ref2.options;
|
|
10
|
-
var editorView = getEditorView();
|
|
11
|
-
if (!editorView) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
var tr = editorView.state.tr;
|
|
15
|
-
var editorPlugins = getEditorPlugins();
|
|
16
|
-
handleInsertContent({
|
|
17
|
-
editorPlugins: editorPlugins,
|
|
18
|
-
node: node,
|
|
19
|
-
options: options
|
|
20
|
-
})(tr);
|
|
21
|
-
|
|
22
|
-
// TODO: ED-14676 This approach to send analytics should be temporary only for the table work
|
|
23
|
-
if (options.analyticsPayload) {
|
|
24
|
-
addAnalytics(editorView.state, tr, options.analyticsPayload);
|
|
25
|
-
}
|
|
26
|
-
editorView.dispatch(tr);
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// TODO: ED-14676 - Implement the append behavior
|
|
31
|
-
// append: ({ node, options }) => (tr) => {
|
|
32
|
-
// const editorPlugins = getEditorPlugins();
|
|
33
|
-
// return insertContent({ editorPlugins, node, options })(tr);
|
|
34
|
-
// },
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { insertProseMirrorContent } from './insert-node-helpers';
|
|
2
|
-
export var findCreateNodeHandler = function findCreateNodeHandler(_ref) {
|
|
3
|
-
var _editorPluginHandler$;
|
|
4
|
-
var node = _ref.node,
|
|
5
|
-
editorPlugins = _ref.editorPlugins;
|
|
6
|
-
if (!node) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
var nodeName = typeof node === 'string' ? node : null;
|
|
10
|
-
var editorPluginHandler = nodeName ? editorPlugins.find(function (plugin) {
|
|
11
|
-
if (!plugin.nodes) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return plugin.nodes().find(function (nodeConfig) {
|
|
15
|
-
return nodeConfig.name === nodeName;
|
|
16
|
-
});
|
|
17
|
-
}) : null;
|
|
18
|
-
// That is how we allow the insertion behavior to be extended. (for now)
|
|
19
|
-
// Any plugin, following the rank order and respecting the node name, can override the node insertion output.
|
|
20
|
-
// To guarantee an insertion
|
|
21
|
-
return (editorPluginHandler === null || editorPluginHandler === void 0 ? void 0 : (_editorPluginHandler$ = editorPluginHandler.pluginsOptions) === null || _editorPluginHandler$ === void 0 ? void 0 : _editorPluginHandler$.createNodeHandler) || null;
|
|
22
|
-
};
|
|
23
|
-
export var handleInsertContent = function handleInsertContent(_ref2) {
|
|
24
|
-
var node = _ref2.node,
|
|
25
|
-
options = _ref2.options,
|
|
26
|
-
editorPlugins = _ref2.editorPlugins;
|
|
27
|
-
return function (tr) {
|
|
28
|
-
// TODO: ED-14676 - Probably, we should use the options.insertAt here
|
|
29
|
-
var position = tr.selection;
|
|
30
|
-
var createNodeHandler = findCreateNodeHandler({
|
|
31
|
-
node: node,
|
|
32
|
-
editorPlugins: editorPlugins
|
|
33
|
-
});
|
|
34
|
-
var nodeName = typeof node === 'string' ? node : null;
|
|
35
|
-
|
|
36
|
-
// TODO: ED-14676 Once we fix the coupled table code issue (ED-15503) we should enable this API to insert any ProseMirror Node
|
|
37
|
-
// if (node instanceof PMNode || node instanceof Fragment) {
|
|
38
|
-
// insertProseMirrorContent({
|
|
39
|
-
// tr,
|
|
40
|
-
// node,
|
|
41
|
-
// position,
|
|
42
|
-
// selectNodeInserted: options.selectNodeInserted,
|
|
43
|
-
// });
|
|
44
|
-
// } else
|
|
45
|
-
|
|
46
|
-
if (nodeName && createNodeHandler) {
|
|
47
|
-
var nodeOverride = createNodeHandler({
|
|
48
|
-
nodeName: nodeName,
|
|
49
|
-
schema: tr.doc.type.schema
|
|
50
|
-
});
|
|
51
|
-
insertProseMirrorContent({
|
|
52
|
-
tr: tr,
|
|
53
|
-
node: nodeOverride,
|
|
54
|
-
position: position,
|
|
55
|
-
selectNodeInserted: options.selectNodeInserted
|
|
56
|
-
});
|
|
57
|
-
} else if (nodeName) {
|
|
58
|
-
var nodeType = tr.doc.type.schema.nodes[nodeName];
|
|
59
|
-
if (!nodeType) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
insertProseMirrorContent({
|
|
63
|
-
tr: tr,
|
|
64
|
-
node: nodeType.createAndFill(),
|
|
65
|
-
position: position,
|
|
66
|
-
selectNodeInserted: options.selectNodeInserted
|
|
67
|
-
});
|
|
68
|
-
} else {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// TODO: ED-14676 Implement the attachPluginMessage behavior
|
|
73
|
-
// if (editorPluginHandler?.nodes && options.attachPluginMessage) {
|
|
74
|
-
// const pluginKey = editorPluginHandler
|
|
75
|
-
// .nodes()
|
|
76
|
-
// .find((nodeConfig) => nodeConfig.name === nodeName)?.pluginKey;
|
|
77
|
-
|
|
78
|
-
// if (pluginKey) {
|
|
79
|
-
// tr.setMeta(pluginKey, options.attachPluginMessage);
|
|
80
|
-
// }
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
|
-
tr.scrollIntoView();
|
|
84
|
-
return true;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/* Copied from type-ahead */
|
|
2
|
-
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
3
|
-
import { Node as PMNode, Slice, Fragment } from 'prosemirror-model';
|
|
4
|
-
import { normaliseNestedLayout } from '../utils/selection';
|
|
5
|
-
import { safeInsert } from '../utils/insert';
|
|
6
|
-
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
7
|
-
var $pos = doc.resolve(pos);
|
|
8
|
-
var createInsertPosition = function createInsertPosition(from, to) {
|
|
9
|
-
return {
|
|
10
|
-
from: from,
|
|
11
|
-
to: to || from
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// Search for a valid position for nodeToInsert in progressively higher levels
|
|
16
|
-
for (var level = $pos.depth; level >= 0; level--) {
|
|
17
|
-
var nodeAtLevel = $pos.node(level);
|
|
18
|
-
|
|
19
|
-
// Try to replace the empty paragraph in the level above
|
|
20
|
-
// Scenario:
|
|
21
|
-
// doc(
|
|
22
|
-
// table(
|
|
23
|
-
// row(
|
|
24
|
-
// cell(
|
|
25
|
-
// p('{<>}'),
|
|
26
|
-
// ),
|
|
27
|
-
// )
|
|
28
|
-
// )
|
|
29
|
-
// )
|
|
30
|
-
var levelAbove = Math.max(level - 1, 0);
|
|
31
|
-
var parentNode = $pos.node(levelAbove);
|
|
32
|
-
// Special case: when this is true, the 'to' position should be the end
|
|
33
|
-
// of the empty paragraph
|
|
34
|
-
var isNodeAtLevelEmptyParagraph = nodeAtLevel.type.name === 'paragraph' && nodeAtLevel.content.size === 0;
|
|
35
|
-
var indexAtLevelAbove = $pos.index(levelAbove);
|
|
36
|
-
var canReplaceNodeAtLevelAbove = parentNode.canReplaceWith(indexAtLevelAbove, indexAtLevelAbove, nodeToInsert.type);
|
|
37
|
-
if (isNodeAtLevelEmptyParagraph && canReplaceNodeAtLevelAbove) {
|
|
38
|
-
var from = $pos.posAtIndex(indexAtLevelAbove, levelAbove);
|
|
39
|
-
return createInsertPosition(from, from + nodeAtLevel.nodeSize);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Try to insert this node right after the node in the level above
|
|
43
|
-
// Scenario:
|
|
44
|
-
// doc(
|
|
45
|
-
// panel(
|
|
46
|
-
// p('{<>}'),
|
|
47
|
-
// )
|
|
48
|
-
// )
|
|
49
|
-
var indexAfterAtLevelAbove = $pos.indexAfter(levelAbove);
|
|
50
|
-
var canInsertNodeAtLevelAbove = parentNode.canReplaceWith(indexAfterAtLevelAbove, indexAfterAtLevelAbove, nodeToInsert.type);
|
|
51
|
-
if (canInsertNodeAtLevelAbove) {
|
|
52
|
-
return createInsertPosition($pos.posAtIndex(indexAfterAtLevelAbove, levelAbove));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return createInsertPosition(0);
|
|
56
|
-
}
|
|
57
|
-
export var insertBlockNode = function insertBlockNode(_ref) {
|
|
58
|
-
var node = _ref.node,
|
|
59
|
-
tr = _ref.tr,
|
|
60
|
-
position = _ref.position;
|
|
61
|
-
var start = position.$from.pos,
|
|
62
|
-
end = position.$to.pos;
|
|
63
|
-
if (node.isText) {
|
|
64
|
-
return tr.replaceWith(start, end, node);
|
|
65
|
-
}
|
|
66
|
-
if (node.isBlock) {
|
|
67
|
-
tr.delete(start, end);
|
|
68
|
-
var mappedStart = tr.mapping.map(start);
|
|
69
|
-
var nodeNormalized = normaliseNestedLayout(tr, node);
|
|
70
|
-
|
|
71
|
-
// Handle edge cases for hr and mediaSingle
|
|
72
|
-
var inserted = safeInsert(nodeNormalized, mappedStart)(tr);
|
|
73
|
-
if (inserted) {
|
|
74
|
-
return tr;
|
|
75
|
-
}
|
|
76
|
-
var sliceInserted = Slice.maxOpen(Fragment.from(nodeNormalized));
|
|
77
|
-
var _findInsertPoint = findInsertPoint(tr.doc, mappedStart, nodeNormalized),
|
|
78
|
-
from = _findInsertPoint.from,
|
|
79
|
-
to = _findInsertPoint.to;
|
|
80
|
-
tr.replaceWith(from, to, node);
|
|
81
|
-
var openPosition = Math.min(from + (node.isAtom ? node.nodeSize : sliceInserted.openStart), tr.doc.content.size);
|
|
82
|
-
var FORWARD_DIRECTION = 1;
|
|
83
|
-
var nextSelection = TextSelection.findFrom(tr.doc.resolve(openPosition), FORWARD_DIRECTION, true);
|
|
84
|
-
if (nextSelection) {
|
|
85
|
-
return tr.setSelection(nextSelection);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return tr;
|
|
89
|
-
};
|
|
90
|
-
export var insertInlineNodeOrFragment = function insertInlineNodeOrFragment(_ref2) {
|
|
91
|
-
var maybeFragment = _ref2.maybeFragment,
|
|
92
|
-
tr = _ref2.tr,
|
|
93
|
-
position = _ref2.position,
|
|
94
|
-
selectInlineNode = _ref2.selectInlineNode;
|
|
95
|
-
var start = position.$from.pos,
|
|
96
|
-
end = position.$to.pos;
|
|
97
|
-
var fragment = maybeFragment instanceof PMNode ? Fragment.from(maybeFragment) : maybeFragment;
|
|
98
|
-
tr.replaceWith(start, end, fragment);
|
|
99
|
-
if (selectInlineNode) {
|
|
100
|
-
return tr.setSelection(NodeSelection.create(tr.doc, start));
|
|
101
|
-
}
|
|
102
|
-
return tr.setSelection(TextSelection.near(tr.doc.resolve(start + fragment.size)));
|
|
103
|
-
};
|
|
104
|
-
export var insertProseMirrorContent = function insertProseMirrorContent(_ref3) {
|
|
105
|
-
var tr = _ref3.tr,
|
|
106
|
-
node = _ref3.node,
|
|
107
|
-
position = _ref3.position,
|
|
108
|
-
selectNodeInserted = _ref3.selectNodeInserted;
|
|
109
|
-
if (node instanceof PMNode && node.isBlock) {
|
|
110
|
-
insertBlockNode({
|
|
111
|
-
node: node,
|
|
112
|
-
tr: tr,
|
|
113
|
-
position: position
|
|
114
|
-
});
|
|
115
|
-
} else {
|
|
116
|
-
insertInlineNodeOrFragment({
|
|
117
|
-
maybeFragment: node,
|
|
118
|
-
tr: tr,
|
|
119
|
-
position: position,
|
|
120
|
-
selectInlineNode: selectNodeInserted
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["buttonStyles"];
|
|
4
|
-
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; }
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
-
import Button from '@atlaskit/button/custom-theme-button';
|
|
9
|
-
import { getButtonStyles, iconOnlySpacing } from './styles';
|
|
10
|
-
export default (function (_ref) {
|
|
11
|
-
var title = _ref.title,
|
|
12
|
-
icon = _ref.icon,
|
|
13
|
-
iconAfter = _ref.iconAfter,
|
|
14
|
-
onClick = _ref.onClick,
|
|
15
|
-
onKeyDown = _ref.onKeyDown,
|
|
16
|
-
onMouseEnter = _ref.onMouseEnter,
|
|
17
|
-
onMouseLeave = _ref.onMouseLeave,
|
|
18
|
-
onFocus = _ref.onFocus,
|
|
19
|
-
onBlur = _ref.onBlur,
|
|
20
|
-
selected = _ref.selected,
|
|
21
|
-
disabled = _ref.disabled,
|
|
22
|
-
href = _ref.href,
|
|
23
|
-
target = _ref.target,
|
|
24
|
-
_ref$appearance = _ref.appearance,
|
|
25
|
-
appearance = _ref$appearance === void 0 ? 'subtle' : _ref$appearance,
|
|
26
|
-
children = _ref.children,
|
|
27
|
-
className = _ref.className,
|
|
28
|
-
tooltipContent = _ref.tooltipContent,
|
|
29
|
-
testId = _ref.testId,
|
|
30
|
-
_ref$hideTooltipOnCli = _ref.hideTooltipOnClick,
|
|
31
|
-
hideTooltipOnClick = _ref$hideTooltipOnCli === void 0 ? true : _ref$hideTooltipOnCli,
|
|
32
|
-
ariaHasPopup = _ref.ariaHasPopup,
|
|
33
|
-
tabIndex = _ref.tabIndex,
|
|
34
|
-
areaControls = _ref.areaControls,
|
|
35
|
-
ariaLabel = _ref.ariaLabel;
|
|
36
|
-
// Check if there's only an icon and add additional styles
|
|
37
|
-
var iconOnly = (icon || iconAfter) && !children;
|
|
38
|
-
var customSpacing = iconOnly ? iconOnlySpacing : {};
|
|
39
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
40
|
-
content: tooltipContent || title,
|
|
41
|
-
hideTooltipOnClick: hideTooltipOnClick,
|
|
42
|
-
position: "top"
|
|
43
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
44
|
-
onMouseEnter: onMouseEnter,
|
|
45
|
-
onMouseLeave: onMouseLeave
|
|
46
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
47
|
-
className: className,
|
|
48
|
-
theme: function theme(adgTheme, themeProps) {
|
|
49
|
-
var _adgTheme = adgTheme(themeProps),
|
|
50
|
-
buttonStyles = _adgTheme.buttonStyles,
|
|
51
|
-
rest = _objectWithoutProperties(_adgTheme, _excluded);
|
|
52
|
-
return _objectSpread({
|
|
53
|
-
buttonStyles: _objectSpread(_objectSpread(_objectSpread({}, buttonStyles), customSpacing), appearance === 'danger' && getButtonStyles({
|
|
54
|
-
appearance: appearance,
|
|
55
|
-
state: themeProps.state,
|
|
56
|
-
mode: themeProps.mode
|
|
57
|
-
}))
|
|
58
|
-
}, rest);
|
|
59
|
-
},
|
|
60
|
-
"aria-label": ariaLabel || title,
|
|
61
|
-
"aria-pressed": !ariaHasPopup ? selected : undefined,
|
|
62
|
-
"aria-expanded": ariaHasPopup ? selected : undefined,
|
|
63
|
-
"aria-controls": ariaHasPopup ? areaControls : undefined,
|
|
64
|
-
spacing: 'compact',
|
|
65
|
-
href: href,
|
|
66
|
-
target: target,
|
|
67
|
-
appearance: appearance,
|
|
68
|
-
"aria-haspopup": ariaHasPopup,
|
|
69
|
-
iconBefore: icon || undefined,
|
|
70
|
-
iconAfter: iconAfter,
|
|
71
|
-
onClick: onClick,
|
|
72
|
-
onKeyDown: onKeyDown,
|
|
73
|
-
isSelected: selected,
|
|
74
|
-
isDisabled: disabled,
|
|
75
|
-
testId: testId,
|
|
76
|
-
onFocus: onFocus,
|
|
77
|
-
onBlur: onBlur
|
|
78
|
-
// @ts-ignore
|
|
79
|
-
// tabIndex set as 0 by default in the design system ButtonBase component
|
|
80
|
-
// this is not expected for all buttons, we have to use tabIndex={null} for some cases
|
|
81
|
-
// should be fixed here https://a11y-internal.atlassian.net/browse/DST-287
|
|
82
|
-
,
|
|
83
|
-
tabIndex: tabIndex
|
|
84
|
-
}, children)));
|
|
85
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics/types';
|
|
2
|
-
import { getLinkDomain, isFromCurrentDomain } from './utils';
|
|
3
|
-
export function getLinkCreationAnalyticsEvent(inputMethod, url) {
|
|
4
|
-
return {
|
|
5
|
-
action: ACTION.INSERTED,
|
|
6
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
7
|
-
actionSubjectId: ACTION_SUBJECT_ID.LINK,
|
|
8
|
-
attributes: {
|
|
9
|
-
inputMethod: inputMethod,
|
|
10
|
-
fromCurrentDomain: isFromCurrentDomain(url)
|
|
11
|
-
},
|
|
12
|
-
eventType: EVENT_TYPE.TRACK,
|
|
13
|
-
nonPrivacySafeAttributes: {
|
|
14
|
-
linkDomain: getLinkDomain(url)
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/utils/hyperlink.ts
|
|
4
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
5
|
-
|
|
6
|
-
import { mapSlice } from '../../utils/slice';
|
|
7
|
-
import { isSafeUrl, linkify, normalizeUrl as normaliseLinkHref } from '@atlaskit/adf-schema';
|
|
8
|
-
|
|
9
|
-
// Regular expression for a windows filepath in the format <DRIVE LETTER>:\<folder name>\
|
|
10
|
-
export var FILEPATH_REGEXP = /([a-zA-Z]:|\\)([^\/:*?<>"|]+\\)?([^\/:*?<>"| ]+(?=\s?))?/gim;
|
|
11
|
-
|
|
12
|
-
// Don't linkify if starts with $ or {
|
|
13
|
-
export var DONTLINKIFY_REGEXP = /^(\$|{)/;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Instance of class LinkMatcher are used in autoformatting in place of Regex.
|
|
17
|
-
* Hence it has been made similar to regex with an exec method.
|
|
18
|
-
* Extending it directly from class Regex was introducing some issues, thus that has been avoided.
|
|
19
|
-
*/
|
|
20
|
-
export var LinkMatcher = /*#__PURE__*/function () {
|
|
21
|
-
function LinkMatcher() {
|
|
22
|
-
_classCallCheck(this, LinkMatcher);
|
|
23
|
-
}
|
|
24
|
-
_createClass(LinkMatcher, null, [{
|
|
25
|
-
key: "create",
|
|
26
|
-
value: function create() {
|
|
27
|
-
var LinkMatcherRegex = /*#__PURE__*/function () {
|
|
28
|
-
function LinkMatcherRegex() {
|
|
29
|
-
_classCallCheck(this, LinkMatcherRegex);
|
|
30
|
-
}
|
|
31
|
-
_createClass(LinkMatcherRegex, [{
|
|
32
|
-
key: "exec",
|
|
33
|
-
value: function exec(str) {
|
|
34
|
-
var stringsBySpace = str.slice(0, str.length - 1).split(' ');
|
|
35
|
-
var lastStringBeforeSpace = stringsBySpace[stringsBySpace.length - 1];
|
|
36
|
-
var isLastStringValid = lastStringBeforeSpace.length > 0;
|
|
37
|
-
if (!str.endsWith(' ') || !isLastStringValid) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
if (DONTLINKIFY_REGEXP.test(lastStringBeforeSpace)) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
var links = linkify.match(lastStringBeforeSpace);
|
|
44
|
-
if (!links || links.length === 0) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
var lastMatch = links[links.length - 1];
|
|
48
|
-
var lastLink = links[links.length - 1];
|
|
49
|
-
lastLink.input = str.substring(lastMatch.index);
|
|
50
|
-
lastLink.length = lastLink.lastIndex - lastLink.index + 1;
|
|
51
|
-
lastLink.index = str.lastIndexOf(lastStringBeforeSpace) + lastMatch.index;
|
|
52
|
-
return lastLink;
|
|
53
|
-
}
|
|
54
|
-
}]);
|
|
55
|
-
return LinkMatcherRegex;
|
|
56
|
-
}();
|
|
57
|
-
return new LinkMatcherRegex();
|
|
58
|
-
}
|
|
59
|
-
}]);
|
|
60
|
-
return LinkMatcher;
|
|
61
|
-
}();
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Adds protocol to url if needed.
|
|
65
|
-
*/
|
|
66
|
-
export function normalizeUrl(url) {
|
|
67
|
-
if (!url) {
|
|
68
|
-
return '';
|
|
69
|
-
}
|
|
70
|
-
if (isSafeUrl(url)) {
|
|
71
|
-
return url;
|
|
72
|
-
}
|
|
73
|
-
return normaliseLinkHref(url);
|
|
74
|
-
}
|
|
75
|
-
export function linkifyContent(schema) {
|
|
76
|
-
return function (slice) {
|
|
77
|
-
return mapSlice(slice, function (node, parent) {
|
|
78
|
-
var isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
79
|
-
var link = node.type.schema.marks.link;
|
|
80
|
-
if (link === undefined) {
|
|
81
|
-
throw new Error('Link not in schema - unable to linkify content');
|
|
82
|
-
}
|
|
83
|
-
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
84
|
-
var linkified = [];
|
|
85
|
-
var text = node.text;
|
|
86
|
-
var matches = findLinkMatches(text);
|
|
87
|
-
var pos = 0;
|
|
88
|
-
var filepaths = findFilepaths(text);
|
|
89
|
-
matches.forEach(function (match) {
|
|
90
|
-
if (isLinkInMatches(match.start, filepaths)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (match.start > 0) {
|
|
94
|
-
linkified.push(node.cut(pos, match.start));
|
|
95
|
-
}
|
|
96
|
-
linkified.push(node.cut(match.start, match.end).mark(link.create({
|
|
97
|
-
href: normalizeUrl(match.href)
|
|
98
|
-
}).addToSet(node.marks)));
|
|
99
|
-
pos = match.end;
|
|
100
|
-
});
|
|
101
|
-
if (pos < text.length) {
|
|
102
|
-
linkified.push(node.cut(pos));
|
|
103
|
-
}
|
|
104
|
-
return linkified;
|
|
105
|
-
}
|
|
106
|
-
return node;
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
export function getLinkDomain(url) {
|
|
111
|
-
// Remove protocol and www., if either exists
|
|
112
|
-
var withoutProtocol = url.toLowerCase().replace(/^(.*):\/\//, '');
|
|
113
|
-
var withoutWWW = withoutProtocol.replace(/^(www\.)/, '');
|
|
114
|
-
|
|
115
|
-
// Remove port, fragment, path, query string
|
|
116
|
-
return withoutWWW.replace(/[:\/?#](.*)$/, '');
|
|
117
|
-
}
|
|
118
|
-
export function isFromCurrentDomain(url) {
|
|
119
|
-
if (!window || !window.location) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
var currentDomain = window.location.hostname;
|
|
123
|
-
var linkDomain = getLinkDomain(url);
|
|
124
|
-
return currentDomain === linkDomain;
|
|
125
|
-
}
|
|
126
|
-
function findLinkMatches(text) {
|
|
127
|
-
var matches = [];
|
|
128
|
-
var linkMatches = text && linkify.match(text);
|
|
129
|
-
if (linkMatches && linkMatches.length > 0) {
|
|
130
|
-
linkMatches.forEach(function (match) {
|
|
131
|
-
matches.push({
|
|
132
|
-
start: match.index,
|
|
133
|
-
end: match.lastIndex,
|
|
134
|
-
title: match.raw,
|
|
135
|
-
href: match.url
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return matches;
|
|
140
|
-
}
|
|
141
|
-
export var findFilepaths = function findFilepaths(text) {
|
|
142
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
143
|
-
// Creation of a copy of the RegExp is necessary as lastIndex is stored on it when we run .exec()
|
|
144
|
-
var localRegExp = new RegExp(FILEPATH_REGEXP);
|
|
145
|
-
var match;
|
|
146
|
-
var matchesList = [];
|
|
147
|
-
var maxFilepathSize = 260;
|
|
148
|
-
while ((match = localRegExp.exec(text)) !== null) {
|
|
149
|
-
var start = match.index + offset;
|
|
150
|
-
var end = localRegExp.lastIndex + offset;
|
|
151
|
-
if (end - start > maxFilepathSize) {
|
|
152
|
-
end = start + maxFilepathSize;
|
|
153
|
-
} // We don't care about big strings of text that are pretending to be filepaths!!
|
|
154
|
-
matchesList.push({
|
|
155
|
-
startIndex: start,
|
|
156
|
-
endIndex: end
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return matchesList;
|
|
160
|
-
};
|
|
161
|
-
export var isLinkInMatches = function isLinkInMatches(linkStart, matchesList) {
|
|
162
|
-
for (var i = 0; i < matchesList.length; i++) {
|
|
163
|
-
if (linkStart >= matchesList[i].startIndex && linkStart < matchesList[i].endIndex) {
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return false;
|
|
168
|
-
};
|
|
@@ -1,41 +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
|
-
var 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
|
-
var 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(function (acc, token, index) {
|
|
30
|
-
var type = token.type;
|
|
31
|
-
if (type === 'heading_open') {
|
|
32
|
-
handleHeadingOpen(state, token, acc, index);
|
|
33
|
-
} else if (type === 'heading_close') {
|
|
34
|
-
handleHeadingClose(state, token, acc, index);
|
|
35
|
-
} else {
|
|
36
|
-
acc.push(token);
|
|
37
|
-
}
|
|
38
|
-
return acc;
|
|
39
|
-
}, []);
|
|
40
|
-
});
|
|
41
|
-
}
|