@atlaskit/editor-core 160.0.0 → 162.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/dist/cjs/actions/index.js +76 -48
- package/dist/cjs/extensibility.js +2 -2
- package/dist/cjs/labs/next/full-page.js +2 -2
- package/dist/cjs/plugins/block-type/styles.js +5 -2
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +13 -11
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +11 -7
- package/dist/cjs/plugins/card/messages.js +4 -4
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +29 -11
- package/dist/cjs/plugins/card/ui/LinkToolbarButtonGroup.js +66 -7
- package/dist/cjs/plugins/card/ui/LinkToolbarIconDropdown.js +166 -7
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +9 -6
- package/dist/cjs/plugins/card/ui/assets/card.js +1 -1
- package/dist/cjs/plugins/card/ui/assets/embed.js +1 -1
- package/dist/cjs/plugins/card/ui/assets/inline.js +1 -1
- package/dist/cjs/plugins/card/ui/assets/url.js +1 -1
- package/dist/cjs/plugins/card/ui/link-toolbar-button-group-options.js +60 -0
- package/dist/cjs/plugins/card/ui/link-toolbar-icon-dropdown-options.js +66 -0
- package/dist/cjs/plugins/card/ui/styled.js +5 -13
- package/dist/cjs/plugins/card/ui/types.js +5 -0
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +99 -3
- package/dist/cjs/plugins/code-block/styles.js +45 -38
- package/dist/cjs/plugins/extension/plugin-factory.js +4 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +34 -11
- package/dist/cjs/plugins/extension/utils.js +57 -12
- package/dist/cjs/plugins/find-replace/ui/Find.js +12 -12
- package/dist/cjs/plugins/find-replace/ui/FindReplace.js +5 -5
- package/dist/cjs/plugins/find-replace/ui/Replace.js +5 -5
- package/dist/cjs/plugins/find-replace/ui/styles.js +12 -15
- package/dist/cjs/plugins/layout/styles.js +2 -2
- package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +180 -0
- package/dist/cjs/plugins/list/commands/index.js +35 -38
- package/dist/cjs/plugins/list/utils/replace-content.js +31 -0
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
- package/dist/cjs/plugins/media/styles.js +2 -2
- package/dist/cjs/plugins/media/utils/media-single.js +15 -2
- package/dist/cjs/plugins/paste/handlers.js +19 -5
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/cjs/plugins/placeholder-text/index.js +45 -1
- package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +66 -22
- package/dist/cjs/plugins/placeholder-text/selection-utils.js +19 -0
- package/dist/cjs/plugins/placeholder-text/styles.js +3 -1
- package/dist/cjs/plugins/table/commands/index.js +0 -6
- package/dist/cjs/plugins/table/commands/insert.js +1 -1
- package/dist/cjs/plugins/table/commands/misc.js +5 -18
- package/dist/cjs/plugins/table/commands-with-analytics.js +1 -1
- package/dist/cjs/plugins/table/handlers.js +6 -2
- package/dist/cjs/plugins/table/index.js +7 -13
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -2
- package/dist/cjs/plugins/table/nodeviews/table.js +7 -38
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/main.js +3 -1
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +4 -7
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +11 -0
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +3 -3
- package/dist/cjs/plugins/table/reducer.js +0 -7
- package/dist/cjs/plugins/table/toolbar.js +5 -15
- package/dist/cjs/plugins/table/transforms/metadata.js +2 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +1 -1
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/{styles.css.js → styles.js} +0 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/{styles.css.js → styles.js} +0 -0
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/cjs/plugins/table/ui/common-styles.js +53 -0
- package/dist/cjs/plugins/table/ui/ui-styles.js +109 -0
- package/dist/cjs/plugins/table/utils/nodes.js +15 -15
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +15 -1
- package/dist/cjs/plugins/text-formatting/styles.js +5 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +71 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
- package/dist/cjs/plugins/text-formatting/utils.js +30 -2
- package/dist/cjs/plugins/type-ahead/api.js +32 -1
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -5
- package/dist/cjs/plugins/type-ahead/utils.js +22 -4
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +33 -10
- package/dist/cjs/utils/index.js +1 -8
- package/dist/cjs/utils/insert.js +1 -9
- package/dist/cjs/utils/selection.js +2 -9
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +20 -23
- package/dist/es2019/extensibility.js +1 -1
- package/dist/es2019/labs/next/full-page.js +2 -2
- package/dist/es2019/plugins/block-type/styles.js +3 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +15 -12
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +19 -14
- package/dist/es2019/plugins/card/messages.js +4 -4
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +21 -9
- package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +54 -3
- package/dist/es2019/plugins/card/ui/LinkToolbarIconDropdown.js +145 -3
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +10 -6
- package/dist/es2019/plugins/card/ui/assets/card.js +1 -1
- package/dist/es2019/plugins/card/ui/assets/embed.js +1 -1
- package/dist/es2019/plugins/card/ui/assets/inline.js +1 -1
- package/dist/es2019/plugins/card/ui/assets/url.js +1 -1
- package/dist/es2019/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
- package/dist/es2019/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
- package/dist/es2019/plugins/card/ui/styled.js +2 -2
- package/dist/es2019/plugins/card/ui/types.js +1 -0
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +91 -9
- package/dist/es2019/plugins/code-block/styles.js +14 -14
- package/dist/es2019/plugins/extension/plugin-factory.js +3 -1
- package/dist/es2019/plugins/extension/pm-plugins/main.js +38 -12
- package/dist/es2019/plugins/extension/utils.js +37 -2
- package/dist/es2019/plugins/find-replace/ui/Find.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplace.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/Replace.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/styles.js +14 -9
- package/dist/es2019/plugins/layout/styles.js +5 -1
- package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +163 -0
- package/dist/es2019/plugins/list/commands/index.js +29 -28
- package/dist/es2019/plugins/list/utils/replace-content.js +22 -0
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
- package/dist/es2019/plugins/media/styles.js +1 -1
- package/dist/es2019/plugins/media/utils/media-single.js +14 -1
- package/dist/es2019/plugins/paste/handlers.js +19 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/es2019/plugins/placeholder-text/index.js +46 -1
- package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +66 -20
- package/dist/es2019/plugins/placeholder-text/selection-utils.js +9 -0
- package/dist/es2019/plugins/placeholder-text/styles.js +22 -0
- package/dist/es2019/plugins/table/commands/index.js +1 -1
- package/dist/es2019/plugins/table/commands/insert.js +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +5 -11
- package/dist/es2019/plugins/table/commands-with-analytics.js +1 -1
- package/dist/es2019/plugins/table/handlers.js +6 -2
- package/dist/es2019/plugins/table/index.js +4 -8
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -2
- package/dist/es2019/plugins/table/nodeviews/table.js +2 -16
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
- package/dist/es2019/plugins/table/reducer.js +0 -9
- package/dist/es2019/plugins/table/toolbar.js +1 -4
- package/dist/es2019/plugins/table/transforms/metadata.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/{styles.css.js → styles.js} +0 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +3 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/{styles.css.js → styles.js} +0 -0
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/es2019/plugins/table/ui/{common-styles.css.js → common-styles.js} +57 -27
- package/dist/es2019/plugins/table/ui/{ui-styles.css.js → ui-styles.js} +99 -78
- package/dist/es2019/plugins/table/utils/nodes.js +11 -11
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +13 -1
- package/dist/es2019/plugins/text-formatting/styles.js +3 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +61 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
- package/dist/es2019/plugins/text-formatting/utils.js +13 -1
- package/dist/es2019/plugins/type-ahead/api.js +31 -2
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +17 -5
- package/dist/es2019/plugins/type-ahead/utils.js +15 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +2 -2
- package/dist/es2019/ui/ContentStyles/index.js +46 -24
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/insert.js +2 -10
- package/dist/es2019/utils/selection.js +1 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +76 -48
- package/dist/esm/extensibility.js +1 -1
- package/dist/esm/labs/next/full-page.js +2 -2
- package/dist/esm/plugins/block-type/styles.js +4 -2
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +14 -12
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +9 -5
- package/dist/esm/plugins/card/messages.js +4 -4
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +25 -9
- package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +57 -5
- package/dist/esm/plugins/card/ui/LinkToolbarIconDropdown.js +154 -5
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +9 -6
- package/dist/esm/plugins/card/ui/assets/card.js +1 -1
- package/dist/esm/plugins/card/ui/assets/embed.js +1 -1
- package/dist/esm/plugins/card/ui/assets/inline.js +1 -1
- package/dist/esm/plugins/card/ui/assets/url.js +1 -1
- package/dist/esm/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
- package/dist/esm/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
- package/dist/esm/plugins/card/ui/styled.js +2 -2
- package/dist/esm/plugins/card/ui/types.js +1 -0
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +91 -2
- package/dist/esm/plugins/code-block/styles.js +42 -38
- package/dist/esm/plugins/extension/plugin-factory.js +3 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +34 -11
- package/dist/esm/plugins/extension/utils.js +51 -9
- package/dist/esm/plugins/find-replace/ui/Find.js +1 -1
- package/dist/esm/plugins/find-replace/ui/FindReplace.js +1 -1
- package/dist/esm/plugins/find-replace/ui/Replace.js +1 -1
- package/dist/esm/plugins/find-replace/ui/styles.js +6 -10
- package/dist/esm/plugins/layout/styles.js +2 -2
- package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +168 -0
- package/dist/esm/plugins/list/commands/index.js +33 -34
- package/dist/esm/plugins/list/utils/replace-content.js +21 -0
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
- package/dist/esm/plugins/media/styles.js +1 -1
- package/dist/esm/plugins/media/utils/media-single.js +12 -1
- package/dist/esm/plugins/paste/handlers.js +19 -5
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/esm/plugins/placeholder-text/index.js +44 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +67 -20
- package/dist/esm/plugins/placeholder-text/selection-utils.js +9 -0
- package/dist/esm/plugins/placeholder-text/styles.js +2 -1
- package/dist/esm/plugins/table/commands/index.js +1 -1
- package/dist/esm/plugins/table/commands/insert.js +1 -1
- package/dist/esm/plugins/table/commands/misc.js +5 -15
- package/dist/esm/plugins/table/commands-with-analytics.js +1 -1
- package/dist/esm/plugins/table/handlers.js +6 -2
- package/dist/esm/plugins/table/index.js +6 -11
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -2
- package/dist/esm/plugins/table/nodeviews/table.js +6 -37
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
- package/dist/esm/plugins/table/reducer.js +0 -7
- package/dist/esm/plugins/table/toolbar.js +1 -10
- package/dist/esm/plugins/table/transforms/metadata.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingContextualButton/{styles.css.js → styles.js} +0 -0
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +3 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/{styles.css.js → styles.js} +0 -0
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/esm/plugins/table/ui/common-styles.js +27 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +68 -0
- package/dist/esm/plugins/table/utils/nodes.js +14 -14
- package/dist/esm/plugins/tasks-and-decisions/commands.js +13 -1
- package/dist/esm/plugins/text-formatting/styles.js +4 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +69 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
- package/dist/esm/plugins/text-formatting/utils.js +18 -0
- package/dist/esm/plugins/type-ahead/api.js +30 -2
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +16 -4
- package/dist/esm/plugins/type-ahead/utils.js +17 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +28 -10
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/insert.js +2 -10
- package/dist/esm/utils/selection.js +1 -6
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types/extensibility.d.ts +1 -1
- package/dist/types/plugins/analytics/types/list-events.d.ts +0 -1
- package/dist/types/plugins/block-type/styles.d.ts +2 -1
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +2 -7
- package/dist/types/plugins/card/messages.d.ts +2 -2
- package/dist/types/plugins/card/ui/LinkToolbarButtonGroup.d.ts +18 -2
- package/dist/types/plugins/card/ui/LinkToolbarIconDropdown.d.ts +23 -3
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +3 -1
- package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +5 -0
- package/dist/types/plugins/card/ui/link-toolbar-icon-dropdown-options.d.ts +5 -0
- package/dist/types/plugins/card/ui/styled.d.ts +2 -3
- package/dist/types/plugins/card/ui/types.d.ts +12 -0
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +10 -1
- package/dist/types/plugins/code-block/styles.d.ts +3 -2
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/extension/types.d.ts +1 -0
- package/dist/types/plugins/extension/utils.d.ts +3 -1
- package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +2 -1
- package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -5
- package/dist/types/plugins/layout/styles.d.ts +1 -1
- package/dist/types/plugins/list/actions/wrap-and-join-lists.d.ts +25 -0
- package/dist/types/plugins/list/commands/index.d.ts +0 -1
- package/dist/types/plugins/list/utils/replace-content.d.ts +8 -0
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +2 -2
- package/dist/types/plugins/media/styles.d.ts +1 -1
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -0
- package/dist/types/plugins/panel/styles.d.ts +1 -1
- package/dist/types/plugins/paste/handlers.d.ts +1 -1
- package/dist/types/plugins/placeholder-text/placeholder-text-nodeview.d.ts +3 -2
- package/dist/types/plugins/placeholder-text/selection-utils.d.ts +2 -0
- package/dist/types/plugins/rule/styles.d.ts +1 -1
- package/dist/types/plugins/table/commands/index.d.ts +1 -1
- package/dist/types/plugins/table/commands/misc.d.ts +0 -1
- package/dist/types/plugins/table/nodeviews/table.d.ts +0 -1
- package/dist/types/plugins/table/pm-plugins/plugin-factory.d.ts +1 -4
- package/dist/types/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/types.d.ts +1 -8
- package/dist/types/plugins/table/ui/FloatingContextualButton/{styles.css.d.ts → styles.d.ts} +0 -0
- package/dist/types/plugins/table/ui/FloatingContextualMenu/{styles.css.d.ts → styles.d.ts} +0 -0
- package/dist/types/plugins/table/ui/LayoutButton/index.d.ts +0 -1
- package/dist/types/plugins/table/ui/common-styles.d.ts +6 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +15 -0
- package/dist/types/plugins/table/utils/nodes.d.ts +6 -6
- package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
- package/dist/types/plugins/text-formatting/styles.d.ts +2 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +30 -0
- package/dist/types/plugins/text-formatting/utils.d.ts +4 -0
- package/dist/types/plugins/type-ahead/api.d.ts +11 -1
- package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +1 -0
- package/dist/types/plugins/type-ahead/utils.d.ts +4 -0
- package/dist/types/ui/ContentStyles/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/selection.d.ts +0 -1
- package/package.json +28 -26
- package/dist/cjs/plugins/table/ui/common-styles.css.js +0 -44
- package/dist/cjs/plugins/table/ui/ui-styles.css.js +0 -95
- package/dist/esm/plugins/table/ui/common-styles.css.js +0 -23
- package/dist/esm/plugins/table/ui/ui-styles.css.js +0 -59
- package/dist/types/plugins/table/ui/common-styles.css.d.ts +0 -3
- package/dist/types/plugins/table/ui/ui-styles.css.d.ts +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from '
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
import { tableCellBorderWidth, tableMarginBottom, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { N40A, B300, N300, R300, N20A, N60A, N0, Y50, Y200 } from '@atlaskit/theme/colors';
|
|
@@ -16,17 +16,18 @@ const InsertLine = cssString => css`
|
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
-
const Marker = css`
|
|
20
|
-
background-color: ${tableBorderColor};
|
|
19
|
+
const Marker = props => css`
|
|
20
|
+
background-color: ${tableBorderColor(props)};
|
|
21
21
|
position: absolute;
|
|
22
22
|
height: ${lineMarkerSize}px;
|
|
23
23
|
width: ${lineMarkerSize}px;
|
|
24
24
|
border-radius: 50%;
|
|
25
25
|
pointer-events: none;
|
|
26
26
|
`;
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
export const InsertMarker = (props, cssString) => css`
|
|
28
29
|
.${ClassName.CONTROLS_INSERT_MARKER} {
|
|
29
|
-
${Marker};
|
|
30
|
+
${Marker(props)};
|
|
30
31
|
${cssString}
|
|
31
32
|
}
|
|
32
33
|
`;
|
|
@@ -40,7 +41,8 @@ const Button = cssString => css`
|
|
|
40
41
|
margin: 0px;
|
|
41
42
|
padding: 0px;
|
|
42
43
|
text-decoration: none;
|
|
43
|
-
transition: background 0.1s ease-out 0s,
|
|
44
|
+
transition: background 0.1s ease-out 0s,
|
|
45
|
+
box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38) 0s;
|
|
44
46
|
outline: none !important;
|
|
45
47
|
cursor: none;
|
|
46
48
|
|
|
@@ -52,10 +54,10 @@ const Button = cssString => css`
|
|
|
52
54
|
${cssString}
|
|
53
55
|
`;
|
|
54
56
|
|
|
55
|
-
export const HeaderButton = cssString => css`
|
|
57
|
+
export const HeaderButton = (props, cssString) => css`
|
|
56
58
|
.${ClassName.CONTROLS_BUTTON} {
|
|
57
|
-
background: ${tableToolbarColor};
|
|
58
|
-
border: 1px solid ${tableBorderColor};
|
|
59
|
+
background: ${tableToolbarColor(props)};
|
|
60
|
+
border: 1px solid ${tableBorderColor(props)};
|
|
59
61
|
display: block;
|
|
60
62
|
box-sizing: border-box;
|
|
61
63
|
padding: 0;
|
|
@@ -107,7 +109,7 @@ const InsertButton = () => css`
|
|
|
107
109
|
bottom: 0;
|
|
108
110
|
}
|
|
109
111
|
.${ClassName.CONTROLS_INSERT_BUTTON_INNER},
|
|
110
|
-
|
|
112
|
+
.${ClassName.CONTROLS_INSERT_BUTTON} {
|
|
111
113
|
height: ${tableInsertColumnButtonSize}px;
|
|
112
114
|
width: ${tableInsertColumnButtonSize}px;
|
|
113
115
|
}
|
|
@@ -151,14 +153,20 @@ export const insertRowButtonWrapper = css`
|
|
|
151
153
|
left: ${tableInsertColumnButtonSize - 1}px;
|
|
152
154
|
`)}
|
|
153
155
|
`;
|
|
154
|
-
export const columnControlsLineMarker = css`
|
|
155
|
-
.${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}
|
|
156
|
-
|
|
156
|
+
export const columnControlsLineMarker = props => css`
|
|
157
|
+
.${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}
|
|
158
|
+
table
|
|
159
|
+
tr:first-child
|
|
160
|
+
td,
|
|
161
|
+
.${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}
|
|
162
|
+
table
|
|
163
|
+
tr:first-child
|
|
164
|
+
th {
|
|
157
165
|
position: relative;
|
|
158
166
|
|
|
159
167
|
&::before {
|
|
160
168
|
content: ' ';
|
|
161
|
-
${Marker};
|
|
169
|
+
${Marker(props)};
|
|
162
170
|
top: -${tableToolbarSize + lineMarkerOffsetFromColumnControls}px;
|
|
163
171
|
right: -${lineMarkerSize / 2}px;
|
|
164
172
|
}
|
|
@@ -166,7 +174,7 @@ export const columnControlsLineMarker = css`
|
|
|
166
174
|
`;
|
|
167
175
|
export const DeleteButton = css`
|
|
168
176
|
.${ClassName.CONTROLS_DELETE_BUTTON_WRAP},
|
|
169
|
-
|
|
177
|
+
.${ClassName.CONTROLS_DELETE_BUTTON} {
|
|
170
178
|
height: ${tableDeleteButtonSize}px;
|
|
171
179
|
width: ${tableDeleteButtonSize}px;
|
|
172
180
|
}
|
|
@@ -185,57 +193,52 @@ export const DeleteButton = css`
|
|
|
185
193
|
cursor: pointer;
|
|
186
194
|
}
|
|
187
195
|
`;
|
|
188
|
-
export const OverflowShadow = css`
|
|
189
|
-
.${ClassName.TABLE_RIGHT_SHADOW},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
200
|
-
background: linear-gradient(
|
|
201
|
-
to left,
|
|
202
|
-
rgba(99, 114, 130, 0) 0,
|
|
203
|
-
${N40A} 100%
|
|
204
|
-
);
|
|
205
|
-
left: 0px;
|
|
206
|
-
}
|
|
207
|
-
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] > :not(.${ClassName.TABLE_STICKY_SHADOW}).${ClassName.TABLE_LEFT_SHADOW} {
|
|
208
|
-
left: ${akEditorTableNumberColumnWidth - 1}px;
|
|
209
|
-
}
|
|
210
|
-
.${ClassName.TABLE_RIGHT_SHADOW} {
|
|
211
|
-
background: linear-gradient(
|
|
212
|
-
to right,
|
|
213
|
-
rgba(99, 114, 130, 0) 0,
|
|
214
|
-
${N40A} 100%
|
|
215
|
-
);
|
|
216
|
-
left: calc(100% + 2px);
|
|
217
|
-
}
|
|
218
|
-
.${ClassName.WITH_CONTROLS} {
|
|
219
|
-
.${ClassName.TABLE_RIGHT_SHADOW},
|
|
220
|
-
.${ClassName.TABLE_LEFT_SHADOW}{
|
|
221
|
-
height: calc(100% - ${tableMarginTop + tableMarginBottom - 2}px);
|
|
222
|
-
top: ${tableMarginTop - 1}px;
|
|
196
|
+
export const OverflowShadow = props => css`
|
|
197
|
+
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
198
|
+
display: block;
|
|
199
|
+
height: calc(
|
|
200
|
+
100% - ${tableMarginTop + tableMarginBottom + tableToolbarSize - 2}px
|
|
201
|
+
);
|
|
202
|
+
position: absolute;
|
|
203
|
+
pointer-events: none;
|
|
204
|
+
top: ${tableMarginTop + tableToolbarSize - 1}px;
|
|
205
|
+
z-index: ${akEditorShadowZIndex};
|
|
206
|
+
width: 8px;
|
|
223
207
|
}
|
|
224
208
|
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
225
|
-
|
|
209
|
+
background: linear-gradient(to left, rgba(99, 114, 130, 0) 0, ${N40A} 100%);
|
|
210
|
+
left: 0px;
|
|
226
211
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
.${ClassName.
|
|
231
|
-
|
|
212
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] > :not(.${ClassName.TABLE_STICKY_SHADOW}).${ClassName.TABLE_LEFT_SHADOW} {
|
|
213
|
+
left: ${akEditorTableNumberColumnWidth - 1}px;
|
|
214
|
+
}
|
|
215
|
+
.${ClassName.TABLE_RIGHT_SHADOW} {
|
|
216
|
+
background: linear-gradient(
|
|
217
|
+
to right,
|
|
218
|
+
rgba(99, 114, 130, 0) 0,
|
|
219
|
+
${N40A} 100%
|
|
220
|
+
);
|
|
221
|
+
left: calc(100% + 2px);
|
|
222
|
+
}
|
|
223
|
+
.${ClassName.WITH_CONTROLS} {
|
|
224
|
+
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
225
|
+
height: calc(100% - ${tableMarginTop + tableMarginBottom - 2}px);
|
|
226
|
+
top: ${tableMarginTop - 1}px;
|
|
227
|
+
}
|
|
228
|
+
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
229
|
+
border-left: 1px solid ${tableBorderColor(props)};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
.${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY} {
|
|
233
|
+
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
234
|
+
top: ${tableControlsSpacing}px;
|
|
235
|
+
}
|
|
232
236
|
}
|
|
233
|
-
}
|
|
234
237
|
`;
|
|
235
238
|
|
|
236
|
-
const columnHeaderButton = cssString => css`
|
|
237
|
-
background: ${tableToolbarColor};
|
|
238
|
-
border: 1px solid ${tableBorderColor};
|
|
239
|
+
const columnHeaderButton = (props, cssString) => css`
|
|
240
|
+
background: ${tableToolbarColor(props)};
|
|
241
|
+
border: 1px solid ${tableBorderColor(props)};
|
|
239
242
|
display: block;
|
|
240
243
|
box-sizing: border-box;
|
|
241
244
|
padding: 0;
|
|
@@ -253,7 +256,7 @@ const columnHeaderButtonSelected = css`
|
|
|
253
256
|
border-color: ${tableBorderSelectedColor};
|
|
254
257
|
z-index: ${columnControlsSelectedZIndex};
|
|
255
258
|
`;
|
|
256
|
-
export const columnControlsDecoration = css`
|
|
259
|
+
export const columnControlsDecoration = props => css`
|
|
257
260
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
258
261
|
display: none;
|
|
259
262
|
cursor: pointer;
|
|
@@ -266,8 +269,8 @@ export const columnControlsDecoration = css`
|
|
|
266
269
|
&::after {
|
|
267
270
|
content: ' ';
|
|
268
271
|
|
|
269
|
-
${columnHeaderButton(`
|
|
270
|
-
border-right: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
272
|
+
${columnHeaderButton(props, `
|
|
273
|
+
border-right: ${tableCellBorderWidth}px solid ${tableBorderColor(props)};
|
|
271
274
|
border-bottom: none;
|
|
272
275
|
height: ${tableToolbarSize}px;
|
|
273
276
|
width: 100%;
|
|
@@ -283,16 +286,21 @@ export const columnControlsDecoration = css`
|
|
|
283
286
|
display: block;
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
table
|
|
287
|
-
|
|
289
|
+
table
|
|
290
|
+
tr:first-child
|
|
291
|
+
td.${ClassName.TABLE_CELL},
|
|
292
|
+
table
|
|
293
|
+
tr:first-child
|
|
294
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
288
295
|
&.${ClassName.COLUMN_SELECTED},
|
|
289
|
-
|
|
290
|
-
|
|
296
|
+
&.${ClassName.HOVERED_COLUMN},
|
|
297
|
+
&.${ClassName.HOVERED_TABLE} {
|
|
291
298
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
292
299
|
${columnHeaderButtonSelected};
|
|
293
300
|
}
|
|
294
301
|
|
|
295
|
-
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
302
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
303
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
296
304
|
background-color: ${tableToolbarDeleteColor};
|
|
297
305
|
border: 1px solid ${tableBorderDeleteColor};
|
|
298
306
|
border-bottom: none;
|
|
@@ -301,8 +309,14 @@ export const columnControlsDecoration = css`
|
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
311
|
|
|
304
|
-
.${ClassName.TABLE_SELECTED}
|
|
305
|
-
|
|
312
|
+
.${ClassName.TABLE_SELECTED}
|
|
313
|
+
table
|
|
314
|
+
tr:first-child
|
|
315
|
+
td.${ClassName.TABLE_CELL},
|
|
316
|
+
.${ClassName.TABLE_SELECTED}
|
|
317
|
+
table
|
|
318
|
+
tr:first-child
|
|
319
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
306
320
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
307
321
|
${columnHeaderButtonSelected};
|
|
308
322
|
}
|
|
@@ -311,8 +325,8 @@ export const columnControlsDecoration = css`
|
|
|
311
325
|
export const hoveredDeleteButton = css`
|
|
312
326
|
.${ClassName.TABLE_CONTAINER}.${ClassName.HOVERED_DELETE_BUTTON} {
|
|
313
327
|
.${ClassName.SELECTED_CELL},
|
|
314
|
-
|
|
315
|
-
|
|
328
|
+
.${ClassName.COLUMN_SELECTED},
|
|
329
|
+
.${ClassName.HOVERED_CELL} {
|
|
316
330
|
border: 1px solid ${tableBorderDeleteColor};
|
|
317
331
|
}
|
|
318
332
|
.${ClassName.SELECTED_CELL}::after {
|
|
@@ -321,7 +335,8 @@ export const hoveredDeleteButton = css`
|
|
|
321
335
|
}
|
|
322
336
|
`;
|
|
323
337
|
export const hoveredCell = css`
|
|
324
|
-
:not(.${ClassName.IS_RESIZING})
|
|
338
|
+
:not(.${ClassName.IS_RESIZING})
|
|
339
|
+
.${ClassName.TABLE_CONTAINER}:not(.${ClassName.HOVERED_DELETE_BUTTON}) {
|
|
325
340
|
.${ClassName.HOVERED_CELL} {
|
|
326
341
|
position: relative;
|
|
327
342
|
border: 1px solid ${tableBorderSelectedColor};
|
|
@@ -329,7 +344,8 @@ export const hoveredCell = css`
|
|
|
329
344
|
}
|
|
330
345
|
`;
|
|
331
346
|
export const hoveredWarningCell = css`
|
|
332
|
-
:not(.${ClassName.IS_RESIZING})
|
|
347
|
+
:not(.${ClassName.IS_RESIZING})
|
|
348
|
+
.${ClassName.TABLE_CONTAINER}:not(.${ClassName.HOVERED_DELETE_BUTTON}) {
|
|
333
349
|
td.${ClassName.HOVERED_CELL_WARNING} {
|
|
334
350
|
background-color: ${Y50} !important; // We need to override the background-color added to the cell
|
|
335
351
|
border: 1px solid ${Y200};
|
|
@@ -349,8 +365,7 @@ export const resizeHandle = css`
|
|
|
349
365
|
z-index: ${resizeHandlerZIndex};
|
|
350
366
|
}
|
|
351
367
|
|
|
352
|
-
td.${ClassName.WITH_RESIZE_LINE},
|
|
353
|
-
th.${ClassName.WITH_RESIZE_LINE} {
|
|
368
|
+
td.${ClassName.WITH_RESIZE_LINE}, th.${ClassName.WITH_RESIZE_LINE} {
|
|
354
369
|
.${ClassName.RESIZE_HANDLE_DECORATION}::after {
|
|
355
370
|
content: ' ';
|
|
356
371
|
right: ${(resizeHandlerAreaWidth - resizeLineWidth) / 2}px;
|
|
@@ -363,8 +378,14 @@ export const resizeHandle = css`
|
|
|
363
378
|
}
|
|
364
379
|
}
|
|
365
380
|
|
|
366
|
-
table
|
|
367
|
-
|
|
381
|
+
table
|
|
382
|
+
tr:first-child
|
|
383
|
+
th.${ClassName.WITH_RESIZE_LINE}
|
|
384
|
+
.${ClassName.RESIZE_HANDLE_DECORATION}::after,
|
|
385
|
+
table
|
|
386
|
+
tr:first-child
|
|
387
|
+
td.${ClassName.WITH_RESIZE_LINE}
|
|
388
|
+
.${ClassName.RESIZE_HANDLE_DECORATION}::after {
|
|
368
389
|
top: -${tableToolbarSize + tableCellBorderWidth}px;
|
|
369
390
|
height: calc(100% + ${tableToolbarSize + tableCellBorderWidth}px);
|
|
370
391
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
2
2
|
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { pluginKey } from '../pm-plugins/plugin-
|
|
4
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
5
5
|
export const isIsolating = node => {
|
|
6
6
|
return !!node.type.spec.isolating;
|
|
7
7
|
};
|
|
8
|
-
export const containsHeaderColumn =
|
|
8
|
+
export const containsHeaderColumn = table => {
|
|
9
9
|
const map = TableMap.get(table); // Get cell positions for first column.
|
|
10
10
|
|
|
11
11
|
const cellPositions = map.cellsInRect({
|
|
@@ -19,7 +19,7 @@ export const containsHeaderColumn = (state, table) => {
|
|
|
19
19
|
try {
|
|
20
20
|
const cell = table.nodeAt(cellPositions[i]);
|
|
21
21
|
|
|
22
|
-
if (cell && cell.type !==
|
|
22
|
+
if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
} catch (e) {
|
|
@@ -29,22 +29,22 @@ export const containsHeaderColumn = (state, table) => {
|
|
|
29
29
|
|
|
30
30
|
return true;
|
|
31
31
|
};
|
|
32
|
-
export const containsHeaderRow =
|
|
32
|
+
export const containsHeaderRow = table => {
|
|
33
33
|
const map = TableMap.get(table);
|
|
34
34
|
|
|
35
35
|
for (let i = 0; i < map.width; i++) {
|
|
36
36
|
const cell = table.nodeAt(map.map[i]);
|
|
37
37
|
|
|
38
|
-
if (cell && cell.type !==
|
|
38
|
+
if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return true;
|
|
44
44
|
};
|
|
45
|
-
export const checkIfHeaderColumnEnabled =
|
|
46
|
-
export const checkIfHeaderRowEnabled =
|
|
47
|
-
export const checkIfNumberColumnEnabled =
|
|
45
|
+
export const checkIfHeaderColumnEnabled = selection => filterNearSelection(selection, findTable, containsHeaderColumn, false);
|
|
46
|
+
export const checkIfHeaderRowEnabled = selection => filterNearSelection(selection, findTable, containsHeaderRow, false);
|
|
47
|
+
export const checkIfNumberColumnEnabled = selection => filterNearSelection(selection, findTable, table => !!table.attrs.isNumberColumnEnabled, false);
|
|
48
48
|
export const isLayoutSupported = state => {
|
|
49
49
|
const {
|
|
50
50
|
permittedLayouts
|
|
@@ -78,14 +78,14 @@ export const tablesHaveDifferentNoOfColumns = (currentTable, previousTable) => {
|
|
|
78
78
|
return prevMap.width !== currentMap.width;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
function filterNearSelection(
|
|
82
|
-
const found = findNode(
|
|
81
|
+
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
82
|
+
const found = findNode(selection);
|
|
83
83
|
|
|
84
84
|
if (!found) {
|
|
85
85
|
return defaultValue;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
return predicate(
|
|
88
|
+
return predicate(found.node, found.pos);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function getTableWidths(node) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { autoJoin } from 'prosemirror-commands';
|
|
2
|
+
import { NodeRange } from 'prosemirror-model';
|
|
2
3
|
import { TextSelection } from 'prosemirror-state';
|
|
3
4
|
import { findParentNodeOfType, hasParentNodeOfType, replaceParentNodeOfType, safeInsert, setTextSelection } from 'prosemirror-utils';
|
|
5
|
+
import { liftTarget } from 'prosemirror-transform';
|
|
4
6
|
import { uuid } from '@atlaskit/adf-schema';
|
|
5
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD, USER_CONTEXT } from '../analytics';
|
|
6
8
|
import { GapCursorSelection } from '../selection/gap-cursor-selection';
|
|
@@ -234,6 +236,14 @@ export const createListAtSelection = (tr, list, item, schema, state, listLocalId
|
|
|
234
236
|
}, [item.create({
|
|
235
237
|
localId: uuid.generate()
|
|
236
238
|
}, $from.node($from.depth).content)]);
|
|
239
|
+
const hasBlockquoteParent = findParentNodeOfType(blockquote)(selection);
|
|
240
|
+
|
|
241
|
+
if (hasBlockquoteParent) {
|
|
242
|
+
const liftedDepth = $from.depth - 1;
|
|
243
|
+
const range = new NodeRange($from, $to, liftedDepth);
|
|
244
|
+
tr.lift(range, liftTarget(range));
|
|
245
|
+
}
|
|
246
|
+
|
|
237
247
|
const listParent = findParentNodeOfType(taskList)(selection) || findParentNodeOfType(decisionList)(selection);
|
|
238
248
|
const listItem = findParentNodeOfType(taskItem)(selection) || findParentNodeOfType(decisionItem)(selection); // For a selection inside a task/decision list, we can't just simply replace the
|
|
239
249
|
// node type as it will mess up lists with > 1 item
|
|
@@ -265,10 +275,12 @@ export const createListAtSelection = (tr, list, item, schema, state, listLocalId
|
|
|
265
275
|
|
|
266
276
|
const nodeTypesToReplace = [blockquote];
|
|
267
277
|
|
|
268
|
-
if (nodeType === paragraph && childCount > 0) {
|
|
278
|
+
if (nodeType === paragraph && childCount > 0 || hasBlockquoteParent) {
|
|
269
279
|
// Only convert paragraphs containing content.
|
|
270
280
|
// Empty paragraphs use the default flow.
|
|
271
281
|
// This distinction ensures the text selection remains in the correct location.
|
|
282
|
+
// We also want to replace the paragraph type when we are inside a blockQuote
|
|
283
|
+
// to avoid inserting an extra taskList whilst keeping the paragraph
|
|
272
284
|
nodeTypesToReplace.push(paragraph);
|
|
273
285
|
}
|
|
274
286
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { css } from '
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
import { codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
|
|
3
|
-
export const textFormattingStyles = css`
|
|
4
|
-
${codeMarkSharedStyles}
|
|
3
|
+
export const textFormattingStyles = props => css`
|
|
4
|
+
${codeMarkSharedStyles(props)}
|
|
5
5
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useMemo, useState, useEffect } from 'react';
|
|
2
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
3
|
import { Separator, Wrapper, ButtonGroup } from '../../../../ui/styles';
|
|
4
4
|
import { useFormattingIcons, useHasFormattingActived } from './hooks/formatting-icons';
|
|
@@ -8,6 +8,8 @@ import { SingleToolbarButtons } from './single-toolbar-buttons';
|
|
|
8
8
|
import { MoreButton } from './more-button';
|
|
9
9
|
import { FormattingTextDropdownMenu } from './dropdown-menu';
|
|
10
10
|
import { toolbarMessages } from './toolbar-messages';
|
|
11
|
+
import { usePreviousObjectState, compareItemsArrays, isArrayContainsContent } from '../../utils';
|
|
12
|
+
import Announcer from '../../../../utils/announcer/announcer';
|
|
11
13
|
|
|
12
14
|
const ToolbarFormatting = ({
|
|
13
15
|
shouldUseResponsiveToolbar,
|
|
@@ -21,6 +23,7 @@ const ToolbarFormatting = ({
|
|
|
21
23
|
intl
|
|
22
24
|
}) => {
|
|
23
25
|
const editorState = useMemo(() => editorView.state, [editorView.state]);
|
|
26
|
+
const [message, setMessage] = useState('');
|
|
24
27
|
const defaultIcons = useFormattingIcons({
|
|
25
28
|
editorState,
|
|
26
29
|
intl,
|
|
@@ -46,6 +49,52 @@ const ToolbarFormatting = ({
|
|
|
46
49
|
toolbarSize,
|
|
47
50
|
responsivenessEnabled: shouldUseResponsiveToolbar
|
|
48
51
|
});
|
|
52
|
+
const clearFormattingStatus = intl.formatMessage(toolbarMessages.textFormattingOff);
|
|
53
|
+
const superscriptOffSubscriptOnStatus = intl.formatMessage(toolbarMessages.superscriptOffSubscriptOn);
|
|
54
|
+
const subscriptOffSuperscriptOnStatus = intl.formatMessage(toolbarMessages.subscriptOffSuperscriptOn);
|
|
55
|
+
const activeItems = [...dropdownItems, ...singleItems].filter(item => item.isActive);
|
|
56
|
+
const prevActiveItems = usePreviousObjectState(activeItems);
|
|
57
|
+
const fromSuperscriptToSubscript = isArrayContainsContent(activeItems, 'Subscript') && isArrayContainsContent(prevActiveItems, 'Superscript');
|
|
58
|
+
const fromSubscriptToSuperscript = isArrayContainsContent(activeItems, 'Superscript') && isArrayContainsContent(prevActiveItems, 'Subscript');
|
|
59
|
+
let comparedItems;
|
|
60
|
+
let screenReaderMessage = '';
|
|
61
|
+
|
|
62
|
+
if (prevActiveItems && activeItems.length > prevActiveItems.length) {
|
|
63
|
+
comparedItems = compareItemsArrays(activeItems, prevActiveItems);
|
|
64
|
+
screenReaderMessage = intl.formatMessage(toolbarMessages.on, {
|
|
65
|
+
formattingType: comparedItems[0].content
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
comparedItems = compareItemsArrays(prevActiveItems, activeItems);
|
|
69
|
+
|
|
70
|
+
if (comparedItems && comparedItems.length) {
|
|
71
|
+
var _activeItems$;
|
|
72
|
+
|
|
73
|
+
screenReaderMessage = intl.formatMessage(toolbarMessages.off, {
|
|
74
|
+
formattingType: comparedItems[0].content
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (((_activeItems$ = activeItems[0]) === null || _activeItems$ === void 0 ? void 0 : _activeItems$.content) === 'Code') {
|
|
78
|
+
screenReaderMessage = intl.formatMessage(toolbarMessages.codeOn, {
|
|
79
|
+
textFormattingOff: (prevActiveItems === null || prevActiveItems === void 0 ? void 0 : prevActiveItems.length) > 1 ? clearFormattingStatus : screenReaderMessage
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (fromSuperscriptToSubscript) {
|
|
84
|
+
screenReaderMessage = superscriptOffSubscriptOnStatus;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (fromSubscriptToSuperscript) {
|
|
88
|
+
screenReaderMessage = subscriptOffSuperscriptOnStatus;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} // handle 'Clear formatting' status for screen readers
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
if (!(activeItems !== null && activeItems !== void 0 && activeItems.length) && (prevActiveItems === null || prevActiveItems === void 0 ? void 0 : prevActiveItems.length) > 1) {
|
|
95
|
+
screenReaderMessage = clearFormattingStatus;
|
|
96
|
+
}
|
|
97
|
+
|
|
49
98
|
const items = useMemo(() => {
|
|
50
99
|
if (!clearIcon) {
|
|
51
100
|
return dropdownItems;
|
|
@@ -54,9 +103,19 @@ const ToolbarFormatting = ({
|
|
|
54
103
|
return [...dropdownItems, clearIcon];
|
|
55
104
|
}, [clearIcon, dropdownItems]);
|
|
56
105
|
const moreFormattingButtonLabel = intl.formatMessage(toolbarMessages.moreFormatting);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (screenReaderMessage) {
|
|
108
|
+
setMessage(screenReaderMessage);
|
|
109
|
+
}
|
|
110
|
+
}, [screenReaderMessage]);
|
|
57
111
|
return /*#__PURE__*/React.createElement(ButtonGroup, {
|
|
58
112
|
width: isReducedSpacing ? 'small' : 'large'
|
|
59
|
-
}, /*#__PURE__*/React.createElement(
|
|
113
|
+
}, message && /*#__PURE__*/React.createElement(Announcer, {
|
|
114
|
+
ariaLive: "assertive",
|
|
115
|
+
text: message,
|
|
116
|
+
ariaRelevant: "additions",
|
|
117
|
+
delay: 250
|
|
118
|
+
}), /*#__PURE__*/React.createElement(SingleToolbarButtons, {
|
|
60
119
|
items: singleItems,
|
|
61
120
|
editorView: editorView,
|
|
62
121
|
isReducedSpacing: isReducedSpacing
|
|
@@ -15,16 +15,31 @@ export const toolbarMessages = defineMessages({
|
|
|
15
15
|
defaultMessage: 'Code',
|
|
16
16
|
description: 'Whether the text selection has monospaced/code font'
|
|
17
17
|
},
|
|
18
|
+
codeOn: {
|
|
19
|
+
id: 'fabric.editor.code.on',
|
|
20
|
+
defaultMessage: '{textFormattingOff}, Code On',
|
|
21
|
+
description: 'Reports that code formatting has been turned on'
|
|
22
|
+
},
|
|
18
23
|
subscript: {
|
|
19
24
|
id: 'fabric.editor.subscript',
|
|
20
25
|
defaultMessage: 'Subscript',
|
|
21
26
|
description: 'Whether the text selection is written below the line in a slightly smaller size'
|
|
22
27
|
},
|
|
28
|
+
subscriptOffSuperscriptOn: {
|
|
29
|
+
id: 'fabric.editor.subscript.off.superscript.on',
|
|
30
|
+
defaultMessage: 'Subscript Off, Superscript On',
|
|
31
|
+
description: 'Reports text formatting in case when subscript off and superscript on'
|
|
32
|
+
},
|
|
23
33
|
superscript: {
|
|
24
34
|
id: 'fabric.editor.superscript',
|
|
25
35
|
defaultMessage: 'Superscript',
|
|
26
36
|
description: 'Whether the text selection is written above the line in a slightly smaller size'
|
|
27
37
|
},
|
|
38
|
+
superscriptOffSubscriptOn: {
|
|
39
|
+
id: 'fabric.editor.superscript.off.subscript.on',
|
|
40
|
+
defaultMessage: 'Superscript Off, Subscript On',
|
|
41
|
+
description: 'Describe text formatting in case when Superscript Off and Subscript on'
|
|
42
|
+
},
|
|
28
43
|
clearFormatting: {
|
|
29
44
|
id: 'fabric.editor.clearFormatting',
|
|
30
45
|
defaultMessage: 'Clear formatting',
|
|
@@ -44,5 +59,20 @@ export const toolbarMessages = defineMessages({
|
|
|
44
59
|
id: 'fabric.editor.italic',
|
|
45
60
|
defaultMessage: 'Italic',
|
|
46
61
|
description: 'This refers to italics or emphasized formatting.'
|
|
62
|
+
},
|
|
63
|
+
on: {
|
|
64
|
+
id: 'fabric.editor.on',
|
|
65
|
+
defaultMessage: '{formattingType} On',
|
|
66
|
+
description: 'Reports that text formatting has been turned on'
|
|
67
|
+
},
|
|
68
|
+
off: {
|
|
69
|
+
id: 'fabric.editor.off',
|
|
70
|
+
defaultMessage: '{formattingType} Off',
|
|
71
|
+
description: 'Reports that text formatting has been turned off'
|
|
72
|
+
},
|
|
73
|
+
textFormattingOff: {
|
|
74
|
+
id: 'fabric.editor.text.formatting.off',
|
|
75
|
+
defaultMessage: 'Text formatting Off',
|
|
76
|
+
description: 'Reports that text formatting has been turned off'
|
|
47
77
|
}
|
|
48
78
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
1
2
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
2
3
|
import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './commands/clear-formatting';
|
|
3
4
|
export const nodeLen = node => {
|
|
@@ -131,4 +132,15 @@ const marksArePresent = state => {
|
|
|
131
132
|
|
|
132
133
|
export const checkFormattingIsPresent = state => {
|
|
133
134
|
return marksArePresent(state) || blockStylingIsPresent(state);
|
|
134
|
-
};
|
|
135
|
+
};
|
|
136
|
+
export const usePreviousObjectState = value => {
|
|
137
|
+
const ref = useRef();
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
ref.current = value;
|
|
140
|
+
});
|
|
141
|
+
return ref.current;
|
|
142
|
+
};
|
|
143
|
+
export const compareItemsArrays = (items, prevItems) => {
|
|
144
|
+
return items && items.filter(item => !prevItems.includes(item));
|
|
145
|
+
};
|
|
146
|
+
export const isArrayContainsContent = (items, content) => items.filter(item => item.content === content).length > 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypeAheadAvailableNodes, SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
2
|
-
import { findHandler, isTypeAheadOpen, getTypeAheadHandler, getTypeAheadQuery } from './utils';
|
|
2
|
+
import { findHandler, findHandlerByTrigger, isTypeAheadOpen, getTypeAheadHandler, getTypeAheadQuery } from './utils';
|
|
3
3
|
import { INPUT_METHOD } from '../analytics/types/enums';
|
|
4
|
-
import { openTypeAheadAtCursor } from './transforms/open-typeahead-at-cursor';
|
|
4
|
+
import { openTypeAheadAtCursor, openTypeAhead } from './transforms/open-typeahead-at-cursor';
|
|
5
5
|
import { closeTypeAhead } from './transforms/close-type-ahead';
|
|
6
6
|
import { updateQuery } from './commands/update-query';
|
|
7
7
|
import { insertTypeAheadItem } from './commands/insert-type-ahead-item';
|
|
@@ -203,6 +203,35 @@ const currentQuery = ({
|
|
|
203
203
|
return getTypeAheadQuery(editorView.state);
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
+
const find = ({
|
|
207
|
+
editorView
|
|
208
|
+
}) => trigger => {
|
|
209
|
+
const {
|
|
210
|
+
state: editorState
|
|
211
|
+
} = editorView;
|
|
212
|
+
const handler = findHandlerByTrigger({
|
|
213
|
+
trigger,
|
|
214
|
+
editorState
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (!handler) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return handler;
|
|
222
|
+
}; // This is an internal tool to be used inside of others Editor Plugins
|
|
223
|
+
// We shouldn't public export this method.
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
export const createInternalTypeAheadTools = editorView => {
|
|
227
|
+
const props = {
|
|
228
|
+
editorView
|
|
229
|
+
};
|
|
230
|
+
return {
|
|
231
|
+
findTypeAheadHandler: find(props),
|
|
232
|
+
openTypeAheadHandler: openTypeAhead
|
|
233
|
+
};
|
|
234
|
+
};
|
|
206
235
|
export const createTypeAheadTools = editorView => {
|
|
207
236
|
const props = {
|
|
208
237
|
editorView
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TextSelection } from 'prosemirror-state';
|
|
2
2
|
import { pluginKey } from '../pm-plugins/key';
|
|
3
3
|
import { ACTIONS } from '../pm-plugins/actions';
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export const openTypeAhead = props => tr => {
|
|
5
|
+
const {
|
|
6
|
+
triggerHandler,
|
|
7
|
+
inputMethod,
|
|
8
|
+
query
|
|
9
|
+
} = props;
|
|
9
10
|
tr.setMeta(pluginKey, {
|
|
10
11
|
action: ACTIONS.OPEN_TYPEAHEAD_AT_CURSOR,
|
|
11
12
|
params: {
|
|
@@ -14,6 +15,17 @@ export const openTypeAheadAtCursor = ({
|
|
|
14
15
|
query
|
|
15
16
|
}
|
|
16
17
|
});
|
|
18
|
+
};
|
|
19
|
+
export const openTypeAheadAtCursor = ({
|
|
20
|
+
triggerHandler,
|
|
21
|
+
inputMethod,
|
|
22
|
+
query
|
|
23
|
+
}) => tr => {
|
|
24
|
+
openTypeAhead({
|
|
25
|
+
triggerHandler,
|
|
26
|
+
inputMethod,
|
|
27
|
+
query
|
|
28
|
+
})(tr);
|
|
17
29
|
const {
|
|
18
30
|
selection
|
|
19
31
|
} = tr;
|