@atlaskit/editor-plugin-local-id 1.0.4 → 1.0.6

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,20 @@
1
1
  # @atlaskit/editor-plugin-local-id
2
2
 
3
+ ## 1.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
8
+ EDITOR-1442 Bump adf-schema
9
+ - Updated dependencies
10
+
11
+ ## 1.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`e5f37a1deec51`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5f37a1deec51) -
16
+ Added check for localId in the node spec to prevent adding id's to nodes that may not allow it.
17
+
3
18
  ## 1.0.4
4
19
 
5
20
  ### Patch Changes
@@ -43,8 +43,8 @@ var createPlugin = exports.createPlugin = function createPlugin() {
43
43
  // https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
44
44
  var ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
45
45
  editorView.state.doc.descendants(function (node, pos) {
46
- // Skip text nodes, hard breaks and nodes that already have local IDs
47
- if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId) {
46
+ var _node$type$spec$attrs;
47
+ 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)) {
48
48
  localIdWasAdded = true;
49
49
  addLocalIdToNode(pos, tr);
50
50
  }
@@ -94,7 +94,8 @@ var createPlugin = exports.createPlugin = function createPlugin() {
94
94
  step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
95
95
  // Scan the changed range to find all nodes
96
96
  tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
97
- if (ignoredNodeTypes.includes(node.type.name)) {
97
+ var _node$type$spec$attrs2;
98
+ 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)) {
98
99
  return true;
99
100
  }
100
101
  modified = true;
@@ -35,8 +35,8 @@ export const createPlugin = () => {
35
35
  // https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
36
36
  const ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
37
37
  editorView.state.doc.descendants((node, pos) => {
38
- // Skip text nodes, hard breaks and nodes that already have local IDs
39
- if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId) {
38
+ var _node$type$spec$attrs;
39
+ 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)) {
40
40
  localIdWasAdded = true;
41
41
  addLocalIdToNode(pos, tr);
42
42
  }
@@ -87,7 +87,8 @@ export const createPlugin = () => {
87
87
  step.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
88
88
  // Scan the changed range to find all nodes
89
89
  tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), (node, pos) => {
90
- if (ignoredNodeTypes.includes(node.type.name)) {
90
+ var _node$type$spec$attrs2;
91
+ 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)) {
91
92
  return true;
92
93
  }
93
94
  modified = true;
@@ -37,8 +37,8 @@ export var createPlugin = function createPlugin() {
37
37
  // https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
38
38
  var ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
39
39
  editorView.state.doc.descendants(function (node, pos) {
40
- // Skip text nodes, hard breaks and nodes that already have local IDs
41
- if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId) {
40
+ var _node$type$spec$attrs;
41
+ 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)) {
42
42
  localIdWasAdded = true;
43
43
  addLocalIdToNode(pos, tr);
44
44
  }
@@ -88,7 +88,8 @@ export var createPlugin = function createPlugin() {
88
88
  step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
89
89
  // Scan the changed range to find all nodes
90
90
  tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
91
- if (ignoredNodeTypes.includes(node.type.name)) {
91
+ var _node$type$spec$attrs2;
92
+ 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)) {
92
93
  return true;
93
94
  }
94
95
  modified = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-local-id",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
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": "^50.2.2",
31
+ "@atlaskit/adf-schema": "^50.2.3",
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": "^107.32.0",
38
+ "@atlaskit/editor-common": "^107.33.0",
39
39
  "react": "^18.2.0"
40
40
  },
41
41
  "devDependencies": {