@atlaskit/editor-plugin-local-id 4.2.5 → 4.2.7
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 +16 -0
- package/dist/cjs/pm-plugins/main.js +0 -20
- package/dist/es2019/pm-plugins/main.js +0 -20
- package/dist/esm/pm-plugins/main.js +0 -20
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-local-id
|
|
2
2
|
|
|
3
|
+
## 4.2.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e3779b75fdeca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3779b75fdeca) -
|
|
8
|
+
EDITOR-1643 Promote syncBlock and bodiedSyncBlock to full schema
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 4.2.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
|
|
16
|
+
tsignores added for help-center local consumpton removed
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 4.2.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -38,8 +38,6 @@ var requestIdleCallbackWithFallback = function requestIdleCallbackWithFallback(c
|
|
|
38
38
|
var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
39
39
|
return new _safePlugin.SafePlugin({
|
|
40
40
|
key: localIdPluginKey,
|
|
41
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
42
|
-
|
|
43
41
|
view: function view(editorView) {
|
|
44
42
|
/**
|
|
45
43
|
* This performs a one-time scan of the document to add local IDs
|
|
@@ -58,9 +56,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
58
56
|
// Media group is ignored for now
|
|
59
57
|
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
60
58
|
var ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
|
|
61
|
-
|
|
62
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
63
|
-
|
|
64
59
|
editorView.state.doc.descendants(function (node, pos) {
|
|
65
60
|
var _node$type$spec$attrs;
|
|
66
61
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId && !!((_node$type$spec$attrs = node.type.spec.attrs) !== null && _node$type$spec$attrs !== void 0 && _node$type$spec$attrs.localId)) {
|
|
@@ -91,8 +86,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
91
86
|
* Handles adding local IDs to new nodes that are created and have the localId attribute
|
|
92
87
|
* This ensures uniqueness of localIds on nodes being created or edited
|
|
93
88
|
*/
|
|
94
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
95
|
-
|
|
96
89
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
97
90
|
var modified = false;
|
|
98
91
|
var tr = newState.tr;
|
|
@@ -109,8 +102,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
109
102
|
var nodesToUpdate = new Map(); // position -> localId
|
|
110
103
|
|
|
111
104
|
// Process only the nodes added in the transactions
|
|
112
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
113
|
-
|
|
114
105
|
transactions.forEach(function (transaction) {
|
|
115
106
|
if (!transaction.docChanged) {
|
|
116
107
|
return;
|
|
@@ -127,19 +118,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
127
118
|
if (transaction.getMeta('ignoreLocalIdUpdate')) {
|
|
128
119
|
return;
|
|
129
120
|
}
|
|
130
|
-
|
|
131
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
132
|
-
|
|
133
121
|
transaction.steps.forEach(function (step) {
|
|
134
122
|
if (!(0, _utils.stepHasSlice)(step)) {
|
|
135
123
|
return;
|
|
136
124
|
}
|
|
137
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
138
|
-
|
|
139
125
|
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
140
126
|
// Scan the changed range to find all nodes
|
|
141
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
142
|
-
|
|
143
127
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
|
|
144
128
|
var _node$type$spec$attrs2;
|
|
145
129
|
if (ignoredNodeTypes.includes(node.type.name) || !((_node$type$spec$attrs2 = node.type.spec.attrs) !== null && _node$type$spec$attrs2 !== void 0 && _node$type$spec$attrs2.localId)) {
|
|
@@ -166,8 +150,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
166
150
|
});
|
|
167
151
|
});
|
|
168
152
|
if (addedNodes.size > 0 && (0, _platformFeatureFlags.fg)('platform_editor_use_localid_dedupe')) {
|
|
169
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
170
|
-
|
|
171
153
|
newState.doc.descendants(function (node, pos) {
|
|
172
154
|
if (addedNodes.has(node)) {
|
|
173
155
|
return true;
|
|
@@ -237,8 +219,6 @@ var addLocalIdToNode = exports.addLocalIdToNode = function addLocalIdToNode(api,
|
|
|
237
219
|
* @param tr
|
|
238
220
|
*/
|
|
239
221
|
var batchAddLocalIdToNodes = exports.batchAddLocalIdToNodes = function batchAddLocalIdToNodes(nodesToUpdate, tr) {
|
|
240
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
241
|
-
|
|
242
222
|
var batchData = Array.from(nodesToUpdate.entries()).map(function (_ref) {
|
|
243
223
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
244
224
|
pos = _ref2[0],
|
|
@@ -27,8 +27,6 @@ const requestIdleCallbackWithFallback = callback => {
|
|
|
27
27
|
export const createPlugin = api => {
|
|
28
28
|
return new SafePlugin({
|
|
29
29
|
key: localIdPluginKey,
|
|
30
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
31
|
-
|
|
32
30
|
view: editorView => {
|
|
33
31
|
/**
|
|
34
32
|
* This performs a one-time scan of the document to add local IDs
|
|
@@ -48,9 +46,6 @@ export const createPlugin = api => {
|
|
|
48
46
|
// Media group is ignored for now
|
|
49
47
|
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
50
48
|
const ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
|
|
51
|
-
|
|
52
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
53
|
-
|
|
54
49
|
editorView.state.doc.descendants((node, pos) => {
|
|
55
50
|
var _node$type$spec$attrs;
|
|
56
51
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId && !!((_node$type$spec$attrs = node.type.spec.attrs) !== null && _node$type$spec$attrs !== void 0 && _node$type$spec$attrs.localId)) {
|
|
@@ -81,8 +76,6 @@ export const createPlugin = api => {
|
|
|
81
76
|
* Handles adding local IDs to new nodes that are created and have the localId attribute
|
|
82
77
|
* This ensures uniqueness of localIds on nodes being created or edited
|
|
83
78
|
*/
|
|
84
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
85
|
-
|
|
86
79
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
87
80
|
let modified = false;
|
|
88
81
|
const tr = newState.tr;
|
|
@@ -100,8 +93,6 @@ export const createPlugin = api => {
|
|
|
100
93
|
const nodesToUpdate = new Map(); // position -> localId
|
|
101
94
|
|
|
102
95
|
// Process only the nodes added in the transactions
|
|
103
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
104
|
-
|
|
105
96
|
transactions.forEach(transaction => {
|
|
106
97
|
if (!transaction.docChanged) {
|
|
107
98
|
return;
|
|
@@ -118,19 +109,12 @@ export const createPlugin = api => {
|
|
|
118
109
|
if (transaction.getMeta('ignoreLocalIdUpdate')) {
|
|
119
110
|
return;
|
|
120
111
|
}
|
|
121
|
-
|
|
122
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
123
|
-
|
|
124
112
|
transaction.steps.forEach(step => {
|
|
125
113
|
if (!stepHasSlice(step)) {
|
|
126
114
|
return;
|
|
127
115
|
}
|
|
128
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
129
|
-
|
|
130
116
|
step.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
131
117
|
// Scan the changed range to find all nodes
|
|
132
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
133
|
-
|
|
134
118
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), (node, pos) => {
|
|
135
119
|
var _node$type$spec$attrs2;
|
|
136
120
|
if (ignoredNodeTypes.includes(node.type.name) || !((_node$type$spec$attrs2 = node.type.spec.attrs) !== null && _node$type$spec$attrs2 !== void 0 && _node$type$spec$attrs2.localId)) {
|
|
@@ -157,8 +141,6 @@ export const createPlugin = api => {
|
|
|
157
141
|
});
|
|
158
142
|
});
|
|
159
143
|
if (addedNodes.size > 0 && fg('platform_editor_use_localid_dedupe')) {
|
|
160
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
161
|
-
|
|
162
144
|
newState.doc.descendants((node, pos) => {
|
|
163
145
|
if (addedNodes.has(node)) {
|
|
164
146
|
return true;
|
|
@@ -219,8 +201,6 @@ export const addLocalIdToNode = (api, pos, tr, node) => {
|
|
|
219
201
|
* @param tr
|
|
220
202
|
*/
|
|
221
203
|
export const batchAddLocalIdToNodes = (nodesToUpdate, tr) => {
|
|
222
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
223
|
-
|
|
224
204
|
const batchData = Array.from(nodesToUpdate.entries()).map(([pos, localId]) => {
|
|
225
205
|
const node = tr.doc.nodeAt(pos);
|
|
226
206
|
if (!node) {
|
|
@@ -31,8 +31,6 @@ var requestIdleCallbackWithFallback = function requestIdleCallbackWithFallback(c
|
|
|
31
31
|
export var createPlugin = function createPlugin(api) {
|
|
32
32
|
return new SafePlugin({
|
|
33
33
|
key: localIdPluginKey,
|
|
34
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
35
|
-
|
|
36
34
|
view: function view(editorView) {
|
|
37
35
|
/**
|
|
38
36
|
* This performs a one-time scan of the document to add local IDs
|
|
@@ -51,9 +49,6 @@ export var createPlugin = function createPlugin(api) {
|
|
|
51
49
|
// Media group is ignored for now
|
|
52
50
|
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
53
51
|
var ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
|
|
54
|
-
|
|
55
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
56
|
-
|
|
57
52
|
editorView.state.doc.descendants(function (node, pos) {
|
|
58
53
|
var _node$type$spec$attrs;
|
|
59
54
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId && !!((_node$type$spec$attrs = node.type.spec.attrs) !== null && _node$type$spec$attrs !== void 0 && _node$type$spec$attrs.localId)) {
|
|
@@ -84,8 +79,6 @@ export var createPlugin = function createPlugin(api) {
|
|
|
84
79
|
* Handles adding local IDs to new nodes that are created and have the localId attribute
|
|
85
80
|
* This ensures uniqueness of localIds on nodes being created or edited
|
|
86
81
|
*/
|
|
87
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
88
|
-
|
|
89
82
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
90
83
|
var modified = false;
|
|
91
84
|
var tr = newState.tr;
|
|
@@ -102,8 +95,6 @@ export var createPlugin = function createPlugin(api) {
|
|
|
102
95
|
var nodesToUpdate = new Map(); // position -> localId
|
|
103
96
|
|
|
104
97
|
// Process only the nodes added in the transactions
|
|
105
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
106
|
-
|
|
107
98
|
transactions.forEach(function (transaction) {
|
|
108
99
|
if (!transaction.docChanged) {
|
|
109
100
|
return;
|
|
@@ -120,19 +111,12 @@ export var createPlugin = function createPlugin(api) {
|
|
|
120
111
|
if (transaction.getMeta('ignoreLocalIdUpdate')) {
|
|
121
112
|
return;
|
|
122
113
|
}
|
|
123
|
-
|
|
124
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
125
|
-
|
|
126
114
|
transaction.steps.forEach(function (step) {
|
|
127
115
|
if (!stepHasSlice(step)) {
|
|
128
116
|
return;
|
|
129
117
|
}
|
|
130
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
131
|
-
|
|
132
118
|
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
133
119
|
// Scan the changed range to find all nodes
|
|
134
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
135
|
-
|
|
136
120
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
|
|
137
121
|
var _node$type$spec$attrs2;
|
|
138
122
|
if (ignoredNodeTypes.includes(node.type.name) || !((_node$type$spec$attrs2 = node.type.spec.attrs) !== null && _node$type$spec$attrs2 !== void 0 && _node$type$spec$attrs2.localId)) {
|
|
@@ -159,8 +143,6 @@ export var createPlugin = function createPlugin(api) {
|
|
|
159
143
|
});
|
|
160
144
|
});
|
|
161
145
|
if (addedNodes.size > 0 && fg('platform_editor_use_localid_dedupe')) {
|
|
162
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
163
|
-
|
|
164
146
|
newState.doc.descendants(function (node, pos) {
|
|
165
147
|
if (addedNodes.has(node)) {
|
|
166
148
|
return true;
|
|
@@ -230,8 +212,6 @@ export var addLocalIdToNode = function addLocalIdToNode(api, pos, tr, node) {
|
|
|
230
212
|
* @param tr
|
|
231
213
|
*/
|
|
232
214
|
export var batchAddLocalIdToNodes = function batchAddLocalIdToNodes(nodesToUpdate, tr) {
|
|
233
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
234
|
-
|
|
235
215
|
var batchData = Array.from(nodesToUpdate.entries()).map(function (_ref) {
|
|
236
216
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
237
217
|
pos = _ref2[0],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-local-id",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.7",
|
|
4
4
|
"description": "LocalId plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^51.
|
|
31
|
+
"@atlaskit/adf-schema": "^51.5.1",
|
|
32
32
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
33
33
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"raf-schd": "^4.0.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@atlaskit/editor-common": "^110.
|
|
38
|
+
"@atlaskit/editor-common": "^110.38.0",
|
|
39
39
|
"react": "^18.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|