@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
|
@@ -5,9 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
7
|
import { Fragment, Slice } from 'prosemirror-model';
|
|
8
|
-
import { ReplaceAroundStep } from 'prosemirror-transform';
|
|
9
8
|
import * as baseCommand from 'prosemirror-commands';
|
|
10
|
-
import * as baseListCommand from 'prosemirror-schema-list';
|
|
11
9
|
import { hasParentNodeOfType, findPositionOfNodeBefore } from 'prosemirror-utils';
|
|
12
10
|
import { hasVisibleContent, isNodeEmpty } from '../../../utils/document';
|
|
13
11
|
import { findCutBefore, isEmptySelectionAtStart, isFirstChildOfParent, filter } from '../../../utils/commands';
|
|
@@ -20,8 +18,10 @@ import { getCommonListAnalyticsAttributes } from '../utils/analytics';
|
|
|
20
18
|
import { listBackspace } from './listBackspace';
|
|
21
19
|
import { joinListItemForward } from './join-list-item-forward';
|
|
22
20
|
import { convertListType } from '../actions/conversions';
|
|
21
|
+
import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
|
|
23
22
|
import { outdentList } from './outdent-list';
|
|
24
23
|
import { indentList } from './indent-list';
|
|
24
|
+
import { moveTargetIntoList } from '../utils/replace-content';
|
|
25
25
|
export { outdentList, indentList };
|
|
26
26
|
export var enterKeyCommand = function enterKeyCommand(state, dispatch) {
|
|
27
27
|
var selection = state.selection;
|
|
@@ -89,8 +89,8 @@ function untoggleSelectedList(tr) {
|
|
|
89
89
|
|
|
90
90
|
export function toggleList(inputMethod, listType) {
|
|
91
91
|
return function (state, dispatch) {
|
|
92
|
-
var
|
|
93
|
-
var listInsideSelection = selectionContainsList(
|
|
92
|
+
var tr = state.tr;
|
|
93
|
+
var listInsideSelection = selectionContainsList(tr);
|
|
94
94
|
var listNodeType = state.schema.nodes[listType];
|
|
95
95
|
var actionSubjectId = listType === 'bulletList' ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
96
96
|
|
|
@@ -101,9 +101,9 @@ export function toggleList(inputMethod, listType) {
|
|
|
101
101
|
var transformedFrom = listInsideSelection.type.name === 'bulletList' ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
102
102
|
|
|
103
103
|
if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type.name) === listType && (toNode === null || toNode === void 0 ? void 0 : toNode.type.name) === listType) {
|
|
104
|
-
var
|
|
105
|
-
untoggleSelectedList(
|
|
106
|
-
addAnalytics(state,
|
|
104
|
+
var _tr2 = state.tr;
|
|
105
|
+
untoggleSelectedList(_tr2);
|
|
106
|
+
addAnalytics(state, _tr2, {
|
|
107
107
|
action: ACTION.CONVERTED,
|
|
108
108
|
actionSubject: ACTION_SUBJECT.LIST,
|
|
109
109
|
actionSubjectId: ACTION_SUBJECT_ID.TEXT,
|
|
@@ -115,17 +115,17 @@ export function toggleList(inputMethod, listType) {
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
if (dispatch) {
|
|
118
|
-
dispatch(
|
|
118
|
+
dispatch(_tr2);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
return true;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
convertListType({
|
|
125
|
-
tr:
|
|
125
|
+
tr: tr,
|
|
126
126
|
nextListNodeType: listNodeType
|
|
127
127
|
});
|
|
128
|
-
addAnalytics(state,
|
|
128
|
+
addAnalytics(state, tr, {
|
|
129
129
|
action: ACTION.CONVERTED,
|
|
130
130
|
actionSubject: ACTION_SUBJECT.LIST,
|
|
131
131
|
actionSubjectId: actionSubjectId,
|
|
@@ -136,17 +136,11 @@ export function toggleList(inputMethod, listType) {
|
|
|
136
136
|
})
|
|
137
137
|
});
|
|
138
138
|
} else {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// until after wrapInList, since any changes made to it will be discarded when it
|
|
145
|
-
// gets replaced with the transaction generated by wrapInList.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
wrapInList(listNodeType)(state, replaceCurrentTr);
|
|
149
|
-
addAnalytics(state, customTr, {
|
|
139
|
+
// Need to have this before wrapInList so the wrapping is done with valid content
|
|
140
|
+
// For example, if trying to convert centre or right aligned paragraphs to lists
|
|
141
|
+
sanitiseMarksInSelection(tr, listNodeType);
|
|
142
|
+
wrapInListAndJoin(listNodeType, tr);
|
|
143
|
+
addAnalytics(state, tr, {
|
|
150
144
|
action: ACTION.INSERTED,
|
|
151
145
|
actionSubject: ACTION_SUBJECT.LIST,
|
|
152
146
|
actionSubjectId: actionSubjectId,
|
|
@@ -155,18 +149,16 @@ export function toggleList(inputMethod, listType) {
|
|
|
155
149
|
inputMethod: inputMethod
|
|
156
150
|
}
|
|
157
151
|
});
|
|
158
|
-
} //
|
|
159
|
-
//
|
|
152
|
+
} // If document wasn't changed, return false from the command to indicate that the
|
|
153
|
+
// editing action failed
|
|
160
154
|
|
|
161
155
|
|
|
162
|
-
if (!
|
|
156
|
+
if (!tr.docChanged) {
|
|
163
157
|
return false;
|
|
164
158
|
}
|
|
165
159
|
|
|
166
|
-
sanitiseMarksInSelection(customTr, listNodeType);
|
|
167
|
-
|
|
168
160
|
if (dispatch) {
|
|
169
|
-
dispatch(
|
|
161
|
+
dispatch(tr);
|
|
170
162
|
}
|
|
171
163
|
|
|
172
164
|
return true;
|
|
@@ -180,11 +172,6 @@ export function toggleOrderedList(view) {
|
|
|
180
172
|
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INPUT_METHOD.TOOLBAR;
|
|
181
173
|
return toggleList(inputMethod, 'orderedList')(view.state, view.dispatch);
|
|
182
174
|
}
|
|
183
|
-
export function wrapInList(nodeType) {
|
|
184
|
-
return baseCommand.autoJoin(baseListCommand.wrapInList(nodeType), function (before, after) {
|
|
185
|
-
return before.type === after.type && before.type === nodeType;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
175
|
/**
|
|
189
176
|
* Implementation taken and modified for our needs from PM
|
|
190
177
|
* @param itemType Node
|
|
@@ -315,8 +302,20 @@ var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
|
|
|
315
302
|
var list = $cut.nodeBefore.copy($cut.nodeBefore.content.append(Fragment.from(listItem.createChecked({}, $cut.nodeAfter))));
|
|
316
303
|
tr.replaceWith(nodeBeforePos, $from.pos + $cut.nodeAfter.nodeSize, list);
|
|
317
304
|
} else {
|
|
318
|
-
|
|
319
|
-
|
|
305
|
+
var step = moveTargetIntoList({
|
|
306
|
+
insertPosition: $lastNode.pos,
|
|
307
|
+
$target: $cut
|
|
308
|
+
}); // ED-13966: check if the step will cause an ProseMirror error
|
|
309
|
+
// if there's an error don't apply the step as it will might lead into a data loss.
|
|
310
|
+
// It doesn't play well with media being a leaf node.
|
|
311
|
+
|
|
312
|
+
var stepResult = state.tr.maybeStep(step);
|
|
313
|
+
|
|
314
|
+
if (stepResult.failed) {
|
|
315
|
+
return false;
|
|
316
|
+
} else {
|
|
317
|
+
tr = state.tr.step(step);
|
|
318
|
+
}
|
|
320
319
|
} // find out if there's now another list following and join them
|
|
321
320
|
// as in, [list, p, list] => [list with p, list], and we want [joined list]
|
|
322
321
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReplaceAroundStep, ReplaceStep } from 'prosemirror-transform';
|
|
2
|
+
export var moveTargetIntoList = function moveTargetIntoList(_ref) {
|
|
3
|
+
var _$target$nodeAfter;
|
|
4
|
+
|
|
5
|
+
var insertPosition = _ref.insertPosition,
|
|
6
|
+
$target = _ref.$target;
|
|
7
|
+
// take the text content of the paragraph and insert after the paragraph up until before the the cut
|
|
8
|
+
var from = insertPosition;
|
|
9
|
+
var to = $target.pos + (((_$target$nodeAfter = $target.nodeAfter) === null || _$target$nodeAfter === void 0 ? void 0 : _$target$nodeAfter.nodeSize) || 0); //$cut.pos + $cut.nodeAfter.nodeSize;
|
|
10
|
+
|
|
11
|
+
var gapFrom = $target.posAtIndex(0, $target.depth + 1); // start pos of the child
|
|
12
|
+
|
|
13
|
+
var gapTo = $target.doc.resolve(gapFrom).end(); // end pos of the paragraph
|
|
14
|
+
|
|
15
|
+
if (gapTo - gapFrom === 0) {
|
|
16
|
+
return new ReplaceStep(from, to, $target.doc.slice(insertPosition, $target.pos));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var step = new ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
|
|
20
|
+
return step;
|
|
21
|
+
};
|
|
@@ -178,7 +178,7 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
178
178
|
|
|
179
179
|
case 2:
|
|
180
180
|
contextIdentifierProvider = _context3.sent;
|
|
181
|
-
return _context3.abrupt("return", contextIdentifierProvider
|
|
181
|
+
return _context3.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
|
|
182
182
|
|
|
183
183
|
case 4:
|
|
184
184
|
case "end":
|
|
@@ -266,10 +266,10 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
266
266
|
var attrs = _this.getAttrs();
|
|
267
267
|
|
|
268
268
|
if (!attrs || attrs.type !== 'file') {
|
|
269
|
-
return
|
|
269
|
+
return null;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
return attrs.__contextId;
|
|
272
|
+
return attrs.__contextId || null;
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
_defineProperty(this, "updateDimensions", function (dimensions) {
|
|
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
5
|
-
import { css } from '
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
6
|
import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
7
7
|
import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { N60, B200 } from '@atlaskit/theme/colors';
|
|
@@ -252,4 +252,15 @@ export var calcMediaPxWidth = function calcMediaPxWidth(opts) {
|
|
|
252
252
|
|
|
253
253
|
var calcPctWidth = function calcPctWidth(containerWidth, pctWidth, origWidth, origHeight) {
|
|
254
254
|
return pctWidth && origWidth && origHeight && Math.ceil(calcPxFromPct(pctWidth / 100, containerWidth.lineLength || containerWidth.width));
|
|
255
|
-
};
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export function isCaptionNode(editorView) {
|
|
258
|
+
var $from = editorView.state.selection.$from;
|
|
259
|
+
var immediateWrapperParentNode = editorView.state.doc.nodeAt($from.before(Math.max($from.depth, 1)));
|
|
260
|
+
|
|
261
|
+
if (immediateWrapperParentNode && immediateWrapperParentNode.type.name === 'caption') {
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
@@ -14,7 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
14
|
|
|
15
15
|
import { closeHistory } from 'prosemirror-history';
|
|
16
16
|
import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
|
|
17
|
-
import { TextSelection } from 'prosemirror-state';
|
|
17
|
+
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
18
18
|
import { findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
|
|
19
19
|
import { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue } from '../../utils';
|
|
20
20
|
import { mapSlice } from '../../utils/slice';
|
|
@@ -61,8 +61,10 @@ export function handlePasteIntoTaskAndDecision(slice) {
|
|
|
61
61
|
taskList = _schema$nodes.taskList,
|
|
62
62
|
taskItem = _schema$nodes.taskItem,
|
|
63
63
|
text = _schema$nodes.text;
|
|
64
|
+
var isDecisionOrTaskNodeSelection = state.selection instanceof NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
|
|
65
|
+
var hasParentDecisionOrTaskItem = hasParentNodeOfType([decisionItem, taskItem])(state.selection);
|
|
64
66
|
|
|
65
|
-
if (!decisionItem || !decisionList || !taskList || !taskItem || !
|
|
67
|
+
if (!decisionItem || !decisionList || !taskList || !taskItem || !hasParentDecisionOrTaskItem && !isDecisionOrTaskNodeSelection) {
|
|
66
68
|
return false;
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -76,7 +78,15 @@ export function handlePasteIntoTaskAndDecision(slice) {
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
var transformedSlice = compose.apply(null, filters)(slice);
|
|
79
|
-
var tr = closeHistory(state.tr)
|
|
81
|
+
var tr = closeHistory(state.tr);
|
|
82
|
+
var transformedSliceIsValidNode = transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(transformedSlice.content.firstChild.type.name);
|
|
83
|
+
|
|
84
|
+
if (transformedSliceIsValidNode || isDecisionOrTaskNodeSelection) {
|
|
85
|
+
tr.replaceSelection(transformedSlice).scrollIntoView();
|
|
86
|
+
} else {
|
|
87
|
+
safeInsert(transformedSlice.content)(tr).scrollIntoView();
|
|
88
|
+
}
|
|
89
|
+
|
|
80
90
|
queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
81
91
|
|
|
82
92
|
if (dispatch) {
|
|
@@ -396,9 +406,13 @@ export function handleMediaSingle(inputMethod) {
|
|
|
396
406
|
};
|
|
397
407
|
};
|
|
398
408
|
}
|
|
399
|
-
export function
|
|
409
|
+
export function handleExpandPasteInTable(slice) {
|
|
400
410
|
return function (state, dispatch) {
|
|
401
|
-
|
|
411
|
+
var _slice$content$firstC;
|
|
412
|
+
|
|
413
|
+
// Do not handle expand if it's not being pasted into a table
|
|
414
|
+
// OR if it's nested within another node when being pasted into a table
|
|
415
|
+
if (!insideTable(state) || ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) !== 'expand') {
|
|
402
416
|
return false;
|
|
403
417
|
}
|
|
404
418
|
|
|
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
|
|
8
8
|
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents, withAnalytics } from '../../analytics';
|
|
9
9
|
import { getPasteSource } from '../util';
|
|
10
|
-
import { handlePasteAsPlainText, handlePasteIntoTaskAndDecision, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText,
|
|
10
|
+
import { handlePasteAsPlainText, handlePasteIntoTaskAndDecision, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText } from '../handlers';
|
|
11
11
|
import { pipe } from '../../../utils';
|
|
12
12
|
import { findParentNode } from 'prosemirror-utils';
|
|
13
13
|
import { mapSlice } from '../../../utils/slice';
|
|
@@ -248,7 +248,7 @@ export var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(vi
|
|
|
248
248
|
}))(slice);
|
|
249
249
|
};
|
|
250
250
|
export var handleExpandWithAnalytics = function handleExpandWithAnalytics(view, event, slice) {
|
|
251
|
-
return pipe(
|
|
251
|
+
return pipe(handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
|
|
252
252
|
type: PasteTypes.richText
|
|
253
253
|
}))(slice);
|
|
254
254
|
};
|
|
@@ -12,6 +12,23 @@ import { PlaceholderTextNodeView } from './placeholder-text-nodeview';
|
|
|
12
12
|
import { pluginKey } from './plugin-key';
|
|
13
13
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
|
|
14
14
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
15
|
+
import { isSelectionAtPlaceholder } from './selection-utils';
|
|
16
|
+
import { createInternalTypeAheadTools } from '../type-ahead/api';
|
|
17
|
+
|
|
18
|
+
var getOpenTypeAhead = function getOpenTypeAhead(view, content) {
|
|
19
|
+
var typeAheadAPI = createInternalTypeAheadTools(view);
|
|
20
|
+
var typeAheadHandler = typeAheadAPI.findTypeAheadHandler(content);
|
|
21
|
+
|
|
22
|
+
if (!typeAheadHandler || !typeAheadHandler.id) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return typeAheadAPI.openTypeAheadHandler({
|
|
27
|
+
triggerHandler: typeAheadHandler,
|
|
28
|
+
inputMethod: INPUT_METHOD.KEYBOARD
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
15
32
|
export function createPlugin(dispatch, options) {
|
|
16
33
|
var allowInserting = !!options.allowInserting;
|
|
17
34
|
return new SafePlugin({
|
|
@@ -82,6 +99,32 @@ export function createPlugin(dispatch, options) {
|
|
|
82
99
|
return;
|
|
83
100
|
},
|
|
84
101
|
props: {
|
|
102
|
+
handleDOMEvents: {
|
|
103
|
+
beforeinput: function beforeinput(view, event) {
|
|
104
|
+
var state = view.state;
|
|
105
|
+
|
|
106
|
+
if (event instanceof InputEvent && !event.isComposing && event.inputType === 'insertText' && isSelectionAtPlaceholder(view.state.selection)) {
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
var startNodePosition = state.selection.from;
|
|
110
|
+
var content = event.data || '';
|
|
111
|
+
var tr = view.state.tr;
|
|
112
|
+
tr.delete(startNodePosition, startNodePosition + 1);
|
|
113
|
+
var openTypeAhead = getOpenTypeAhead(view, content);
|
|
114
|
+
|
|
115
|
+
if (openTypeAhead) {
|
|
116
|
+
openTypeAhead(tr);
|
|
117
|
+
} else {
|
|
118
|
+
tr.insertText(content);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
view.dispatch(tr);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
85
128
|
nodeViews: {
|
|
86
129
|
placeholder: function placeholder(node, view, getPos) {
|
|
87
130
|
return new PlaceholderTextNodeView(node, view, getPos);
|
|
@@ -183,7 +226,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
183
226
|
});
|
|
184
227
|
},
|
|
185
228
|
action: function action(insert, state) {
|
|
186
|
-
var tr =
|
|
229
|
+
var tr = state.tr;
|
|
187
230
|
tr.setMeta(pluginKey, {
|
|
188
231
|
showInsertPanelAt: tr.selection.anchor
|
|
189
232
|
});
|
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Selection } from 'prosemirror-state';
|
|
4
|
+
import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
5
|
+
|
|
6
|
+
var serializePlaceholderNode = function serializePlaceholderNode(node) {
|
|
7
|
+
var element = document.createElement('span');
|
|
8
|
+
element.classList.add('pm-placeholder');
|
|
9
|
+
|
|
10
|
+
if (browser.gecko) {
|
|
11
|
+
element.setAttribute('contenteditable', 'true');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
element.innerText = ZERO_WIDTH_SPACE;
|
|
15
|
+
var elementChildren = document.createElement('span');
|
|
16
|
+
elementChildren.classList.add('pm-placeholder__text');
|
|
17
|
+
elementChildren.dataset.placeholder = node.attrs.text;
|
|
18
|
+
elementChildren.setAttribute('contenteditable', 'false');
|
|
19
|
+
element.appendChild(elementChildren);
|
|
20
|
+
|
|
21
|
+
if (browser.safari) {
|
|
22
|
+
element.appendChild(document.createTextNode(ZERO_WIDTH_SPACE));
|
|
23
|
+
} else {
|
|
24
|
+
element.appendChild(document.createElement('wbr'));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return element;
|
|
28
|
+
};
|
|
29
|
+
|
|
5
30
|
export var PlaceholderTextNodeView = /*#__PURE__*/function () {
|
|
6
31
|
function PlaceholderTextNodeView(node, view, getPos) {
|
|
7
32
|
_classCallCheck(this, PlaceholderTextNodeView);
|
|
@@ -9,34 +34,56 @@ export var PlaceholderTextNodeView = /*#__PURE__*/function () {
|
|
|
9
34
|
this.node = node;
|
|
10
35
|
this.view = view;
|
|
11
36
|
this.getPos = getPos;
|
|
12
|
-
|
|
13
|
-
this.
|
|
37
|
+
this.dom = serializePlaceholderNode(this.node);
|
|
38
|
+
this.getPos = getPos;
|
|
14
39
|
}
|
|
15
40
|
|
|
16
41
|
_createClass(PlaceholderTextNodeView, [{
|
|
42
|
+
key: "stopEvent",
|
|
43
|
+
value: function stopEvent(e) {
|
|
44
|
+
if (e.type === 'mousedown' && typeof this.getPos === 'function') {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
var _view = this.view;
|
|
47
|
+
var startNodePosition = this.getPos();
|
|
48
|
+
var tr = _view.state.tr;
|
|
49
|
+
tr.setSelection(Selection.near(tr.doc.resolve(startNodePosition)));
|
|
50
|
+
|
|
51
|
+
_view.dispatch(tr);
|
|
52
|
+
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
17
59
|
key: "ignoreMutation",
|
|
18
60
|
value: function ignoreMutation(record) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// when we detect a characterData mutation inside
|
|
61
|
+
if (typeof this.getPos !== 'function' || record.type !== 'selection') {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
24
65
|
var view = this.view,
|
|
25
|
-
dom = this.dom,
|
|
26
66
|
node = this.node;
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
var placeholderStartPosition = this.getPos();
|
|
68
|
+
var placeholderEndPosition = this.getPos() + node.nodeSize;
|
|
69
|
+
var selection = view.state.selection; // when the selection is set right after the placeholder.
|
|
70
|
+
// we should let ProseMirror deal with this edge-case
|
|
71
|
+
|
|
72
|
+
if (selection.from === placeholderEndPosition) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var isSelectionAtPlaceholder = selection.from === placeholderStartPosition;
|
|
77
|
+
var isSelectionAfterlaceholder = selection.from > placeholderEndPosition;
|
|
78
|
+
|
|
79
|
+
if (isSelectionAtPlaceholder || isSelectionAfterlaceholder) {
|
|
80
|
+
var tr = view.state.tr;
|
|
81
|
+
tr.setSelection(Selection.near(tr.doc.resolve(placeholderEndPosition)));
|
|
36
82
|
view.dispatch(tr);
|
|
83
|
+
return true;
|
|
37
84
|
}
|
|
38
85
|
|
|
39
|
-
return
|
|
86
|
+
return true;
|
|
40
87
|
}
|
|
41
88
|
}]);
|
|
42
89
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TextSelection } from 'prosemirror-state';
|
|
2
|
+
export var isSelectionAtPlaceholder = function isSelectionAtPlaceholder(selection) {
|
|
3
|
+
if (!(selection instanceof TextSelection) || !selection.$cursor) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
var node = selection.$cursor.doc.nodeAt(selection.$cursor.pos);
|
|
8
|
+
return (node === null || node === void 0 ? void 0 : node.type.name) === 'placeholder';
|
|
9
|
+
};
|
|
@@ -4,4 +4,5 @@ var _templateObject;
|
|
|
4
4
|
|
|
5
5
|
import { css } from 'styled-components';
|
|
6
6
|
import { N300 } from '@atlaskit/theme/colors';
|
|
7
|
-
|
|
7
|
+
import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
export var placeholderTextStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror span[data-placeholder] {\n color: ", ";\n display: inline;\n }\n\n .ProseMirror span.pm-placeholder {\n display: inline;\n color: ", ";\n }\n .ProseMirror span.pm-placeholder__text {\n display: inline;\n color: ", ";\n }\n\n .ProseMirror span.pm-placeholder.", " {\n ", "\n }\n\n .ProseMirror span.pm-placeholder__text[data-placeholder]::after {\n color: ", ";\n cursor: text;\n content: attr(data-placeholder);\n display: inline;\n }\n"])), N300, N300, N300, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Background]), N300);
|
|
@@ -2,6 +2,6 @@ export { hoverColumns, hoverRows, hoverTable, hoverMergedCells, clearHoverSelect
|
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
5
|
-
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectRow, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations
|
|
5
|
+
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectRow, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations } from './misc';
|
|
6
6
|
export { sortByColumn } from './sort';
|
|
7
7
|
export { goToNextCell } from './go-to-next-cell';
|
|
@@ -99,7 +99,7 @@ export var insertColumn = function insertColumn(column) {
|
|
|
99
99
|
export var insertRow = function insertRow(row, moveCursorToTheNewRow) {
|
|
100
100
|
return function (state, dispatch) {
|
|
101
101
|
// Don't clone the header row
|
|
102
|
-
var headerRowEnabled = checkIfHeaderRowEnabled(state);
|
|
102
|
+
var headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
|
|
103
103
|
var clonePreviousRow = headerRowEnabled && row > 1 || !headerRowEnabled && row > 0; // When the table have header row
|
|
104
104
|
// we should not add row on the position zero
|
|
105
105
|
|
|
@@ -19,7 +19,7 @@ import { createCommand, getPluginState } from '../pm-plugins/plugin-factory';
|
|
|
19
19
|
import { fixAutoSizedTable } from '../transforms';
|
|
20
20
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
21
21
|
import { createColumnControlsDecoration, createColumnSelectedDecoration } from '../utils/decoration';
|
|
22
|
-
import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, isIsolating } from '../utils/nodes';
|
|
22
|
+
import { checkIfNumberColumnEnabled, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, isIsolating } from '../utils/nodes';
|
|
23
23
|
import { updatePluginStateDecorations } from '../utils/update-plugin-state-decorations'; // #endregion
|
|
24
24
|
// #endregion
|
|
25
25
|
// #region Commands
|
|
@@ -49,8 +49,9 @@ export var setTableRef = function setTableRef(ref) {
|
|
|
49
49
|
tablePos: tablePos,
|
|
50
50
|
tableWrapperTarget: tableWrapperTarget,
|
|
51
51
|
layout: layout || 'default',
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
|
|
53
|
+
isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
|
|
54
|
+
isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
|
|
54
55
|
decorationSet: decorationSet,
|
|
55
56
|
resizeHandleColumnIndex: undefined
|
|
56
57
|
}
|
|
@@ -113,7 +114,7 @@ export var triggerUnlessTableHeader = function triggerUnlessTableHeader(command)
|
|
|
113
114
|
if (selection instanceof CellSelection) {
|
|
114
115
|
var rect = getSelectionRect(selection);
|
|
115
116
|
|
|
116
|
-
if (!checkIfHeaderRowEnabled(
|
|
117
|
+
if (!checkIfHeaderRowEnabled(selection) || rect && rect.top > 0) {
|
|
117
118
|
return command(state, dispatch, view);
|
|
118
119
|
}
|
|
119
120
|
}
|
|
@@ -404,17 +405,6 @@ export var addResizeHandleDecorations = function addResizeHandleDecorations(colu
|
|
|
404
405
|
return tr.setMeta('addToHistory', false);
|
|
405
406
|
});
|
|
406
407
|
};
|
|
407
|
-
export var setTableSize = function setTableSize(tableHeight, tableWidth) {
|
|
408
|
-
return createCommand({
|
|
409
|
-
type: 'SET_TABLE_SIZE',
|
|
410
|
-
data: {
|
|
411
|
-
tableHeight: tableHeight,
|
|
412
|
-
tableWidth: tableWidth
|
|
413
|
-
}
|
|
414
|
-
}, function (tr) {
|
|
415
|
-
return tr.setMeta('addToHistory', false);
|
|
416
|
-
});
|
|
417
|
-
};
|
|
418
408
|
export var autoSizeTable = function autoSizeTable(view, node, table, basePos, opts) {
|
|
419
409
|
view.dispatch(fixAutoSizedTable(view, node, table, basePos, opts));
|
|
420
410
|
return true;
|
|
@@ -345,7 +345,7 @@ export var toggleNumberColumnWithAnalytics = function toggleNumberColumnWithAnal
|
|
|
345
345
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
346
346
|
actionSubjectId: null,
|
|
347
347
|
attributes: {
|
|
348
|
-
newState: !checkIfNumberColumnEnabled(state),
|
|
348
|
+
newState: !checkIfNumberColumnEnabled(state.selection),
|
|
349
349
|
totalRowCount: totalRowCount,
|
|
350
350
|
totalColumnCount: totalColumnCount
|
|
351
351
|
},
|
|
@@ -12,8 +12,9 @@ import { isTableCollapsible } from './utils/collapse';
|
|
|
12
12
|
import { defaultTableSelection } from './pm-plugins/default-table-selection';
|
|
13
13
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
14
14
|
import { TableSortStep } from '@atlaskit/adf-schema/steps';
|
|
15
|
-
|
|
16
15
|
// #endregion
|
|
16
|
+
import { checkIfNumberColumnEnabled, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled } from './utils/nodes';
|
|
17
|
+
|
|
17
18
|
var nextTableSorting = function nextTableSorting(tr, table) {
|
|
18
19
|
var tableSortStep = tr.steps.find(function (step) {
|
|
19
20
|
return step instanceof TableSortStep;
|
|
@@ -70,7 +71,10 @@ var updateTableNodePluginState = function updateTableNodePluginState(_ref2) {
|
|
|
70
71
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), defaultTableSelection), {}, {
|
|
71
72
|
tableNode: tableNode,
|
|
72
73
|
ordering: nextTableSorting(tr, table),
|
|
73
|
-
resizeHandleColumnIndex: nextResizeHandleColumnIndex(tr, pluginState.resizeHandleColumnIndex)
|
|
74
|
+
resizeHandleColumnIndex: nextResizeHandleColumnIndex(tr, pluginState.resizeHandleColumnIndex),
|
|
75
|
+
isNumberColumnEnabled: checkIfNumberColumnEnabled(tr.selection),
|
|
76
|
+
isHeaderColumnEnabled: checkIfHeaderColumnEnabled(tr.selection),
|
|
77
|
+
isHeaderRowEnabled: checkIfHeaderRowEnabled(tr.selection)
|
|
74
78
|
});
|
|
75
79
|
};
|
|
76
80
|
};
|
|
@@ -15,7 +15,7 @@ import { createPlugin as createDecorationsPlugin } from './pm-plugins/decoration
|
|
|
15
15
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
16
16
|
import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap';
|
|
17
17
|
import { createPlugin } from './pm-plugins/main';
|
|
18
|
-
import { pluginKey } from './pm-plugins/plugin-
|
|
18
|
+
import { pluginKey } from './pm-plugins/plugin-key';
|
|
19
19
|
import { createPlugin as createStickyHeadersPlugin, findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from './pm-plugins/sticky-headers';
|
|
20
20
|
import { createPlugin as createFlexiResizingPlugin, pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
21
21
|
import { getToolbarConfig } from './toolbar';
|
|
@@ -25,7 +25,6 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
|
25
25
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
26
26
|
import LayoutButton from './ui/LayoutButton';
|
|
27
27
|
import { isLayoutSupported } from './utils';
|
|
28
|
-
import { getFeatureFlags } from '../feature-flags-context';
|
|
29
28
|
import { ErrorBoundary } from '../../ui/ErrorBoundary';
|
|
30
29
|
|
|
31
30
|
var tablesPlugin = function tablesPlugin(options) {
|
|
@@ -120,6 +119,8 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
120
119
|
}]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
|
|
121
120
|
// causing issues with table selections in Safari
|
|
122
121
|
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
122
|
+
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
123
|
+
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
123
124
|
|
|
124
125
|
if (browser.safari) {
|
|
125
126
|
plugins.push({
|
|
@@ -166,13 +167,8 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
166
167
|
insertRowButtonIndex = _ref9.insertRowButtonIndex,
|
|
167
168
|
isHeaderColumnEnabled = _ref9.isHeaderColumnEnabled,
|
|
168
169
|
isHeaderRowEnabled = _ref9.isHeaderRowEnabled,
|
|
169
|
-
tableWrapperTarget = _ref9.tableWrapperTarget
|
|
170
|
-
tableWidth = _ref9.tableWidth;
|
|
170
|
+
tableWrapperTarget = _ref9.tableWrapperTarget;
|
|
171
171
|
var allowControls = pluginConfig.allowControls;
|
|
172
|
-
|
|
173
|
-
var _ref10 = getFeatureFlags(state) || {},
|
|
174
|
-
tableRenderOptimization = _ref10.tableRenderOptimization;
|
|
175
|
-
|
|
176
172
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
177
173
|
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
178
174
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
@@ -222,15 +218,14 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
222
218
|
targetRef: tableWrapperTarget,
|
|
223
219
|
layout: layout,
|
|
224
220
|
isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
|
|
225
|
-
tableWidth: tableRenderOptimization ? tableWidth : undefined,
|
|
226
221
|
stickyHeader: stickyHeader
|
|
227
222
|
}));
|
|
228
223
|
}
|
|
229
224
|
}));
|
|
230
225
|
},
|
|
231
226
|
pluginsOptions: {
|
|
232
|
-
quickInsert: function quickInsert(
|
|
233
|
-
var formatMessage =
|
|
227
|
+
quickInsert: function quickInsert(_ref10) {
|
|
228
|
+
var formatMessage = _ref10.formatMessage;
|
|
234
229
|
return [{
|
|
235
230
|
id: 'table',
|
|
236
231
|
title: formatMessage(messages.table),
|