@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
|
@@ -3,6 +3,9 @@ import { NodeSelection } from 'prosemirror-state';
|
|
|
3
3
|
import { isNodeSelection, removeSelectedNode, safeInsert } from 'prosemirror-utils';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE } from '../../analytics';
|
|
5
5
|
import { removeMediaGroupNode } from './utils';
|
|
6
|
+
import { currentMediaNodeWithPos } from '../utils/current-media-node';
|
|
7
|
+
export const DEFAULT_BORDER_COLOR = '#091e4224';
|
|
8
|
+
export const DEFAULT_BORDER_SIZE = 2;
|
|
6
9
|
export const changeInlineToMediaCard = (state, dispatch) => {
|
|
7
10
|
const {
|
|
8
11
|
media,
|
|
@@ -84,4 +87,94 @@ export const removeInlineCard = (state, dispatch) => {
|
|
|
84
87
|
return true;
|
|
85
88
|
}
|
|
86
89
|
return false;
|
|
90
|
+
};
|
|
91
|
+
export const toggleBorderMark = (state, dispatch) => {
|
|
92
|
+
const nodeWithPos = currentMediaNodeWithPos(state);
|
|
93
|
+
if (!nodeWithPos) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
const {
|
|
97
|
+
node,
|
|
98
|
+
pos
|
|
99
|
+
} = nodeWithPos;
|
|
100
|
+
const borderMark = node.marks.find(m => m.type.name === 'border');
|
|
101
|
+
const marks = node.marks.filter(m => m.type.name !== 'border').concat(borderMark ? [] : state.schema.marks.border.create({
|
|
102
|
+
color: DEFAULT_BORDER_COLOR,
|
|
103
|
+
size: DEFAULT_BORDER_SIZE
|
|
104
|
+
}));
|
|
105
|
+
const tr = state.tr.setNodeMarkup(pos, node.type, node.attrs, marks);
|
|
106
|
+
tr.setMeta('scrollIntoView', false);
|
|
107
|
+
if (state.selection instanceof NodeSelection) {
|
|
108
|
+
if (state.selection.$anchor.pos === state.selection.from) {
|
|
109
|
+
tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (dispatch) {
|
|
113
|
+
if (borderMark !== null && borderMark !== void 0 && borderMark.attrs) {
|
|
114
|
+
addAnalytics(state, tr, {
|
|
115
|
+
action: ACTION.DELETED,
|
|
116
|
+
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
117
|
+
actionSubjectId: ACTION_SUBJECT_ID.BORDER,
|
|
118
|
+
eventType: EVENT_TYPE.TRACK,
|
|
119
|
+
attributes: {
|
|
120
|
+
previousColor: borderMark.attrs.color,
|
|
121
|
+
previousSize: borderMark.attrs.size
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
addAnalytics(state, tr, {
|
|
126
|
+
action: ACTION.ADDED,
|
|
127
|
+
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
128
|
+
actionSubjectId: ACTION_SUBJECT_ID.BORDER,
|
|
129
|
+
eventType: EVENT_TYPE.TRACK,
|
|
130
|
+
attributes: {
|
|
131
|
+
color: DEFAULT_BORDER_COLOR,
|
|
132
|
+
size: DEFAULT_BORDER_SIZE
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
dispatch(tr);
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
};
|
|
140
|
+
export const setBorderMark = attrs => (state, dispatch) => {
|
|
141
|
+
var _node$marks$find, _ref, _attrs$color, _ref2, _attrs$size;
|
|
142
|
+
const nodeWithPos = currentMediaNodeWithPos(state);
|
|
143
|
+
if (!nodeWithPos) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
const {
|
|
147
|
+
node,
|
|
148
|
+
pos
|
|
149
|
+
} = nodeWithPos;
|
|
150
|
+
const borderMark = (_node$marks$find = node.marks.find(m => m.type.name === 'border')) === null || _node$marks$find === void 0 ? void 0 : _node$marks$find.attrs;
|
|
151
|
+
const 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;
|
|
152
|
+
const 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;
|
|
153
|
+
const marks = node.marks.filter(m => m.type.name !== 'border').concat(state.schema.marks.border.create({
|
|
154
|
+
color,
|
|
155
|
+
size
|
|
156
|
+
}));
|
|
157
|
+
const tr = state.tr.setNodeMarkup(pos, node.type, node.attrs, marks);
|
|
158
|
+
tr.setMeta('scrollIntoView', false);
|
|
159
|
+
if (state.selection instanceof NodeSelection) {
|
|
160
|
+
if (state.selection.$anchor.pos === state.selection.from) {
|
|
161
|
+
tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (dispatch) {
|
|
165
|
+
addAnalytics(state, tr, {
|
|
166
|
+
action: ACTION.UPDATED,
|
|
167
|
+
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
168
|
+
actionSubjectId: ACTION_SUBJECT_ID.BORDER,
|
|
169
|
+
eventType: EVENT_TYPE.TRACK,
|
|
170
|
+
attributes: {
|
|
171
|
+
previousColor: borderMark === null || borderMark === void 0 ? void 0 : borderMark.color,
|
|
172
|
+
previousSize: borderMark === null || borderMark === void 0 ? void 0 : borderMark.size,
|
|
173
|
+
newColor: color,
|
|
174
|
+
newSize: size
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
dispatch(tr);
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
87
180
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { currentMediaNodeWithPos } from '../utils/current-media-node';
|
|
2
|
+
export function shouldShowImageBorder(editorState) {
|
|
3
|
+
const border = editorState.schema.marks.border;
|
|
4
|
+
if (!border) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const nodeWithPos = currentMediaNodeWithPos(editorState);
|
|
8
|
+
if (!nodeWithPos) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
let {
|
|
12
|
+
parent
|
|
13
|
+
} = editorState.doc.resolve(nodeWithPos.pos);
|
|
14
|
+
return parent && parent.type.allowsMarkType(border);
|
|
15
|
+
}
|
|
@@ -19,8 +19,11 @@ import { messages } from '@atlaskit/media-ui';
|
|
|
19
19
|
import { messages as cardMessages } from '../../card/messages';
|
|
20
20
|
import { FilePreviewItem } from './filePreviewItem';
|
|
21
21
|
import { downloadMedia, removeMediaGroupNode } from './utils';
|
|
22
|
-
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard } from './commands';
|
|
22
|
+
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
23
23
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
24
|
+
import ImageBorderItem from '../ui/ImageBorder';
|
|
25
|
+
import { currentMediaNodeBorderMark } from '../utils/current-media-node';
|
|
26
|
+
import { shouldShowImageBorder } from './imageBorder';
|
|
24
27
|
const remove = (state, dispatch) => {
|
|
25
28
|
if (dispatch) {
|
|
26
29
|
dispatch(removeSelectedNode(state.tr));
|
|
@@ -184,7 +187,7 @@ const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState) => {
|
|
|
184
187
|
}];
|
|
185
188
|
return items;
|
|
186
189
|
};
|
|
187
|
-
const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState) => {
|
|
190
|
+
const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, getEditorFeatureFlags) => {
|
|
188
191
|
const {
|
|
189
192
|
mediaSingle
|
|
190
193
|
} = state.schema.nodes;
|
|
@@ -196,8 +199,35 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
196
199
|
allowAltTextOnImages
|
|
197
200
|
} = options;
|
|
198
201
|
let toolbarButtons = [];
|
|
202
|
+
if (shouldShowImageBorder(state)) {
|
|
203
|
+
toolbarButtons.push({
|
|
204
|
+
type: 'custom',
|
|
205
|
+
fallback: [],
|
|
206
|
+
render: editorView => {
|
|
207
|
+
if (!editorView) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
const {
|
|
211
|
+
dispatch,
|
|
212
|
+
state
|
|
213
|
+
} = editorView;
|
|
214
|
+
const borderMark = currentMediaNodeBorderMark(state);
|
|
215
|
+
return /*#__PURE__*/React.createElement(ImageBorderItem, {
|
|
216
|
+
toggleBorder: () => {
|
|
217
|
+
toggleBorderMark(state, dispatch);
|
|
218
|
+
},
|
|
219
|
+
setBorder: attrs => {
|
|
220
|
+
setBorderMark(attrs)(state, dispatch);
|
|
221
|
+
},
|
|
222
|
+
showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
|
|
223
|
+
borderMark: borderMark,
|
|
224
|
+
intl: intl
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
199
229
|
if (allowAdvancedToolBarOptions) {
|
|
200
|
-
toolbarButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, allowResizing, allowResizingInTables);
|
|
230
|
+
toolbarButtons = [...toolbarButtons, ...buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, allowResizing, allowResizingInTables)];
|
|
201
231
|
if (toolbarButtons.length) {
|
|
202
232
|
toolbarButtons.push({
|
|
203
233
|
type: 'separator'
|
|
@@ -291,7 +321,8 @@ export const floatingToolbar = (state, intl, options = {}) => {
|
|
|
291
321
|
allowLinking,
|
|
292
322
|
allowAltTextOnImages,
|
|
293
323
|
providerFactory,
|
|
294
|
-
allowMediaInline
|
|
324
|
+
allowMediaInline,
|
|
325
|
+
getEditorFeatureFlags
|
|
295
326
|
} = options;
|
|
296
327
|
const mediaPluginState = stateKey.getState(state);
|
|
297
328
|
const mediaLinkingState = getMediaLinkingState(state);
|
|
@@ -345,7 +376,7 @@ export const floatingToolbar = (state, intl, options = {}) => {
|
|
|
345
376
|
const element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(`.${MediaSingleNodeSelector}`);
|
|
346
377
|
return element || mediaPluginState.element;
|
|
347
378
|
};
|
|
348
|
-
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState);
|
|
379
|
+
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, getEditorFeatureFlags);
|
|
349
380
|
}
|
|
350
381
|
return {
|
|
351
382
|
...baseToolbar,
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
4
|
+
import { DropdownMenuSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
5
|
+
import ImageBorderIcon from '@atlaskit/icon/glyph/image-border';
|
|
6
|
+
import { useRef, useState } from 'react';
|
|
7
|
+
import { ColorPalette, borderPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
8
|
+
import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
|
|
9
|
+
import { borderColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
10
|
+
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
11
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
12
|
+
import { Popup } from '@atlaskit/editor-common/ui';
|
|
13
|
+
import ToolbarButton from '../../../../ui/ToolbarButton';
|
|
14
|
+
import { buttonStyle, buttonWrapperStyle, contextualMenuArrow, contextualMenuColorIcon, contextualSubMenu, itemSpacing, line, menuItemDimensions, toolbarButtonWrapper } from './styles';
|
|
15
|
+
import { messages } from './messages';
|
|
16
|
+
const ImageBorder = ({
|
|
17
|
+
intl: {
|
|
18
|
+
formatMessage
|
|
19
|
+
},
|
|
20
|
+
toggleBorder,
|
|
21
|
+
showSomewhatSemanticTooltips,
|
|
22
|
+
borderMark,
|
|
23
|
+
setBorder
|
|
24
|
+
}) => {
|
|
25
|
+
const popupTarget = useRef(null);
|
|
26
|
+
const enabled = !!borderMark;
|
|
27
|
+
const color = borderMark === null || borderMark === void 0 ? void 0 : borderMark.color;
|
|
28
|
+
const size = borderMark === null || borderMark === void 0 ? void 0 : borderMark.size;
|
|
29
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
30
|
+
const [isColorSubmenuOpen, setIsColorSubmenuOpen] = useState(false);
|
|
31
|
+
const [isSizeSubmenuOpen, setIsSizeSubmenuOpen] = useState(false);
|
|
32
|
+
const borderSizeOptions = [{
|
|
33
|
+
name: formatMessage(messages.borderSizeSubtle),
|
|
34
|
+
value: 1
|
|
35
|
+
}, {
|
|
36
|
+
name: formatMessage(messages.borderSizeMedium),
|
|
37
|
+
value: 2
|
|
38
|
+
}, {
|
|
39
|
+
name: formatMessage(messages.borderSizeBold),
|
|
40
|
+
value: 3
|
|
41
|
+
}];
|
|
42
|
+
const items = [{
|
|
43
|
+
content: formatMessage(messages.borderColor),
|
|
44
|
+
value: {
|
|
45
|
+
name: 'color'
|
|
46
|
+
},
|
|
47
|
+
elemAfter: jsx("div", {
|
|
48
|
+
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
49
|
+
}, jsx("div", {
|
|
50
|
+
css: contextualMenuColorIcon(color && hexToEditorBorderPaletteColor(color))
|
|
51
|
+
}), isColorSubmenuOpen && jsx("div", {
|
|
52
|
+
css: contextualSubMenu(0)
|
|
53
|
+
}, jsx(ColorPalette, {
|
|
54
|
+
onClick: color => {
|
|
55
|
+
setBorder({
|
|
56
|
+
color
|
|
57
|
+
});
|
|
58
|
+
setIsOpen(!isOpen);
|
|
59
|
+
},
|
|
60
|
+
selectedColor: color !== null && color !== void 0 ? color : null,
|
|
61
|
+
paletteOptions: {
|
|
62
|
+
palette: borderColorPalette,
|
|
63
|
+
paletteColorTooltipMessages: borderPaletteTooltipMessages,
|
|
64
|
+
hexToPaletteColor: hexToEditorBorderPaletteColor,
|
|
65
|
+
showSomewhatSemanticTooltips
|
|
66
|
+
}
|
|
67
|
+
})))
|
|
68
|
+
}, {
|
|
69
|
+
content: formatMessage(messages.borderSize),
|
|
70
|
+
value: {
|
|
71
|
+
name: 'size'
|
|
72
|
+
},
|
|
73
|
+
elemAfter: jsx("div", {
|
|
74
|
+
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
75
|
+
}, jsx("div", {
|
|
76
|
+
css: contextualMenuArrow
|
|
77
|
+
}), isSizeSubmenuOpen && jsx("div", {
|
|
78
|
+
css: contextualSubMenu(1)
|
|
79
|
+
}, borderSizeOptions.map(({
|
|
80
|
+
name,
|
|
81
|
+
value
|
|
82
|
+
}, idx) => jsx(Tooltip, {
|
|
83
|
+
key: idx,
|
|
84
|
+
content: name
|
|
85
|
+
}, jsx("span", {
|
|
86
|
+
css: buttonWrapperStyle
|
|
87
|
+
}, jsx("button", {
|
|
88
|
+
css: buttonStyle(value === size),
|
|
89
|
+
"aria-label": name,
|
|
90
|
+
role: "radio",
|
|
91
|
+
"aria-checked": value === size,
|
|
92
|
+
onClick: () => {
|
|
93
|
+
setBorder({
|
|
94
|
+
size: value
|
|
95
|
+
});
|
|
96
|
+
setIsOpen(false);
|
|
97
|
+
},
|
|
98
|
+
onMouseDown: e => {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
}
|
|
101
|
+
}, jsx("div", {
|
|
102
|
+
css: line(value, value === size),
|
|
103
|
+
role: "presentation"
|
|
104
|
+
})))))))
|
|
105
|
+
}];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* We want to change direction of our dropdowns a bit early,
|
|
109
|
+
* not exactly when it hits the boundary.
|
|
110
|
+
*/
|
|
111
|
+
const fitTolerance = 10;
|
|
112
|
+
const fitWidth = menuItemDimensions.width;
|
|
113
|
+
const fitHeight = items.length * (menuItemDimensions.height + itemSpacing);
|
|
114
|
+
return jsx("div", null, jsx("div", {
|
|
115
|
+
css: toolbarButtonWrapper({
|
|
116
|
+
enabled,
|
|
117
|
+
isOpen
|
|
118
|
+
})
|
|
119
|
+
}, jsx(ToolbarButton, {
|
|
120
|
+
className: "image-border-toolbar-btn",
|
|
121
|
+
selected: enabled,
|
|
122
|
+
onClick: toggleBorder,
|
|
123
|
+
spacing: "compact",
|
|
124
|
+
"aria-label": enabled ? formatMessage(messages.removeBorder) : formatMessage(messages.addBorder),
|
|
125
|
+
iconBefore: jsx(ImageBorderIcon, {
|
|
126
|
+
label: ""
|
|
127
|
+
}),
|
|
128
|
+
title: enabled ? formatMessage(messages.removeBorder) : formatMessage(messages.addBorder)
|
|
129
|
+
}), jsx("div", {
|
|
130
|
+
ref: popupTarget
|
|
131
|
+
}, jsx(ToolbarButton, {
|
|
132
|
+
className: "image-border-toolbar-dropdown",
|
|
133
|
+
selected: isOpen,
|
|
134
|
+
"aria-label": formatMessage(messages.borderOptions),
|
|
135
|
+
title: formatMessage(messages.borderOptions),
|
|
136
|
+
spacing: "compact",
|
|
137
|
+
iconBefore: jsx(ExpandIcon, {
|
|
138
|
+
label: ""
|
|
139
|
+
}),
|
|
140
|
+
onClick: () => {
|
|
141
|
+
setIsOpen(!isOpen);
|
|
142
|
+
}
|
|
143
|
+
}))), jsx(Popup, {
|
|
144
|
+
target: popupTarget.current ? popupTarget.current : undefined,
|
|
145
|
+
fitWidth: fitWidth + fitTolerance,
|
|
146
|
+
fitHeight: fitHeight + fitTolerance,
|
|
147
|
+
forcePlacement: true,
|
|
148
|
+
stick: true
|
|
149
|
+
}, jsx("div", {
|
|
150
|
+
onMouseLeave: () => {
|
|
151
|
+
setIsColorSubmenuOpen(false);
|
|
152
|
+
setIsSizeSubmenuOpen(false);
|
|
153
|
+
}
|
|
154
|
+
}, jsx(DropdownMenu
|
|
155
|
+
//This needs be removed when the a11y is completely handled
|
|
156
|
+
//Disabling key navigation now as it works only partially
|
|
157
|
+
//Same with packages/editor/editor-plugin-table/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx
|
|
158
|
+
, {
|
|
159
|
+
arrowKeyNavigationProviderOptions: {
|
|
160
|
+
type: ArrowKeyNavigationType.MENU,
|
|
161
|
+
disableArrowKeyNavigation: true
|
|
162
|
+
},
|
|
163
|
+
items: [{
|
|
164
|
+
items
|
|
165
|
+
}],
|
|
166
|
+
isOpen: isOpen,
|
|
167
|
+
onOpenChange: () => {
|
|
168
|
+
setIsOpen(false);
|
|
169
|
+
setIsColorSubmenuOpen(false);
|
|
170
|
+
setIsSizeSubmenuOpen(false);
|
|
171
|
+
},
|
|
172
|
+
onItemActivated: ({
|
|
173
|
+
item
|
|
174
|
+
}) => {
|
|
175
|
+
if (item.value.name === 'color') {
|
|
176
|
+
setIsColorSubmenuOpen(!isColorSubmenuOpen);
|
|
177
|
+
}
|
|
178
|
+
if (item.value.name === 'size') {
|
|
179
|
+
setIsSizeSubmenuOpen(!isSizeSubmenuOpen);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
onMouseEnter: ({
|
|
183
|
+
item
|
|
184
|
+
}) => {
|
|
185
|
+
if (item.value.name === 'color') {
|
|
186
|
+
setIsColorSubmenuOpen(true);
|
|
187
|
+
}
|
|
188
|
+
if (item.value.name === 'size') {
|
|
189
|
+
setIsSizeSubmenuOpen(true);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
onMouseLeave: ({
|
|
193
|
+
item
|
|
194
|
+
}) => {
|
|
195
|
+
if (item.value.name === 'color') {
|
|
196
|
+
setIsColorSubmenuOpen(false);
|
|
197
|
+
}
|
|
198
|
+
if (item.value.name === 'size') {
|
|
199
|
+
setIsSizeSubmenuOpen(false);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
fitWidth: fitWidth + fitTolerance,
|
|
203
|
+
fitHeight: fitHeight + fitTolerance
|
|
204
|
+
}))));
|
|
205
|
+
};
|
|
206
|
+
export default ImageBorder;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export const messages = defineMessages({
|
|
3
|
+
borderColor: {
|
|
4
|
+
id: 'fabric.editor.imageBorderColor',
|
|
5
|
+
defaultMessage: 'Color',
|
|
6
|
+
description: 'Change the border color of an image.'
|
|
7
|
+
},
|
|
8
|
+
borderSize: {
|
|
9
|
+
id: 'fabric.editor.imageBorderSize',
|
|
10
|
+
defaultMessage: 'Size',
|
|
11
|
+
description: 'Change the border size of an image.'
|
|
12
|
+
},
|
|
13
|
+
addBorder: {
|
|
14
|
+
id: 'fabric.editor.addImageBorder',
|
|
15
|
+
defaultMessage: 'Add border',
|
|
16
|
+
description: 'Add a border to an image.'
|
|
17
|
+
},
|
|
18
|
+
removeBorder: {
|
|
19
|
+
id: 'fabric.editor.removeImageBorder',
|
|
20
|
+
defaultMessage: 'Remove border',
|
|
21
|
+
description: 'Remove the border of an image.'
|
|
22
|
+
},
|
|
23
|
+
borderOptions: {
|
|
24
|
+
id: 'fabric.editor.imageBorderOptions',
|
|
25
|
+
defaultMessage: 'Border options',
|
|
26
|
+
description: 'Display options available for customizing the border of an image.'
|
|
27
|
+
},
|
|
28
|
+
borderSizeSubtle: {
|
|
29
|
+
id: 'fabric.editor.imageBorderSubtle',
|
|
30
|
+
defaultMessage: 'Subtle',
|
|
31
|
+
description: 'Name of a border size.'
|
|
32
|
+
},
|
|
33
|
+
borderSizeMedium: {
|
|
34
|
+
id: 'fabric.editor.imageBorderMedium',
|
|
35
|
+
defaultMessage: 'Medium',
|
|
36
|
+
description: 'Name of a border size.'
|
|
37
|
+
},
|
|
38
|
+
borderSizeBold: {
|
|
39
|
+
id: 'fabric.editor.imageBorderBold',
|
|
40
|
+
defaultMessage: 'Bold',
|
|
41
|
+
description: 'Name of a border size.'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import * as colors from '@atlaskit/theme/colors';
|
|
3
|
+
import { DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
4
|
+
import { N20A, N50, N60A, N90, N800, N0 } from '@atlaskit/theme/colors';
|
|
5
|
+
import { gridSize } from '@atlaskit/theme/constants';
|
|
6
|
+
|
|
7
|
+
// menuItemDimensions and itemSpacing are copied from
|
|
8
|
+
// packages/editor/editor-core/src/plugins/floating-toolbar/ui/DropdownMenu.tsx
|
|
9
|
+
|
|
10
|
+
export const menuItemDimensions = {
|
|
11
|
+
width: 175,
|
|
12
|
+
height: 32
|
|
13
|
+
};
|
|
14
|
+
export const itemSpacing = gridSize() / 2;
|
|
15
|
+
export const contextualMenuArrow = css`
|
|
16
|
+
display: flex;
|
|
17
|
+
&::after {
|
|
18
|
+
content: '›';
|
|
19
|
+
margin-left: 4px;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
color: ${`var(--ds-icon, ${N90})`};
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
export const contextualMenuColorIcon = color => css`
|
|
25
|
+
${contextualMenuArrow}
|
|
26
|
+
&::before {
|
|
27
|
+
content: '';
|
|
28
|
+
display: block;
|
|
29
|
+
border: 1px solid ${DEFAULT_BORDER_COLOR};
|
|
30
|
+
border-radius: ${"var(--ds-radius-100, 3px)"};
|
|
31
|
+
width: 20px;
|
|
32
|
+
height: 20px;
|
|
33
|
+
${color && `background: ${color}`}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
export const contextualSubMenu = index => css`
|
|
37
|
+
border-radius: ${"var(--ds-radius-100, 3px)"};
|
|
38
|
+
background: ${"var(--ds-surface-overlay, white)"};
|
|
39
|
+
box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`})`};
|
|
40
|
+
display: flex;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: ${index * (menuItemDimensions.height + itemSpacing * 2)}px;
|
|
43
|
+
left: ${menuItemDimensions.width}px;
|
|
44
|
+
padding: 8px;
|
|
45
|
+
|
|
46
|
+
> div {
|
|
47
|
+
padding: 0;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
export const buttonStyle = selected => css`
|
|
51
|
+
height: 26px;
|
|
52
|
+
width: 26px;
|
|
53
|
+
padding: 0;
|
|
54
|
+
border-radius: 4px;
|
|
55
|
+
background-color: ${selected ? `var(--ds-text, ${N800})` : `var(--ds-background-neutral, ${N20A})`};
|
|
56
|
+
border: 1px solid ${DEFAULT_BORDER_COLOR};
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
display: block;
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
62
|
+
export const buttonWrapperStyle = css`
|
|
63
|
+
border: 1px solid transparent;
|
|
64
|
+
margin: 1px;
|
|
65
|
+
font-size: 0;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
padding: 1px;
|
|
69
|
+
border-radius: 6px;
|
|
70
|
+
&:focus-within,
|
|
71
|
+
&:focus,
|
|
72
|
+
&:hover {
|
|
73
|
+
border-color: ${N50} !important;
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
export const line = (size, selected) => css`
|
|
77
|
+
position: relative;
|
|
78
|
+
&:before {
|
|
79
|
+
content: '';
|
|
80
|
+
display: block;
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 50%;
|
|
83
|
+
left: 50%;
|
|
84
|
+
width: 12px;
|
|
85
|
+
height: ${size}px;
|
|
86
|
+
background-color: ${selected ? `var(--ds-icon-inverse, ${N0})` : "var(--ds-icon, #44546F)"};
|
|
87
|
+
border-radius: 90px;
|
|
88
|
+
transform: translate(-50%, -50%) rotate(135deg);
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
export const toolbarButtonWrapper = ({
|
|
92
|
+
enabled,
|
|
93
|
+
isOpen
|
|
94
|
+
}) => css`
|
|
95
|
+
display: flex;
|
|
96
|
+
.image-border-toolbar-btn {
|
|
97
|
+
border-top-right-radius: 0;
|
|
98
|
+
border-bottom-right-radius: 0;
|
|
99
|
+
padding: 0;
|
|
100
|
+
& > span {
|
|
101
|
+
margin: 0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
.image-border-toolbar-dropdown {
|
|
105
|
+
padding: 0;
|
|
106
|
+
& > span {
|
|
107
|
+
margin: 0;
|
|
108
|
+
}
|
|
109
|
+
width: 16px !important;
|
|
110
|
+
border-top-left-radius: 0 !important;
|
|
111
|
+
border-bottom-left-radius: 0 !important;
|
|
112
|
+
margin-left: 1px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:hover {
|
|
116
|
+
.image-border-toolbar-btn {
|
|
117
|
+
${!enabled && ` background: ${`var(--ds-background-neutral-subtle-hovered, ${colors.N30A})`};`}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.image-border-toolbar-dropdown {
|
|
121
|
+
${!isOpen && `background: ${`var(--ds-background-neutral-subtle-hovered, ${colors.N30A})`};`}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeSelection } from 'prosemirror-state';
|
|
2
|
-
export const
|
|
2
|
+
export const currentMediaNodeWithPos = editorState => {
|
|
3
3
|
const {
|
|
4
4
|
doc,
|
|
5
5
|
selection,
|
|
@@ -8,9 +8,28 @@ export const currentMediaNode = editorState => {
|
|
|
8
8
|
if (!doc || !selection || !(selection instanceof NodeSelection) || selection.node.type !== schema.nodes.mediaSingle) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const pos = selection.$anchor.pos + 1;
|
|
12
|
+
const node = doc.nodeAt(pos);
|
|
12
13
|
if (!node || node.type !== schema.nodes.media) {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
node,
|
|
18
|
+
pos
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const currentMediaNode = editorState => {
|
|
22
|
+
var _currentMediaNodeWith;
|
|
23
|
+
return (_currentMediaNodeWith = currentMediaNodeWithPos(editorState)) === null || _currentMediaNodeWith === void 0 ? void 0 : _currentMediaNodeWith.node;
|
|
24
|
+
};
|
|
25
|
+
export const currentMediaNodeBorderMark = editorState => {
|
|
26
|
+
const node = currentMediaNode(editorState);
|
|
27
|
+
if (!node) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const borderMark = node.marks.find(m => m.type.name === 'border');
|
|
31
|
+
if (!borderMark) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
return borderMark.attrs;
|
|
16
35
|
};
|
|
@@ -4,6 +4,7 @@ import { ACTION_SUBJECT, addAnalytics, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION }
|
|
|
4
4
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
5
5
|
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
6
6
|
import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
7
|
+
import { sortByOrderWithTypeName } from '../../../create-editor/sort-by-order';
|
|
7
8
|
export function isPastedFromWord(html) {
|
|
8
9
|
return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
|
|
9
10
|
}
|
|
@@ -93,6 +94,7 @@ export function applyTextMarksToSlice(schema, marks) {
|
|
|
93
94
|
// add marks to a slice if they're allowed in parent node
|
|
94
95
|
// and exclude link marks
|
|
95
96
|
...parent.type.allowedMarks(marks).filter(mark => mark.type !== linkMark)];
|
|
97
|
+
node.marks.sort(sortByOrderWithTypeName('marks'));
|
|
96
98
|
return false;
|
|
97
99
|
}
|
|
98
100
|
return true;
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
// Inline marks
|
|
22
22
|
'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery',
|
|
23
23
|
// Block marks
|
|
24
|
-
'alignment', 'breakout', 'indentation', 'annotation', 'dataConsumer',
|
|
24
|
+
'alignment', 'breakout', 'indentation', 'annotation', 'dataConsumer', 'border',
|
|
25
25
|
// Unsupported mark
|
|
26
26
|
'unsupportedMark', 'unsupportedNodeAttribute']
|
|
27
27
|
};
|
|
@@ -2,6 +2,7 @@ import { Fragment, Slice } from 'prosemirror-model';
|
|
|
2
2
|
import { createRule, createPlugin } from '../../../utils/input-rules';
|
|
3
3
|
import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
4
4
|
import { safeInsert } from '../../../utils/insert';
|
|
5
|
+
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
5
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../../analytics';
|
|
6
7
|
import { getFeatureFlags } from '../../feature-flags-context';
|
|
7
8
|
export const createHorizontalRule = (state, start, end, inputMethod) => {
|
|
@@ -38,6 +39,12 @@ export const createHorizontalRule = (state, start, end, inputMethod) => {
|
|
|
38
39
|
});
|
|
39
40
|
};
|
|
40
41
|
const createHorizontalRuleAutoformat = (state, start, end) => {
|
|
42
|
+
const {
|
|
43
|
+
listItem
|
|
44
|
+
} = state.schema.nodes;
|
|
45
|
+
if (hasParentNodeOfType(listItem)(state.selection)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
41
48
|
return createHorizontalRule(state, start, end, INPUT_METHOD.FORMATTING);
|
|
42
49
|
};
|
|
43
50
|
export function inputRulePlugin(schema, featureFlags) {
|
|
@@ -34,7 +34,8 @@ export const useClearIcon = ({
|
|
|
34
34
|
name: 'clearFormatting'
|
|
35
35
|
},
|
|
36
36
|
isActive: false,
|
|
37
|
-
isDisabled: !formattingIsPresent
|
|
37
|
+
isDisabled: !formattingIsPresent,
|
|
38
|
+
'aria-label': clearFormattingKeymap ? tooltip(clearFormattingKeymap, String(clearFormattingLabel)) : String(clearFormattingLabel)
|
|
38
39
|
};
|
|
39
40
|
}, [clearFormattingLabel, isPluginAvailable, formattingIsPresent]);
|
|
40
41
|
};
|