@atlaskit/editor-plugin-paste 1.7.0 → 1.7.2
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 +14 -0
- package/dist/cjs/handlers.js +3 -3
- package/dist/es2019/handlers.js +4 -4
- package/dist/esm/handlers.js +4 -4
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 1.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#124517](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124517)
|
|
8
|
+
[`d7e6d3d76a05d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d7e6d3d76a05d) -
|
|
9
|
+
Removed FF platform.editor.handle-paste-for-action-in-panel
|
|
10
|
+
|
|
11
|
+
## 1.7.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 1.7.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/cjs/handlers.js
CHANGED
|
@@ -153,7 +153,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
153
153
|
var transformedSlice = compose.apply(null, filters)(slice);
|
|
154
154
|
var isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
|
|
155
155
|
var tr = (0, _history.closeHistory)(state.tr);
|
|
156
|
-
if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && (0,
|
|
156
|
+
if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && (0, _util.isEmptyNode)(panelNode) && selection.$from.node() === selection.$to.node()) {
|
|
157
157
|
return Boolean((0, _lists.insertSliceInsideOfPanelNodeSelected)(panelNode)({
|
|
158
158
|
tr: tr,
|
|
159
159
|
slice: slice
|
|
@@ -959,7 +959,7 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
959
959
|
var lastChild = slice.content.lastChild;
|
|
960
960
|
var $nextPos = tr.doc.resolve(tr.mapping.map(selection.from));
|
|
961
961
|
var nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? _state.TextSelection.findFrom($nextPos, -1, true) : new _selection.GapCursorSelection($nextPos, _selection.Side.RIGHT);
|
|
962
|
-
if ((0, _platformFeatureFlags.
|
|
962
|
+
if (nextSelection && (0, _platformFeatureFlags.fg)('platform.editor.place-cursor-inside-text-block')) {
|
|
963
963
|
tr.setSelection(nextSelection);
|
|
964
964
|
} else if ((0, _utils.insideTableCell)(state) && shouldUpdateCursorPosAfterPaste) {
|
|
965
965
|
var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
@@ -1038,5 +1038,5 @@ var handleSelectedTable = exports.handleSelectedTable = function handleSelectedT
|
|
|
1038
1038
|
};
|
|
1039
1039
|
function checkTaskListInList(state, slice) {
|
|
1040
1040
|
var _slice$content$firstC4;
|
|
1041
|
-
return Boolean((0, _utils.isInListItem)(state) &&
|
|
1041
|
+
return Boolean((0, _utils.isInListItem)(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || '') && (0, _platformFeatureFlags.fg)('platform.editor.allow-action-in-list'));
|
|
1042
1042
|
}
|
package/dist/es2019/handlers.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
|
|
|
9
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
11
11
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
12
|
-
import {
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
// TODO: ED-20519 Needs Macro extraction
|
|
14
14
|
|
|
15
15
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
@@ -125,7 +125,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
125
125
|
const transformedSlice = compose.apply(null, filters)(slice);
|
|
126
126
|
const isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
|
|
127
127
|
const tr = closeHistory(state.tr);
|
|
128
|
-
if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel &&
|
|
128
|
+
if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && isEmptyNode(panelNode) && selection.$from.node() === selection.$to.node()) {
|
|
129
129
|
return Boolean(insertSliceInsideOfPanelNodeSelected(panelNode)({
|
|
130
130
|
tr,
|
|
131
131
|
slice
|
|
@@ -937,7 +937,7 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
937
937
|
const lastChild = slice.content.lastChild;
|
|
938
938
|
const $nextPos = tr.doc.resolve(tr.mapping.map(selection.from));
|
|
939
939
|
const nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? TextSelection.findFrom($nextPos, -1, true) : new GapCursorSelection($nextPos, Side.RIGHT);
|
|
940
|
-
if (
|
|
940
|
+
if (nextSelection && fg('platform.editor.place-cursor-inside-text-block')) {
|
|
941
941
|
tr.setSelection(nextSelection);
|
|
942
942
|
} else if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
|
|
943
943
|
const nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
@@ -1014,5 +1014,5 @@ export const handleSelectedTable = editorAnalyticsAPI => slice => (state, dispat
|
|
|
1014
1014
|
};
|
|
1015
1015
|
export function checkTaskListInList(state, slice) {
|
|
1016
1016
|
var _slice$content$firstC4, _slice$content$firstC5;
|
|
1017
|
-
return Boolean(isInListItem(state) &&
|
|
1017
|
+
return Boolean(isInListItem(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 ? void 0 : (_slice$content$firstC5 = _slice$content$firstC4.type) === null || _slice$content$firstC5 === void 0 ? void 0 : _slice$content$firstC5.name) || '') && fg('platform.editor.allow-action-in-list'));
|
|
1018
1018
|
}
|
package/dist/esm/handlers.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
|
|
|
17
17
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
18
18
|
import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
19
19
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
20
|
-
import {
|
|
20
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
21
|
// TODO: ED-20519 Needs Macro extraction
|
|
22
22
|
|
|
23
23
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
@@ -130,7 +130,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
|
|
|
130
130
|
var transformedSlice = compose.apply(null, filters)(slice);
|
|
131
131
|
var isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
|
|
132
132
|
var tr = closeHistory(state.tr);
|
|
133
|
-
if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel &&
|
|
133
|
+
if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && isEmptyNode(panelNode) && selection.$from.node() === selection.$to.node()) {
|
|
134
134
|
return Boolean(insertSliceInsideOfPanelNodeSelected(panelNode)({
|
|
135
135
|
tr: tr,
|
|
136
136
|
slice: slice
|
|
@@ -936,7 +936,7 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
936
936
|
var lastChild = slice.content.lastChild;
|
|
937
937
|
var $nextPos = tr.doc.resolve(tr.mapping.map(selection.from));
|
|
938
938
|
var nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? TextSelection.findFrom($nextPos, -1, true) : new GapCursorSelection($nextPos, Side.RIGHT);
|
|
939
|
-
if (
|
|
939
|
+
if (nextSelection && fg('platform.editor.place-cursor-inside-text-block')) {
|
|
940
940
|
tr.setSelection(nextSelection);
|
|
941
941
|
} else if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
|
|
942
942
|
var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
@@ -1015,5 +1015,5 @@ export var handleSelectedTable = function handleSelectedTable(editorAnalyticsAPI
|
|
|
1015
1015
|
};
|
|
1016
1016
|
export function checkTaskListInList(state, slice) {
|
|
1017
1017
|
var _slice$content$firstC4;
|
|
1018
|
-
return Boolean(isInListItem(state) &&
|
|
1018
|
+
return Boolean(isInListItem(state) && ['taskList', 'taskItem'].includes(((_slice$content$firstC4 = slice.content.firstChild) === null || _slice$content$firstC4 === void 0 || (_slice$content$firstC4 = _slice$content$firstC4.type) === null || _slice$content$firstC4 === void 0 ? void 0 : _slice$content$firstC4.name) || '') && fg('platform.editor.allow-action-in-list'));
|
|
1019
1019
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
36
|
+
"@atlaskit/editor-common": "^87.0.0",
|
|
37
37
|
"@atlaskit/editor-markdown-transformer": "^5.10.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.6.0",
|
|
39
39
|
"@atlaskit/editor-plugin-annotation": "^1.18.0",
|
|
@@ -118,9 +118,6 @@
|
|
|
118
118
|
"platform.editor.media.fix-copy-paste-excel_62g4s": {
|
|
119
119
|
"type": "boolean"
|
|
120
120
|
},
|
|
121
|
-
"platform.editor.handle-paste-for-action-in-panel": {
|
|
122
|
-
"type": "boolean"
|
|
123
|
-
},
|
|
124
121
|
"platform.editor.place-cursor-inside-text-block": {
|
|
125
122
|
"type": "boolean"
|
|
126
123
|
},
|