@atlaskit/editor-plugin-synced-block 12.0.7 → 12.0.8
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/AGENTS.md +0 -1
- package/CHANGELOG.md +9 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +7 -15
- package/dist/cjs/pm-plugins/main.js +5 -21
- package/dist/cjs/ui/SyncedLocationDropdown.js +1 -2
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +7 -15
- package/dist/es2019/pm-plugins/main.js +5 -22
- package/dist/es2019/ui/SyncedLocationDropdown.js +1 -2
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +7 -15
- package/dist/esm/pm-plugins/main.js +5 -21
- package/dist/esm/ui/SyncedLocationDropdown.js +1 -2
- package/package.json +2 -2
- package/dist/cjs/pm-plugins/utils/rebase-transaction.js +0 -26
- package/dist/es2019/pm-plugins/utils/rebase-transaction.js +0 -16
- package/dist/esm/pm-plugins/utils/rebase-transaction.js +0 -19
- package/dist/types/pm-plugins/utils/rebase-transaction.d.ts +0 -2
package/AGENTS.md
CHANGED
|
@@ -48,7 +48,6 @@ src/
|
|
|
48
48
|
│ ├── has-synced-blocks.ts # O(childCount) presence check (EDITOR-6928 lazy init)
|
|
49
49
|
│ ├── transaction-inserts-synced-block.ts # Detect tr inserts a synced block (lazy init)
|
|
50
50
|
│ ├── selection-decorations.ts # Selection decoration helpers
|
|
51
|
-
│ ├── rebase-transaction.ts # Rebase helpers used by main.ts
|
|
52
51
|
│ ├── ignore-dom-event.ts # DOM event guard
|
|
53
52
|
│ └── utils.ts # Misc shared helpers
|
|
54
53
|
├── ui/ # (grep the dir for the full current list — it grows often)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 12.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1f0dab65b6efd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1f0dab65b6efd) -
|
|
8
|
+
Remove unreachable cut-handling branch and duplicated synced block node view setup left over from
|
|
9
|
+
feature gate cleanup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 12.0.7
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
13
12
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
14
13
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
15
14
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
@@ -43,20 +42,13 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
43
42
|
this.dom = dom;
|
|
44
43
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
45
44
|
this.contentDOM = contentDOM;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} else {
|
|
54
|
-
// Render the label into a separate container so portal implementations
|
|
55
|
-
// that write directly into the target do not clobber contentDOM.
|
|
56
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
57
|
-
labelContainer = document.createElement('div');
|
|
58
|
-
this.dom.appendChild(labelContainer);
|
|
59
|
-
}
|
|
45
|
+
|
|
46
|
+
// Render the label into a separate container so portal implementations that
|
|
47
|
+
// write directly into the target do not clobber contentDOM. This also covers
|
|
48
|
+
// SSR, where the portal's renderToStaticMarkup + innerHTML would clobber it.
|
|
49
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
50
|
+
var labelContainer = document.createElement('div');
|
|
51
|
+
this.dom.appendChild(labelContainer);
|
|
60
52
|
this.labelKey = crypto.randomUUID();
|
|
61
53
|
this.nodeViewPortalProviderAPI.render(function () {
|
|
62
54
|
var _this$api;
|
|
@@ -950,23 +950,10 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
950
950
|
var syncBlockStore = pluginState === null || pluginState === void 0 ? void 0 : pluginState.syncBlockStore;
|
|
951
951
|
var schema = state.schema;
|
|
952
952
|
var isCopy = ctx.consumeCopyEvent();
|
|
953
|
-
var
|
|
954
|
-
|
|
955
|
-
var isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) &&
|
|
956
|
-
if (!syncBlockStore || !isCopy && !isCut
|
|
957
|
-
return slice;
|
|
958
|
-
}
|
|
959
|
-
if (isPromptedFeedbackCut && !isCut) {
|
|
960
|
-
var _containsCutSyncBlock = false;
|
|
961
|
-
(0, _utils.mapSlice)(slice, function (node) {
|
|
962
|
-
if (syncBlockStore.referenceManager.isReferenceBlock(node) || node.type.name === 'bodiedSyncBlock' && (0, _utils3.sliceFullyContainsNode)(slice, node)) {
|
|
963
|
-
_containsCutSyncBlock = true;
|
|
964
|
-
}
|
|
965
|
-
return node;
|
|
966
|
-
});
|
|
967
|
-
if (_containsCutSyncBlock) {
|
|
968
|
-
ctx.markCutRemovalPending();
|
|
969
|
-
}
|
|
953
|
+
var isCut = ctx.consumeCutEvent();
|
|
954
|
+
// A prompted feedback cut is always a cut, so the two never need combining.
|
|
955
|
+
var isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) && isCut) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
956
|
+
if (!syncBlockStore || !isCopy && !isCut) {
|
|
970
957
|
return slice;
|
|
971
958
|
}
|
|
972
959
|
var containsCutSyncBlock = false;
|
|
@@ -981,7 +968,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
981
968
|
return node;
|
|
982
969
|
}
|
|
983
970
|
if (node.type.name === 'bodiedSyncBlock' && node.attrs.resourceId) {
|
|
984
|
-
if (isPromptedFeedbackCut &&
|
|
971
|
+
if (isPromptedFeedbackCut && (0, _utils3.sliceFullyContainsNode)(slice, node)) {
|
|
985
972
|
containsCutSyncBlock = true;
|
|
986
973
|
}
|
|
987
974
|
// if we only selected part of the bodied sync block content,
|
|
@@ -1145,9 +1132,6 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
1145
1132
|
}
|
|
1146
1133
|
});
|
|
1147
1134
|
}
|
|
1148
|
-
|
|
1149
|
-
// Delete is recomputed fresh from the live document on confirm.
|
|
1150
|
-
// See EDITOR-7889.
|
|
1151
1135
|
var _iterator2 = _createForOfIteratorHelper(trs),
|
|
1152
1136
|
_step2;
|
|
1153
1137
|
try {
|
|
@@ -244,9 +244,8 @@ var ItemIcon = function ItemIcon(_ref3) {
|
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
// Render a Jira issue-type icon when we have one
|
|
247
|
+
// Render a Jira issue-type icon when we have one.
|
|
248
248
|
// Falls through to the generic product icon when:
|
|
249
|
-
// - the gate is off,
|
|
250
249
|
// - we don't have access (issueType is not surfaced for no-access references),
|
|
251
250
|
// - AGG returned no `issueType` (partial index, deleted, etc.), or
|
|
252
251
|
// - the issue type is unrecognised AND has no `iconUrl`.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { isSSR, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
4
3
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
5
4
|
import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
6
5
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
@@ -31,20 +30,13 @@ export class BodiedSyncBlock {
|
|
|
31
30
|
this.dom = dom;
|
|
32
31
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
33
32
|
this.contentDOM = contentDOM;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} else {
|
|
42
|
-
// Render the label into a separate container so portal implementations
|
|
43
|
-
// that write directly into the target do not clobber contentDOM.
|
|
44
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
45
|
-
labelContainer = document.createElement('div');
|
|
46
|
-
this.dom.appendChild(labelContainer);
|
|
47
|
-
}
|
|
33
|
+
|
|
34
|
+
// Render the label into a separate container so portal implementations that
|
|
35
|
+
// write directly into the target do not clobber contentDOM. This also covers
|
|
36
|
+
// SSR, where the portal's renderToStaticMarkup + innerHTML would clobber it.
|
|
37
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
38
|
+
const labelContainer = document.createElement('div');
|
|
39
|
+
this.dom.appendChild(labelContainer);
|
|
48
40
|
this.labelKey = crypto.randomUUID();
|
|
49
41
|
this.nodeViewPortalProviderAPI.render(() => {
|
|
50
42
|
var _this$api, _this$api$analytics;
|
|
@@ -890,23 +890,10 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
890
890
|
schema
|
|
891
891
|
} = state;
|
|
892
892
|
const isCopy = ctx.consumeCopyEvent();
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
const isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) &&
|
|
896
|
-
if (!syncBlockStore || !isCopy && !isCut
|
|
897
|
-
return slice;
|
|
898
|
-
}
|
|
899
|
-
if (isPromptedFeedbackCut && !isCut) {
|
|
900
|
-
let containsCutSyncBlock = false;
|
|
901
|
-
mapSlice(slice, node => {
|
|
902
|
-
if (syncBlockStore.referenceManager.isReferenceBlock(node) || node.type.name === 'bodiedSyncBlock' && sliceFullyContainsNode(slice, node)) {
|
|
903
|
-
containsCutSyncBlock = true;
|
|
904
|
-
}
|
|
905
|
-
return node;
|
|
906
|
-
});
|
|
907
|
-
if (containsCutSyncBlock) {
|
|
908
|
-
ctx.markCutRemovalPending();
|
|
909
|
-
}
|
|
893
|
+
const isCut = ctx.consumeCutEvent();
|
|
894
|
+
// A prompted feedback cut is always a cut, so the two never need combining.
|
|
895
|
+
const isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) && isCut) && expValEqualsNoExposure('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
896
|
+
if (!syncBlockStore || !isCopy && !isCut) {
|
|
910
897
|
return slice;
|
|
911
898
|
}
|
|
912
899
|
let containsCutSyncBlock = false;
|
|
@@ -921,7 +908,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
921
908
|
return node;
|
|
922
909
|
}
|
|
923
910
|
if (node.type.name === 'bodiedSyncBlock' && node.attrs.resourceId) {
|
|
924
|
-
if (isPromptedFeedbackCut &&
|
|
911
|
+
if (isPromptedFeedbackCut && sliceFullyContainsNode(slice, node)) {
|
|
925
912
|
containsCutSyncBlock = true;
|
|
926
913
|
}
|
|
927
914
|
// if we only selected part of the bodied sync block content,
|
|
@@ -1075,10 +1062,6 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
1075
1062
|
}
|
|
1076
1063
|
});
|
|
1077
1064
|
}
|
|
1078
|
-
|
|
1079
|
-
// Delete is recomputed fresh from the live document on confirm.
|
|
1080
|
-
// See EDITOR-7889.
|
|
1081
|
-
|
|
1082
1065
|
for (const tr of trs) {
|
|
1083
1066
|
if (tr.getMeta(pmHistoryPluginKey)) {
|
|
1084
1067
|
const {
|
|
@@ -234,9 +234,8 @@ const ItemIcon = ({
|
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
// Render a Jira issue-type icon when we have one
|
|
237
|
+
// Render a Jira issue-type icon when we have one.
|
|
238
238
|
// Falls through to the generic product icon when:
|
|
239
|
-
// - the gate is off,
|
|
240
239
|
// - we don't have access (issueType is not surfaced for no-access references),
|
|
241
240
|
// - AGG returned no `issueType` (partial index, deleted, etc.), or
|
|
242
241
|
// - the issue type is unrecognised AND has no `iconUrl`.
|
|
@@ -2,7 +2,6 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { isSSR, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
6
5
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
7
6
|
import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
|
|
8
7
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
@@ -36,20 +35,13 @@ export var BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
36
35
|
this.dom = dom;
|
|
37
36
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
38
37
|
this.contentDOM = contentDOM;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} else {
|
|
47
|
-
// Render the label into a separate container so portal implementations
|
|
48
|
-
// that write directly into the target do not clobber contentDOM.
|
|
49
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
50
|
-
labelContainer = document.createElement('div');
|
|
51
|
-
this.dom.appendChild(labelContainer);
|
|
52
|
-
}
|
|
38
|
+
|
|
39
|
+
// Render the label into a separate container so portal implementations that
|
|
40
|
+
// write directly into the target do not clobber contentDOM. This also covers
|
|
41
|
+
// SSR, where the portal's renderToStaticMarkup + innerHTML would clobber it.
|
|
42
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- NodeView DOM must be created against active runtime document
|
|
43
|
+
var labelContainer = document.createElement('div');
|
|
44
|
+
this.dom.appendChild(labelContainer);
|
|
53
45
|
this.labelKey = crypto.randomUUID();
|
|
54
46
|
this.nodeViewPortalProviderAPI.render(function () {
|
|
55
47
|
var _this$api;
|
|
@@ -943,23 +943,10 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
943
943
|
var syncBlockStore = pluginState === null || pluginState === void 0 ? void 0 : pluginState.syncBlockStore;
|
|
944
944
|
var schema = state.schema;
|
|
945
945
|
var isCopy = ctx.consumeCopyEvent();
|
|
946
|
-
var
|
|
947
|
-
|
|
948
|
-
var isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) &&
|
|
949
|
-
if (!syncBlockStore || !isCopy && !isCut
|
|
950
|
-
return slice;
|
|
951
|
-
}
|
|
952
|
-
if (isPromptedFeedbackCut && !isCut) {
|
|
953
|
-
var _containsCutSyncBlock = false;
|
|
954
|
-
mapSlice(slice, function (node) {
|
|
955
|
-
if (syncBlockStore.referenceManager.isReferenceBlock(node) || node.type.name === 'bodiedSyncBlock' && sliceFullyContainsNode(slice, node)) {
|
|
956
|
-
_containsCutSyncBlock = true;
|
|
957
|
-
}
|
|
958
|
-
return node;
|
|
959
|
-
});
|
|
960
|
-
if (_containsCutSyncBlock) {
|
|
961
|
-
ctx.markCutRemovalPending();
|
|
962
|
-
}
|
|
946
|
+
var isCut = ctx.consumeCutEvent();
|
|
947
|
+
// A prompted feedback cut is always a cut, so the two never need combining.
|
|
948
|
+
var isPromptedFeedbackCut = Boolean(syncBlockStore && (options === null || options === void 0 ? void 0 : options.onGiveFeedback) && isCut) && expValEqualsNoExposure('platform_editor_sync_block_activation', 'isEnabled', true);
|
|
949
|
+
if (!syncBlockStore || !isCopy && !isCut) {
|
|
963
950
|
return slice;
|
|
964
951
|
}
|
|
965
952
|
var containsCutSyncBlock = false;
|
|
@@ -974,7 +961,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
974
961
|
return node;
|
|
975
962
|
}
|
|
976
963
|
if (node.type.name === 'bodiedSyncBlock' && node.attrs.resourceId) {
|
|
977
|
-
if (isPromptedFeedbackCut &&
|
|
964
|
+
if (isPromptedFeedbackCut && sliceFullyContainsNode(slice, node)) {
|
|
978
965
|
containsCutSyncBlock = true;
|
|
979
966
|
}
|
|
980
967
|
// if we only selected part of the bodied sync block content,
|
|
@@ -1138,9 +1125,6 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
1138
1125
|
}
|
|
1139
1126
|
});
|
|
1140
1127
|
}
|
|
1141
|
-
|
|
1142
|
-
// Delete is recomputed fresh from the live document on confirm.
|
|
1143
|
-
// See EDITOR-7889.
|
|
1144
1128
|
var _iterator2 = _createForOfIteratorHelper(trs),
|
|
1145
1129
|
_step2;
|
|
1146
1130
|
try {
|
|
@@ -236,9 +236,8 @@ var ItemIcon = function ItemIcon(_ref3) {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
// Render a Jira issue-type icon when we have one
|
|
239
|
+
// Render a Jira issue-type icon when we have one.
|
|
240
240
|
// Falls through to the generic product icon when:
|
|
241
|
-
// - the gate is off,
|
|
242
241
|
// - we don't have access (issueType is not surfaced for no-access references),
|
|
243
242
|
// - AGG returned no `issueType` (partial index, deleted, etc.), or
|
|
244
243
|
// - the issue type is unrecognised AND has no `iconUrl`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.8",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
47
47
|
"@atlaskit/primitives": "^22.2.0",
|
|
48
48
|
"@atlaskit/spinner": "20.1.2",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^146.0.0",
|
|
50
50
|
"@atlaskit/tokens": "16.6.0",
|
|
51
51
|
"@atlaskit/tooltip": "^24.0.0",
|
|
52
52
|
"@atlaskit/visually-hidden": "^4.2.0",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.rebaseTransaction = void 0;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
10
|
-
var rebaseTransaction = exports.rebaseTransaction = function rebaseTransaction(currentTr, incomingTr, state) {
|
|
11
|
-
if (!incomingTr.docChanged) {
|
|
12
|
-
return currentTr;
|
|
13
|
-
}
|
|
14
|
-
var currentMapping = new _transform.Mapping((0, _toConsumableArray2.default)(currentTr.mapping.maps).reverse().map(function (map) {
|
|
15
|
-
return map.invert();
|
|
16
|
-
}));
|
|
17
|
-
var rebasedTransaction = state.tr;
|
|
18
|
-
currentTr.steps.forEach(function (step) {
|
|
19
|
-
var mappedStep = step.map(currentMapping);
|
|
20
|
-
if (mappedStep) {
|
|
21
|
-
rebasedTransaction.step(mappedStep);
|
|
22
|
-
currentMapping.appendMap(mappedStep.getMap());
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return rebasedTransaction;
|
|
26
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Mapping } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
-
export const rebaseTransaction = (currentTr, incomingTr, state) => {
|
|
3
|
-
if (!incomingTr.docChanged) {
|
|
4
|
-
return currentTr;
|
|
5
|
-
}
|
|
6
|
-
const currentMapping = new Mapping([...currentTr.mapping.maps].reverse().map(map => map.invert()));
|
|
7
|
-
const rebasedTransaction = state.tr;
|
|
8
|
-
currentTr.steps.forEach(step => {
|
|
9
|
-
const mappedStep = step.map(currentMapping);
|
|
10
|
-
if (mappedStep) {
|
|
11
|
-
rebasedTransaction.step(mappedStep);
|
|
12
|
-
currentMapping.appendMap(mappedStep.getMap());
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return rebasedTransaction;
|
|
16
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { Mapping } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
export var rebaseTransaction = function rebaseTransaction(currentTr, incomingTr, state) {
|
|
4
|
-
if (!incomingTr.docChanged) {
|
|
5
|
-
return currentTr;
|
|
6
|
-
}
|
|
7
|
-
var currentMapping = new Mapping(_toConsumableArray(currentTr.mapping.maps).reverse().map(function (map) {
|
|
8
|
-
return map.invert();
|
|
9
|
-
}));
|
|
10
|
-
var rebasedTransaction = state.tr;
|
|
11
|
-
currentTr.steps.forEach(function (step) {
|
|
12
|
-
var mappedStep = step.map(currentMapping);
|
|
13
|
-
if (mappedStep) {
|
|
14
|
-
rebasedTransaction.step(mappedStep);
|
|
15
|
-
currentMapping.appendMap(mappedStep.getMap());
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return rebasedTransaction;
|
|
19
|
-
};
|