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