@atlaskit/editor-core 161.0.0 → 162.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/cjs/actions/index.js +76 -48
- package/dist/cjs/extensibility.js +2 -2
- package/dist/cjs/labs/next/full-page.js +1 -1
- 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/FloatingContextualMenu/index.js +3 -1
- 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.css.js +17 -8
- package/dist/cjs/plugins/table/ui/ui-styles.css.js +39 -25
- 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 +1 -1
- package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +1 -1
- package/dist/cjs/ui/ContentStyles/index.js +32 -9
- 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/FloatingContextualMenu/index.js +2 -1
- 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 +51 -26
- package/dist/es2019/plugins/table/ui/ui-styles.css.js +57 -56
- 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 +45 -23
- 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/FloatingContextualMenu/index.js +2 -1
- 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.css.js +10 -6
- package/dist/esm/plugins/table/ui/ui-styles.css.js +20 -11
- 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 +27 -9
- 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/LayoutButton/index.d.ts +0 -1
- package/dist/types/plugins/table/ui/common-styles.css.d.ts +6 -3
- package/dist/types/plugins/table/ui/ui-styles.css.d.ts +15 -14
- 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
|
@@ -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),
|
|
@@ -432,7 +432,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
432
432
|
if (this.overflowShadowsObserver) {
|
|
433
433
|
var _this$state$stickyHea;
|
|
434
434
|
|
|
435
|
-
this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, containsHeaderRow(
|
|
435
|
+
this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, containsHeaderRow(getNode()));
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
|
|
@@ -507,7 +507,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
507
507
|
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined; //dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
|
|
508
508
|
|
|
509
509
|
var tableHeight = tableRef && !tableRenderOptimization ? tableRef.offsetHeight : undefined;
|
|
510
|
-
var hasHeaderRow = containsHeaderRow(
|
|
510
|
+
var hasHeaderRow = containsHeaderRow(node);
|
|
511
511
|
var rowControls = /*#__PURE__*/React.createElement("div", {
|
|
512
512
|
className: ClassName.ROW_CONTROLS_WRAPPER
|
|
513
513
|
}, /*#__PURE__*/React.createElement(TableFloatingControls, {
|
|
@@ -9,12 +9,6 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
11
11
|
|
|
12
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
-
|
|
14
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
-
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
-
|
|
18
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
19
13
|
|
|
20
14
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -25,12 +19,12 @@ import ReactNodeView from '../../../nodeviews/ReactNodeView';
|
|
|
25
19
|
import WithPluginState from '../../../ui/WithPluginState';
|
|
26
20
|
import { pluginKey as widthPluginKey } from '../../width';
|
|
27
21
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
28
|
-
import { getPluginState
|
|
22
|
+
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
23
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
29
24
|
import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing';
|
|
30
25
|
import { generateColgroup } from '../pm-plugins/table-resizing/utils';
|
|
31
26
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
32
27
|
import TableComponent from './TableComponent';
|
|
33
|
-
import { setTableSize } from '../commands';
|
|
34
28
|
import { getFeatureFlags } from '../../feature-flags-context';
|
|
35
29
|
import { EmitterEvents } from '../../../extensibility';
|
|
36
30
|
|
|
@@ -72,7 +66,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
72
66
|
_defineProperty(_assertThisInitialized(_this), "hasHoveredRows", false);
|
|
73
67
|
|
|
74
68
|
_this.getPos = props.getPos;
|
|
75
|
-
_this.editorView = props.view;
|
|
76
69
|
_this.tableRenderOptimization = props.tableRenderOptimization;
|
|
77
70
|
_this.eventDispatcher = props.eventDispatcher;
|
|
78
71
|
return _this;
|
|
@@ -81,42 +74,18 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
81
74
|
_createClass(TableView, [{
|
|
82
75
|
key: "getContentDOM",
|
|
83
76
|
value: function getContentDOM() {
|
|
84
|
-
var _window,
|
|
85
|
-
_this2 = this;
|
|
86
|
-
|
|
87
77
|
var rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
|
|
88
78
|
|
|
89
79
|
if (rendered.dom) {
|
|
90
80
|
this.table = rendered.dom;
|
|
91
81
|
}
|
|
92
82
|
|
|
93
|
-
if (this.tableRenderOptimization && this.table && !this.resizeObserver && (_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
|
|
94
|
-
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
95
|
-
var _iterator = _createForOfIteratorHelper(entries),
|
|
96
|
-
_step;
|
|
97
|
-
|
|
98
|
-
try {
|
|
99
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
100
|
-
var entry = _step.value;
|
|
101
|
-
var height = entry.contentRect ? entry.contentRect.height : entry.target.offsetHeight;
|
|
102
|
-
var width = entry.contentRect ? entry.contentRect.width : entry.target.offsetWidth;
|
|
103
|
-
setTableSize(height, width)(_this2.editorView.state, _this2.editorView.dispatch);
|
|
104
|
-
}
|
|
105
|
-
} catch (err) {
|
|
106
|
-
_iterator.e(err);
|
|
107
|
-
} finally {
|
|
108
|
-
_iterator.f();
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
this.resizeObserver.observe(this.table);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
83
|
return rendered;
|
|
115
84
|
}
|
|
116
85
|
}, {
|
|
117
86
|
key: "setDomAttrs",
|
|
118
87
|
value: function setDomAttrs(node) {
|
|
119
|
-
var
|
|
88
|
+
var _this2 = this;
|
|
120
89
|
|
|
121
90
|
if (!this.table) {
|
|
122
91
|
return;
|
|
@@ -124,13 +93,13 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
124
93
|
|
|
125
94
|
var attrs = tableAttributes(node);
|
|
126
95
|
Object.keys(attrs).forEach(function (attr) {
|
|
127
|
-
|
|
96
|
+
_this2.table.setAttribute(attr, attrs[attr]);
|
|
128
97
|
});
|
|
129
98
|
}
|
|
130
99
|
}, {
|
|
131
100
|
key: "render",
|
|
132
101
|
value: function render(props, forwardRef) {
|
|
133
|
-
var
|
|
102
|
+
var _this3 = this;
|
|
134
103
|
|
|
135
104
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
136
105
|
plugins: {
|
|
@@ -156,7 +125,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
156
125
|
tableActive: tableActive,
|
|
157
126
|
ordering: pluginState.ordering,
|
|
158
127
|
tableResizingPluginState: tableResizingPluginState,
|
|
159
|
-
getNode:
|
|
128
|
+
getNode: _this3.getNode,
|
|
160
129
|
containerWidth: containerWidth,
|
|
161
130
|
contentDOM: forwardRef
|
|
162
131
|
});
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
4
|
import { DecorationSet } from 'prosemirror-view';
|
|
5
|
-
import { pluginKey as tablePluginKey } from '../plugin-
|
|
5
|
+
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
6
6
|
import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils';
|
|
7
7
|
export var pluginKey = new PluginKey('tableDecorationsPlugin');
|
|
8
8
|
export var getDecorations = function getDecorations(state) {
|
|
@@ -18,7 +18,8 @@ import { TableCssClassName as ClassName } from '../types';
|
|
|
18
18
|
import { findControlsHoverDecoration, updateResizeHandles } from '../utils';
|
|
19
19
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '../../analytics';
|
|
20
20
|
import { defaultTableSelection } from './default-table-selection';
|
|
21
|
-
import { createPluginState, getPluginState
|
|
21
|
+
import { createPluginState, getPluginState } from './plugin-factory';
|
|
22
|
+
import { pluginKey } from './plugin-key';
|
|
22
23
|
import TableCellNodeView from '../nodeviews/tableCell';
|
|
23
24
|
var isBreakoutEnabled;
|
|
24
25
|
var isDynamicTextSizingEnabled;
|
|
@@ -4,11 +4,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
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
|
-
import { PluginKey } from 'prosemirror-state';
|
|
8
7
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
9
8
|
import { handleDocOrSelectionChanged } from '../handlers';
|
|
10
9
|
import reducer from '../reducer';
|
|
11
|
-
|
|
10
|
+
import { pluginKey } from './plugin-key';
|
|
12
11
|
|
|
13
12
|
var _pluginFactory = pluginFactory(pluginKey, reducer, {
|
|
14
13
|
mapping: function mapping(tr, pluginState) {
|
package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js
CHANGED
|
@@ -22,6 +22,8 @@ export var createPlugin = function createPlugin() {
|
|
|
22
22
|
// DOM selection syncing during pointer drag.
|
|
23
23
|
//
|
|
24
24
|
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
25
|
+
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
26
|
+
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
25
27
|
// This fix removes the selectionToDOM from the view
|
|
26
28
|
// prior to selectionToDOM being called.
|
|
27
29
|
// selectionToDOM checks if there is an "active"
|
|
@@ -6,7 +6,7 @@ import { pluginKey as widthPluginKey } from '../../../../../plugins/width';
|
|
|
6
6
|
import { mapChildren } from '../../../../../utils/slice';
|
|
7
7
|
import { TableCssClassName as ClassName, TableCssClassName } from '../../../types';
|
|
8
8
|
import { stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableControlsSpacing, tableScrollbarOffset } from '../../../ui/consts';
|
|
9
|
-
import { pluginKey as tablePluginKey } from '../../plugin-
|
|
9
|
+
import { pluginKey as tablePluginKey } from '../../plugin-key';
|
|
10
10
|
import { syncStickyRowToTable, updateStickyMargins as updateTableMargin } from '../../table-resizing/utils/dom';
|
|
11
11
|
import { updateStickyState } from '../commands';
|
|
12
12
|
import { getTop, getTree } from './dom';
|
|
@@ -80,13 +80,6 @@ export default (function (pluginState, action) {
|
|
|
80
80
|
|
|
81
81
|
return _objectSpread(_objectSpread({}, pluginState), action.data);
|
|
82
82
|
|
|
83
|
-
case 'SET_TABLE_SIZE':
|
|
84
|
-
if (pluginState.tableWidth !== action.data.tableWidth || pluginState.tableHeight !== action.data.tableHeight) {
|
|
85
|
-
return _objectSpread(_objectSpread({}, pluginState), action.data);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return pluginState;
|
|
89
|
-
|
|
90
83
|
case 'SET_TABLE_REF':
|
|
91
84
|
case 'HOVER_ROWS':
|
|
92
85
|
case 'HOVER_COLUMNS':
|