@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
|
@@ -18,7 +18,8 @@ var _assets = require("../quick-insert/assets");
|
|
|
18
18
|
Toolbar buttons to bullet and ordered list can be found in
|
|
19
19
|
packages/editor/editor-core/src/plugins/toolbar-lists-indentation/ui/Toolbar.tsx
|
|
20
20
|
*/
|
|
21
|
-
var listPlugin = function listPlugin(options) {
|
|
21
|
+
var listPlugin = function listPlugin(options, api) {
|
|
22
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : api.dependencies.featureFlags.sharedState.currentState()) || {};
|
|
22
23
|
return {
|
|
23
24
|
name: 'list',
|
|
24
25
|
nodes: function nodes() {
|
|
@@ -38,7 +39,7 @@ var listPlugin = function listPlugin(options) {
|
|
|
38
39
|
name: 'list',
|
|
39
40
|
plugin: function plugin(_ref) {
|
|
40
41
|
var dispatch = _ref.dispatch;
|
|
41
|
-
return (0, _main.createPlugin)(dispatch);
|
|
42
|
+
return (0, _main.createPlugin)(dispatch, featureFlags);
|
|
42
43
|
}
|
|
43
44
|
}, {
|
|
44
45
|
name: 'listInputRule',
|
|
@@ -50,7 +51,7 @@ var listPlugin = function listPlugin(options) {
|
|
|
50
51
|
}, {
|
|
51
52
|
name: 'listKeymap',
|
|
52
53
|
plugin: function plugin() {
|
|
53
|
-
return (0, _keymap.default)();
|
|
54
|
+
return (0, _keymap.default)(featureFlags);
|
|
54
55
|
}
|
|
55
56
|
}];
|
|
56
57
|
},
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createRuleForListType = createRuleForListType;
|
|
7
7
|
var _inputRules = require("../../../../utils/input-rules");
|
|
8
|
+
var _wrappingJoinRule = require("./wrapping-join-rule");
|
|
8
9
|
var _analytics = require("../../../analytics");
|
|
9
10
|
var _analytics2 = require("@atlaskit/editor-common/analytics");
|
|
10
11
|
var getOrder = function getOrder(matchResult) {
|
|
@@ -50,7 +51,8 @@ function createRuleForListType(_ref) {
|
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
var inputRule = (0,
|
|
54
|
+
var inputRule = (0, _wrappingJoinRule.createWrappingJoinRule)({
|
|
55
|
+
featureFlags: featureFlags,
|
|
54
56
|
match: expression,
|
|
55
57
|
nodeType: listType,
|
|
56
58
|
getAttrs: getAttrs,
|
|
@@ -17,7 +17,8 @@ function inputRulePlugin(schema, featureFlags) {
|
|
|
17
17
|
// because of issue where product converted the
|
|
18
18
|
// character into an escaped version.
|
|
19
19
|
expression: /^\s*([\*\-\u2022]) $/,
|
|
20
|
-
listType: bulletList
|
|
20
|
+
listType: bulletList,
|
|
21
|
+
featureFlags: featureFlags
|
|
21
22
|
}));
|
|
22
23
|
}
|
|
23
24
|
var expression = featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists ? /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/ : /^(1)[\.\)] $/;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createWrappingJoinRule = void 0;
|
|
7
|
+
var _prosemirrorTransform = require("prosemirror-transform");
|
|
8
|
+
var _prosemirrorUtils = require("prosemirror-utils");
|
|
9
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var _inputRules = require("../../../../utils/input-rules");
|
|
11
|
+
var createWrappingJoinRule = function createWrappingJoinRule(_ref) {
|
|
12
|
+
var match = _ref.match,
|
|
13
|
+
nodeType = _ref.nodeType,
|
|
14
|
+
getAttrs = _ref.getAttrs,
|
|
15
|
+
joinPredicate = _ref.joinPredicate,
|
|
16
|
+
featureFlags = _ref.featureFlags;
|
|
17
|
+
var handler = function handler(state, match, start, end) {
|
|
18
|
+
var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
19
|
+
var tr = state.tr;
|
|
20
|
+
var fixedStart = Math.max(start, 1);
|
|
21
|
+
tr.delete(fixedStart, end);
|
|
22
|
+
var $start = tr.doc.resolve(fixedStart);
|
|
23
|
+
var range = $start.blockRange();
|
|
24
|
+
var wrapping = range && (0, _prosemirrorTransform.findWrapping)(range, nodeType, attrs);
|
|
25
|
+
if (!wrapping || !range) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
var parentNodePosMapped = tr.mapping.map(range.start);
|
|
29
|
+
var parentNode = tr.doc.nodeAt(parentNodePosMapped);
|
|
30
|
+
var lastWrap = wrapping[wrapping.length - 1];
|
|
31
|
+
if (parentNode && lastWrap) {
|
|
32
|
+
var allowedMarks = lastWrap.type.allowedMarks(parentNode.marks) || [];
|
|
33
|
+
tr.setNodeMarkup(parentNodePosMapped, parentNode.type, parentNode.attrs, allowedMarks);
|
|
34
|
+
}
|
|
35
|
+
tr.wrap(range, wrapping);
|
|
36
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && nodeType === state.schema.nodes.orderedList) {
|
|
37
|
+
// if an orderedList node would be inserted by the input rule match, and
|
|
38
|
+
// that orderedList node is being added directly before another orderedList
|
|
39
|
+
// node, then join those nodes
|
|
40
|
+
var $end = tr.doc.resolve(tr.mapping.map(end));
|
|
41
|
+
var _node = (0, _prosemirrorUtils.findParentNodeOfTypeClosestToPos)($end, nodeType);
|
|
42
|
+
if (_node) {
|
|
43
|
+
var nodeEnd = _node.pos + _node.node.nodeSize;
|
|
44
|
+
var after = tr.doc.resolve(nodeEnd).nodeAfter;
|
|
45
|
+
if (after && after.type === nodeType && (0, _prosemirrorTransform.canJoin)(tr.doc, nodeEnd) && (!joinPredicate || joinPredicate(match, after, _analytics.JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_BELOW))) {
|
|
46
|
+
tr.join(nodeEnd);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var before = tr.doc.resolve(fixedStart - 1).nodeBefore;
|
|
51
|
+
if (before && before.type === nodeType && (0, _prosemirrorTransform.canJoin)(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before, _analytics.JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_ABOVE))) {
|
|
52
|
+
tr.join(fixedStart - 1);
|
|
53
|
+
}
|
|
54
|
+
return tr;
|
|
55
|
+
};
|
|
56
|
+
return (0, _inputRules.createRule)(match, handler);
|
|
57
|
+
};
|
|
58
|
+
exports.createWrappingJoinRule = createWrappingJoinRule;
|
|
@@ -13,14 +13,14 @@ var _outdentList = require("../commands/outdent-list");
|
|
|
13
13
|
var _analytics = require("../../analytics");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function keymapPlugin() {
|
|
16
|
+
function keymapPlugin(featureFlags) {
|
|
17
17
|
var list = {};
|
|
18
18
|
keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.toggleOrderedList), (0, _commands.toggleList)(_analytics.INPUT_METHOD.KEYBOARD, 'orderedList'), list);
|
|
19
19
|
keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.toggleBulletList), (0, _commands.toggleList)(_analytics.INPUT_METHOD.KEYBOARD, 'bulletList'), list);
|
|
20
20
|
keymaps.bindKeymapWithCommand(keymaps.indentList.common, (0, _commands.indentList)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
21
|
-
keymaps.bindKeymapWithCommand(keymaps.outdentList.common, (0, _outdentList.outdentList)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
22
|
-
keymaps.bindKeymapWithCommand(keymaps.enter.common, _commands.enterKeyCommand, list);
|
|
23
|
-
keymaps.bindKeymapWithCommand(keymaps.backspace.common, _commands.backspaceKeyCommand, list);
|
|
21
|
+
keymaps.bindKeymapWithCommand(keymaps.outdentList.common, (0, _outdentList.outdentList)(_analytics.INPUT_METHOD.KEYBOARD, featureFlags), list);
|
|
22
|
+
keymaps.bindKeymapWithCommand(keymaps.enter.common, (0, _commands.enterKeyCommand)(featureFlags), list);
|
|
23
|
+
keymaps.bindKeymapWithCommand(keymaps.backspace.common, (0, _commands.backspaceKeyCommand)(featureFlags), list);
|
|
24
24
|
keymaps.bindKeymapWithCommand(keymaps.deleteKey.common, _commands.deleteKeyCommand, list);
|
|
25
25
|
|
|
26
26
|
// This shortcut is Mac only
|
|
@@ -17,7 +17,6 @@ var _utils = require("../../../utils");
|
|
|
17
17
|
var _gapCursorSelection = require("../../selection/gap-cursor-selection");
|
|
18
18
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
19
19
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
20
|
-
var _featureFlagsContext = require("../../feature-flags-context");
|
|
21
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
22
|
var listPluginKey = new _prosemirrorState.PluginKey('listPlugin');
|
|
@@ -30,9 +29,8 @@ var initialState = {
|
|
|
30
29
|
orderedListDisabled: false,
|
|
31
30
|
decorationSet: _prosemirrorView.DecorationSet.empty
|
|
32
31
|
};
|
|
33
|
-
var getDecorations = function getDecorations(doc, state) {
|
|
32
|
+
var getDecorations = function getDecorations(doc, state, featureFlags) {
|
|
34
33
|
var decorations = [];
|
|
35
|
-
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(state);
|
|
36
34
|
|
|
37
35
|
// this stack keeps track of each (nested) list to calculate the indentation level
|
|
38
36
|
var processedListsStack = [];
|
|
@@ -86,12 +84,14 @@ var getDecorations = function getDecorations(doc, state) {
|
|
|
86
84
|
return _prosemirrorView.DecorationSet.empty.add(doc, decorations);
|
|
87
85
|
};
|
|
88
86
|
exports.getDecorations = getDecorations;
|
|
89
|
-
var handleDocChanged = function handleDocChanged(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
var handleDocChanged = function handleDocChanged(featureFlags) {
|
|
88
|
+
return function (tr, pluginState, editorState) {
|
|
89
|
+
var nextPluginState = handleSelectionChanged(tr, pluginState);
|
|
90
|
+
var decorationSet = getDecorations(tr.doc, editorState, featureFlags);
|
|
91
|
+
return _objectSpread(_objectSpread({}, nextPluginState), {}, {
|
|
92
|
+
decorationSet: decorationSet
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
95
|
};
|
|
96
96
|
var handleSelectionChanged = function handleSelectionChanged(tr, pluginState) {
|
|
97
97
|
var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
|
|
@@ -118,20 +118,22 @@ var reducer = function reducer() {
|
|
|
118
118
|
return state;
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var createInitialState = function createInitialState(state) {
|
|
128
|
-
return _objectSpread(_objectSpread({}, initialState), {}, {
|
|
129
|
-
decorationSet: getDecorations(state.doc, state)
|
|
130
|
-
});
|
|
121
|
+
var createInitialState = function createInitialState(featureFlags) {
|
|
122
|
+
return function (state) {
|
|
123
|
+
return _objectSpread(_objectSpread({}, initialState), {}, {
|
|
124
|
+
decorationSet: getDecorations(state.doc, state, featureFlags)
|
|
125
|
+
});
|
|
126
|
+
};
|
|
131
127
|
};
|
|
132
|
-
var createPlugin = function createPlugin(eventDispatch) {
|
|
128
|
+
var createPlugin = function createPlugin(eventDispatch, featureFlags) {
|
|
129
|
+
var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(listPluginKey, reducer(), {
|
|
130
|
+
onDocChanged: handleDocChanged(featureFlags),
|
|
131
|
+
onSelectionChanged: handleSelectionChanged
|
|
132
|
+
}),
|
|
133
|
+
getPluginState = _pluginFactory.getPluginState,
|
|
134
|
+
createPluginState = _pluginFactory.createPluginState;
|
|
133
135
|
return new _safePlugin.SafePlugin({
|
|
134
|
-
state: createPluginState(eventDispatch, createInitialState),
|
|
136
|
+
state: createPluginState(eventDispatch, createInitialState(featureFlags)),
|
|
135
137
|
key: listPluginKey,
|
|
136
138
|
props: {
|
|
137
139
|
decorations: function decorations(state) {
|
|
@@ -168,6 +168,9 @@ var MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
168
168
|
isLoading = _this$props.isLoading,
|
|
169
169
|
maxDimensions = _this$props.maxDimensions,
|
|
170
170
|
mediaOptions = _this$props.mediaOptions;
|
|
171
|
+
var borderMark = node.marks.find(function (m) {
|
|
172
|
+
return m.type.name === 'border';
|
|
173
|
+
});
|
|
171
174
|
var _this$state = this.state,
|
|
172
175
|
viewMediaClientConfig = _this$state.viewMediaClientConfig,
|
|
173
176
|
contextIdentifierProvider = _this$state.contextIdentifierProvider;
|
|
@@ -203,7 +206,9 @@ var MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
203
206
|
};
|
|
204
207
|
return /*#__PURE__*/_react.default.createElement(_styles.MediaCardWrapper, {
|
|
205
208
|
dimensions: originalDimensions,
|
|
206
|
-
onContextMenu: this.selectMediaSingle
|
|
209
|
+
onContextMenu: this.selectMediaSingle,
|
|
210
|
+
borderWidth: borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size,
|
|
211
|
+
selected: selected
|
|
207
212
|
}, /*#__PURE__*/_react.default.createElement(_mediaCard.Card, {
|
|
208
213
|
mediaClientConfig: mediaClientConfig,
|
|
209
214
|
resizeMode: "stretchy-fit",
|
|
@@ -20,8 +20,20 @@ var forcedDimensions = (0, _react2.css)(_templateObject3 || (_templateObject3 =
|
|
|
20
20
|
var MediaCardWrapper = function MediaCardWrapper(_ref) {
|
|
21
21
|
var dimensions = _ref.dimensions,
|
|
22
22
|
children = _ref.children,
|
|
23
|
+
selected = _ref.selected,
|
|
24
|
+
_ref$borderWidth = _ref.borderWidth,
|
|
25
|
+
borderWidth = _ref$borderWidth === void 0 ? 0 : _ref$borderWidth,
|
|
23
26
|
onContextMenu = _ref.onContextMenu;
|
|
27
|
+
var calculatedBorderWidth = selected && borderWidth > 0 ? borderWidth + 1 : borderWidth;
|
|
24
28
|
return (0, _react2.jsx)("div", {
|
|
29
|
+
"data-testid": "media-card-wrapper",
|
|
30
|
+
style: {
|
|
31
|
+
borderColor: "var(--custom-palette-color)",
|
|
32
|
+
borderWidth: "".concat(calculatedBorderWidth, "px"),
|
|
33
|
+
borderStyle: 'solid',
|
|
34
|
+
borderRadius: "".concat(calculatedBorderWidth * 2, "px")
|
|
35
|
+
}
|
|
36
|
+
}, (0, _react2.jsx)("div", {
|
|
25
37
|
css: forcedDimensions,
|
|
26
38
|
style: {
|
|
27
39
|
paddingBottom: "".concat(dimensions.height / dimensions.width * 100, "%")
|
|
@@ -29,6 +41,6 @@ var MediaCardWrapper = function MediaCardWrapper(_ref) {
|
|
|
29
41
|
onContextMenuCapture: onContextMenu
|
|
30
42
|
}, (0, _react2.jsx)("div", {
|
|
31
43
|
css: absoluteDiv
|
|
32
|
-
}, children));
|
|
44
|
+
}, children)));
|
|
33
45
|
};
|
|
34
46
|
exports.MediaCardWrapper = MediaCardWrapper;
|
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.removeInlineCard = exports.changeMediaCardToInline = exports.changeInlineToMediaCard = void 0;
|
|
6
|
+
exports.toggleBorderMark = exports.setBorderMark = exports.removeInlineCard = exports.changeMediaCardToInline = exports.changeInlineToMediaCard = exports.DEFAULT_BORDER_SIZE = exports.DEFAULT_BORDER_COLOR = void 0;
|
|
7
7
|
var _prosemirrorModel = require("prosemirror-model");
|
|
8
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
9
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
10
10
|
var _analytics = require("../../analytics");
|
|
11
11
|
var _utils = require("./utils");
|
|
12
|
+
var _currentMediaNode = require("../utils/current-media-node");
|
|
13
|
+
var DEFAULT_BORDER_COLOR = '#091e4224';
|
|
14
|
+
exports.DEFAULT_BORDER_COLOR = DEFAULT_BORDER_COLOR;
|
|
15
|
+
var DEFAULT_BORDER_SIZE = 2;
|
|
16
|
+
exports.DEFAULT_BORDER_SIZE = DEFAULT_BORDER_SIZE;
|
|
12
17
|
var changeInlineToMediaCard = function changeInlineToMediaCard(state, dispatch) {
|
|
13
18
|
var _state$schema$nodes = state.schema.nodes,
|
|
14
19
|
media = _state$schema$nodes.media,
|
|
@@ -90,4 +95,102 @@ var removeInlineCard = function removeInlineCard(state, dispatch) {
|
|
|
90
95
|
}
|
|
91
96
|
return false;
|
|
92
97
|
};
|
|
93
|
-
exports.removeInlineCard = removeInlineCard;
|
|
98
|
+
exports.removeInlineCard = removeInlineCard;
|
|
99
|
+
var toggleBorderMark = function toggleBorderMark(state, dispatch) {
|
|
100
|
+
var nodeWithPos = (0, _currentMediaNode.currentMediaNodeWithPos)(state);
|
|
101
|
+
if (!nodeWithPos) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
var node = nodeWithPos.node,
|
|
105
|
+
pos = nodeWithPos.pos;
|
|
106
|
+
var borderMark = node.marks.find(function (m) {
|
|
107
|
+
return m.type.name === 'border';
|
|
108
|
+
});
|
|
109
|
+
var marks = node.marks.filter(function (m) {
|
|
110
|
+
return m.type.name !== 'border';
|
|
111
|
+
}).concat(borderMark ? [] : state.schema.marks.border.create({
|
|
112
|
+
color: DEFAULT_BORDER_COLOR,
|
|
113
|
+
size: DEFAULT_BORDER_SIZE
|
|
114
|
+
}));
|
|
115
|
+
var tr = state.tr.setNodeMarkup(pos, node.type, node.attrs, marks);
|
|
116
|
+
tr.setMeta('scrollIntoView', false);
|
|
117
|
+
if (state.selection instanceof _prosemirrorState.NodeSelection) {
|
|
118
|
+
if (state.selection.$anchor.pos === state.selection.from) {
|
|
119
|
+
tr.setSelection(_prosemirrorState.NodeSelection.create(tr.doc, state.selection.from));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (dispatch) {
|
|
123
|
+
if (borderMark !== null && borderMark !== void 0 && borderMark.attrs) {
|
|
124
|
+
(0, _analytics.addAnalytics)(state, tr, {
|
|
125
|
+
action: _analytics.ACTION.DELETED,
|
|
126
|
+
actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
|
|
127
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.BORDER,
|
|
128
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
129
|
+
attributes: {
|
|
130
|
+
previousColor: borderMark.attrs.color,
|
|
131
|
+
previousSize: borderMark.attrs.size
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
(0, _analytics.addAnalytics)(state, tr, {
|
|
136
|
+
action: _analytics.ACTION.ADDED,
|
|
137
|
+
actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
|
|
138
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.BORDER,
|
|
139
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
140
|
+
attributes: {
|
|
141
|
+
color: DEFAULT_BORDER_COLOR,
|
|
142
|
+
size: DEFAULT_BORDER_SIZE
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
dispatch(tr);
|
|
147
|
+
}
|
|
148
|
+
return true;
|
|
149
|
+
};
|
|
150
|
+
exports.toggleBorderMark = toggleBorderMark;
|
|
151
|
+
var setBorderMark = function setBorderMark(attrs) {
|
|
152
|
+
return function (state, dispatch) {
|
|
153
|
+
var _node$marks$find, _ref, _attrs$color, _ref2, _attrs$size;
|
|
154
|
+
var nodeWithPos = (0, _currentMediaNode.currentMediaNodeWithPos)(state);
|
|
155
|
+
if (!nodeWithPos) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
var node = nodeWithPos.node,
|
|
159
|
+
pos = nodeWithPos.pos;
|
|
160
|
+
var borderMark = (_node$marks$find = node.marks.find(function (m) {
|
|
161
|
+
return m.type.name === 'border';
|
|
162
|
+
})) === null || _node$marks$find === void 0 ? void 0 : _node$marks$find.attrs;
|
|
163
|
+
var color = (_ref = (_attrs$color = attrs.color) !== null && _attrs$color !== void 0 ? _attrs$color : borderMark === null || borderMark === void 0 ? void 0 : borderMark.color) !== null && _ref !== void 0 ? _ref : DEFAULT_BORDER_COLOR;
|
|
164
|
+
var size = (_ref2 = (_attrs$size = attrs.size) !== null && _attrs$size !== void 0 ? _attrs$size : borderMark === null || borderMark === void 0 ? void 0 : borderMark.size) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_BORDER_SIZE;
|
|
165
|
+
var marks = node.marks.filter(function (m) {
|
|
166
|
+
return m.type.name !== 'border';
|
|
167
|
+
}).concat(state.schema.marks.border.create({
|
|
168
|
+
color: color,
|
|
169
|
+
size: size
|
|
170
|
+
}));
|
|
171
|
+
var tr = state.tr.setNodeMarkup(pos, node.type, node.attrs, marks);
|
|
172
|
+
tr.setMeta('scrollIntoView', false);
|
|
173
|
+
if (state.selection instanceof _prosemirrorState.NodeSelection) {
|
|
174
|
+
if (state.selection.$anchor.pos === state.selection.from) {
|
|
175
|
+
tr.setSelection(_prosemirrorState.NodeSelection.create(tr.doc, state.selection.from));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (dispatch) {
|
|
179
|
+
(0, _analytics.addAnalytics)(state, tr, {
|
|
180
|
+
action: _analytics.ACTION.UPDATED,
|
|
181
|
+
actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
|
|
182
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.BORDER,
|
|
183
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
184
|
+
attributes: {
|
|
185
|
+
previousColor: borderMark === null || borderMark === void 0 ? void 0 : borderMark.color,
|
|
186
|
+
previousSize: borderMark === null || borderMark === void 0 ? void 0 : borderMark.size,
|
|
187
|
+
newColor: color,
|
|
188
|
+
newSize: size
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
dispatch(tr);
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
exports.setBorderMark = setBorderMark;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.shouldShowImageBorder = shouldShowImageBorder;
|
|
7
|
+
var _currentMediaNode = require("../utils/current-media-node");
|
|
8
|
+
function shouldShowImageBorder(editorState) {
|
|
9
|
+
var border = editorState.schema.marks.border;
|
|
10
|
+
if (!border) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
var nodeWithPos = (0, _currentMediaNode.currentMediaNodeWithPos)(editorState);
|
|
14
|
+
if (!nodeWithPos) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
var _editorState$doc$reso = editorState.doc.resolve(nodeWithPos.pos),
|
|
18
|
+
parent = _editorState$doc$reso.parent;
|
|
19
|
+
return parent && parent.type.allowsMarkType(border);
|
|
20
|
+
}
|
|
@@ -30,6 +30,9 @@ var _filePreviewItem = require("./filePreviewItem");
|
|
|
30
30
|
var _utils = require("./utils");
|
|
31
31
|
var _commands = require("./commands");
|
|
32
32
|
var _styles = require("../nodeviews/styles");
|
|
33
|
+
var _ImageBorder = _interopRequireDefault(require("../ui/ImageBorder"));
|
|
34
|
+
var _currentMediaNode = require("../utils/current-media-node");
|
|
35
|
+
var _imageBorder = require("./imageBorder");
|
|
33
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
34
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
38
|
var remove = function remove(state, dispatch) {
|
|
@@ -191,7 +194,7 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
|
|
|
191
194
|
}];
|
|
192
195
|
return items;
|
|
193
196
|
};
|
|
194
|
-
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState) {
|
|
197
|
+
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, getEditorFeatureFlags) {
|
|
195
198
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
196
199
|
var allowResizing = options.allowResizing,
|
|
197
200
|
allowLinking = options.allowLinking,
|
|
@@ -199,8 +202,33 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
199
202
|
allowResizingInTables = options.allowResizingInTables,
|
|
200
203
|
allowAltTextOnImages = options.allowAltTextOnImages;
|
|
201
204
|
var toolbarButtons = [];
|
|
205
|
+
if ((0, _imageBorder.shouldShowImageBorder)(state)) {
|
|
206
|
+
toolbarButtons.push({
|
|
207
|
+
type: 'custom',
|
|
208
|
+
fallback: [],
|
|
209
|
+
render: function render(editorView) {
|
|
210
|
+
if (!editorView) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
var dispatch = editorView.dispatch,
|
|
214
|
+
state = editorView.state;
|
|
215
|
+
var borderMark = (0, _currentMediaNode.currentMediaNodeBorderMark)(state);
|
|
216
|
+
return /*#__PURE__*/_react.default.createElement(_ImageBorder.default, {
|
|
217
|
+
toggleBorder: function toggleBorder() {
|
|
218
|
+
(0, _commands.toggleBorderMark)(state, dispatch);
|
|
219
|
+
},
|
|
220
|
+
setBorder: function setBorder(attrs) {
|
|
221
|
+
(0, _commands.setBorderMark)(attrs)(state, dispatch);
|
|
222
|
+
},
|
|
223
|
+
showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
|
|
224
|
+
borderMark: borderMark,
|
|
225
|
+
intl: intl
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
202
230
|
if (allowAdvancedToolBarOptions) {
|
|
203
|
-
toolbarButtons = (0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.mediaSingle, allowResizing, allowResizingInTables);
|
|
231
|
+
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)((0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.mediaSingle, allowResizing, allowResizingInTables)));
|
|
204
232
|
if (toolbarButtons.length) {
|
|
205
233
|
toolbarButtons.push({
|
|
206
234
|
type: 'separator'
|
|
@@ -289,7 +317,8 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
289
317
|
allowLinking = options.allowLinking,
|
|
290
318
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
291
319
|
providerFactory = options.providerFactory,
|
|
292
|
-
allowMediaInline = options.allowMediaInline
|
|
320
|
+
allowMediaInline = options.allowMediaInline,
|
|
321
|
+
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
293
322
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
294
323
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
|
|
295
324
|
if (!mediaPluginState) {
|
|
@@ -344,7 +373,7 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
344
373
|
var element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(".".concat(_styles.MediaSingleNodeSelector));
|
|
345
374
|
return element || mediaPluginState.element;
|
|
346
375
|
};
|
|
347
|
-
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState);
|
|
376
|
+
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, getEditorFeatureFlags);
|
|
348
377
|
}
|
|
349
378
|
return _objectSpread(_objectSpread({}, baseToolbar), {}, {
|
|
350
379
|
items: items,
|