@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,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findInsertLocation = findInsertLocation;
|
|
7
|
-
exports.getSelectionType = getSelectionType;
|
|
8
|
-
exports.getStateContext = getStateContext;
|
|
9
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
11
|
-
var _prosemirrorUtils = require("prosemirror-utils");
|
|
12
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
13
|
-
function getSelectionType(state) {
|
|
14
|
-
var _selection$constructo;
|
|
15
|
-
var selection = state.selection;
|
|
16
|
-
var type;
|
|
17
|
-
var position;
|
|
18
|
-
if ((selection === null || selection === void 0 ? void 0 : (_selection$constructo = selection.constructor) === null || _selection$constructo === void 0 ? void 0 : _selection$constructo.name) === 'GapCursorSelection') {
|
|
19
|
-
type = _analytics.SELECTION_TYPE.GAP_CURSOR;
|
|
20
|
-
position = selection.side;
|
|
21
|
-
} else if (selection instanceof _cellSelection.CellSelection) {
|
|
22
|
-
type = _analytics.SELECTION_TYPE.CELL;
|
|
23
|
-
} else if (selection instanceof _prosemirrorState.NodeSelection) {
|
|
24
|
-
type = _analytics.SELECTION_TYPE.NODE;
|
|
25
|
-
} else if (selection.from !== selection.to) {
|
|
26
|
-
type = _analytics.SELECTION_TYPE.RANGED;
|
|
27
|
-
} else {
|
|
28
|
-
type = _analytics.SELECTION_TYPE.CURSOR;
|
|
29
|
-
var from = selection.from,
|
|
30
|
-
$from = selection.$from;
|
|
31
|
-
if (from === $from.start()) {
|
|
32
|
-
position = _analytics.SELECTION_POSITION.START;
|
|
33
|
-
} else if (from === $from.end()) {
|
|
34
|
-
position = _analytics.SELECTION_POSITION.END;
|
|
35
|
-
} else {
|
|
36
|
-
position = _analytics.SELECTION_POSITION.MIDDLE;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
type: type,
|
|
41
|
-
position: position
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function findInsertLocation(state) {
|
|
45
|
-
var selection = state.selection;
|
|
46
|
-
if (selection instanceof _prosemirrorState.NodeSelection) {
|
|
47
|
-
return selection.node.type.name;
|
|
48
|
-
}
|
|
49
|
-
if (selection instanceof _cellSelection.CellSelection) {
|
|
50
|
-
return state.schema.nodes.table.name;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Text selection
|
|
54
|
-
var parentNodeInfo = (0, _prosemirrorUtils.findParentNode)(function (node) {
|
|
55
|
-
return node.type !== state.schema.nodes.paragraph;
|
|
56
|
-
})(state.selection);
|
|
57
|
-
return parentNodeInfo ? parentNodeInfo.node.type.name : state.doc.type.name;
|
|
58
|
-
}
|
|
59
|
-
function getStateContext(state, payload) {
|
|
60
|
-
if (!payload.attributes) {
|
|
61
|
-
return payload;
|
|
62
|
-
}
|
|
63
|
-
var _getSelectionType = getSelectionType(state),
|
|
64
|
-
type = _getSelectionType.type,
|
|
65
|
-
position = _getSelectionType.position;
|
|
66
|
-
payload.attributes.selectionType = type;
|
|
67
|
-
if (position) {
|
|
68
|
-
payload.attributes.selectionPosition = position;
|
|
69
|
-
}
|
|
70
|
-
var insertLocation = findInsertLocation(state);
|
|
71
|
-
if (payload.action === _analytics.ACTION.INSERTED && payload.actionSubject === _analytics.ACTION_SUBJECT.DOCUMENT && payload.attributes) {
|
|
72
|
-
payload.attributes.insertLocation = insertLocation;
|
|
73
|
-
} else {
|
|
74
|
-
payload.attributes.nodeLocation = insertLocation;
|
|
75
|
-
}
|
|
76
|
-
return payload;
|
|
77
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.mapActionSubjectIdToAttributes = mapActionSubjectIdToAttributes;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
function mapActionSubjectIdToAttributes(payload) {
|
|
13
|
-
var documentInserted = payload.action === _analytics.ACTION.INSERTED && payload.actionSubject === _analytics.ACTION_SUBJECT.DOCUMENT;
|
|
14
|
-
var textFormatted = payload.action === _analytics.ACTION.FORMATTED && payload.actionSubject === _analytics.ACTION_SUBJECT.TEXT;
|
|
15
|
-
var hasActionSubjectId = !!payload.actionSubjectId;
|
|
16
|
-
if (hasActionSubjectId && (documentInserted || textFormatted)) {
|
|
17
|
-
payload.attributes = _objectSpread(_objectSpread({}, payload.attributes), {}, {
|
|
18
|
-
// @ts-expect-error
|
|
19
|
-
actionSubjectId: payload.actionSubjectId
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return payload;
|
|
23
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createInsertNodeAPI = void 0;
|
|
7
|
-
var _insertContentHandlers = require("./insert-content-handlers");
|
|
8
|
-
var _analytics = require("../plugins/analytics");
|
|
9
|
-
var createInsertNodeAPI = function createInsertNodeAPI(_ref) {
|
|
10
|
-
var getEditorView = _ref.getEditorView,
|
|
11
|
-
getEditorPlugins = _ref.getEditorPlugins;
|
|
12
|
-
return {
|
|
13
|
-
insert: function insert(_ref2) {
|
|
14
|
-
var node = _ref2.node,
|
|
15
|
-
options = _ref2.options;
|
|
16
|
-
var editorView = getEditorView();
|
|
17
|
-
if (!editorView) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
var tr = editorView.state.tr;
|
|
21
|
-
var editorPlugins = getEditorPlugins();
|
|
22
|
-
(0, _insertContentHandlers.handleInsertContent)({
|
|
23
|
-
editorPlugins: editorPlugins,
|
|
24
|
-
node: node,
|
|
25
|
-
options: options
|
|
26
|
-
})(tr);
|
|
27
|
-
|
|
28
|
-
// TODO: ED-14676 This approach to send analytics should be temporary only for the table work
|
|
29
|
-
if (options.analyticsPayload) {
|
|
30
|
-
(0, _analytics.addAnalytics)(editorView.state, tr, options.analyticsPayload);
|
|
31
|
-
}
|
|
32
|
-
editorView.dispatch(tr);
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// TODO: ED-14676 - Implement the append behavior
|
|
37
|
-
// append: ({ node, options }) => (tr) => {
|
|
38
|
-
// const editorPlugins = getEditorPlugins();
|
|
39
|
-
// return insertContent({ editorPlugins, node, options })(tr);
|
|
40
|
-
// },
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
exports.createInsertNodeAPI = createInsertNodeAPI;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.handleInsertContent = exports.findCreateNodeHandler = void 0;
|
|
7
|
-
var _insertNodeHelpers = require("./insert-node-helpers");
|
|
8
|
-
var findCreateNodeHandler = function findCreateNodeHandler(_ref) {
|
|
9
|
-
var _editorPluginHandler$;
|
|
10
|
-
var node = _ref.node,
|
|
11
|
-
editorPlugins = _ref.editorPlugins;
|
|
12
|
-
if (!node) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
var nodeName = typeof node === 'string' ? node : null;
|
|
16
|
-
var editorPluginHandler = nodeName ? editorPlugins.find(function (plugin) {
|
|
17
|
-
if (!plugin.nodes) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
return plugin.nodes().find(function (nodeConfig) {
|
|
21
|
-
return nodeConfig.name === nodeName;
|
|
22
|
-
});
|
|
23
|
-
}) : null;
|
|
24
|
-
// That is how we allow the insertion behavior to be extended. (for now)
|
|
25
|
-
// Any plugin, following the rank order and respecting the node name, can override the node insertion output.
|
|
26
|
-
// To guarantee an insertion
|
|
27
|
-
return (editorPluginHandler === null || editorPluginHandler === void 0 ? void 0 : (_editorPluginHandler$ = editorPluginHandler.pluginsOptions) === null || _editorPluginHandler$ === void 0 ? void 0 : _editorPluginHandler$.createNodeHandler) || null;
|
|
28
|
-
};
|
|
29
|
-
exports.findCreateNodeHandler = findCreateNodeHandler;
|
|
30
|
-
var handleInsertContent = function handleInsertContent(_ref2) {
|
|
31
|
-
var node = _ref2.node,
|
|
32
|
-
options = _ref2.options,
|
|
33
|
-
editorPlugins = _ref2.editorPlugins;
|
|
34
|
-
return function (tr) {
|
|
35
|
-
// TODO: ED-14676 - Probably, we should use the options.insertAt here
|
|
36
|
-
var position = tr.selection;
|
|
37
|
-
var createNodeHandler = findCreateNodeHandler({
|
|
38
|
-
node: node,
|
|
39
|
-
editorPlugins: editorPlugins
|
|
40
|
-
});
|
|
41
|
-
var nodeName = typeof node === 'string' ? node : null;
|
|
42
|
-
|
|
43
|
-
// TODO: ED-14676 Once we fix the coupled table code issue (ED-15503) we should enable this API to insert any ProseMirror Node
|
|
44
|
-
// if (node instanceof PMNode || node instanceof Fragment) {
|
|
45
|
-
// insertProseMirrorContent({
|
|
46
|
-
// tr,
|
|
47
|
-
// node,
|
|
48
|
-
// position,
|
|
49
|
-
// selectNodeInserted: options.selectNodeInserted,
|
|
50
|
-
// });
|
|
51
|
-
// } else
|
|
52
|
-
|
|
53
|
-
if (nodeName && createNodeHandler) {
|
|
54
|
-
var nodeOverride = createNodeHandler({
|
|
55
|
-
nodeName: nodeName,
|
|
56
|
-
schema: tr.doc.type.schema
|
|
57
|
-
});
|
|
58
|
-
(0, _insertNodeHelpers.insertProseMirrorContent)({
|
|
59
|
-
tr: tr,
|
|
60
|
-
node: nodeOverride,
|
|
61
|
-
position: position,
|
|
62
|
-
selectNodeInserted: options.selectNodeInserted
|
|
63
|
-
});
|
|
64
|
-
} else if (nodeName) {
|
|
65
|
-
var nodeType = tr.doc.type.schema.nodes[nodeName];
|
|
66
|
-
if (!nodeType) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
(0, _insertNodeHelpers.insertProseMirrorContent)({
|
|
70
|
-
tr: tr,
|
|
71
|
-
node: nodeType.createAndFill(),
|
|
72
|
-
position: position,
|
|
73
|
-
selectNodeInserted: options.selectNodeInserted
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// TODO: ED-14676 Implement the attachPluginMessage behavior
|
|
80
|
-
// if (editorPluginHandler?.nodes && options.attachPluginMessage) {
|
|
81
|
-
// const pluginKey = editorPluginHandler
|
|
82
|
-
// .nodes()
|
|
83
|
-
// .find((nodeConfig) => nodeConfig.name === nodeName)?.pluginKey;
|
|
84
|
-
|
|
85
|
-
// if (pluginKey) {
|
|
86
|
-
// tr.setMeta(pluginKey, options.attachPluginMessage);
|
|
87
|
-
// }
|
|
88
|
-
// }
|
|
89
|
-
|
|
90
|
-
tr.scrollIntoView();
|
|
91
|
-
return true;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
exports.handleInsertContent = handleInsertContent;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.insertProseMirrorContent = exports.insertInlineNodeOrFragment = exports.insertBlockNode = void 0;
|
|
7
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
8
|
-
var _prosemirrorModel = require("prosemirror-model");
|
|
9
|
-
var _selection = require("../utils/selection");
|
|
10
|
-
var _insert = require("../utils/insert");
|
|
11
|
-
/* Copied from type-ahead */
|
|
12
|
-
|
|
13
|
-
function findInsertPoint(doc, pos, nodeToInsert) {
|
|
14
|
-
var $pos = doc.resolve(pos);
|
|
15
|
-
var createInsertPosition = function createInsertPosition(from, to) {
|
|
16
|
-
return {
|
|
17
|
-
from: from,
|
|
18
|
-
to: to || from
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// Search for a valid position for nodeToInsert in progressively higher levels
|
|
23
|
-
for (var level = $pos.depth; level >= 0; level--) {
|
|
24
|
-
var nodeAtLevel = $pos.node(level);
|
|
25
|
-
|
|
26
|
-
// Try to replace the empty paragraph in the level above
|
|
27
|
-
// Scenario:
|
|
28
|
-
// doc(
|
|
29
|
-
// table(
|
|
30
|
-
// row(
|
|
31
|
-
// cell(
|
|
32
|
-
// p('{<>}'),
|
|
33
|
-
// ),
|
|
34
|
-
// )
|
|
35
|
-
// )
|
|
36
|
-
// )
|
|
37
|
-
var levelAbove = Math.max(level - 1, 0);
|
|
38
|
-
var parentNode = $pos.node(levelAbove);
|
|
39
|
-
// Special case: when this is true, the 'to' position should be the end
|
|
40
|
-
// of the empty paragraph
|
|
41
|
-
var isNodeAtLevelEmptyParagraph = nodeAtLevel.type.name === 'paragraph' && nodeAtLevel.content.size === 0;
|
|
42
|
-
var indexAtLevelAbove = $pos.index(levelAbove);
|
|
43
|
-
var canReplaceNodeAtLevelAbove = parentNode.canReplaceWith(indexAtLevelAbove, indexAtLevelAbove, nodeToInsert.type);
|
|
44
|
-
if (isNodeAtLevelEmptyParagraph && canReplaceNodeAtLevelAbove) {
|
|
45
|
-
var from = $pos.posAtIndex(indexAtLevelAbove, levelAbove);
|
|
46
|
-
return createInsertPosition(from, from + nodeAtLevel.nodeSize);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Try to insert this node right after the node in the level above
|
|
50
|
-
// Scenario:
|
|
51
|
-
// doc(
|
|
52
|
-
// panel(
|
|
53
|
-
// p('{<>}'),
|
|
54
|
-
// )
|
|
55
|
-
// )
|
|
56
|
-
var indexAfterAtLevelAbove = $pos.indexAfter(levelAbove);
|
|
57
|
-
var canInsertNodeAtLevelAbove = parentNode.canReplaceWith(indexAfterAtLevelAbove, indexAfterAtLevelAbove, nodeToInsert.type);
|
|
58
|
-
if (canInsertNodeAtLevelAbove) {
|
|
59
|
-
return createInsertPosition($pos.posAtIndex(indexAfterAtLevelAbove, levelAbove));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return createInsertPosition(0);
|
|
63
|
-
}
|
|
64
|
-
var insertBlockNode = function insertBlockNode(_ref) {
|
|
65
|
-
var node = _ref.node,
|
|
66
|
-
tr = _ref.tr,
|
|
67
|
-
position = _ref.position;
|
|
68
|
-
var start = position.$from.pos,
|
|
69
|
-
end = position.$to.pos;
|
|
70
|
-
if (node.isText) {
|
|
71
|
-
return tr.replaceWith(start, end, node);
|
|
72
|
-
}
|
|
73
|
-
if (node.isBlock) {
|
|
74
|
-
tr.delete(start, end);
|
|
75
|
-
var mappedStart = tr.mapping.map(start);
|
|
76
|
-
var nodeNormalized = (0, _selection.normaliseNestedLayout)(tr, node);
|
|
77
|
-
|
|
78
|
-
// Handle edge cases for hr and mediaSingle
|
|
79
|
-
var inserted = (0, _insert.safeInsert)(nodeNormalized, mappedStart)(tr);
|
|
80
|
-
if (inserted) {
|
|
81
|
-
return tr;
|
|
82
|
-
}
|
|
83
|
-
var sliceInserted = _prosemirrorModel.Slice.maxOpen(_prosemirrorModel.Fragment.from(nodeNormalized));
|
|
84
|
-
var _findInsertPoint = findInsertPoint(tr.doc, mappedStart, nodeNormalized),
|
|
85
|
-
from = _findInsertPoint.from,
|
|
86
|
-
to = _findInsertPoint.to;
|
|
87
|
-
tr.replaceWith(from, to, node);
|
|
88
|
-
var openPosition = Math.min(from + (node.isAtom ? node.nodeSize : sliceInserted.openStart), tr.doc.content.size);
|
|
89
|
-
var FORWARD_DIRECTION = 1;
|
|
90
|
-
var nextSelection = _prosemirrorState.TextSelection.findFrom(tr.doc.resolve(openPosition), FORWARD_DIRECTION, true);
|
|
91
|
-
if (nextSelection) {
|
|
92
|
-
return tr.setSelection(nextSelection);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return tr;
|
|
96
|
-
};
|
|
97
|
-
exports.insertBlockNode = insertBlockNode;
|
|
98
|
-
var insertInlineNodeOrFragment = function insertInlineNodeOrFragment(_ref2) {
|
|
99
|
-
var maybeFragment = _ref2.maybeFragment,
|
|
100
|
-
tr = _ref2.tr,
|
|
101
|
-
position = _ref2.position,
|
|
102
|
-
selectInlineNode = _ref2.selectInlineNode;
|
|
103
|
-
var start = position.$from.pos,
|
|
104
|
-
end = position.$to.pos;
|
|
105
|
-
var fragment = maybeFragment instanceof _prosemirrorModel.Node ? _prosemirrorModel.Fragment.from(maybeFragment) : maybeFragment;
|
|
106
|
-
tr.replaceWith(start, end, fragment);
|
|
107
|
-
if (selectInlineNode) {
|
|
108
|
-
return tr.setSelection(_prosemirrorState.NodeSelection.create(tr.doc, start));
|
|
109
|
-
}
|
|
110
|
-
return tr.setSelection(_prosemirrorState.TextSelection.near(tr.doc.resolve(start + fragment.size)));
|
|
111
|
-
};
|
|
112
|
-
exports.insertInlineNodeOrFragment = insertInlineNodeOrFragment;
|
|
113
|
-
var insertProseMirrorContent = function insertProseMirrorContent(_ref3) {
|
|
114
|
-
var tr = _ref3.tr,
|
|
115
|
-
node = _ref3.node,
|
|
116
|
-
position = _ref3.position,
|
|
117
|
-
selectNodeInserted = _ref3.selectNodeInserted;
|
|
118
|
-
if (node instanceof _prosemirrorModel.Node && node.isBlock) {
|
|
119
|
-
insertBlockNode({
|
|
120
|
-
node: node,
|
|
121
|
-
tr: tr,
|
|
122
|
-
position: position
|
|
123
|
-
});
|
|
124
|
-
} else {
|
|
125
|
-
insertInlineNodeOrFragment({
|
|
126
|
-
maybeFragment: node,
|
|
127
|
-
tr: tr,
|
|
128
|
-
position: position,
|
|
129
|
-
selectInlineNode: selectNodeInserted
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
exports.insertProseMirrorContent = insertProseMirrorContent;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
12
|
-
var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button"));
|
|
13
|
-
var _styles = require("./styles");
|
|
14
|
-
var _excluded = ["buttonStyles"];
|
|
15
|
-
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; }
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
-
var _default = function _default(_ref) {
|
|
18
|
-
var title = _ref.title,
|
|
19
|
-
icon = _ref.icon,
|
|
20
|
-
iconAfter = _ref.iconAfter,
|
|
21
|
-
onClick = _ref.onClick,
|
|
22
|
-
onKeyDown = _ref.onKeyDown,
|
|
23
|
-
onMouseEnter = _ref.onMouseEnter,
|
|
24
|
-
onMouseLeave = _ref.onMouseLeave,
|
|
25
|
-
onFocus = _ref.onFocus,
|
|
26
|
-
onBlur = _ref.onBlur,
|
|
27
|
-
selected = _ref.selected,
|
|
28
|
-
disabled = _ref.disabled,
|
|
29
|
-
href = _ref.href,
|
|
30
|
-
target = _ref.target,
|
|
31
|
-
_ref$appearance = _ref.appearance,
|
|
32
|
-
appearance = _ref$appearance === void 0 ? 'subtle' : _ref$appearance,
|
|
33
|
-
children = _ref.children,
|
|
34
|
-
className = _ref.className,
|
|
35
|
-
tooltipContent = _ref.tooltipContent,
|
|
36
|
-
testId = _ref.testId,
|
|
37
|
-
_ref$hideTooltipOnCli = _ref.hideTooltipOnClick,
|
|
38
|
-
hideTooltipOnClick = _ref$hideTooltipOnCli === void 0 ? true : _ref$hideTooltipOnCli,
|
|
39
|
-
ariaHasPopup = _ref.ariaHasPopup,
|
|
40
|
-
tabIndex = _ref.tabIndex,
|
|
41
|
-
areaControls = _ref.areaControls,
|
|
42
|
-
ariaLabel = _ref.ariaLabel;
|
|
43
|
-
// Check if there's only an icon and add additional styles
|
|
44
|
-
var iconOnly = (icon || iconAfter) && !children;
|
|
45
|
-
var customSpacing = iconOnly ? _styles.iconOnlySpacing : {};
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
47
|
-
content: tooltipContent || title,
|
|
48
|
-
hideTooltipOnClick: hideTooltipOnClick,
|
|
49
|
-
position: "top"
|
|
50
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
-
onMouseEnter: onMouseEnter,
|
|
52
|
-
onMouseLeave: onMouseLeave
|
|
53
|
-
}, /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
|
|
54
|
-
className: className,
|
|
55
|
-
theme: function theme(adgTheme, themeProps) {
|
|
56
|
-
var _adgTheme = adgTheme(themeProps),
|
|
57
|
-
buttonStyles = _adgTheme.buttonStyles,
|
|
58
|
-
rest = (0, _objectWithoutProperties2.default)(_adgTheme, _excluded);
|
|
59
|
-
return _objectSpread({
|
|
60
|
-
buttonStyles: _objectSpread(_objectSpread(_objectSpread({}, buttonStyles), customSpacing), appearance === 'danger' && (0, _styles.getButtonStyles)({
|
|
61
|
-
appearance: appearance,
|
|
62
|
-
state: themeProps.state,
|
|
63
|
-
mode: themeProps.mode
|
|
64
|
-
}))
|
|
65
|
-
}, rest);
|
|
66
|
-
},
|
|
67
|
-
"aria-label": ariaLabel || title,
|
|
68
|
-
"aria-pressed": !ariaHasPopup ? selected : undefined,
|
|
69
|
-
"aria-expanded": ariaHasPopup ? selected : undefined,
|
|
70
|
-
"aria-controls": ariaHasPopup ? areaControls : undefined,
|
|
71
|
-
spacing: 'compact',
|
|
72
|
-
href: href,
|
|
73
|
-
target: target,
|
|
74
|
-
appearance: appearance,
|
|
75
|
-
"aria-haspopup": ariaHasPopup,
|
|
76
|
-
iconBefore: icon || undefined,
|
|
77
|
-
iconAfter: iconAfter,
|
|
78
|
-
onClick: onClick,
|
|
79
|
-
onKeyDown: onKeyDown,
|
|
80
|
-
isSelected: selected,
|
|
81
|
-
isDisabled: disabled,
|
|
82
|
-
testId: testId,
|
|
83
|
-
onFocus: onFocus,
|
|
84
|
-
onBlur: onBlur
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
// tabIndex set as 0 by default in the design system ButtonBase component
|
|
87
|
-
// this is not expected for all buttons, we have to use tabIndex={null} for some cases
|
|
88
|
-
// should be fixed here https://a11y-internal.atlassian.net/browse/DST-287
|
|
89
|
-
,
|
|
90
|
-
tabIndex: tabIndex
|
|
91
|
-
}, children)));
|
|
92
|
-
};
|
|
93
|
-
exports.default = _default;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getLinkCreationAnalyticsEvent = getLinkCreationAnalyticsEvent;
|
|
7
|
-
var _types = require("../analytics/types");
|
|
8
|
-
var _utils = require("./utils");
|
|
9
|
-
function getLinkCreationAnalyticsEvent(inputMethod, url) {
|
|
10
|
-
return {
|
|
11
|
-
action: _types.ACTION.INSERTED,
|
|
12
|
-
actionSubject: _types.ACTION_SUBJECT.DOCUMENT,
|
|
13
|
-
actionSubjectId: _types.ACTION_SUBJECT_ID.LINK,
|
|
14
|
-
attributes: {
|
|
15
|
-
inputMethod: inputMethod,
|
|
16
|
-
fromCurrentDomain: (0, _utils.isFromCurrentDomain)(url)
|
|
17
|
-
},
|
|
18
|
-
eventType: _types.EVENT_TYPE.TRACK,
|
|
19
|
-
nonPrivacySafeAttributes: {
|
|
20
|
-
linkDomain: (0, _utils.getLinkDomain)(url)
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.findFilepaths = exports.LinkMatcher = exports.FILEPATH_REGEXP = exports.DONTLINKIFY_REGEXP = void 0;
|
|
8
|
-
exports.getLinkDomain = getLinkDomain;
|
|
9
|
-
exports.isFromCurrentDomain = isFromCurrentDomain;
|
|
10
|
-
exports.isLinkInMatches = void 0;
|
|
11
|
-
exports.linkifyContent = linkifyContent;
|
|
12
|
-
exports.normalizeUrl = normalizeUrl;
|
|
13
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
var _slice = require("../../utils/slice");
|
|
16
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
17
|
-
// File has been copied to packages/editor/editor-plugin-ai/src/provider/markdown-transformer/utils/hyperlink.ts
|
|
18
|
-
// If changes are made to this file, please make the same update in the linked file.
|
|
19
|
-
|
|
20
|
-
// Regular expression for a windows filepath in the format <DRIVE LETTER>:\<folder name>\
|
|
21
|
-
var FILEPATH_REGEXP = /([a-zA-Z]:|\\)([^\/:*?<>"|]+\\)?([^\/:*?<>"| ]+(?=\s?))?/gim;
|
|
22
|
-
|
|
23
|
-
// Don't linkify if starts with $ or {
|
|
24
|
-
exports.FILEPATH_REGEXP = FILEPATH_REGEXP;
|
|
25
|
-
var DONTLINKIFY_REGEXP = /^(\$|{)/;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Instance of class LinkMatcher are used in autoformatting in place of Regex.
|
|
29
|
-
* Hence it has been made similar to regex with an exec method.
|
|
30
|
-
* Extending it directly from class Regex was introducing some issues, thus that has been avoided.
|
|
31
|
-
*/
|
|
32
|
-
exports.DONTLINKIFY_REGEXP = DONTLINKIFY_REGEXP;
|
|
33
|
-
var LinkMatcher = /*#__PURE__*/function () {
|
|
34
|
-
function LinkMatcher() {
|
|
35
|
-
(0, _classCallCheck2.default)(this, LinkMatcher);
|
|
36
|
-
}
|
|
37
|
-
(0, _createClass2.default)(LinkMatcher, null, [{
|
|
38
|
-
key: "create",
|
|
39
|
-
value: function create() {
|
|
40
|
-
var LinkMatcherRegex = /*#__PURE__*/function () {
|
|
41
|
-
function LinkMatcherRegex() {
|
|
42
|
-
(0, _classCallCheck2.default)(this, LinkMatcherRegex);
|
|
43
|
-
}
|
|
44
|
-
(0, _createClass2.default)(LinkMatcherRegex, [{
|
|
45
|
-
key: "exec",
|
|
46
|
-
value: function exec(str) {
|
|
47
|
-
var stringsBySpace = str.slice(0, str.length - 1).split(' ');
|
|
48
|
-
var lastStringBeforeSpace = stringsBySpace[stringsBySpace.length - 1];
|
|
49
|
-
var isLastStringValid = lastStringBeforeSpace.length > 0;
|
|
50
|
-
if (!str.endsWith(' ') || !isLastStringValid) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
if (DONTLINKIFY_REGEXP.test(lastStringBeforeSpace)) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
var links = _adfSchema.linkify.match(lastStringBeforeSpace);
|
|
57
|
-
if (!links || links.length === 0) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
var lastMatch = links[links.length - 1];
|
|
61
|
-
var lastLink = links[links.length - 1];
|
|
62
|
-
lastLink.input = str.substring(lastMatch.index);
|
|
63
|
-
lastLink.length = lastLink.lastIndex - lastLink.index + 1;
|
|
64
|
-
lastLink.index = str.lastIndexOf(lastStringBeforeSpace) + lastMatch.index;
|
|
65
|
-
return lastLink;
|
|
66
|
-
}
|
|
67
|
-
}]);
|
|
68
|
-
return LinkMatcherRegex;
|
|
69
|
-
}();
|
|
70
|
-
return new LinkMatcherRegex();
|
|
71
|
-
}
|
|
72
|
-
}]);
|
|
73
|
-
return LinkMatcher;
|
|
74
|
-
}();
|
|
75
|
-
/**
|
|
76
|
-
* Adds protocol to url if needed.
|
|
77
|
-
*/
|
|
78
|
-
exports.LinkMatcher = LinkMatcher;
|
|
79
|
-
function normalizeUrl(url) {
|
|
80
|
-
if (!url) {
|
|
81
|
-
return '';
|
|
82
|
-
}
|
|
83
|
-
if ((0, _adfSchema.isSafeUrl)(url)) {
|
|
84
|
-
return url;
|
|
85
|
-
}
|
|
86
|
-
return (0, _adfSchema.normalizeUrl)(url);
|
|
87
|
-
}
|
|
88
|
-
function linkifyContent(schema) {
|
|
89
|
-
return function (slice) {
|
|
90
|
-
return (0, _slice.mapSlice)(slice, function (node, parent) {
|
|
91
|
-
var isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
92
|
-
var link = node.type.schema.marks.link;
|
|
93
|
-
if (link === undefined) {
|
|
94
|
-
throw new Error('Link not in schema - unable to linkify content');
|
|
95
|
-
}
|
|
96
|
-
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
97
|
-
var linkified = [];
|
|
98
|
-
var text = node.text;
|
|
99
|
-
var matches = findLinkMatches(text);
|
|
100
|
-
var pos = 0;
|
|
101
|
-
var filepaths = findFilepaths(text);
|
|
102
|
-
matches.forEach(function (match) {
|
|
103
|
-
if (isLinkInMatches(match.start, filepaths)) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (match.start > 0) {
|
|
107
|
-
linkified.push(node.cut(pos, match.start));
|
|
108
|
-
}
|
|
109
|
-
linkified.push(node.cut(match.start, match.end).mark(link.create({
|
|
110
|
-
href: normalizeUrl(match.href)
|
|
111
|
-
}).addToSet(node.marks)));
|
|
112
|
-
pos = match.end;
|
|
113
|
-
});
|
|
114
|
-
if (pos < text.length) {
|
|
115
|
-
linkified.push(node.cut(pos));
|
|
116
|
-
}
|
|
117
|
-
return linkified;
|
|
118
|
-
}
|
|
119
|
-
return node;
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function getLinkDomain(url) {
|
|
124
|
-
// Remove protocol and www., if either exists
|
|
125
|
-
var withoutProtocol = url.toLowerCase().replace(/^(.*):\/\//, '');
|
|
126
|
-
var withoutWWW = withoutProtocol.replace(/^(www\.)/, '');
|
|
127
|
-
|
|
128
|
-
// Remove port, fragment, path, query string
|
|
129
|
-
return withoutWWW.replace(/[:\/?#](.*)$/, '');
|
|
130
|
-
}
|
|
131
|
-
function isFromCurrentDomain(url) {
|
|
132
|
-
if (!window || !window.location) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
var currentDomain = window.location.hostname;
|
|
136
|
-
var linkDomain = getLinkDomain(url);
|
|
137
|
-
return currentDomain === linkDomain;
|
|
138
|
-
}
|
|
139
|
-
function findLinkMatches(text) {
|
|
140
|
-
var matches = [];
|
|
141
|
-
var linkMatches = text && _adfSchema.linkify.match(text);
|
|
142
|
-
if (linkMatches && linkMatches.length > 0) {
|
|
143
|
-
linkMatches.forEach(function (match) {
|
|
144
|
-
matches.push({
|
|
145
|
-
start: match.index,
|
|
146
|
-
end: match.lastIndex,
|
|
147
|
-
title: match.raw,
|
|
148
|
-
href: match.url
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
return matches;
|
|
153
|
-
}
|
|
154
|
-
var findFilepaths = function findFilepaths(text) {
|
|
155
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
156
|
-
// Creation of a copy of the RegExp is necessary as lastIndex is stored on it when we run .exec()
|
|
157
|
-
var localRegExp = new RegExp(FILEPATH_REGEXP);
|
|
158
|
-
var match;
|
|
159
|
-
var matchesList = [];
|
|
160
|
-
var maxFilepathSize = 260;
|
|
161
|
-
while ((match = localRegExp.exec(text)) !== null) {
|
|
162
|
-
var start = match.index + offset;
|
|
163
|
-
var end = localRegExp.lastIndex + offset;
|
|
164
|
-
if (end - start > maxFilepathSize) {
|
|
165
|
-
end = start + maxFilepathSize;
|
|
166
|
-
} // We don't care about big strings of text that are pretending to be filepaths!!
|
|
167
|
-
matchesList.push({
|
|
168
|
-
startIndex: start,
|
|
169
|
-
endIndex: end
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
return matchesList;
|
|
173
|
-
};
|
|
174
|
-
exports.findFilepaths = findFilepaths;
|
|
175
|
-
var isLinkInMatches = function isLinkInMatches(linkStart, matchesList) {
|
|
176
|
-
for (var i = 0; i < matchesList.length; i++) {
|
|
177
|
-
if (linkStart >= matchesList[i].startIndex && linkStart < matchesList[i].endIndex) {
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return false;
|
|
182
|
-
};
|
|
183
|
-
exports.isLinkInMatches = isLinkInMatches;
|