@atlaskit/editor-core 181.0.1 → 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 +40 -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/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/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/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/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/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/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/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 +12 -11
- 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
|
@@ -10,7 +10,8 @@ var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
|
|
|
10
10
|
var selected = props.isInviteToEditButtonSelected,
|
|
11
11
|
onClick = props.inviteToEditHandler,
|
|
12
12
|
Component = props.inviteToEditComponent,
|
|
13
|
-
editorView = props.editorView
|
|
13
|
+
editorView = props.editorView,
|
|
14
|
+
featureFlags = props.featureFlags;
|
|
14
15
|
var render = React.useCallback(function (_ref) {
|
|
15
16
|
var data = _ref.data;
|
|
16
17
|
if (!data) {
|
|
@@ -19,14 +20,15 @@ var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
|
|
|
19
20
|
return /*#__PURE__*/React.createElement(Avatars, {
|
|
20
21
|
sessionId: data.sessionId,
|
|
21
22
|
participants: data.activeParticipants,
|
|
22
|
-
editorView: editorView
|
|
23
|
+
editorView: editorView,
|
|
24
|
+
featureFlags: featureFlags
|
|
23
25
|
}, /*#__PURE__*/React.createElement(InviteToEditButton, {
|
|
24
26
|
title: title,
|
|
25
27
|
selected: selected,
|
|
26
28
|
onClick: onClick,
|
|
27
29
|
Component: Component
|
|
28
30
|
}));
|
|
29
|
-
}, [selected, onClick, Component, title, editorView]);
|
|
31
|
+
}, [selected, onClick, Component, title, editorView, featureFlags]);
|
|
30
32
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
31
33
|
plugins: {
|
|
32
34
|
data: collabEditPluginKey
|
|
@@ -5,10 +5,10 @@ import AvatarGroup from '@atlaskit/avatar-group';
|
|
|
5
5
|
import { avatarContainer } from './styles';
|
|
6
6
|
import toAvatar from './to-avatar';
|
|
7
7
|
import { scrollToCollabCursor } from '../utils';
|
|
8
|
-
import { getFeatureFlags } from '../../feature-flags-context';
|
|
9
8
|
export var Avatars = /*#__PURE__*/React.memo(function (props) {
|
|
10
9
|
var sessionId = props.sessionId,
|
|
11
|
-
editorView = props.editorView
|
|
10
|
+
editorView = props.editorView,
|
|
11
|
+
featureFlags = props.featureFlags;
|
|
12
12
|
var participants = props.participants.toArray();
|
|
13
13
|
var avatars = participants.sort(function (p) {
|
|
14
14
|
return p.sessionId === sessionId ? -1 : 1;
|
|
@@ -27,7 +27,6 @@ export var Avatars = /*#__PURE__*/React.memo(function (props) {
|
|
|
27
27
|
if (!editorView) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
var featureFlags = getFeatureFlags(editorView.state);
|
|
31
30
|
var allowCollabAvatarScroll = featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.collabAvatarScroll;
|
|
32
31
|
|
|
33
32
|
// user does not need to scroll to their own position (index 0)
|
|
@@ -2,15 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
3
3
|
import Loadable from 'react-loadable';
|
|
4
4
|
import { date } from '@atlaskit/adf-schema';
|
|
5
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
6
5
|
import { insertDate, closeDatePicker as _closeDatePicker, closeDatePickerWithAnalytics as _closeDatePickerWithAnalytics, createDate, deleteDate } from './actions';
|
|
7
6
|
import createDatePlugin from './pm-plugins/main';
|
|
8
7
|
import keymap from './pm-plugins/keymap';
|
|
9
|
-
import { pluginKey as editorDisabledPluginKey } from '../editor-disabled';
|
|
10
8
|
import { IconDate } from '../quick-insert/assets';
|
|
11
9
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
|
|
12
10
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
13
11
|
import { pluginKey as datePluginKey } from './pm-plugins/plugin-key';
|
|
12
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
14
13
|
var DatePicker = Loadable({
|
|
15
14
|
loader: function loader() {
|
|
16
15
|
return import( /* webpackChunkName: "@atlaskit-internal_editor-datepicker" */'./ui/DatePicker').then(function (mod) {
|
|
@@ -21,9 +20,84 @@ var DatePicker = Loadable({
|
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
|
-
|
|
23
|
+
function ContentComponent(_ref) {
|
|
24
|
+
var editorView = _ref.editorView,
|
|
25
|
+
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
26
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
27
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
28
|
+
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
29
|
+
dependencyApi = _ref.dependencyApi;
|
|
30
|
+
var dispatch = editorView.dispatch;
|
|
31
|
+
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
32
|
+
var _useSharedPluginState = useSharedPluginState(dependencyApi, ['date', 'editorDisabled']),
|
|
33
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
34
|
+
dateState = _useSharedPluginState.dateState;
|
|
35
|
+
if (!(dateState !== null && dateState !== void 0 && dateState.showDatePickerAt) || editorDisabledState !== null && editorDisabledState !== void 0 && editorDisabledState.editorDisabled) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
var showDatePickerAt = dateState.showDatePickerAt,
|
|
39
|
+
isNew = dateState.isNew,
|
|
40
|
+
focusDateInput = dateState.focusDateInput;
|
|
41
|
+
var element = findDomRefAtPos(showDatePickerAt, domAtPos);
|
|
42
|
+
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
43
|
+
mountTo: popupsMountPoint,
|
|
44
|
+
boundariesElement: popupsBoundariesElement,
|
|
45
|
+
scrollableElement: popupsScrollableElement,
|
|
46
|
+
key: showDatePickerAt,
|
|
47
|
+
element: element,
|
|
48
|
+
isNew: isNew,
|
|
49
|
+
autoFocus: focusDateInput,
|
|
50
|
+
onDelete: function onDelete() {
|
|
51
|
+
deleteDate()(editorView.state, dispatch);
|
|
52
|
+
editorView.focus();
|
|
53
|
+
return;
|
|
54
|
+
},
|
|
55
|
+
onSelect: function onSelect(date, commitMethod) {
|
|
56
|
+
// Undefined means couldn't parse date, null means invalid (out of bounds) date
|
|
57
|
+
if (date === undefined || date === null) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
insertDate(date, undefined, commitMethod)(editorView.state, dispatch);
|
|
61
|
+
editorView.focus();
|
|
62
|
+
},
|
|
63
|
+
onTextChanged: function onTextChanged(date) {
|
|
64
|
+
insertDate(date, undefined, undefined, false)(editorView.state, dispatch);
|
|
65
|
+
},
|
|
66
|
+
closeDatePicker: function closeDatePicker() {
|
|
67
|
+
_closeDatePicker()(editorView.state, dispatch);
|
|
68
|
+
editorView.focus();
|
|
69
|
+
},
|
|
70
|
+
closeDatePickerWithAnalytics: function closeDatePickerWithAnalytics(_ref2) {
|
|
71
|
+
var date = _ref2.date;
|
|
72
|
+
_closeDatePickerWithAnalytics({
|
|
73
|
+
date: date
|
|
74
|
+
})(editorView.state, dispatch);
|
|
75
|
+
editorView.focus();
|
|
76
|
+
},
|
|
77
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
var datePlugin = function datePlugin(_, api) {
|
|
25
81
|
return {
|
|
26
82
|
name: 'date',
|
|
83
|
+
getSharedState: function getSharedState(editorState) {
|
|
84
|
+
if (!editorState) {
|
|
85
|
+
return {
|
|
86
|
+
showDatePickerAt: null,
|
|
87
|
+
isNew: false,
|
|
88
|
+
focusDateInput: false
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
var _datePluginKey$getSta = datePluginKey.getState(editorState),
|
|
92
|
+
showDatePickerAt = _datePluginKey$getSta.showDatePickerAt,
|
|
93
|
+
isNew = _datePluginKey$getSta.isNew,
|
|
94
|
+
focusDateInput = _datePluginKey$getSta.focusDateInput;
|
|
95
|
+
return {
|
|
96
|
+
showDatePickerAt: showDatePickerAt,
|
|
97
|
+
isNew: isNew,
|
|
98
|
+
focusDateInput: focusDateInput
|
|
99
|
+
};
|
|
100
|
+
},
|
|
27
101
|
nodes: function nodes() {
|
|
28
102
|
return [{
|
|
29
103
|
name: 'date',
|
|
@@ -45,67 +119,19 @@ var datePlugin = function datePlugin() {
|
|
|
45
119
|
}
|
|
46
120
|
}];
|
|
47
121
|
},
|
|
48
|
-
contentComponent: function contentComponent(
|
|
49
|
-
var editorView =
|
|
50
|
-
dispatchAnalyticsEvent =
|
|
51
|
-
popupsMountPoint =
|
|
52
|
-
popupsBoundariesElement =
|
|
53
|
-
popupsScrollableElement =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
render: function render(_ref2) {
|
|
62
|
-
var editorDisabledPlugin = _ref2.editorDisabledPlugin,
|
|
63
|
-
datePlugin = _ref2.datePlugin;
|
|
64
|
-
if (!(datePlugin !== null && datePlugin !== void 0 && datePlugin.showDatePickerAt) || editorDisabledPlugin !== null && editorDisabledPlugin !== void 0 && editorDisabledPlugin.editorDisabled) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
var showDatePickerAt = datePlugin.showDatePickerAt,
|
|
68
|
-
isNew = datePlugin.isNew,
|
|
69
|
-
focusDateInput = datePlugin.focusDateInput;
|
|
70
|
-
var element = findDomRefAtPos(showDatePickerAt, domAtPos);
|
|
71
|
-
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
72
|
-
mountTo: popupsMountPoint,
|
|
73
|
-
boundariesElement: popupsBoundariesElement,
|
|
74
|
-
scrollableElement: popupsScrollableElement,
|
|
75
|
-
key: showDatePickerAt,
|
|
76
|
-
element: element,
|
|
77
|
-
isNew: isNew,
|
|
78
|
-
autoFocus: focusDateInput,
|
|
79
|
-
onDelete: function onDelete() {
|
|
80
|
-
deleteDate()(editorView.state, dispatch);
|
|
81
|
-
editorView.focus();
|
|
82
|
-
return;
|
|
83
|
-
},
|
|
84
|
-
onSelect: function onSelect(date, commitMethod) {
|
|
85
|
-
// Undefined means couldn't parse date, null means invalid (out of bounds) date
|
|
86
|
-
if (date === undefined || date === null) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
insertDate(date, undefined, commitMethod)(editorView.state, dispatch);
|
|
90
|
-
editorView.focus();
|
|
91
|
-
},
|
|
92
|
-
onTextChanged: function onTextChanged(date) {
|
|
93
|
-
insertDate(date, undefined, undefined, false)(editorView.state, dispatch);
|
|
94
|
-
},
|
|
95
|
-
closeDatePicker: function closeDatePicker() {
|
|
96
|
-
_closeDatePicker()(editorView.state, dispatch);
|
|
97
|
-
editorView.focus();
|
|
98
|
-
},
|
|
99
|
-
closeDatePickerWithAnalytics: function closeDatePickerWithAnalytics(_ref3) {
|
|
100
|
-
var date = _ref3.date;
|
|
101
|
-
_closeDatePickerWithAnalytics({
|
|
102
|
-
date: date
|
|
103
|
-
})(editorView.state, dispatch);
|
|
104
|
-
editorView.focus();
|
|
105
|
-
},
|
|
106
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
107
|
-
});
|
|
108
|
-
}
|
|
122
|
+
contentComponent: function contentComponent(_ref3) {
|
|
123
|
+
var editorView = _ref3.editorView,
|
|
124
|
+
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
125
|
+
popupsMountPoint = _ref3.popupsMountPoint,
|
|
126
|
+
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
127
|
+
popupsScrollableElement = _ref3.popupsScrollableElement;
|
|
128
|
+
return /*#__PURE__*/React.createElement(ContentComponent, {
|
|
129
|
+
dependencyApi: api,
|
|
130
|
+
editorView: editorView,
|
|
131
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
132
|
+
popupsMountPoint: popupsMountPoint,
|
|
133
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
134
|
+
popupsScrollableElement: popupsScrollableElement
|
|
109
135
|
});
|
|
110
136
|
},
|
|
111
137
|
pluginsOptions: {
|
|
@@ -38,6 +38,14 @@ export function createPlugin(dispatch) {
|
|
|
38
38
|
var editorDisabledPlugin = function editorDisabledPlugin() {
|
|
39
39
|
return {
|
|
40
40
|
name: 'editorDisabled',
|
|
41
|
+
getSharedState: function getSharedState(editorState) {
|
|
42
|
+
if (!editorState) {
|
|
43
|
+
return {
|
|
44
|
+
editorDisabled: false
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return pluginKey.getState(editorState);
|
|
48
|
+
},
|
|
41
49
|
pmPlugins: function pmPlugins() {
|
|
42
50
|
return [{
|
|
43
51
|
name: 'editorDisabled',
|
|
@@ -9,7 +9,10 @@ import { getToolbarConfig } from './toolbar';
|
|
|
9
9
|
import { createExpandNode } from './commands';
|
|
10
10
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
11
11
|
var expandPlugin = function expandPlugin() {
|
|
12
|
+
var _api$dependencies, _api$dependencies$fea;
|
|
12
13
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
14
|
+
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
15
|
+
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()) || {};
|
|
13
16
|
return {
|
|
14
17
|
name: 'expand',
|
|
15
18
|
nodes: function nodes() {
|
|
@@ -27,7 +30,7 @@ var expandPlugin = function expandPlugin() {
|
|
|
27
30
|
plugin: function plugin(_ref) {
|
|
28
31
|
var dispatch = _ref.dispatch,
|
|
29
32
|
getIntl = _ref.getIntl;
|
|
30
|
-
return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection);
|
|
33
|
+
return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, featureFlags);
|
|
31
34
|
}
|
|
32
35
|
}, {
|
|
33
36
|
name: 'expandKeymap',
|
|
@@ -12,7 +12,6 @@ import { isEmptyNode } from '../../../utils';
|
|
|
12
12
|
import { updateExpandTitle, toggleExpandExpanded, deleteExpandAtPos, setSelectionInsideExpand } from '../commands';
|
|
13
13
|
import { expandClassNames } from '../ui/class-names';
|
|
14
14
|
import { GapCursorSelection, Side } from '../../../plugins/selection/gap-cursor-selection';
|
|
15
|
-
import { getFeatureFlags } from '../../feature-flags-context';
|
|
16
15
|
import { closestElement } from '../../../utils/dom';
|
|
17
16
|
import { RelativeSelectionPos } from '../../selection/types';
|
|
18
17
|
import { setSelectionRelativeToNode } from '../../selection/commands';
|
|
@@ -54,7 +53,7 @@ var toDOM = function toDOM(node, intl) {
|
|
|
54
53
|
}, 0]];
|
|
55
54
|
};
|
|
56
55
|
export var ExpandNodeView = /*#__PURE__*/function () {
|
|
57
|
-
function ExpandNodeView(node, view, getPos, getIntl, isMobile) {
|
|
56
|
+
function ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags) {
|
|
58
57
|
var _this = this;
|
|
59
58
|
_classCallCheck(this, ExpandNodeView);
|
|
60
59
|
_defineProperty(this, "allowInteractiveExpand", true);
|
|
@@ -82,9 +81,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
82
81
|
}
|
|
83
82
|
});
|
|
84
83
|
_defineProperty(this, "isAllowInteractiveExpandEnabled", function () {
|
|
85
|
-
|
|
86
|
-
var featureFlags = getFeatureFlags(state);
|
|
87
|
-
return featureFlags && !!featureFlags.interactiveExpand;
|
|
84
|
+
return _this.featureFlags && !!_this.featureFlags.interactiveExpand;
|
|
88
85
|
});
|
|
89
86
|
_defineProperty(this, "handleClick", function (event) {
|
|
90
87
|
var target = event.target;
|
|
@@ -286,6 +283,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
286
283
|
this.dom = dom;
|
|
287
284
|
this.contentDOM = contentDOM;
|
|
288
285
|
this.isMobile = isMobile;
|
|
286
|
+
this.featureFlags = featureFlags;
|
|
289
287
|
this.icon = this.dom.querySelector(".".concat(expandClassNames.icon));
|
|
290
288
|
this.input = this.dom.querySelector(".".concat(expandClassNames.titleInput));
|
|
291
289
|
this.titleContainer = this.dom.querySelector(".".concat(expandClassNames.titleContainer));
|
|
@@ -405,8 +403,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
405
403
|
}();
|
|
406
404
|
export default function (_ref2) {
|
|
407
405
|
var getIntl = _ref2.getIntl,
|
|
408
|
-
isMobile = _ref2.isMobile
|
|
406
|
+
isMobile = _ref2.isMobile,
|
|
407
|
+
featureFlags = _ref2.featureFlags;
|
|
409
408
|
return function (node, view, getPos) {
|
|
410
|
-
return new ExpandNodeView(node, view, getPos, getIntl, isMobile);
|
|
409
|
+
return new ExpandNodeView(node, view, getPos, getIntl, isMobile, featureFlags);
|
|
411
410
|
};
|
|
412
411
|
}
|
|
@@ -13,6 +13,7 @@ export function containsClass(element, className) {
|
|
|
13
13
|
export var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
14
14
|
var appearance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'full-page';
|
|
15
15
|
var useLongPressSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
16
|
+
var featureFlags = arguments.length > 4 ? arguments[4] : undefined;
|
|
16
17
|
var state = createPluginState(dispatch, {});
|
|
17
18
|
var isMobile = appearance === 'mobile';
|
|
18
19
|
return new SafePlugin({
|
|
@@ -22,11 +23,13 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
22
23
|
nodeViews: {
|
|
23
24
|
expand: ExpandNodeView({
|
|
24
25
|
getIntl: getIntl,
|
|
25
|
-
isMobile: isMobile
|
|
26
|
+
isMobile: isMobile,
|
|
27
|
+
featureFlags: featureFlags
|
|
26
28
|
}),
|
|
27
29
|
nestedExpand: ExpandNodeView({
|
|
28
30
|
getIntl: getIntl,
|
|
29
|
-
isMobile: isMobile
|
|
31
|
+
isMobile: isMobile,
|
|
32
|
+
featureFlags: featureFlags
|
|
30
33
|
})
|
|
31
34
|
},
|
|
32
35
|
handleKeyDown: function handleKeyDown(_view, event) {
|
|
@@ -2,13 +2,13 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import { validator } from '@atlaskit/adf-utils/validator';
|
|
3
3
|
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
import { Fragment, Mark } from 'prosemirror-model';
|
|
5
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
5
|
+
import { NodeSelection, Selection } from 'prosemirror-state';
|
|
6
6
|
import { insertMacroFromMacroBrowser } from '../macro';
|
|
7
7
|
import { pluginKey as macroPluginKey } from '../macro/plugin-key';
|
|
8
|
+
import { nodeToJSON } from '../../utils';
|
|
8
9
|
import { setEditingContextToContextPanel } from './commands';
|
|
9
|
-
import { findNodePosWithLocalId, getSelectedExtension } from './utils';
|
|
10
|
+
import { findNodePosWithLocalId, getDataConsumerMark, getNodeTypesReferenced, getSelectedExtension } from './utils';
|
|
10
11
|
import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '../analytics';
|
|
11
|
-
import { getNodeTypesReferenced, getDataConsumerMark } from './utils';
|
|
12
12
|
import { setTextSelection } from 'prosemirror-utils';
|
|
13
13
|
export var getEditInLegacyMacroBrowser = function getEditInLegacyMacroBrowser(_ref) {
|
|
14
14
|
var view = _ref.view,
|
|
@@ -39,7 +39,12 @@ var extensionAPICallPayload = function extensionAPICallPayload(functionName) {
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
export var createExtensionAPI = function createExtensionAPI(options) {
|
|
42
|
-
var
|
|
42
|
+
var schema = options.editorView.state.schema;
|
|
43
|
+
var nodes = Object.keys(schema.nodes);
|
|
44
|
+
var marks = Object.keys(schema.marks);
|
|
45
|
+
var validate = validator(nodes, marks, {
|
|
46
|
+
allowPrivateAttributes: true
|
|
47
|
+
});
|
|
43
48
|
|
|
44
49
|
/**
|
|
45
50
|
* Finds the node and its position by `localId`. Throws if the node could not be found.
|
|
@@ -172,6 +177,7 @@ export var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
172
177
|
var tr = state.tr,
|
|
173
178
|
schema = state.schema;
|
|
174
179
|
var changedValues = mutationCallback({
|
|
180
|
+
content: nodeToJSON(node).content,
|
|
175
181
|
attrs: node.attrs,
|
|
176
182
|
marks: node.marks.map(function (pmMark) {
|
|
177
183
|
return {
|
|
@@ -180,13 +186,12 @@ export var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
180
186
|
};
|
|
181
187
|
})
|
|
182
188
|
});
|
|
183
|
-
var _state$doc$resolve = state.doc.resolve(pos),
|
|
184
|
-
parent = _state$doc$resolve.parent;
|
|
185
189
|
var ensureValidMark = function ensureValidMark(mark) {
|
|
186
190
|
if (_typeof(mark) !== 'object' || Array.isArray(mark)) {
|
|
187
191
|
throw new Error("update(): Invalid mark given.");
|
|
188
192
|
}
|
|
189
|
-
|
|
193
|
+
var _state$doc$resolve = state.doc.resolve(pos),
|
|
194
|
+
parent = _state$doc$resolve.parent;
|
|
190
195
|
// Ensure that the given mark is present in the schema
|
|
191
196
|
var markType = schema.marks[mark.type];
|
|
192
197
|
if (!markType) {
|
|
@@ -200,21 +205,28 @@ export var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
200
205
|
attrs: mark.attrs
|
|
201
206
|
};
|
|
202
207
|
};
|
|
203
|
-
var newMarks = (_changedValues$marks = changedValues.marks) === null || _changedValues$marks === void 0 ? void 0 : _changedValues$marks.map(ensureValidMark).map(function (_ref3) {
|
|
208
|
+
var newMarks = changedValues.hasOwnProperty('marks') ? (_changedValues$marks = changedValues.marks) === null || _changedValues$marks === void 0 ? void 0 : _changedValues$marks.map(ensureValidMark).map(function (_ref3) {
|
|
204
209
|
var mark = _ref3.mark,
|
|
205
210
|
attrs = _ref3.attrs;
|
|
206
211
|
return mark.create(attrs);
|
|
207
|
-
});
|
|
212
|
+
}) : node.marks;
|
|
213
|
+
var newContent = changedValues.hasOwnProperty('content') ? Fragment.fromJSON(schema, changedValues.content) : node.content;
|
|
214
|
+
var newAttrs = changedValues.hasOwnProperty('attrs') ? changedValues.attrs : node.attrs;
|
|
208
215
|
|
|
209
|
-
// Validate if the new attributes and marks result in a valid node and adf.
|
|
216
|
+
// Validate if the new attributes, content and marks result in a valid node and adf.
|
|
210
217
|
try {
|
|
211
|
-
var newNode = node.type.createChecked(
|
|
218
|
+
var newNode = node.type.createChecked(newAttrs, newContent, newMarks);
|
|
212
219
|
var newNodeAdf = new JSONTransformer().encodeNode(newNode);
|
|
213
220
|
validate(newNodeAdf);
|
|
221
|
+
tr.replaceWith(pos, pos + node.nodeSize, newNode);
|
|
222
|
+
|
|
223
|
+
// Keep selection if content does not change
|
|
224
|
+
if (newContent === node.content) {
|
|
225
|
+
tr.setSelection(Selection.fromJSON(tr.doc, state.selection.toJSON()));
|
|
226
|
+
}
|
|
214
227
|
} catch (err) {
|
|
215
228
|
throw new Error("update(): The given ADFEntity cannot be inserted in the current position.\n".concat(err));
|
|
216
229
|
}
|
|
217
|
-
tr.setNodeMarkup(pos, undefined, changedValues.attrs, newMarks);
|
|
218
230
|
|
|
219
231
|
// Analytics - tracking the api call
|
|
220
232
|
var apiCallPayload = extensionAPICallPayload('update');
|