@atlaskit/editor-plugin-synced-block 3.1.1 → 3.2.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 +17 -0
- package/afm-dev-agents/tsconfig.json +6 -0
- package/afm-jira/tsconfig.json +6 -0
- package/afm-passionfruit/tsconfig.json +6 -0
- package/afm-post-office/tsconfig.json +6 -0
- package/afm-rovo-extension/tsconfig.json +6 -0
- package/afm-townsquare/tsconfig.json +6 -0
- package/dist/cjs/pm-plugins/main.js +8 -0
- package/dist/cjs/pm-plugins/utils/rebase-transaction.js +26 -0
- package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +39 -34
- package/dist/es2019/pm-plugins/main.js +6 -0
- package/dist/es2019/pm-plugins/utils/rebase-transaction.js +16 -0
- package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +39 -36
- package/dist/esm/pm-plugins/main.js +8 -0
- package/dist/esm/pm-plugins/utils/rebase-transaction.js +19 -0
- package/dist/esm/pm-plugins/utils/track-sync-blocks.js +39 -34
- package/dist/types/pm-plugins/utils/rebase-transaction.d.ts +2 -0
- package/dist/types/ui/CreateSyncedBlockDropdownItem.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/rebase-transaction.d.ts +2 -0
- package/dist/types-ts4.5/ui/CreateSyncedBlockDropdownItem.d.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`acb8231bc9e0c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/acb8231bc9e0c) -
|
|
8
|
+
EDITOR-1779 - "rebase" the transaction to reflect the latest document state
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 3.1.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 3.1.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
{
|
|
26
26
|
"path": "../../../design-system/button/afm-dev-agents/tsconfig.json"
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
"path": "../../editor-plugin-block-menu/afm-dev-agents/tsconfig.json"
|
|
30
|
+
},
|
|
28
31
|
{
|
|
29
32
|
"path": "../../editor-plugin-decorations/afm-dev-agents/tsconfig.json"
|
|
30
33
|
},
|
|
@@ -40,6 +43,9 @@
|
|
|
40
43
|
{
|
|
41
44
|
"path": "../../editor-synced-block-provider/afm-dev-agents/tsconfig.json"
|
|
42
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"path": "../../editor-toolbar/afm-dev-agents/tsconfig.json"
|
|
48
|
+
},
|
|
43
49
|
{
|
|
44
50
|
"path": "../../../design-system/icon/afm-dev-agents/tsconfig.json"
|
|
45
51
|
},
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
{
|
|
26
26
|
"path": "../../../design-system/button/afm-jira/tsconfig.json"
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
"path": "../../editor-plugin-block-menu/afm-jira/tsconfig.json"
|
|
30
|
+
},
|
|
28
31
|
{
|
|
29
32
|
"path": "../../editor-plugin-decorations/afm-jira/tsconfig.json"
|
|
30
33
|
},
|
|
@@ -40,6 +43,9 @@
|
|
|
40
43
|
{
|
|
41
44
|
"path": "../../editor-synced-block-provider/afm-jira/tsconfig.json"
|
|
42
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"path": "../../editor-toolbar/afm-jira/tsconfig.json"
|
|
48
|
+
},
|
|
43
49
|
{
|
|
44
50
|
"path": "../../../design-system/icon/afm-jira/tsconfig.json"
|
|
45
51
|
},
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
{
|
|
26
26
|
"path": "../../../design-system/button/afm-passionfruit/tsconfig.json"
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
"path": "../../editor-plugin-block-menu/afm-passionfruit/tsconfig.json"
|
|
30
|
+
},
|
|
28
31
|
{
|
|
29
32
|
"path": "../../editor-plugin-decorations/afm-passionfruit/tsconfig.json"
|
|
30
33
|
},
|
|
@@ -40,6 +43,9 @@
|
|
|
40
43
|
{
|
|
41
44
|
"path": "../../editor-synced-block-provider/afm-passionfruit/tsconfig.json"
|
|
42
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"path": "../../editor-toolbar/afm-passionfruit/tsconfig.json"
|
|
48
|
+
},
|
|
43
49
|
{
|
|
44
50
|
"path": "../../../design-system/icon/afm-passionfruit/tsconfig.json"
|
|
45
51
|
},
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
{
|
|
26
26
|
"path": "../../../design-system/button/afm-post-office/tsconfig.json"
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
"path": "../../editor-plugin-block-menu/afm-post-office/tsconfig.json"
|
|
30
|
+
},
|
|
28
31
|
{
|
|
29
32
|
"path": "../../editor-plugin-decorations/afm-post-office/tsconfig.json"
|
|
30
33
|
},
|
|
@@ -40,6 +43,9 @@
|
|
|
40
43
|
{
|
|
41
44
|
"path": "../../editor-synced-block-provider/afm-post-office/tsconfig.json"
|
|
42
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"path": "../../editor-toolbar/afm-post-office/tsconfig.json"
|
|
48
|
+
},
|
|
43
49
|
{
|
|
44
50
|
"path": "../../../design-system/icon/afm-post-office/tsconfig.json"
|
|
45
51
|
},
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
{
|
|
26
26
|
"path": "../../../design-system/button/afm-rovo-extension/tsconfig.json"
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
"path": "../../editor-plugin-block-menu/afm-rovo-extension/tsconfig.json"
|
|
30
|
+
},
|
|
28
31
|
{
|
|
29
32
|
"path": "../../editor-plugin-decorations/afm-rovo-extension/tsconfig.json"
|
|
30
33
|
},
|
|
@@ -40,6 +43,9 @@
|
|
|
40
43
|
{
|
|
41
44
|
"path": "../../editor-synced-block-provider/afm-rovo-extension/tsconfig.json"
|
|
42
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"path": "../../editor-toolbar/afm-rovo-extension/tsconfig.json"
|
|
48
|
+
},
|
|
43
49
|
{
|
|
44
50
|
"path": "../../../design-system/icon/afm-rovo-extension/tsconfig.json"
|
|
45
51
|
},
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
{
|
|
26
26
|
"path": "../../../design-system/button/afm-townsquare/tsconfig.json"
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
"path": "../../editor-plugin-block-menu/afm-townsquare/tsconfig.json"
|
|
30
|
+
},
|
|
28
31
|
{
|
|
29
32
|
"path": "../../editor-plugin-decorations/afm-townsquare/tsconfig.json"
|
|
30
33
|
},
|
|
@@ -40,6 +43,9 @@
|
|
|
40
43
|
{
|
|
41
44
|
"path": "../../editor-synced-block-provider/afm-townsquare/tsconfig.json"
|
|
42
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"path": "../../editor-toolbar/afm-townsquare/tsconfig.json"
|
|
48
|
+
},
|
|
43
49
|
{
|
|
44
50
|
"path": "../../../design-system/icon/afm-townsquare/tsconfig.json"
|
|
45
51
|
},
|
|
@@ -64,6 +64,14 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
64
64
|
return false;
|
|
65
65
|
}
|
|
66
66
|
return true;
|
|
67
|
+
},
|
|
68
|
+
appendTransaction: function appendTransaction(trs, oldState, newState) {
|
|
69
|
+
trs.filter(function (tr) {
|
|
70
|
+
return tr.docChanged;
|
|
71
|
+
}).forEach(function (tr) {
|
|
72
|
+
syncBlockStore === null || syncBlockStore === void 0 || syncBlockStore.rebaseTransaction(tr, newState);
|
|
73
|
+
});
|
|
74
|
+
return null;
|
|
67
75
|
}
|
|
68
76
|
});
|
|
69
77
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
};
|
|
@@ -8,43 +8,48 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
|
8
8
|
var trackSyncBlocks = exports.trackSyncBlocks = function trackSyncBlocks(storeManager, tr, state) {
|
|
9
9
|
var sourceSyncBlockRemoved = {};
|
|
10
10
|
var sourceSyncBlockAdded = {};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
|
|
12
|
+
// and cast to specific step types
|
|
13
|
+
var replaceSteps = tr.steps.filter(function (step) {
|
|
14
|
+
return step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep;
|
|
15
|
+
});
|
|
16
|
+
var hasMultipleReplaceSteps = replaceSteps.length > 1;
|
|
17
|
+
replaceSteps.forEach(function (step) {
|
|
18
|
+
var from = step.from,
|
|
19
|
+
to = step.to;
|
|
20
|
+
// replaced a range, check for deleted syncBlock
|
|
21
|
+
if (from !== to) {
|
|
22
|
+
state.doc.nodesBetween(step.from, step.to, function (node) {
|
|
23
|
+
if (storeManager.isSourceBlock(node)) {
|
|
24
|
+
if (sourceSyncBlockAdded[node.attrs.localId]) {
|
|
25
|
+
// If a source block added and then removed in the same transaction,
|
|
26
|
+
// we treat it as no-op.
|
|
27
|
+
delete sourceSyncBlockAdded[node.attrs.localId];
|
|
28
|
+
} else {
|
|
29
|
+
sourceSyncBlockRemoved[node.attrs.localId] = node.attrs;
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
+
}
|
|
32
|
+
// we don't need to go deeper
|
|
33
|
+
return false;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
// replaced content, check for inserted syncBlock
|
|
38
|
+
// if only one replace step, we have already checked the entire replaced range above
|
|
39
|
+
if (step.slice.content.size > 0 && hasMultipleReplaceSteps) {
|
|
40
|
+
step.slice.content.nodesBetween(0, step.slice.content.size, function (node) {
|
|
41
|
+
if (storeManager.isSourceBlock(node)) {
|
|
42
|
+
if (sourceSyncBlockRemoved[node.attrs.localId]) {
|
|
43
|
+
// If a source block is removed and added back in the same transaction,
|
|
44
|
+
// we treat it as no-op.
|
|
45
|
+
delete sourceSyncBlockRemoved[node.attrs.localId];
|
|
46
|
+
} else {
|
|
47
|
+
sourceSyncBlockAdded[node.attrs.localId] = node.attrs;
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
49
|
+
}
|
|
50
|
+
// we don't need to go deeper
|
|
51
|
+
return false;
|
|
52
|
+
});
|
|
48
53
|
}
|
|
49
54
|
});
|
|
50
55
|
return {
|
|
@@ -59,6 +59,12 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
61
|
return true;
|
|
62
|
+
},
|
|
63
|
+
appendTransaction: (trs, oldState, newState) => {
|
|
64
|
+
trs.filter(tr => tr.docChanged).forEach(tr => {
|
|
65
|
+
syncBlockStore === null || syncBlockStore === void 0 ? void 0 : syncBlockStore.rebaseTransaction(tr, newState);
|
|
66
|
+
});
|
|
67
|
+
return null;
|
|
62
68
|
}
|
|
63
69
|
});
|
|
64
70
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
};
|
|
@@ -2,45 +2,48 @@ import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/tra
|
|
|
2
2
|
export const trackSyncBlocks = (storeManager, tr, state) => {
|
|
3
3
|
const sourceSyncBlockRemoved = {};
|
|
4
4
|
const sourceSyncBlockAdded = {};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
|
|
6
|
+
// and cast to specific step types
|
|
7
|
+
const replaceSteps = tr.steps.filter(step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep);
|
|
8
|
+
const hasMultipleReplaceSteps = replaceSteps.length > 1;
|
|
9
|
+
replaceSteps.forEach(step => {
|
|
10
|
+
const {
|
|
11
|
+
from,
|
|
12
|
+
to
|
|
13
|
+
} = step;
|
|
14
|
+
// replaced a range, check for deleted syncBlock
|
|
15
|
+
if (from !== to) {
|
|
16
|
+
state.doc.nodesBetween(step.from, step.to, node => {
|
|
17
|
+
if (storeManager.isSourceBlock(node)) {
|
|
18
|
+
if (sourceSyncBlockAdded[node.attrs.localId]) {
|
|
19
|
+
// If a source block added and then removed in the same transaction,
|
|
20
|
+
// we treat it as no-op.
|
|
21
|
+
delete sourceSyncBlockAdded[node.attrs.localId];
|
|
22
|
+
} else {
|
|
23
|
+
sourceSyncBlockRemoved[node.attrs.localId] = node.attrs;
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
25
|
+
}
|
|
26
|
+
// we don't need to go deeper
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
// replaced content, check for inserted syncBlock
|
|
32
|
+
// if only one replace step, we have already checked the entire replaced range above
|
|
33
|
+
if (step.slice.content.size > 0 && hasMultipleReplaceSteps) {
|
|
34
|
+
step.slice.content.nodesBetween(0, step.slice.content.size, node => {
|
|
35
|
+
if (storeManager.isSourceBlock(node)) {
|
|
36
|
+
if (sourceSyncBlockRemoved[node.attrs.localId]) {
|
|
37
|
+
// If a source block is removed and added back in the same transaction,
|
|
38
|
+
// we treat it as no-op.
|
|
39
|
+
delete sourceSyncBlockRemoved[node.attrs.localId];
|
|
40
|
+
} else {
|
|
41
|
+
sourceSyncBlockAdded[node.attrs.localId] = node.attrs;
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
|
+
// we don't need to go deeper
|
|
45
|
+
return false;
|
|
46
|
+
});
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
49
|
return {
|
|
@@ -58,6 +58,14 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
60
|
return true;
|
|
61
|
+
},
|
|
62
|
+
appendTransaction: function appendTransaction(trs, oldState, newState) {
|
|
63
|
+
trs.filter(function (tr) {
|
|
64
|
+
return tr.docChanged;
|
|
65
|
+
}).forEach(function (tr) {
|
|
66
|
+
syncBlockStore === null || syncBlockStore === void 0 || syncBlockStore.rebaseTransaction(tr, newState);
|
|
67
|
+
});
|
|
68
|
+
return null;
|
|
61
69
|
}
|
|
62
70
|
});
|
|
63
71
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
};
|
|
@@ -2,43 +2,48 @@ import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/tra
|
|
|
2
2
|
export var trackSyncBlocks = function trackSyncBlocks(storeManager, tr, state) {
|
|
3
3
|
var sourceSyncBlockRemoved = {};
|
|
4
4
|
var sourceSyncBlockAdded = {};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
|
|
6
|
+
// and cast to specific step types
|
|
7
|
+
var replaceSteps = tr.steps.filter(function (step) {
|
|
8
|
+
return step instanceof ReplaceStep || step instanceof ReplaceAroundStep;
|
|
9
|
+
});
|
|
10
|
+
var hasMultipleReplaceSteps = replaceSteps.length > 1;
|
|
11
|
+
replaceSteps.forEach(function (step) {
|
|
12
|
+
var from = step.from,
|
|
13
|
+
to = step.to;
|
|
14
|
+
// replaced a range, check for deleted syncBlock
|
|
15
|
+
if (from !== to) {
|
|
16
|
+
state.doc.nodesBetween(step.from, step.to, function (node) {
|
|
17
|
+
if (storeManager.isSourceBlock(node)) {
|
|
18
|
+
if (sourceSyncBlockAdded[node.attrs.localId]) {
|
|
19
|
+
// If a source block added and then removed in the same transaction,
|
|
20
|
+
// we treat it as no-op.
|
|
21
|
+
delete sourceSyncBlockAdded[node.attrs.localId];
|
|
22
|
+
} else {
|
|
23
|
+
sourceSyncBlockRemoved[node.attrs.localId] = node.attrs;
|
|
20
24
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
+
}
|
|
26
|
+
// we don't need to go deeper
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
// replaced content, check for inserted syncBlock
|
|
32
|
+
// if only one replace step, we have already checked the entire replaced range above
|
|
33
|
+
if (step.slice.content.size > 0 && hasMultipleReplaceSteps) {
|
|
34
|
+
step.slice.content.nodesBetween(0, step.slice.content.size, function (node) {
|
|
35
|
+
if (storeManager.isSourceBlock(node)) {
|
|
36
|
+
if (sourceSyncBlockRemoved[node.attrs.localId]) {
|
|
37
|
+
// If a source block is removed and added back in the same transaction,
|
|
38
|
+
// we treat it as no-op.
|
|
39
|
+
delete sourceSyncBlockRemoved[node.attrs.localId];
|
|
40
|
+
} else {
|
|
41
|
+
sourceSyncBlockAdded[node.attrs.localId] = node.attrs;
|
|
37
42
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
43
|
+
}
|
|
44
|
+
// we don't need to go deeper
|
|
45
|
+
return false;
|
|
46
|
+
});
|
|
42
47
|
}
|
|
43
48
|
});
|
|
44
49
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
4
|
-
export declare const CreateSyncedBlockDropdownItem: ({ api }: {
|
|
4
|
+
export declare const CreateSyncedBlockDropdownItem: ({ api, }: {
|
|
5
5
|
api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined;
|
|
6
6
|
}) => React.JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { SyncedBlockPlugin } from '../syncedBlockPluginType';
|
|
4
|
-
export declare const CreateSyncedBlockDropdownItem: ({ api }: {
|
|
4
|
+
export declare const CreateSyncedBlockDropdownItem: ({ api, }: {
|
|
5
5
|
api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined;
|
|
6
6
|
}) => React.JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
"@atlaskit/editor-plugin-block-menu": "^4.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-floating-toolbar": "^8.2.0",
|
|
36
|
-
"@atlaskit/editor-plugin-selection": "^6.
|
|
36
|
+
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
39
|
-
"@atlaskit/editor-synced-block-provider": "^0.
|
|
40
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
39
|
+
"@atlaskit/editor-synced-block-provider": "^0.4.0",
|
|
40
|
+
"@atlaskit/editor-toolbar": "^0.14.0",
|
|
41
41
|
"@atlaskit/icon": "28.4.0",
|
|
42
42
|
"@atlaskit/modal-dialog": "^14.4.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@atlaskit/editor-common": "^110.
|
|
47
|
+
"@atlaskit/editor-common": "^110.7.0",
|
|
48
48
|
"react": "^18.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|