@atlaskit/editor-plugin-paste 27.0.4 → 27.0.5
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 +6 -0
- package/dist/cjs/editor-commands/commands.js +4 -3
- package/dist/cjs/pm-plugins/analytics.js +75 -73
- package/dist/cjs/pm-plugins/create-clipboard-text-serializer.js +2 -2
- package/dist/cjs/pm-plugins/main.js +65 -56
- package/dist/cjs/pm-plugins/media.js +9 -8
- package/dist/cjs/pm-plugins/move-analytics/plugin-factory.js +2 -2
- package/dist/cjs/pm-plugins/move-analytics/plugin.js +5 -5
- package/dist/cjs/pm-plugins/plugin-factory.js +2 -2
- package/dist/cjs/pm-plugins/util/edge-cases/handleVSCodeBlock.js +2 -2
- package/dist/cjs/pm-plugins/util/get-markdown-slice.js +2 -2
- package/dist/cjs/pm-plugins/util/handlers.js +52 -48
- package/dist/cjs/pm-plugins/util/index.js +8 -6
- package/dist/cjs/pm-plugins/util/sync-block.js +7 -7
- package/dist/cjs/ui/Flag.js +2 -2
- package/dist/es2019/editor-commands/commands.js +2 -1
- package/dist/es2019/pm-plugins/analytics.js +4 -2
- package/dist/es2019/pm-plugins/create-clipboard-text-serializer.js +1 -1
- package/dist/es2019/pm-plugins/main.js +19 -10
- package/dist/es2019/pm-plugins/media.js +4 -3
- package/dist/es2019/pm-plugins/move-analytics/plugin-factory.js +1 -1
- package/dist/es2019/pm-plugins/move-analytics/plugin.js +1 -1
- package/dist/es2019/pm-plugins/plugin-factory.js +1 -1
- package/dist/es2019/pm-plugins/util/edge-cases/handleVSCodeBlock.js +1 -1
- package/dist/es2019/pm-plugins/util/get-markdown-slice.js +1 -1
- package/dist/es2019/pm-plugins/util/handlers.js +11 -7
- package/dist/es2019/pm-plugins/util/index.js +4 -2
- package/dist/es2019/pm-plugins/util/sync-block.js +2 -2
- package/dist/es2019/ui/Flag.js +1 -1
- package/dist/esm/editor-commands/commands.js +2 -1
- package/dist/esm/pm-plugins/analytics.js +4 -2
- package/dist/esm/pm-plugins/create-clipboard-text-serializer.js +1 -1
- package/dist/esm/pm-plugins/main.js +19 -10
- package/dist/esm/pm-plugins/media.js +4 -3
- package/dist/esm/pm-plugins/move-analytics/plugin-factory.js +1 -1
- package/dist/esm/pm-plugins/move-analytics/plugin.js +1 -1
- package/dist/esm/pm-plugins/plugin-factory.js +1 -1
- package/dist/esm/pm-plugins/util/edge-cases/handleVSCodeBlock.js +1 -1
- package/dist/esm/pm-plugins/util/get-markdown-slice.js +1 -1
- package/dist/esm/pm-plugins/util/handlers.js +11 -7
- package/dist/esm/pm-plugins/util/index.js +4 -2
- package/dist/esm/pm-plugins/util/sync-block.js +2 -2
- package/dist/esm/ui/Flag.js +1 -1
- package/dist/types/editor-commands/commands.d.ts +1 -1
- package/dist/types/pastePluginType.d.ts +14 -13
- package/dist/types/pm-plugins/analytics.d.ts +6 -3
- package/dist/types/pm-plugins/main.d.ts +6 -4
- package/dist/types/pm-plugins/media.d.ts +1 -1
- package/dist/types/pm-plugins/move-analytics/commands.d.ts +1 -1
- package/dist/types/pm-plugins/move-analytics/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/move-analytics/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/util/handlers.d.ts +8 -6
- package/dist/types/pm-plugins/util/index.d.ts +3 -2
- package/dist/types/pm-plugins/util/sync-block.d.ts +3 -2
- package/dist/types/ui/Flag.d.ts +1 -1
- package/package.json +2 -2
|
@@ -34,20 +34,24 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
34
34
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
35
35
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
36
36
|
var _uuid = require("uuid");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var _depthLimitedNestingContainerNodesTransform = require("@atlaskit/adf-utils/depth-limited-nesting-container-nodes-transform");
|
|
38
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
39
39
|
var _card = require("@atlaskit/editor-common/card");
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var _inside = require("@atlaskit/editor-common/inside");
|
|
41
|
+
var _blockMark = require("@atlaskit/editor-common/lists/block-mark");
|
|
42
42
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
43
43
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
44
44
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
45
|
+
var _selection2 = require("@atlaskit/editor-common/selection/gap-cursor/selection");
|
|
45
46
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
47
|
+
var _hyperlink = require("@atlaskit/editor-common/utils/hyperlink");
|
|
46
48
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
49
|
+
var _nodes = require("@atlaskit/editor-common/utils/nodes");
|
|
50
|
+
var _slice = require("@atlaskit/editor-common/utils/slice");
|
|
47
51
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
48
52
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
49
53
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
50
|
-
var
|
|
54
|
+
var _replaceTable = require("@atlaskit/editor-tables/utils/replace-table");
|
|
51
55
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
52
56
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
53
57
|
var _closeHistory = require("@atlaskit/prosemirror-history/closeHistory");
|
|
@@ -55,7 +59,7 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
|
55
59
|
var _commands = require("../../editor-commands/commands");
|
|
56
60
|
var _pluginFactory = require("../plugin-factory");
|
|
57
61
|
var _edgeCases = require("./edge-cases");
|
|
58
|
-
var
|
|
62
|
+
var _lists = require("./edge-cases/lists");
|
|
59
63
|
var _index = require("./index");
|
|
60
64
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
61
65
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -93,7 +97,7 @@ function compose(func) {
|
|
|
93
97
|
|
|
94
98
|
// remove text attribute from mention for copy/paste (GDPR)
|
|
95
99
|
function handleMention(slice, schema) {
|
|
96
|
-
return (0,
|
|
100
|
+
return (0, _slice.mapSlice)(slice, function (node) {
|
|
97
101
|
var _schema$nodes$mention;
|
|
98
102
|
// We should move this to the mention plugin when we refactor how paste works in the future
|
|
99
103
|
// For now we can just null check mention exists in the schema to ensure we don't crash if it doesn't
|
|
@@ -175,7 +179,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
175
179
|
if (sliceIsInvalid || sliceIsAPanelReceivingLowDepthText || !selectionIsValidNode && !selectionHasValidParentNode) {
|
|
176
180
|
return false;
|
|
177
181
|
}
|
|
178
|
-
var filters = [(0,
|
|
182
|
+
var filters = [(0, _hyperlink.linkifyContent)(schema)];
|
|
179
183
|
var selectionMarks = selection.$head.marks();
|
|
180
184
|
if (selection instanceof _state.TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && (0, _index.hasOnlyNodesOfType)(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || (0, _mark.anyMarkActive)(state, codeMark)) // check if there is a code mark anywhere in the selection
|
|
181
185
|
) {
|
|
@@ -185,7 +189,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
185
189
|
var isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
|
|
186
190
|
var tr = (0, _closeHistory.closeHistory)(state.tr);
|
|
187
191
|
if (panelNode && sliceHasTask && sliceFirstChildIsPanel && (0, _index.isEmptyNode)(panelNode) && selection.$from.node() === selection.$to.node()) {
|
|
188
|
-
return Boolean((0,
|
|
192
|
+
return Boolean((0, _lists.insertSliceInsideOfPanelNodeSelected)(panelNode)({
|
|
189
193
|
tr: tr,
|
|
190
194
|
slice: slice
|
|
191
195
|
}));
|
|
@@ -250,7 +254,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
|
250
254
|
}
|
|
251
255
|
}
|
|
252
256
|
}
|
|
253
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
257
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _enums.INPUT_METHOD.CLIPBOARD);
|
|
254
258
|
if (dispatch) {
|
|
255
259
|
dispatch(tr);
|
|
256
260
|
}
|
|
@@ -483,9 +487,9 @@ function handlePasteLinkOnSelectedText(slice) {
|
|
|
483
487
|
var linkMark;
|
|
484
488
|
|
|
485
489
|
// check if we have a link on the clipboard
|
|
486
|
-
if (slice.content.childCount === 1 && (0,
|
|
490
|
+
if (slice.content.childCount === 1 && (0, _nodes.isParagraph)(slice.content.child(0), schema)) {
|
|
487
491
|
var paragraph = slice.content.child(0);
|
|
488
|
-
if (paragraph.content.childCount === 1 && (0,
|
|
492
|
+
if (paragraph.content.childCount === 1 && (0, _nodes.isText)(paragraph.content.child(0), schema)) {
|
|
489
493
|
var text = paragraph.content.child(0);
|
|
490
494
|
|
|
491
495
|
// If pasteType is plain text, then
|
|
@@ -498,7 +502,7 @@ function handlePasteLinkOnSelectedText(slice) {
|
|
|
498
502
|
// However, if pasteType is richText, that means url in text.text
|
|
499
503
|
// and href in marks, both won't be decoded.
|
|
500
504
|
linkMark = text.marks.find(function (mark) {
|
|
501
|
-
return (0,
|
|
505
|
+
return (0, _nodes.isLinkMark)(mark, schema) && (mark.attrs.href === text.text || decodeURI(mark.attrs.href) === text.text);
|
|
502
506
|
});
|
|
503
507
|
}
|
|
504
508
|
}
|
|
@@ -546,7 +550,7 @@ function handlePasteAsPlainText(slice, _event, editorAnalyticsAPI) {
|
|
|
546
550
|
// <- using the same internal flag that prosemirror-view is using
|
|
547
551
|
|
|
548
552
|
// if user has selected table we need custom logic to replace the table
|
|
549
|
-
tr = (0,
|
|
553
|
+
tr = (0, _replaceTable.replaceSelectedTable)(state, slice);
|
|
550
554
|
|
|
551
555
|
// add analytics after replacing selected table
|
|
552
556
|
tr = (0, _index.addReplaceSelectedTableAnalytics)(state, tr, editorAnalyticsAPI);
|
|
@@ -602,7 +606,7 @@ function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
|
|
|
602
606
|
if ((0, _index.hasOnlyNodesOfType)(bulletList, hardBreak, heading, listItem, text, emoji, mention, orderedList)(slice) || selectionIsHeading || hasActiveCodeMark || hasAnnotationMark) {
|
|
603
607
|
var transformedSlice = (0, _index.applyTextMarksToSlice)(schema, selectionMarks)(slice);
|
|
604
608
|
var tr = (0, _closeHistory.closeHistory)(state.tr).replaceSelection(transformedSlice).setStoredMarks(selectionMarks).scrollIntoView();
|
|
605
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
609
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _enums.INPUT_METHOD.CLIPBOARD);
|
|
606
610
|
if (dispatch) {
|
|
607
611
|
dispatch(tr);
|
|
608
612
|
}
|
|
@@ -661,7 +665,7 @@ function insertAutoMacroOld(slice, macro, view, from, to) {
|
|
|
661
665
|
// so the autoconversion generates 2 undo steps
|
|
662
666
|
var macroTr = (0, _closeHistory.closeHistory)(view.state.tr).replaceRangeWith(before, before + slice.size, macro).scrollIntoView();
|
|
663
667
|
(0, _card.addLinkMetadata)(view.state.selection, macroTr, {
|
|
664
|
-
inputMethod:
|
|
668
|
+
inputMethod: _enums.INPUT_METHOD.CLIPBOARD,
|
|
665
669
|
cardAction: 'AUTO_CONVERT'
|
|
666
670
|
});
|
|
667
671
|
view.dispatch(macroTr);
|
|
@@ -705,7 +709,7 @@ function insertAutoMacroNew(slice, macro, view, from, to) {
|
|
|
705
709
|
// so the autoconversion generates 2 undo steps
|
|
706
710
|
var macroTr = (0, _closeHistory.closeHistory)(view.state.tr).replaceRangeWith(insertedFrom, insertedTo, macro).scrollIntoView();
|
|
707
711
|
(0, _card.addLinkMetadata)(view.state.selection, macroTr, {
|
|
708
|
-
inputMethod:
|
|
712
|
+
inputMethod: _enums.INPUT_METHOD.CLIPBOARD,
|
|
709
713
|
cardAction: 'AUTO_CONVERT'
|
|
710
714
|
});
|
|
711
715
|
view.dispatch(macroTr);
|
|
@@ -813,9 +817,9 @@ function replacePastedLinkWithMacro(view, macro, url, from, to, editorAnalyticsA
|
|
|
813
817
|
// smart link request settled, so the assumption that this is rare is measurable
|
|
814
818
|
// rather than assumed.
|
|
815
819
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.fireAnalyticsEvent({
|
|
816
|
-
action:
|
|
817
|
-
actionSubject:
|
|
818
|
-
eventType:
|
|
820
|
+
action: _enums.ACTION.ERRORED,
|
|
821
|
+
actionSubject: _enums.ACTION_SUBJECT.SMART_LINK,
|
|
822
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
819
823
|
attributes: {
|
|
820
824
|
error: 'macro-auto-convert-pasted-link-not-found'
|
|
821
825
|
}
|
|
@@ -824,7 +828,7 @@ function replacePastedLinkWithMacro(view, macro, url, from, to, editorAnalyticsA
|
|
|
824
828
|
}
|
|
825
829
|
var macroTr = (0, _closeHistory.closeHistory)(view.state.tr).replaceRangeWith(range.from, range.to, macro).scrollIntoView();
|
|
826
830
|
(0, _card.addLinkMetadata)(view.state.selection, macroTr, {
|
|
827
|
-
inputMethod:
|
|
831
|
+
inputMethod: _enums.INPUT_METHOD.CLIPBOARD,
|
|
828
832
|
cardAction: 'AUTO_CONVERT'
|
|
829
833
|
});
|
|
830
834
|
view.dispatch(macroTr);
|
|
@@ -951,11 +955,11 @@ function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
|
|
|
951
955
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
952
956
|
return (_insertMediaAsMediaSi = insertMediaAsMediaSingle === null || insertMediaAsMediaSingle === void 0 ? void 0 : insertMediaAsMediaSingle(view, slice.content.firstChild, inputMethod)) !== null && _insertMediaAsMediaSi !== void 0 ? _insertMediaAsMediaSi : false;
|
|
953
957
|
}
|
|
954
|
-
if ((0,
|
|
958
|
+
if ((0, _inside.insideTable)(state) && isOnlyMediaSingle(state, slice)) {
|
|
955
959
|
var tr = state.tr.replaceSelection(slice);
|
|
956
960
|
var nextPos = tr.doc.resolve(tr.mapping.map(state.selection.$from.pos));
|
|
957
961
|
if (dispatch) {
|
|
958
|
-
dispatch(tr.setSelection(new
|
|
962
|
+
dispatch(tr.setSelection(new _selection2.GapCursorSelection(nextPos, _selection.Side.RIGHT)));
|
|
959
963
|
}
|
|
960
964
|
return true;
|
|
961
965
|
}
|
|
@@ -976,11 +980,11 @@ var hasTopLevelExpand = function hasTopLevelExpand(slice) {
|
|
|
976
980
|
function handleTableContentPasteInBodiedExtension(slice) {
|
|
977
981
|
return function (state, dispatch) {
|
|
978
982
|
var isInsideBodyExtension = (0, _utils2.hasParentNodeOfType)(state.schema.nodes.bodiedExtension)(state.selection);
|
|
979
|
-
if (!(0,
|
|
983
|
+
if (!(0, _inside.insideTable)(state) || !isInsideBodyExtension) {
|
|
980
984
|
return false;
|
|
981
985
|
}
|
|
982
986
|
var bodiedExtension = state.schema.nodes.bodiedExtension;
|
|
983
|
-
var newSlice = (0,
|
|
987
|
+
var newSlice = (0, _slice.mapSlice)(slice, function (maybeNode) {
|
|
984
988
|
if (maybeNode.type === bodiedExtension) {
|
|
985
989
|
return bodiedExtension.createChecked(maybeNode.attrs, maybeNode.content, maybeNode.marks);
|
|
986
990
|
}
|
|
@@ -995,7 +999,7 @@ function handleTableContentPasteInBodiedExtension(slice) {
|
|
|
995
999
|
}
|
|
996
1000
|
function handleNestedTablePaste(slice, isNestingTablesSupported) {
|
|
997
1001
|
return function (state, dispatch) {
|
|
998
|
-
if (!isNestingTablesSupported || !(0,
|
|
1002
|
+
if (!isNestingTablesSupported || !(0, _inside.insideTable)(state)) {
|
|
999
1003
|
return false;
|
|
1000
1004
|
}
|
|
1001
1005
|
var schema = state.schema,
|
|
@@ -1028,7 +1032,7 @@ function handleExpandPaste(slice) {
|
|
|
1028
1032
|
|
|
1029
1033
|
// Do not handle expand if it's not being pasted into a table or expand
|
|
1030
1034
|
// OR if it's nested within another node when being pasted into a table/expand
|
|
1031
|
-
if (!(0,
|
|
1035
|
+
if (!(0, _inside.insideTable)(state) && !isInsideNestableExpand || !hasTopLevelExpand(slice)) {
|
|
1032
1036
|
return false;
|
|
1033
1037
|
}
|
|
1034
1038
|
var _state$schema$nodes3 = state.schema.nodes,
|
|
@@ -1036,7 +1040,7 @@ function handleExpandPaste(slice) {
|
|
|
1036
1040
|
nestedExpand = _state$schema$nodes3.nestedExpand;
|
|
1037
1041
|
var tr = state.tr;
|
|
1038
1042
|
var hasExpand = false;
|
|
1039
|
-
var newSlice = (0,
|
|
1043
|
+
var newSlice = (0, _slice.mapSlice)(slice, function (maybeNode) {
|
|
1040
1044
|
if (maybeNode.type === expand || maybeNode.type === nestedExpand) {
|
|
1041
1045
|
hasExpand = true;
|
|
1042
1046
|
try {
|
|
@@ -1074,7 +1078,7 @@ function handleMarkdown(markdownSlice, queueCardsFromChangedTr, from, to) {
|
|
|
1074
1078
|
}
|
|
1075
1079
|
var textPosition = tr.doc.resolve(Math.min(pastesFrom + markdownSlice.size, tr.doc.content.size));
|
|
1076
1080
|
tr.setSelection(_state.TextSelection.near(textPosition, -1));
|
|
1077
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
1081
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _enums.INPUT_METHOD.CLIPBOARD);
|
|
1078
1082
|
if (dispatch) {
|
|
1079
1083
|
dispatch(tr.scrollIntoView());
|
|
1080
1084
|
}
|
|
@@ -1107,7 +1111,7 @@ function rollupLeafListItems(list, leafListItems) {
|
|
|
1107
1111
|
}
|
|
1108
1112
|
function shouldFlattenList(state, slice) {
|
|
1109
1113
|
var node = slice.content.firstChild;
|
|
1110
|
-
return node && (0,
|
|
1114
|
+
return node && (0, _inside.insideTable)(state) && (0, _utils.isListNode)(node) && slice.openStart > slice.openEnd;
|
|
1111
1115
|
}
|
|
1112
1116
|
function sliceHasTopLevelMarks(slice) {
|
|
1113
1117
|
var hasTopLevelMarks = false;
|
|
@@ -1168,10 +1172,10 @@ function unwrapContainerNodesWithBlockMarks(slice, schema, fontSize) {
|
|
|
1168
1172
|
*/
|
|
1169
1173
|
function getDestinationFontSizeAttrs(destinationListNode, isInSmallTaskContext, $from, currentNode, fontSize) {
|
|
1170
1174
|
if (destinationListNode) {
|
|
1171
|
-
return (0,
|
|
1175
|
+
return (0, _blockMark.getFirstParagraphBlockMarkAttrs)(destinationListNode, fontSize);
|
|
1172
1176
|
}
|
|
1173
1177
|
if (isInSmallTaskContext) {
|
|
1174
|
-
return (0,
|
|
1178
|
+
return (0, _blockMark.getBlockMarkAttrs)($from.parent, fontSize) || (0, _blockMark.getFirstParagraphBlockMarkAttrs)(currentNode, fontSize);
|
|
1175
1179
|
}
|
|
1176
1180
|
return false;
|
|
1177
1181
|
}
|
|
@@ -1214,7 +1218,7 @@ function handleMarkdownWithInsertedRange(markdownSlice, queueCardsFromChangedTr,
|
|
|
1214
1218
|
var insertedFrom = tr.mapping.map(replaceFrom, -1);
|
|
1215
1219
|
var insertedTo = tr.mapping.map(replaceTo, 1);
|
|
1216
1220
|
tr.setSelection(_state.TextSelection.near(tr.doc.resolve(Math.min(insertedTo, tr.doc.content.size)), -1));
|
|
1217
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
1221
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _enums.INPUT_METHOD.CLIPBOARD);
|
|
1218
1222
|
if (dispatch) {
|
|
1219
1223
|
dispatch(tr.scrollIntoView());
|
|
1220
1224
|
onInsert({
|
|
@@ -1291,7 +1295,7 @@ function handleParagraphBlockMarks(state, slice) {
|
|
|
1291
1295
|
} finally {
|
|
1292
1296
|
_iterator.f();
|
|
1293
1297
|
}
|
|
1294
|
-
var normalizedContent = (0,
|
|
1298
|
+
var normalizedContent = (0, _slice.mapSlice)(slice, function (node) {
|
|
1295
1299
|
if (node.type === paragraph) {
|
|
1296
1300
|
var paragraphMarks = node.marks.filter(function (mark) {
|
|
1297
1301
|
return !forbiddenMarkTypes.includes(mark.type);
|
|
@@ -1397,7 +1401,7 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1397
1401
|
var listContainerNodeTypes = [bulletList, orderedList];
|
|
1398
1402
|
var hasFontSize = !!fontSize;
|
|
1399
1403
|
var destinationListNode = hasFontSize ? (_findParentNodeOfType3 = (0, _utils2.findParentNodeOfType)(listContainerNodeTypes)(selection)) === null || _findParentNodeOfType3 === void 0 ? void 0 : _findParentNodeOfType3.node : undefined;
|
|
1400
|
-
var destinationListFontSizeAttrs = hasFontSize ? (0,
|
|
1404
|
+
var destinationListFontSizeAttrs = hasFontSize ? (0, _blockMark.getFirstParagraphBlockMarkAttrs)(destinationListNode, fontSize) : false;
|
|
1401
1405
|
|
|
1402
1406
|
// In case user is pasting inline code,
|
|
1403
1407
|
// any backtick ` immediately preceding it should be removed.
|
|
@@ -1460,12 +1464,12 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1460
1464
|
var shouldUpdateCursorPosAfterPaste = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(slice.content.lastChild ? (0, _nodeTypeUtils.getBaseNodeTypeName)(slice.content.lastChild.type) : '') : ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 || (_slice$content$lastCh = _slice$content$lastCh.type) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.name) || '');
|
|
1461
1465
|
var lastChild = slice.content.lastChild;
|
|
1462
1466
|
var $nextPos = tr.doc.resolve(tr.mapping.map(selection.from));
|
|
1463
|
-
var nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? _state.TextSelection.findFrom($nextPos, -1, true) : new
|
|
1467
|
+
var nextSelection = lastChild !== null && lastChild !== void 0 && lastChild.type.isTextblock ? _state.TextSelection.findFrom($nextPos, -1, true) : new _selection2.GapCursorSelection($nextPos, _selection.Side.RIGHT);
|
|
1464
1468
|
if (nextSelection) {
|
|
1465
1469
|
tr.setSelection(nextSelection);
|
|
1466
1470
|
} else if ((0, _utils.insideTableCell)(state) && shouldUpdateCursorPosAfterPaste) {
|
|
1467
1471
|
var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
|
|
1468
|
-
tr.setSelection(new
|
|
1472
|
+
tr.setSelection(new _selection2.GapCursorSelection(nextPos, _selection.Side.RIGHT));
|
|
1469
1473
|
}
|
|
1470
1474
|
}
|
|
1471
1475
|
} else {
|
|
@@ -1500,13 +1504,13 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1500
1504
|
if (hasFontSize && (isSliceContentListNodes || sliceContentBlockquoteListNodes)) {
|
|
1501
1505
|
var containingList = (0, _utils2.findParentNodeOfTypeClosestToPos)(tr.selection.$from, listContainerNodeTypes);
|
|
1502
1506
|
if (containingList) {
|
|
1503
|
-
(0,
|
|
1507
|
+
(0, _blockMark.reconcileBlockMarkForContainerAtPos)(tr, containingList.pos, fontSize, isSliceContentListNodes ? destinationListFontSizeAttrs : false);
|
|
1504
1508
|
}
|
|
1505
1509
|
}
|
|
1506
1510
|
|
|
1507
1511
|
// font size handling for pasting into paragraphs (normal text) - preserve source style
|
|
1508
|
-
if (hasFontSize && destinationIsEmpty && !sliceMarkTypes.has(fontSize) && !destinationListNode && selection.$from.parent.type === paragraph && (0,
|
|
1509
|
-
(0,
|
|
1512
|
+
if (hasFontSize && destinationIsEmpty && !sliceMarkTypes.has(fontSize) && !destinationListNode && selection.$from.parent.type === paragraph && (0, _blockMark.getBlockMarkAttrs)(selection.$from.parent, fontSize)) {
|
|
1513
|
+
(0, _blockMark.reconcileBlockMarkForParagraphAtPos)(tr, tr.mapping.map(selection.$from.pos), fontSize, false);
|
|
1510
1514
|
}
|
|
1511
1515
|
|
|
1512
1516
|
// Restore destination block marks (e.g. alignment) that were lost when pasting small text
|
|
@@ -1519,7 +1523,7 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1519
1523
|
try {
|
|
1520
1524
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1521
1525
|
var mark = _step2.value;
|
|
1522
|
-
(0,
|
|
1526
|
+
(0, _blockMark.reconcileBlockMarkInRange)(tr, pastedFrom, pastedTo, mark.type, mark.attrs);
|
|
1523
1527
|
}
|
|
1524
1528
|
} catch (err) {
|
|
1525
1529
|
_iterator2.e(err);
|
|
@@ -1534,7 +1538,7 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
1534
1538
|
tr.scrollIntoView();
|
|
1535
1539
|
|
|
1536
1540
|
// queue link cards, ignoring any errors
|
|
1537
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
1541
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _enums.INPUT_METHOD.CLIPBOARD);
|
|
1538
1542
|
if (dispatch) {
|
|
1539
1543
|
dispatch(tr);
|
|
1540
1544
|
}
|
|
@@ -1550,11 +1554,11 @@ function isUrlString(text) {
|
|
|
1550
1554
|
}
|
|
1551
1555
|
}
|
|
1552
1556
|
function isLinkOrUrlString(slice, schema) {
|
|
1553
|
-
if (slice.content.childCount !== 1 || !(0,
|
|
1557
|
+
if (slice.content.childCount !== 1 || !(0, _nodes.isParagraph)(slice.content.child(0), schema)) {
|
|
1554
1558
|
return false;
|
|
1555
1559
|
}
|
|
1556
1560
|
var paragraph = slice.content.child(0);
|
|
1557
|
-
if (paragraph.content.childCount !== 1 || !(0,
|
|
1561
|
+
if (paragraph.content.childCount !== 1 || !(0, _nodes.isText)(paragraph.content.child(0), schema)) {
|
|
1558
1562
|
return false;
|
|
1559
1563
|
}
|
|
1560
1564
|
var _paragraph$content$ch = paragraph.content.child(0),
|
|
@@ -1562,7 +1566,7 @@ function isLinkOrUrlString(slice, schema) {
|
|
|
1562
1566
|
_paragraph$content$ch2 = _paragraph$content$ch.text,
|
|
1563
1567
|
text = _paragraph$content$ch2 === void 0 ? '' : _paragraph$content$ch2;
|
|
1564
1568
|
var hasLinkMark = marks.some(function (mark) {
|
|
1565
|
-
return (0,
|
|
1569
|
+
return (0, _nodes.isLinkMark)(mark, schema);
|
|
1566
1570
|
});
|
|
1567
1571
|
return hasLinkMark || isUrlString(text);
|
|
1568
1572
|
}
|
|
@@ -1589,7 +1593,7 @@ function handlePasteIntoCaption(slice) {
|
|
|
1589
1593
|
var handleSelectedTable = exports.handleSelectedTable = function handleSelectedTable(editorAnalyticsAPI) {
|
|
1590
1594
|
return function (slice) {
|
|
1591
1595
|
return function (state, dispatch) {
|
|
1592
|
-
var tr = (0,
|
|
1596
|
+
var tr = (0, _replaceTable.replaceSelectedTable)(state, slice);
|
|
1593
1597
|
|
|
1594
1598
|
// add analytics after replacing selected table
|
|
1595
1599
|
tr = (0, _index.addReplaceSelectedTableAnalytics)(state, tr, editorAnalyticsAPI);
|
|
@@ -1632,7 +1636,7 @@ function checkIfSelectionInNestedList(state) {
|
|
|
1632
1636
|
|
|
1633
1637
|
// Helper function to filter expand nodes from slice when not allowed
|
|
1634
1638
|
function handlePasteExpand(slice) {
|
|
1635
|
-
return (0,
|
|
1639
|
+
return (0, _slice.mapSlice)(slice, function (node) {
|
|
1636
1640
|
if (node.type.name === 'expand' || node.type.name === 'nestedExpand') {
|
|
1637
1641
|
var children = [];
|
|
1638
1642
|
if (node.attrs.title) {
|
|
@@ -1662,7 +1666,7 @@ function applyContainerNodeTransformToSlice(slice, schema, destinationParentType
|
|
|
1662
1666
|
content: (_sliceJson$content = sliceJson.content) !== null && _sliceJson$content !== void 0 ? _sliceJson$content : []
|
|
1663
1667
|
};
|
|
1664
1668
|
try {
|
|
1665
|
-
var _transformContainerNo = (0,
|
|
1669
|
+
var _transformContainerNo = (0, _depthLimitedNestingContainerNodesTransform.transformContainerNodes)(wrappedAdf, schema),
|
|
1666
1670
|
transformedAdf = _transformContainerNo.transformedAdf,
|
|
1667
1671
|
isTransformed = _transformContainerNo.isTransformed;
|
|
1668
1672
|
return isTransformed && transformedAdf && transformedAdf.content && transformedAdf.content.length > 0 ? _model.Slice.fromJSON(schema, _objectSpread(_objectSpread({}, sliceJson), {}, {
|
|
@@ -20,10 +20,12 @@ exports.isPastedFromWord = isPastedFromWord;
|
|
|
20
20
|
exports.isSelectionInsidePanel = isSelectionInsidePanel;
|
|
21
21
|
exports.transformUnsupportedBlockCardToInline = exports.removeDuplicateInvalidLinks = exports.isSingleLine = void 0;
|
|
22
22
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
23
|
-
var
|
|
23
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
24
|
+
var _tableEvents = require("@atlaskit/editor-common/analytics/types/table-events");
|
|
24
25
|
var _legacyRankPlugins = require("@atlaskit/editor-common/legacy-rank-plugins");
|
|
25
26
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
26
27
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
28
|
+
var _slice = require("@atlaskit/editor-common/utils/slice");
|
|
27
29
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
28
30
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
29
31
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -278,14 +280,14 @@ var addReplaceSelectedTableAnalytics = exports.addReplaceSelectedTableAnalytics
|
|
|
278
280
|
totalRowCount = _getSelectedTableInfo.totalRowCount,
|
|
279
281
|
totalColumnCount = _getSelectedTableInfo.totalColumnCount;
|
|
280
282
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
281
|
-
action:
|
|
282
|
-
actionSubject:
|
|
283
|
+
action: _tableEvents.TABLE_ACTION.REPLACED,
|
|
284
|
+
actionSubject: _enums.ACTION_SUBJECT.TABLE,
|
|
283
285
|
attributes: {
|
|
284
286
|
totalColumnCount: totalColumnCount,
|
|
285
287
|
totalRowCount: totalRowCount,
|
|
286
|
-
inputMethod:
|
|
288
|
+
inputMethod: _enums.INPUT_METHOD.CLIPBOARD
|
|
287
289
|
},
|
|
288
|
-
eventType:
|
|
290
|
+
eventType: _enums.EVENT_TYPE.TRACK
|
|
289
291
|
})(tr);
|
|
290
292
|
return tr;
|
|
291
293
|
}
|
|
@@ -296,7 +298,7 @@ var transformUnsupportedBlockCardToInline = exports.transformUnsupportedBlockCar
|
|
|
296
298
|
blockCard = _state$schema$nodes.blockCard,
|
|
297
299
|
inlineCard = _state$schema$nodes.inlineCard;
|
|
298
300
|
var children = [];
|
|
299
|
-
(0,
|
|
301
|
+
(0, _slice.mapChildren)(slice.content, function (node, i, frag) {
|
|
300
302
|
var _cardOptions$allowBlo;
|
|
301
303
|
if (node.type === blockCard && !isBlockCardSupported(state, frag, (_cardOptions$allowBlo = cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards) !== null && _cardOptions$allowBlo !== void 0 ? _cardOptions$allowBlo : false)) {
|
|
302
304
|
children.push(inlineCard.createChecked(node.attrs, node.content, node.marks));
|
|
@@ -8,8 +8,8 @@ exports.handleSyncBlocksPaste = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _uuid = require("@atlaskit/adf-schema/uuid");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
12
|
+
var _slice = require("@atlaskit/editor-common/utils/slice");
|
|
13
13
|
var _actions = require("../../editor-actions/actions");
|
|
14
14
|
var _pastePluginType = require("../../pastePluginType");
|
|
15
15
|
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
@@ -106,7 +106,7 @@ var handleSyncBlocksPaste = exports.handleSyncBlocksPaste = function handleSyncB
|
|
|
106
106
|
var isFromEditor = pasteSource === 'fabric-editor';
|
|
107
107
|
var isSyncedBlockInRawHtml = hasSyncedBlockInRawHtml(rawHtml);
|
|
108
108
|
var hasSyncedBlockInSlice = false;
|
|
109
|
-
slice = (0,
|
|
109
|
+
slice = (0, _slice.mapSlice)(slice, function (node) {
|
|
110
110
|
if (node.type === schema.nodes.syncBlock) {
|
|
111
111
|
hasSyncedBlockInSlice = true;
|
|
112
112
|
return transformSyncBlockNode(node, schema, isFromEditor);
|
|
@@ -125,10 +125,10 @@ var handleSyncBlocksPaste = exports.handleSyncBlocksPaste = function handleSyncB
|
|
|
125
125
|
if (!hasSyncedBlockInSlice && isSyncedBlockInRawHtml) {
|
|
126
126
|
var _api$analytics;
|
|
127
127
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
|
|
128
|
-
eventType:
|
|
129
|
-
action:
|
|
130
|
-
actionSubject:
|
|
131
|
-
actionSubjectId:
|
|
128
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
129
|
+
action: _enums.ACTION.INSERT_ATTEMPTED,
|
|
130
|
+
actionSubject: _enums.ACTION_SUBJECT.SYNCED_BLOCK,
|
|
131
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.UNSUPPORTED_SURFACE,
|
|
132
132
|
attributes: {
|
|
133
133
|
sourceProduct: getSourceProductFromRawHtml(rawHtml),
|
|
134
134
|
pasteSource: pasteSource
|
package/dist/cjs/ui/Flag.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.Flag = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _reactIntl = require("react-intl");
|
|
11
|
-
var
|
|
11
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
12
12
|
var _autoDismissFlag = _interopRequireDefault(require("@atlaskit/flag/auto-dismiss-flag"));
|
|
13
13
|
var _flag = _interopRequireDefault(require("@atlaskit/flag/flag"));
|
|
14
14
|
var _flagGroup = require("@atlaskit/flag/flag-group");
|
|
@@ -22,7 +22,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
22
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
23
|
var Flag = exports.Flag = function Flag(_ref) {
|
|
24
24
|
var api = _ref.api;
|
|
25
|
-
var _useSharedPluginState = (0,
|
|
25
|
+
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['paste'], function (states) {
|
|
26
26
|
var _states$pasteState;
|
|
27
27
|
return {
|
|
28
28
|
activeFlag: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.activeFlag
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { isListNode
|
|
1
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { mapChildren, mapSlice } from '@atlaskit/editor-common/utils/slice';
|
|
2
3
|
import { autoJoin } from '@atlaskit/editor-prosemirror/commands';
|
|
3
4
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
2
|
+
import { PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics/types/paste-events';
|
|
2
3
|
import { getHadMarkAttributes } from '@atlaskit/editor-common/mark';
|
|
3
|
-
import { getLinkDomain
|
|
4
|
+
import { getLinkDomain } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { mapSlice } from '@atlaskit/editor-common/utils/slice';
|
|
4
6
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
5
7
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
6
8
|
import { getPasteSource } from './util';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { timestampToString } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { timestampToString } from '@atlaskit/editor-common/utils/date';
|
|
2
2
|
/**
|
|
3
3
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
4
4
|
* section of the clipboard on copy.
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
2
|
import { v4 as uuid } from 'uuid';
|
|
3
|
-
import { ACTION, INPUT_METHOD
|
|
3
|
+
import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
4
|
+
import { PasteTypes } from '@atlaskit/editor-common/analytics/types/paste-events';
|
|
4
5
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions/module-helpers';
|
|
7
|
+
import { insideTable } from '@atlaskit/editor-common/inside';
|
|
7
8
|
import { isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
8
|
-
import { isPastedFile as isPastedFileFromEvent
|
|
9
|
+
import { isPastedFile as isPastedFileFromEvent } from '@atlaskit/editor-common/paste/clipboard';
|
|
10
|
+
import { md } from '@atlaskit/editor-common/paste/md';
|
|
9
11
|
import { measureRender } from '@atlaskit/editor-common/performance/measure-render';
|
|
10
12
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
11
|
-
import { SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/sync-block';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
13
|
+
import { SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/styles/sync-block';
|
|
14
|
+
import { transformSingleColumnLayout, transformSingleLineCodeBlockToCodeMark, transformSliceNestedExpandToExpand, transformSliceToRemoveMacroId } from '@atlaskit/editor-common/transforms';
|
|
15
|
+
import { transformSliceToJoinAdjacentCodeBlocks } from '@atlaskit/editor-common/transforms/code-block';
|
|
16
|
+
import { transformSliceToDecisionList } from '@atlaskit/editor-common/transforms/decision-list';
|
|
17
|
+
import { transformSliceToRemoveLegacyContentMacro } from '@atlaskit/editor-common/transforms/extension';
|
|
18
|
+
import { removeBreakoutFromRendererSyncBlockHTML } from '@atlaskit/editor-common/transforms/sync-block';
|
|
19
|
+
import { extractSliceFromStep } from '@atlaskit/editor-common/utils';
|
|
20
|
+
import { containsAnyAnnotations } from '@atlaskit/editor-common/utils/annotation';
|
|
21
|
+
import { linkifyContent } from '@atlaskit/editor-common/utils/hyperlink';
|
|
22
|
+
import { mapChildren } from '@atlaskit/editor-common/utils/slice';
|
|
14
23
|
import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
|
|
15
24
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
16
25
|
import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
17
|
-
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
18
|
-
import { insm } from '@atlaskit/insm';
|
|
19
|
-
import { extractClientIdsFromHtml } from '@atlaskit/media-common';
|
|
26
|
+
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils/handle-paste';
|
|
27
|
+
import { insm } from '@atlaskit/insm/api';
|
|
28
|
+
import { extractClientIdsFromHtml } from '@atlaskit/media-common/clientIdCache';
|
|
20
29
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
21
30
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
31
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
2
|
-
import {
|
|
1
|
+
import { DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single/constants';
|
|
2
|
+
import { removeNestedEmptyEls, unwrap, walkUpTreeUntil } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { mapSlice } from '@atlaskit/editor-common/utils/slice';
|
|
3
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { getRandomHex } from '@atlaskit/media-common';
|
|
5
|
+
import { getRandomHex } from '@atlaskit/media-common/helpers';
|
|
5
6
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
7
|
/**
|
|
7
8
|
* Ensure correct layout in nested mode
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils/plugin-state-factory';
|
|
2
2
|
import { pluginKey } from './plugin-key';
|
|
3
3
|
import { reducer } from './reducer';
|
|
4
4
|
const dest = pluginFactory(pluginKey, reducer);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { resetContentMoved, resetContentMovedTransform, updateContentMoved } from './commands';
|
|
4
4
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils/plugin-state-factory';
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { reducer } from './reducer';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SUPPORTED_LANGUAGES } from '@atlaskit/code/constants';
|
|
2
|
-
import { mapSlice } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { mapSlice } from '@atlaskit/editor-common/utils/slice';
|
|
3
3
|
function safelyGetVSCodeLanguage(editorData) {
|
|
4
4
|
try {
|
|
5
5
|
const vscodeData = editorData ? JSON.parse(editorData) : undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
1
|
+
import { logException } from '@atlaskit/editor-common/monitoring/error';
|
|
2
2
|
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { escapeBackslashAndLinksExceptCodeBlock } from './index';
|
|
4
4
|
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
2
|
import { v4 as uuid } from 'uuid';
|
|
3
|
-
import { transformContainerNodes } from '@atlaskit/adf-utils/
|
|
4
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { transformContainerNodes } from '@atlaskit/adf-utils/depth-limited-nesting-container-nodes-transform';
|
|
4
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
5
5
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
6
|
-
import { insideTable } from '@atlaskit/editor-common/
|
|
7
|
-
import { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange } from '@atlaskit/editor-common/lists';
|
|
6
|
+
import { insideTable } from '@atlaskit/editor-common/inside';
|
|
7
|
+
import { getBlockMarkAttrs, getFirstParagraphBlockMarkAttrs, reconcileBlockMarkForContainerAtPos, reconcileBlockMarkForParagraphAtPos, reconcileBlockMarkInRange } from '@atlaskit/editor-common/lists/block-mark';
|
|
8
8
|
import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
9
9
|
import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atlaskit/editor-common/nesting';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { Side } from '@atlaskit/editor-common/selection';
|
|
11
|
+
import { GapCursorSelection } from '@atlaskit/editor-common/selection/gap-cursor/selection';
|
|
12
|
+
import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isListItemNode, isListNode, isNodeEmpty } from '@atlaskit/editor-common/utils';
|
|
13
|
+
import { linkifyContent } from '@atlaskit/editor-common/utils/hyperlink';
|
|
12
14
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
15
|
+
import { isLinkMark, isParagraph, isText } from '@atlaskit/editor-common/utils/nodes';
|
|
16
|
+
import { mapSlice } from '@atlaskit/editor-common/utils/slice';
|
|
13
17
|
import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
14
18
|
import { AllSelection, NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
15
19
|
import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
16
|
-
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
20
|
+
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils/replace-table';
|
|
17
21
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
18
22
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
23
|
import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
|