@atlaskit/editor-core 181.0.0 → 182.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/codemods/140.0.0-rc-kraken-fix-type-errors.ts +0 -2
- package/codemods/__tests__/next-remove-allow-more-text-colors-prop.ts +0 -17
- package/codemods/migrates/next-remove-allow-more-text-colors-prop.ts +0 -4
- package/dist/cjs/create-editor/create-plugins-list.js +7 -2
- package/dist/cjs/create-editor/feature-flags-from-props.js +31 -26
- package/dist/cjs/create-editor/sort-by-order.js +12 -0
- package/dist/cjs/editor-next/editor-migration-component.js +4 -1
- package/dist/cjs/editor-next/utils/deprecationWarnings.js +0 -5
- package/dist/cjs/labs/next/full-page.js +2 -1
- package/dist/cjs/labs/next/presets/default.js +2 -1
- package/dist/cjs/labs/next/presets/universal.js +7 -1
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +2 -1
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/styles.js +4 -7
- package/dist/cjs/plugins/analytics/plugin.js +6 -6
- package/dist/cjs/plugins/avatar-group/index.js +5 -2
- package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +4 -2
- package/dist/cjs/plugins/base/index.js +4 -2
- package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +1 -3
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -6
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +2 -8
- package/dist/cjs/plugins/border/index.js +20 -0
- package/dist/cjs/plugins/card/index.js +4 -2
- package/dist/cjs/plugins/card/toolbar.js +12 -15
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +7 -3
- package/dist/cjs/plugins/code-block/toolbar.js +1 -1
- package/dist/cjs/plugins/collab-edit/analytics.js +2 -3
- package/dist/cjs/plugins/collab-edit/events/handlers.js +2 -2
- package/dist/cjs/plugins/collab-edit/events/initialize.js +3 -2
- package/dist/cjs/plugins/collab-edit/index.js +5 -3
- package/dist/cjs/plugins/collab-edit/plugin.js +4 -3
- package/dist/cjs/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
- package/dist/cjs/plugins/collab-edit/ui/avatars.js +2 -3
- package/dist/cjs/plugins/date/index.js +90 -64
- package/dist/cjs/plugins/editor-disabled/index.js +8 -0
- package/dist/cjs/plugins/expand/index.js +4 -1
- package/dist/cjs/plugins/expand/nodeviews/index.js +6 -7
- package/dist/cjs/plugins/expand/pm-plugins/main.js +5 -2
- package/dist/cjs/plugins/extension/extension-api.js +27 -14
- package/dist/cjs/plugins/extension/pm-plugins/main.js +117 -177
- package/dist/cjs/plugins/extension/pm-plugins/utils.js +80 -0
- package/dist/cjs/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +7 -11
- package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +3 -4
- package/dist/cjs/plugins/find-replace/index.js +5 -2
- package/dist/cjs/plugins/floating-toolbar/index.js +15 -7
- package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +2 -1
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +13 -3
- package/dist/cjs/plugins/floating-toolbar/ui/SimpleModal.js +2 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +6 -5
- package/dist/cjs/plugins/hyperlink/Toolbar.js +9 -12
- package/dist/cjs/plugins/hyperlink/index.js +6 -2
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -4
- package/dist/cjs/plugins/index.js +7 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +5 -5
- package/dist/cjs/plugins/list/commands/index.js +31 -27
- package/dist/cjs/plugins/list/commands/outdent-list.js +2 -3
- package/dist/cjs/plugins/list/index.js +4 -3
- package/dist/cjs/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +3 -1
- package/dist/cjs/plugins/list/pm-plugins/input-rules/index.js +2 -1
- package/dist/cjs/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +58 -0
- package/dist/cjs/plugins/list/pm-plugins/keymap.js +4 -4
- package/dist/cjs/plugins/list/pm-plugins/main.js +23 -21
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +6 -1
- package/dist/cjs/plugins/media/nodeviews/styles.js +13 -1
- package/dist/cjs/plugins/media/toolbar/commands.js +105 -2
- package/dist/cjs/plugins/media/toolbar/imageBorder.js +20 -0
- package/dist/cjs/plugins/media/toolbar/index.js +33 -4
- package/dist/cjs/plugins/media/ui/ImageBorder/index.js +219 -0
- package/dist/cjs/plugins/media/ui/ImageBorder/messages.js +50 -0
- package/dist/cjs/plugins/media/ui/ImageBorder/styles.js +54 -0
- package/dist/cjs/plugins/media/utils/current-media-node.js +28 -5
- package/dist/cjs/plugins/paste/util/index.js +2 -0
- package/dist/cjs/plugins/rank.js +1 -1
- package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +5 -0
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +3 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +6 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +3 -2
- package/dist/cjs/plugins/type-ahead/index.js +4 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +4 -2
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/cjs/plugins/type-ahead/utils.js +22 -2
- package/dist/cjs/test-utils.js +3 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +4 -2
- package/dist/cjs/ui/styles.js +1 -1
- package/dist/cjs/utils/input-rules.js +0 -17
- package/dist/cjs/utils/insert.js +53 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +7 -2
- package/dist/es2019/create-editor/feature-flags-from-props.js +31 -26
- package/dist/es2019/create-editor/sort-by-order.js +11 -0
- package/dist/es2019/editor-next/editor-migration-component.js +4 -1
- package/dist/es2019/editor-next/utils/deprecationWarnings.js +0 -5
- package/dist/es2019/labs/next/full-page.js +2 -1
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/labs/next/presets/universal.js +8 -2
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +3 -2
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -8
- package/dist/es2019/plugins/analytics/plugin.js +45 -43
- package/dist/es2019/plugins/avatar-group/index.js +26 -21
- package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +4 -2
- package/dist/es2019/plugins/base/index.js +101 -97
- package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +1 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -6
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +2 -7
- package/dist/es2019/plugins/border/index.js +11 -0
- package/dist/es2019/plugins/card/index.js +4 -2
- package/dist/es2019/plugins/card/toolbar.js +10 -11
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +7 -3
- package/dist/es2019/plugins/code-block/toolbar.js +2 -2
- package/dist/es2019/plugins/collab-edit/analytics.js +2 -3
- package/dist/es2019/plugins/collab-edit/events/handlers.js +2 -2
- package/dist/es2019/plugins/collab-edit/events/initialize.js +3 -2
- package/dist/es2019/plugins/collab-edit/index.js +5 -3
- package/dist/es2019/plugins/collab-edit/plugin.js +4 -3
- package/dist/es2019/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
- package/dist/es2019/plugins/collab-edit/ui/avatars.js +2 -3
- package/dist/es2019/plugins/date/index.js +92 -64
- package/dist/es2019/plugins/editor-disabled/index.js +8 -0
- package/dist/es2019/plugins/expand/index.js +57 -53
- package/dist/es2019/plugins/expand/nodeviews/index.js +6 -9
- package/dist/es2019/plugins/expand/pm-plugins/main.js +5 -3
- package/dist/es2019/plugins/extension/extension-api.js +31 -13
- package/dist/es2019/plugins/extension/pm-plugins/main.js +77 -96
- package/dist/es2019/plugins/extension/pm-plugins/utils.js +30 -0
- package/dist/es2019/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +1 -8
- package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +3 -3
- package/dist/es2019/plugins/find-replace/index.js +5 -2
- package/dist/es2019/plugins/floating-toolbar/index.js +159 -149
- package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +4 -1
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +13 -3
- package/dist/es2019/plugins/floating-toolbar/ui/SimpleModal.js +4 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +6 -5
- package/dist/es2019/plugins/hyperlink/Toolbar.js +7 -9
- package/dist/es2019/plugins/hyperlink/index.js +66 -62
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -3
- package/dist/es2019/plugins/index.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +5 -5
- package/dist/es2019/plugins/list/commands/index.js +4 -4
- package/dist/es2019/plugins/list/commands/outdent-list.js +2 -4
- package/dist/es2019/plugins/list/index.js +80 -77
- package/dist/es2019/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +3 -1
- package/dist/es2019/plugins/list/pm-plugins/input-rules/index.js +2 -1
- package/dist/es2019/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +52 -0
- package/dist/es2019/plugins/list/pm-plugins/keymap.js +4 -4
- package/dist/es2019/plugins/list/pm-plugins/main.js +46 -46
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +4 -1
- package/dist/es2019/plugins/media/nodeviews/styles.js +12 -1
- package/dist/es2019/plugins/media/toolbar/commands.js +93 -0
- package/dist/es2019/plugins/media/toolbar/imageBorder.js +15 -0
- package/dist/es2019/plugins/media/toolbar/index.js +36 -5
- package/dist/es2019/plugins/media/ui/ImageBorder/index.js +206 -0
- package/dist/es2019/plugins/media/ui/ImageBorder/messages.js +43 -0
- package/dist/es2019/plugins/media/ui/ImageBorder/styles.js +124 -0
- package/dist/es2019/plugins/media/utils/current-media-node.js +22 -3
- package/dist/es2019/plugins/paste/util/index.js +2 -0
- package/dist/es2019/plugins/rank.js +1 -1
- package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +7 -0
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +59 -55
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +6 -3
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +3 -2
- package/dist/es2019/plugins/type-ahead/index.js +4 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +4 -2
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/es2019/plugins/type-ahead/utils.js +22 -2
- package/dist/es2019/test-utils.js +3 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +4 -2
- package/dist/es2019/ui/styles.js +1 -0
- package/dist/es2019/utils/input-rules.js +0 -17
- package/dist/es2019/utils/insert.js +61 -10
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +7 -2
- package/dist/esm/create-editor/feature-flags-from-props.js +31 -26
- package/dist/esm/create-editor/sort-by-order.js +11 -0
- package/dist/esm/editor-next/editor-migration-component.js +3 -0
- package/dist/esm/editor-next/utils/deprecationWarnings.js +0 -5
- package/dist/esm/labs/next/full-page.js +2 -1
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/labs/next/presets/universal.js +8 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +3 -2
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/styles.js +3 -5
- package/dist/esm/plugins/analytics/plugin.js +6 -6
- package/dist/esm/plugins/avatar-group/index.js +5 -2
- package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +4 -2
- package/dist/esm/plugins/base/index.js +4 -2
- package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +1 -3
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +1 -6
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +2 -8
- package/dist/esm/plugins/border/index.js +13 -0
- package/dist/esm/plugins/card/index.js +4 -2
- package/dist/esm/plugins/card/toolbar.js +12 -15
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +7 -3
- package/dist/esm/plugins/code-block/toolbar.js +2 -2
- package/dist/esm/plugins/collab-edit/analytics.js +2 -3
- package/dist/esm/plugins/collab-edit/events/handlers.js +2 -2
- package/dist/esm/plugins/collab-edit/events/initialize.js +3 -2
- package/dist/esm/plugins/collab-edit/index.js +5 -3
- package/dist/esm/plugins/collab-edit/plugin.js +4 -3
- package/dist/esm/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
- package/dist/esm/plugins/collab-edit/ui/avatars.js +2 -3
- package/dist/esm/plugins/date/index.js +90 -64
- package/dist/esm/plugins/editor-disabled/index.js +8 -0
- package/dist/esm/plugins/expand/index.js +4 -1
- package/dist/esm/plugins/expand/nodeviews/index.js +6 -7
- package/dist/esm/plugins/expand/pm-plugins/main.js +5 -2
- package/dist/esm/plugins/extension/extension-api.js +24 -12
- package/dist/esm/plugins/extension/pm-plugins/main.js +113 -173
- package/dist/esm/plugins/extension/pm-plugins/utils.js +72 -0
- package/dist/esm/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +1 -10
- package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +3 -4
- package/dist/esm/plugins/find-replace/index.js +5 -2
- package/dist/esm/plugins/floating-toolbar/index.js +15 -7
- package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +13 -3
- package/dist/esm/plugins/floating-toolbar/ui/SimpleModal.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +6 -5
- package/dist/esm/plugins/hyperlink/Toolbar.js +9 -13
- package/dist/esm/plugins/hyperlink/index.js +6 -2
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +3 -4
- package/dist/esm/plugins/index.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +5 -5
- package/dist/esm/plugins/list/commands/index.js +31 -27
- package/dist/esm/plugins/list/commands/outdent-list.js +2 -3
- package/dist/esm/plugins/list/index.js +4 -3
- package/dist/esm/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +3 -1
- package/dist/esm/plugins/list/pm-plugins/input-rules/index.js +2 -1
- package/dist/esm/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +51 -0
- package/dist/esm/plugins/list/pm-plugins/keymap.js +4 -4
- package/dist/esm/plugins/list/pm-plugins/main.js +23 -21
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +6 -1
- package/dist/esm/plugins/media/nodeviews/styles.js +13 -1
- package/dist/esm/plugins/media/toolbar/commands.js +99 -0
- package/dist/esm/plugins/media/toolbar/imageBorder.js +14 -0
- package/dist/esm/plugins/media/toolbar/index.js +34 -5
- package/dist/esm/plugins/media/ui/ImageBorder/index.js +211 -0
- package/dist/esm/plugins/media/ui/ImageBorder/messages.js +43 -0
- package/dist/esm/plugins/media/ui/ImageBorder/styles.js +37 -0
- package/dist/esm/plugins/media/utils/current-media-node.js +24 -3
- package/dist/esm/plugins/paste/util/index.js +2 -0
- package/dist/esm/plugins/rank.js +1 -1
- package/dist/esm/plugins/rule/pm-plugins/input-rule.js +5 -0
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -1
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +3 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +6 -3
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +3 -2
- package/dist/esm/plugins/type-ahead/index.js +4 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +4 -2
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +41 -4
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -0
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +9 -5
- package/dist/esm/plugins/type-ahead/utils.js +22 -2
- package/dist/esm/test-utils.js +3 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +4 -2
- package/dist/esm/ui/styles.js +1 -1
- package/dist/esm/utils/input-rules.js +0 -17
- package/dist/esm/utils/insert.js +56 -10
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/sort-by-order.d.ts +9 -0
- package/dist/types/editor-next/editor-migration-component.d.ts +1 -0
- package/dist/types/labs/next/presets/cxhtml.d.ts +36 -2
- package/dist/types/labs/next/presets/default.d.ts +72 -4
- package/dist/types/labs/next/presets/mobile.d.ts +36 -2
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -1
- package/dist/types/plugins/analytics/plugin.d.ts +2 -0
- package/dist/types/plugins/avatar-group/index.d.ts +2 -0
- package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +2 -0
- package/dist/types/plugins/base/index.d.ts +2 -0
- package/dist/types/plugins/base/pm-plugins/disable-spell-checking.d.ts +2 -1
- package/dist/types/plugins/border/index.d.ts +3 -0
- package/dist/types/plugins/card/index.d.ts +2 -0
- package/dist/types/plugins/card/toolbar.d.ts +2 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +5 -2
- package/dist/types/plugins/collab-edit/analytics.d.ts +2 -1
- package/dist/types/plugins/collab-edit/events/handlers.d.ts +2 -1
- package/dist/types/plugins/collab-edit/events/initialize.d.ts +3 -1
- package/dist/types/plugins/collab-edit/index.d.ts +2 -0
- package/dist/types/plugins/collab-edit/plugin.d.ts +2 -1
- package/dist/types/plugins/collab-edit/ui/avatars-with-plugin-state.d.ts +4 -0
- package/dist/types/plugins/collab-edit/ui/avatars.d.ts +2 -0
- package/dist/types/plugins/date/index.d.ts +9 -1
- package/dist/types/plugins/editor-disabled/index.d.ts +3 -1
- package/dist/types/plugins/expand/index.d.ts +2 -0
- package/dist/types/plugins/expand/nodeviews/index.d.ts +5 -2
- package/dist/types/plugins/expand/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +8 -2
- package/dist/types/plugins/extension/pm-plugins/utils.d.ts +3 -0
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -7
- package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +2 -0
- package/dist/types/plugins/find-replace/index.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/index.d.ts +4 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +2 -0
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types/plugins/hyperlink/index.d.ts +2 -0
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +2 -0
- package/dist/types/plugins/index.d.ts +1 -0
- package/dist/types/plugins/list/actions/outdent-list-items-selected.d.ts +2 -1
- package/dist/types/plugins/list/commands/index.d.ts +3 -2
- package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types/plugins/list/index.d.ts +2 -0
- package/dist/types/plugins/list/pm-plugins/input-rules/create-list-input-rule.d.ts +1 -1
- package/dist/types/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +13 -0
- package/dist/types/plugins/list/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/list/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugins/media/nodeviews/styles.d.ts +3 -1
- package/dist/types/plugins/media/toolbar/commands.d.ts +5 -0
- package/dist/types/plugins/media/toolbar/imageBorder.d.ts +2 -0
- package/dist/types/plugins/media/types.d.ts +3 -0
- package/dist/types/plugins/media/ui/ImageBorder/index.d.ts +13 -0
- package/dist/types/plugins/media/ui/ImageBorder/messages.d.ts +42 -0
- package/dist/types/plugins/media/ui/ImageBorder/styles.d.ts +15 -0
- package/dist/types/plugins/media/utils/current-media-node.d.ts +6 -0
- package/dist/types/plugins/text-color/pm-plugins/main.d.ts +0 -2
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +3 -1
- package/dist/types/plugins/type-ahead/index.d.ts +1 -0
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +2 -1
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +1 -0
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +1 -0
- package/dist/types/plugins/type-ahead/utils.d.ts +2 -1
- package/dist/types/test-utils.d.ts +4 -2
- package/dist/types/types/editor-props.d.ts +5 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +13 -12
- package/report.api.md +12 -4
- package/codemods/__tests__/rename-experimental-text-color-prop.ts +0 -204
- package/codemods/migrates/rename-experimental-text-color-prop.ts +0 -6
|
@@ -24,7 +24,10 @@ var _commands = require("./commands");
|
|
|
24
24
|
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
25
25
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
26
26
|
var expandPlugin = function expandPlugin() {
|
|
27
|
+
var _api$dependencies, _api$dependencies$fea;
|
|
27
28
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
29
|
+
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
30
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
28
31
|
return {
|
|
29
32
|
name: 'expand',
|
|
30
33
|
nodes: function nodes() {
|
|
@@ -42,7 +45,7 @@ var expandPlugin = function expandPlugin() {
|
|
|
42
45
|
plugin: function plugin(_ref) {
|
|
43
46
|
var dispatch = _ref.dispatch,
|
|
44
47
|
getIntl = _ref.getIntl;
|
|
45
|
-
return (0, _main.createPlugin)(dispatch, getIntl, options.appearance, options.useLongPressSelection);
|
|
48
|
+
return (0, _main.createPlugin)(dispatch, getIntl, options.appearance, options.useLongPressSelection, featureFlags);
|
|
46
49
|
}
|
|
47
50
|
}, {
|
|
48
51
|
name: 'expandKeymap',
|
|
@@ -20,7 +20,6 @@ var _utils = require("../../../utils");
|
|
|
20
20
|
var _commands = require("../commands");
|
|
21
21
|
var _classNames = require("../ui/class-names");
|
|
22
22
|
var _gapCursorSelection = require("../../../plugins/selection/gap-cursor-selection");
|
|
23
|
-
var _featureFlagsContext = require("../../feature-flags-context");
|
|
24
23
|
var _dom = require("../../../utils/dom");
|
|
25
24
|
var _types = require("../../selection/types");
|
|
26
25
|
var _commands2 = require("../../selection/commands");
|
|
@@ -62,7 +61,7 @@ var toDOM = function toDOM(node, intl) {
|
|
|
62
61
|
}, 0]];
|
|
63
62
|
};
|
|
64
63
|
var ExpandNodeView = /*#__PURE__*/function () {
|
|
65
|
-
function ExpandNodeView(node, view, getPos, getIntl, isMobile) {
|
|
64
|
+
function ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags) {
|
|
66
65
|
var _this = this;
|
|
67
66
|
(0, _classCallCheck2.default)(this, ExpandNodeView);
|
|
68
67
|
(0, _defineProperty2.default)(this, "allowInteractiveExpand", true);
|
|
@@ -90,9 +89,7 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
91
|
(0, _defineProperty2.default)(this, "isAllowInteractiveExpandEnabled", function () {
|
|
93
|
-
|
|
94
|
-
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(state);
|
|
95
|
-
return featureFlags && !!featureFlags.interactiveExpand;
|
|
92
|
+
return _this.featureFlags && !!_this.featureFlags.interactiveExpand;
|
|
96
93
|
});
|
|
97
94
|
(0, _defineProperty2.default)(this, "handleClick", function (event) {
|
|
98
95
|
var target = event.target;
|
|
@@ -294,6 +291,7 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
294
291
|
this.dom = dom;
|
|
295
292
|
this.contentDOM = contentDOM;
|
|
296
293
|
this.isMobile = isMobile;
|
|
294
|
+
this.featureFlags = featureFlags;
|
|
297
295
|
this.icon = this.dom.querySelector(".".concat(_classNames.expandClassNames.icon));
|
|
298
296
|
this.input = this.dom.querySelector(".".concat(_classNames.expandClassNames.titleInput));
|
|
299
297
|
this.titleContainer = this.dom.querySelector(".".concat(_classNames.expandClassNames.titleContainer));
|
|
@@ -414,8 +412,9 @@ var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
414
412
|
exports.ExpandNodeView = ExpandNodeView;
|
|
415
413
|
function _default(_ref2) {
|
|
416
414
|
var getIntl = _ref2.getIntl,
|
|
417
|
-
isMobile = _ref2.isMobile
|
|
415
|
+
isMobile = _ref2.isMobile,
|
|
416
|
+
featureFlags = _ref2.featureFlags;
|
|
418
417
|
return function (node, view, getPos) {
|
|
419
|
-
return new ExpandNodeView(node, view, getPos, getIntl, isMobile);
|
|
418
|
+
return new ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags);
|
|
420
419
|
};
|
|
421
420
|
}
|
|
@@ -21,6 +21,7 @@ function containsClass(element, className) {
|
|
|
21
21
|
var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
22
22
|
var appearance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'full-page';
|
|
23
23
|
var useLongPressSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
24
|
+
var featureFlags = arguments.length > 4 ? arguments[4] : undefined;
|
|
24
25
|
var state = (0, _pluginFactory.createPluginState)(dispatch, {});
|
|
25
26
|
var isMobile = appearance === 'mobile';
|
|
26
27
|
return new _safePlugin.SafePlugin({
|
|
@@ -30,11 +31,13 @@ var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
30
31
|
nodeViews: {
|
|
31
32
|
expand: (0, _nodeviews.default)({
|
|
32
33
|
getIntl: getIntl,
|
|
33
|
-
isMobile: isMobile
|
|
34
|
+
isMobile: isMobile,
|
|
35
|
+
featureFlags: featureFlags
|
|
34
36
|
}),
|
|
35
37
|
nestedExpand: (0, _nodeviews.default)({
|
|
36
38
|
getIntl: getIntl,
|
|
37
|
-
isMobile: isMobile
|
|
39
|
+
isMobile: isMobile,
|
|
40
|
+
featureFlags: featureFlags
|
|
38
41
|
})
|
|
39
42
|
},
|
|
40
43
|
handleKeyDown: function handleKeyDown(_view, event) {
|
|
@@ -12,8 +12,9 @@ var _prosemirrorModel = require("prosemirror-model");
|
|
|
12
12
|
var _prosemirrorState = require("prosemirror-state");
|
|
13
13
|
var _macro = require("../macro");
|
|
14
14
|
var _pluginKey = require("../macro/plugin-key");
|
|
15
|
+
var _utils = require("../../utils");
|
|
15
16
|
var _commands = require("./commands");
|
|
16
|
-
var
|
|
17
|
+
var _utils2 = require("./utils");
|
|
17
18
|
var _analytics = require("../analytics");
|
|
18
19
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
19
20
|
var getEditInLegacyMacroBrowser = function getEditInLegacyMacroBrowser(_ref) {
|
|
@@ -26,7 +27,7 @@ var getEditInLegacyMacroBrowser = function getEditInLegacyMacroBrowser(_ref) {
|
|
|
26
27
|
if (!macroProvider) {
|
|
27
28
|
throw new Error("Missing macroProvider. Can't use the macro browser for updates");
|
|
28
29
|
}
|
|
29
|
-
var nodeWithPos = (0,
|
|
30
|
+
var nodeWithPos = (0, _utils2.getSelectedExtension)(view.state, true);
|
|
30
31
|
if (!nodeWithPos) {
|
|
31
32
|
throw new Error("Missing nodeWithPos. Can't determine position of node");
|
|
32
33
|
}
|
|
@@ -46,7 +47,12 @@ var extensionAPICallPayload = function extensionAPICallPayload(functionName) {
|
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
49
|
var createExtensionAPI = function createExtensionAPI(options) {
|
|
49
|
-
var
|
|
50
|
+
var schema = options.editorView.state.schema;
|
|
51
|
+
var nodes = Object.keys(schema.nodes);
|
|
52
|
+
var marks = Object.keys(schema.marks);
|
|
53
|
+
var validate = (0, _validator.validator)(nodes, marks, {
|
|
54
|
+
allowPrivateAttributes: true
|
|
55
|
+
});
|
|
50
56
|
|
|
51
57
|
/**
|
|
52
58
|
* Finds the node and its position by `localId`. Throws if the node could not be found.
|
|
@@ -62,7 +68,7 @@ var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
62
68
|
|
|
63
69
|
// Find the node + position matching the given ID
|
|
64
70
|
var state = options.editorView.state;
|
|
65
|
-
var nodePos = (0,
|
|
71
|
+
var nodePos = (0, _utils2.findNodePosWithLocalId)(state, localId);
|
|
66
72
|
if (!nodePos) {
|
|
67
73
|
throw new Error("".concat(opName, "(): Could not find node with ID '").concat(localId, "'."));
|
|
68
74
|
}
|
|
@@ -121,12 +127,12 @@ var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
121
127
|
var _node$attrs = node.attrs,
|
|
122
128
|
extensionKey = _node$attrs.extensionKey,
|
|
123
129
|
extensionType = _node$attrs.extensionType;
|
|
124
|
-
var dataConsumerMark = (0,
|
|
130
|
+
var dataConsumerMark = (0, _utils2.getDataConsumerMark)(node);
|
|
125
131
|
var stringIds = (dataConsumerMark === null || dataConsumerMark === void 0 ? void 0 : dataConsumerMark.attrs.sources.map(function (sourceId) {
|
|
126
132
|
return sourceId;
|
|
127
133
|
})) || [];
|
|
128
134
|
var hasReferentiality = !!dataConsumerMark;
|
|
129
|
-
var nodeTypesReferenced = hasReferentiality ? (0,
|
|
135
|
+
var nodeTypesReferenced = hasReferentiality ? (0, _utils2.getNodeTypesReferenced)(stringIds, state) : undefined;
|
|
130
136
|
|
|
131
137
|
// fire off analytics for this ADF
|
|
132
138
|
var payload = {
|
|
@@ -179,6 +185,7 @@ var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
179
185
|
var tr = state.tr,
|
|
180
186
|
schema = state.schema;
|
|
181
187
|
var changedValues = mutationCallback({
|
|
188
|
+
content: (0, _utils.nodeToJSON)(node).content,
|
|
182
189
|
attrs: node.attrs,
|
|
183
190
|
marks: node.marks.map(function (pmMark) {
|
|
184
191
|
return {
|
|
@@ -187,13 +194,12 @@ var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
187
194
|
};
|
|
188
195
|
})
|
|
189
196
|
});
|
|
190
|
-
var _state$doc$resolve = state.doc.resolve(pos),
|
|
191
|
-
parent = _state$doc$resolve.parent;
|
|
192
197
|
var ensureValidMark = function ensureValidMark(mark) {
|
|
193
198
|
if ((0, _typeof2.default)(mark) !== 'object' || Array.isArray(mark)) {
|
|
194
199
|
throw new Error("update(): Invalid mark given.");
|
|
195
200
|
}
|
|
196
|
-
|
|
201
|
+
var _state$doc$resolve = state.doc.resolve(pos),
|
|
202
|
+
parent = _state$doc$resolve.parent;
|
|
197
203
|
// Ensure that the given mark is present in the schema
|
|
198
204
|
var markType = schema.marks[mark.type];
|
|
199
205
|
if (!markType) {
|
|
@@ -207,21 +213,28 @@ var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
207
213
|
attrs: mark.attrs
|
|
208
214
|
};
|
|
209
215
|
};
|
|
210
|
-
var newMarks = (_changedValues$marks = changedValues.marks) === null || _changedValues$marks === void 0 ? void 0 : _changedValues$marks.map(ensureValidMark).map(function (_ref3) {
|
|
216
|
+
var newMarks = changedValues.hasOwnProperty('marks') ? (_changedValues$marks = changedValues.marks) === null || _changedValues$marks === void 0 ? void 0 : _changedValues$marks.map(ensureValidMark).map(function (_ref3) {
|
|
211
217
|
var mark = _ref3.mark,
|
|
212
218
|
attrs = _ref3.attrs;
|
|
213
219
|
return mark.create(attrs);
|
|
214
|
-
});
|
|
220
|
+
}) : node.marks;
|
|
221
|
+
var newContent = changedValues.hasOwnProperty('content') ? _prosemirrorModel.Fragment.fromJSON(schema, changedValues.content) : node.content;
|
|
222
|
+
var newAttrs = changedValues.hasOwnProperty('attrs') ? changedValues.attrs : node.attrs;
|
|
215
223
|
|
|
216
|
-
// Validate if the new attributes and marks result in a valid node and adf.
|
|
224
|
+
// Validate if the new attributes, content and marks result in a valid node and adf.
|
|
217
225
|
try {
|
|
218
|
-
var newNode = node.type.createChecked(
|
|
226
|
+
var newNode = node.type.createChecked(newAttrs, newContent, newMarks);
|
|
219
227
|
var newNodeAdf = new _editorJsonTransformer.JSONTransformer().encodeNode(newNode);
|
|
220
228
|
validate(newNodeAdf);
|
|
229
|
+
tr.replaceWith(pos, pos + node.nodeSize, newNode);
|
|
230
|
+
|
|
231
|
+
// Keep selection if content does not change
|
|
232
|
+
if (newContent === node.content) {
|
|
233
|
+
tr.setSelection(_prosemirrorState.Selection.fromJSON(tr.doc, state.selection.toJSON()));
|
|
234
|
+
}
|
|
221
235
|
} catch (err) {
|
|
222
236
|
throw new Error("update(): The given ADFEntity cannot be inserted in the current position.\n".concat(err));
|
|
223
237
|
}
|
|
224
|
-
tr.setNodeMarkup(pos, undefined, changedValues.attrs, newMarks);
|
|
225
238
|
|
|
226
239
|
// Analytics - tracking the api call
|
|
227
240
|
var apiCallPayload = extensionAPICallPayload('update');
|
|
@@ -17,92 +17,24 @@ Object.defineProperty(exports, "getPluginState", {
|
|
|
17
17
|
return _pluginFactory.getPluginState;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
+
exports.handleUpdate = void 0;
|
|
20
21
|
Object.defineProperty(exports, "pluginKey", {
|
|
21
22
|
enumerable: true,
|
|
22
23
|
get: function get() {
|
|
23
24
|
return _pluginKey.pluginKey;
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
|
-
exports.updateEditButton = void 0;
|
|
27
27
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
28
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
29
28
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
29
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
30
30
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
31
|
-
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
32
31
|
var _utils = require("../../selection/utils");
|
|
33
32
|
var _extension = _interopRequireDefault(require("../nodeviews/extension"));
|
|
34
33
|
var _commands = require("../commands");
|
|
35
34
|
var _utils2 = require("../utils");
|
|
36
35
|
var _pluginFactory = require("../plugin-factory");
|
|
37
36
|
var _pluginKey = require("../plugin-key");
|
|
38
|
-
var
|
|
39
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(view, extensionProvider) {
|
|
40
|
-
var nodeWithPos, _nodeWithPos$node$att, extensionType, extensionKey, extensionModuleNode, newNodeWithPos;
|
|
41
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) {
|
|
43
|
-
switch (_context.prev = _context.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
nodeWithPos = (0, _utils2.getSelectedExtension)(view.state, true);
|
|
46
|
-
if (nodeWithPos) {
|
|
47
|
-
_context.next = 3;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
throw new Error('There is no selection');
|
|
51
|
-
case 3:
|
|
52
|
-
_nodeWithPos$node$att = nodeWithPos.node.attrs, extensionType = _nodeWithPos$node$att.extensionType, extensionKey = _nodeWithPos$node$att.extensionKey;
|
|
53
|
-
_context.next = 6;
|
|
54
|
-
return (0, _extensions.getExtensionModuleNode)(extensionProvider, extensionType, extensionKey);
|
|
55
|
-
case 6:
|
|
56
|
-
extensionModuleNode = _context.sent;
|
|
57
|
-
newNodeWithPos = (0, _utils2.getSelectedExtension)(view.state, true);
|
|
58
|
-
if (!(newNodeWithPos && newNodeWithPos.node.attrs.extensionType === extensionType && newNodeWithPos.node.attrs.extensionKey === extensionKey && newNodeWithPos.pos === nodeWithPos.pos && extensionModuleNode)) {
|
|
59
|
-
_context.next = 10;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
return _context.abrupt("return", extensionModuleNode.update);
|
|
63
|
-
case 10:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, _callee);
|
|
69
|
-
}));
|
|
70
|
-
return function maybeGetUpdateMethodFromExtensionProvider(_x, _x2) {
|
|
71
|
-
return _ref.apply(this, arguments);
|
|
72
|
-
};
|
|
73
|
-
}();
|
|
74
|
-
var updateEditButton = /*#__PURE__*/function () {
|
|
75
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(view, extensionProvider) {
|
|
76
|
-
var updateMethod;
|
|
77
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
78
|
-
while (1) {
|
|
79
|
-
switch (_context2.prev = _context2.next) {
|
|
80
|
-
case 0:
|
|
81
|
-
_context2.prev = 0;
|
|
82
|
-
_context2.next = 3;
|
|
83
|
-
return maybeGetUpdateMethodFromExtensionProvider(view, extensionProvider);
|
|
84
|
-
case 3:
|
|
85
|
-
updateMethod = _context2.sent;
|
|
86
|
-
(0, _commands.updateState)({
|
|
87
|
-
showEditButton: !!updateMethod,
|
|
88
|
-
updateExtension: updateMethod && Promise.resolve(updateMethod) || undefined
|
|
89
|
-
})(view.state, view.dispatch);
|
|
90
|
-
return _context2.abrupt("return", updateMethod);
|
|
91
|
-
case 8:
|
|
92
|
-
_context2.prev = 8;
|
|
93
|
-
_context2.t0 = _context2["catch"](0);
|
|
94
|
-
case 10:
|
|
95
|
-
case "end":
|
|
96
|
-
return _context2.stop();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}, _callee2, null, [[0, 8]]);
|
|
100
|
-
}));
|
|
101
|
-
return function updateEditButton(_x3, _x4) {
|
|
102
|
-
return _ref2.apply(this, arguments);
|
|
103
|
-
};
|
|
104
|
-
}();
|
|
105
|
-
exports.updateEditButton = updateEditButton;
|
|
37
|
+
var _utils3 = require("./utils");
|
|
106
38
|
var shouldShowEditButton = function shouldShowEditButton(extensionHandler, extensionProvider) {
|
|
107
39
|
var usesLegacyMacroBrowser = !extensionHandler && !extensionProvider || typeof extensionHandler === 'function';
|
|
108
40
|
var usesModernUpdateMethod = (0, _typeof2.default)(extensionHandler) === 'object' && typeof extensionHandler.update === 'function';
|
|
@@ -112,129 +44,191 @@ var shouldShowEditButton = function shouldShowEditButton(extensionHandler, exten
|
|
|
112
44
|
return false;
|
|
113
45
|
};
|
|
114
46
|
var getUpdateExtensionPromise = /*#__PURE__*/function () {
|
|
115
|
-
var
|
|
47
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(view, extensionHandler, extensionProvider) {
|
|
116
48
|
var updateMethod;
|
|
117
|
-
return _regenerator.default.wrap(function
|
|
49
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
118
50
|
while (1) {
|
|
119
|
-
switch (
|
|
51
|
+
switch (_context.prev = _context.next) {
|
|
120
52
|
case 0:
|
|
121
53
|
if (!(extensionHandler && (0, _typeof2.default)(extensionHandler) === 'object')) {
|
|
122
|
-
|
|
54
|
+
_context.next = 4;
|
|
123
55
|
break;
|
|
124
56
|
}
|
|
125
|
-
return
|
|
57
|
+
return _context.abrupt("return", extensionHandler.update);
|
|
126
58
|
case 4:
|
|
127
59
|
if (!extensionProvider) {
|
|
128
|
-
|
|
60
|
+
_context.next = 10;
|
|
129
61
|
break;
|
|
130
62
|
}
|
|
131
|
-
|
|
132
|
-
return updateEditButton(view, extensionProvider);
|
|
63
|
+
_context.next = 7;
|
|
64
|
+
return (0, _utils3.updateEditButton)(view, extensionProvider);
|
|
133
65
|
case 7:
|
|
134
|
-
updateMethod =
|
|
66
|
+
updateMethod = _context.sent;
|
|
135
67
|
if (!updateMethod) {
|
|
136
|
-
|
|
68
|
+
_context.next = 10;
|
|
137
69
|
break;
|
|
138
70
|
}
|
|
139
|
-
return
|
|
71
|
+
return _context.abrupt("return", updateMethod);
|
|
140
72
|
case 10:
|
|
141
73
|
throw new Error('No update method available');
|
|
142
74
|
case 11:
|
|
143
75
|
case "end":
|
|
144
|
-
return
|
|
76
|
+
return _context.stop();
|
|
145
77
|
}
|
|
146
78
|
}
|
|
147
|
-
},
|
|
79
|
+
}, _callee);
|
|
148
80
|
}));
|
|
149
|
-
return function getUpdateExtensionPromise(
|
|
150
|
-
return
|
|
81
|
+
return function getUpdateExtensionPromise(_x, _x2, _x3) {
|
|
82
|
+
return _ref.apply(this, arguments);
|
|
151
83
|
};
|
|
152
84
|
}();
|
|
153
85
|
var createExtensionProviderHandler = function createExtensionProviderHandler(view) {
|
|
154
86
|
return /*#__PURE__*/function () {
|
|
155
|
-
var
|
|
87
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, provider) {
|
|
156
88
|
var extensionProvider;
|
|
157
|
-
return _regenerator.default.wrap(function
|
|
89
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
158
90
|
while (1) {
|
|
159
|
-
switch (
|
|
91
|
+
switch (_context2.prev = _context2.next) {
|
|
160
92
|
case 0:
|
|
161
93
|
if (!(name === 'extensionProvider' && provider)) {
|
|
162
|
-
|
|
94
|
+
_context2.next = 13;
|
|
163
95
|
break;
|
|
164
96
|
}
|
|
165
|
-
|
|
166
|
-
|
|
97
|
+
_context2.prev = 1;
|
|
98
|
+
_context2.next = 4;
|
|
167
99
|
return provider;
|
|
168
100
|
case 4:
|
|
169
|
-
extensionProvider =
|
|
101
|
+
extensionProvider = _context2.sent;
|
|
170
102
|
(0, _commands.updateState)({
|
|
171
103
|
extensionProvider: extensionProvider
|
|
172
104
|
})(view.state, view.dispatch);
|
|
173
|
-
|
|
174
|
-
return updateEditButton(view, extensionProvider);
|
|
105
|
+
_context2.next = 8;
|
|
106
|
+
return (0, _utils3.updateEditButton)(view, extensionProvider);
|
|
175
107
|
case 8:
|
|
176
|
-
|
|
108
|
+
_context2.next = 13;
|
|
177
109
|
break;
|
|
178
110
|
case 10:
|
|
179
|
-
|
|
180
|
-
|
|
111
|
+
_context2.prev = 10;
|
|
112
|
+
_context2.t0 = _context2["catch"](1);
|
|
181
113
|
(0, _commands.updateState)({
|
|
182
114
|
extensionProvider: undefined
|
|
183
115
|
})(view.state, view.dispatch);
|
|
184
116
|
case 13:
|
|
185
117
|
case "end":
|
|
186
|
-
return
|
|
118
|
+
return _context2.stop();
|
|
187
119
|
}
|
|
188
120
|
}
|
|
189
|
-
},
|
|
121
|
+
}, _callee2, null, [[1, 10]]);
|
|
190
122
|
}));
|
|
191
|
-
return function (
|
|
192
|
-
return
|
|
123
|
+
return function (_x4, _x5) {
|
|
124
|
+
return _ref2.apply(this, arguments);
|
|
193
125
|
};
|
|
194
126
|
}();
|
|
195
127
|
};
|
|
196
128
|
exports.createExtensionProviderHandler = createExtensionProviderHandler;
|
|
197
129
|
var createContextIdentifierProviderHandler = function createContextIdentifierProviderHandler(view) {
|
|
198
130
|
return /*#__PURE__*/function () {
|
|
199
|
-
var
|
|
131
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, provider) {
|
|
200
132
|
var contextIdentifierProvider;
|
|
201
|
-
return _regenerator.default.wrap(function
|
|
133
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
202
134
|
while (1) {
|
|
203
|
-
switch (
|
|
135
|
+
switch (_context3.prev = _context3.next) {
|
|
204
136
|
case 0:
|
|
205
137
|
if (!(name === 'contextIdentifierProvider' && provider)) {
|
|
206
|
-
|
|
138
|
+
_context3.next = 11;
|
|
207
139
|
break;
|
|
208
140
|
}
|
|
209
|
-
|
|
210
|
-
|
|
141
|
+
_context3.prev = 1;
|
|
142
|
+
_context3.next = 4;
|
|
211
143
|
return provider;
|
|
212
144
|
case 4:
|
|
213
|
-
contextIdentifierProvider =
|
|
145
|
+
contextIdentifierProvider = _context3.sent;
|
|
214
146
|
(0, _commands.updateState)({
|
|
215
147
|
contextIdentifierProvider: contextIdentifierProvider
|
|
216
148
|
})(view.state, view.dispatch);
|
|
217
|
-
|
|
149
|
+
_context3.next = 11;
|
|
218
150
|
break;
|
|
219
151
|
case 8:
|
|
220
|
-
|
|
221
|
-
|
|
152
|
+
_context3.prev = 8;
|
|
153
|
+
_context3.t0 = _context3["catch"](1);
|
|
222
154
|
(0, _commands.updateState)({
|
|
223
155
|
contextIdentifierProvider: undefined
|
|
224
156
|
})(view.state, view.dispatch);
|
|
225
157
|
case 11:
|
|
226
158
|
case "end":
|
|
227
|
-
return
|
|
159
|
+
return _context3.stop();
|
|
228
160
|
}
|
|
229
161
|
}
|
|
230
|
-
},
|
|
162
|
+
}, _callee3, null, [[1, 8]]);
|
|
231
163
|
}));
|
|
232
|
-
return function (
|
|
233
|
-
return
|
|
164
|
+
return function (_x6, _x7) {
|
|
165
|
+
return _ref3.apply(this, arguments);
|
|
234
166
|
};
|
|
235
167
|
}();
|
|
236
168
|
};
|
|
237
169
|
exports.createContextIdentifierProviderHandler = createContextIdentifierProviderHandler;
|
|
170
|
+
var handleUpdate = function handleUpdate(_ref4) {
|
|
171
|
+
var view = _ref4.view,
|
|
172
|
+
prevState = _ref4.prevState,
|
|
173
|
+
domAtPos = _ref4.domAtPos,
|
|
174
|
+
extensionHandlers = _ref4.extensionHandlers;
|
|
175
|
+
var state = view.state,
|
|
176
|
+
dispatch = view.dispatch;
|
|
177
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
178
|
+
element = _getPluginState.element,
|
|
179
|
+
localId = _getPluginState.localId,
|
|
180
|
+
extensionProvider = _getPluginState.extensionProvider,
|
|
181
|
+
showContextPanel = _getPluginState.showContextPanel,
|
|
182
|
+
showEditButton = _getPluginState.showEditButton;
|
|
183
|
+
|
|
184
|
+
// This fetches the selected extension node, either by keyboard selection or click for all types of extensions
|
|
185
|
+
var selectedExtension = (0, _utils2.getSelectedExtension)(state, true);
|
|
186
|
+
if (!selectedExtension) {
|
|
187
|
+
if (showContextPanel) {
|
|
188
|
+
(0, _commands.clearEditingContext)(state, dispatch);
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
var node = selectedExtension.node;
|
|
193
|
+
var newElement = (0, _utils2.getSelectedDomElement)(state.schema, domAtPos, selectedExtension);
|
|
194
|
+
|
|
195
|
+
// In some cases, showEditButton can be stale and the edit button doesn't show - @see ED-15285
|
|
196
|
+
// To be safe, we update the showEditButton state here
|
|
197
|
+
var shouldUpdateEditButton = !showEditButton && extensionProvider && element === newElement && !(0, _utils2.getSelectedExtension)(prevState, true);
|
|
198
|
+
var isNewNodeSelected = node.attrs.localId ? localId !== node.attrs.localId :
|
|
199
|
+
// This is the current assumption and it's wrong but we are keeping it
|
|
200
|
+
// as fallback in case we need to turn off `allowLocalIdGeneration`
|
|
201
|
+
element !== newElement;
|
|
202
|
+
if (isNewNodeSelected || shouldUpdateEditButton) {
|
|
203
|
+
if (showContextPanel) {
|
|
204
|
+
(0, _commands.clearEditingContext)(state, dispatch);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
var extensionType = node.attrs.extensionType;
|
|
208
|
+
var extensionHandler = extensionHandlers[extensionType];
|
|
209
|
+
|
|
210
|
+
// showEditButton might change async based on results from extension providers
|
|
211
|
+
var _showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
|
|
212
|
+
var updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(function () {
|
|
213
|
+
// do nothing;
|
|
214
|
+
});
|
|
215
|
+
(0, _commands.updateState)({
|
|
216
|
+
localId: node.attrs.localId,
|
|
217
|
+
showContextPanel: false,
|
|
218
|
+
element: newElement,
|
|
219
|
+
showEditButton: _showEditButton,
|
|
220
|
+
updateExtension: updateExtension
|
|
221
|
+
})(state, dispatch);
|
|
222
|
+
}
|
|
223
|
+
// New DOM element doesn't necessarily mean it's a new Node
|
|
224
|
+
else if (element !== newElement) {
|
|
225
|
+
(0, _commands.updateState)({
|
|
226
|
+
element: newElement
|
|
227
|
+
})(state, dispatch);
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
};
|
|
231
|
+
exports.handleUpdate = handleUpdate;
|
|
238
232
|
var createPlugin = function createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher) {
|
|
239
233
|
var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
240
234
|
var options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
|
|
@@ -254,67 +248,13 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
254
248
|
providerFactory.subscribe('extensionProvider', extensionProviderHandler);
|
|
255
249
|
providerFactory.subscribe('contextIdentificationProvider', contextIdentificationProviderHandler);
|
|
256
250
|
return {
|
|
257
|
-
update: function update(view) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
showContextPanel = _getPluginState.showContextPanel;
|
|
265
|
-
|
|
266
|
-
// This fetches the selected extension node, either by keyboard selection or click for all types of extensions
|
|
267
|
-
var selectedExtension = (0, _utils2.getSelectedExtension)(state, true);
|
|
268
|
-
if (!selectedExtension) {
|
|
269
|
-
if (showContextPanel) {
|
|
270
|
-
(0, _commands.clearEditingContext)(state, dispatch);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// if an extension is no longer selected, but the plugin has cached the previous selected extension id/ref
|
|
274
|
-
// then this should clear those values so that if an exention is selected again, then this sees it as a change
|
|
275
|
-
// and updates the state correctly.
|
|
276
|
-
if (!!localId || !!element) {
|
|
277
|
-
(0, _commands.updateState)({
|
|
278
|
-
localId: undefined,
|
|
279
|
-
element: undefined
|
|
280
|
-
})(state, dispatch);
|
|
281
|
-
}
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
var node = selectedExtension.node;
|
|
285
|
-
var newElement = (0, _utils2.getSelectedDomElement)(state.schema, domAtPos, selectedExtension);
|
|
286
|
-
|
|
287
|
-
// New node is selection
|
|
288
|
-
if (node.attrs.localId ? localId !== node.attrs.localId :
|
|
289
|
-
// This is the current assumption and it's wrong but we are keeping it
|
|
290
|
-
// as fallback in case we need to turn off `allowLocalIdGeneration`
|
|
291
|
-
element !== newElement) {
|
|
292
|
-
if (showContextPanel) {
|
|
293
|
-
(0, _commands.clearEditingContext)(state, dispatch);
|
|
294
|
-
}
|
|
295
|
-
var extensionType = node.attrs.extensionType;
|
|
296
|
-
var extensionHandler = extensionHandlers[extensionType];
|
|
297
|
-
|
|
298
|
-
// showEditButton might change async based on results from extension providers
|
|
299
|
-
var showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
|
|
300
|
-
var updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(function () {
|
|
301
|
-
// do nothing;
|
|
302
|
-
});
|
|
303
|
-
(0, _commands.updateState)({
|
|
304
|
-
localId: node.attrs.localId,
|
|
305
|
-
showContextPanel: false,
|
|
306
|
-
element: newElement,
|
|
307
|
-
showEditButton: showEditButton,
|
|
308
|
-
updateExtension: updateExtension
|
|
309
|
-
})(state, dispatch);
|
|
310
|
-
}
|
|
311
|
-
// New DOM element doesn't necessarily mean it's a new Node
|
|
312
|
-
else if (element !== newElement) {
|
|
313
|
-
(0, _commands.updateState)({
|
|
314
|
-
element: newElement
|
|
315
|
-
})(state, dispatch);
|
|
316
|
-
}
|
|
317
|
-
return true;
|
|
251
|
+
update: function update(view, prevState) {
|
|
252
|
+
handleUpdate({
|
|
253
|
+
view: view,
|
|
254
|
+
prevState: prevState,
|
|
255
|
+
domAtPos: domAtPos,
|
|
256
|
+
extensionHandlers: extensionHandlers
|
|
257
|
+
});
|
|
318
258
|
},
|
|
319
259
|
destroy: function destroy() {
|
|
320
260
|
providerFactory.unsubscribe('extensionProvider', extensionProviderHandler);
|