@atlaskit/editor-plugin-local-id 1.0.2 → 1.0.4
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/afm-cc/tsconfig.json +3 -3
- package/dist/cjs/pm-plugins/main.js +16 -18
- package/dist/es2019/pm-plugins/main.js +16 -15
- package/dist/esm/pm-plugins/main.js +16 -17
- package/dist/types/pm-plugins/main.d.ts +1 -5
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -5
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-local-id
|
|
2
2
|
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`84d49ebfb038b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/84d49ebfb038b) -
|
|
8
|
+
EDITOR-1426 Updated addLocalIdToNode to use setNodeAttribute which creates an attr step instead of
|
|
9
|
+
a replace step as localId attribute changes should not result in a document change.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 1.0.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`655a927604c69`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/655a927604c69) -
|
|
17
|
+
Ignore media group node for local id as it is not in the schema for now
|
|
18
|
+
|
|
3
19
|
## 1.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"extends": "../../../../tsconfig.entry-points.confluence.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es5",
|
|
5
|
-
"composite": true,
|
|
6
5
|
"outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-local-id",
|
|
7
|
-
"rootDir": "../"
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
8
|
},
|
|
9
9
|
"include": [
|
|
10
10
|
"../src/**/*.ts",
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
25
25
|
}
|
|
26
26
|
]
|
|
27
|
-
}
|
|
27
|
+
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.localIdPluginKey = exports.createPlugin = exports.addLocalIdToNode = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
8
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
12
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
17
13
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
14
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -41,13 +37,16 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
41
37
|
var localIdWasAdded = false;
|
|
42
38
|
var _editorView$state$sch = editorView.state.schema.nodes,
|
|
43
39
|
text = _editorView$state$sch.text,
|
|
44
|
-
hardBreak = _editorView$state$sch.hardBreak
|
|
45
|
-
|
|
40
|
+
hardBreak = _editorView$state$sch.hardBreak,
|
|
41
|
+
mediaGroup = _editorView$state$sch.mediaGroup;
|
|
42
|
+
// Media group is ignored for now
|
|
43
|
+
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
44
|
+
var ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
|
|
46
45
|
editorView.state.doc.descendants(function (node, pos) {
|
|
47
46
|
// Skip text nodes, hard breaks and nodes that already have local IDs
|
|
48
47
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId) {
|
|
49
48
|
localIdWasAdded = true;
|
|
50
|
-
addLocalIdToNode(
|
|
49
|
+
addLocalIdToNode(pos, tr);
|
|
51
50
|
}
|
|
52
51
|
return true; // Continue traversing
|
|
53
52
|
});
|
|
@@ -71,11 +70,15 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
71
70
|
var tr = newState.tr;
|
|
72
71
|
var _newState$schema$node = newState.schema.nodes,
|
|
73
72
|
text = _newState$schema$node.text,
|
|
74
|
-
hardBreak = _newState$schema$node.hardBreak
|
|
75
|
-
|
|
73
|
+
hardBreak = _newState$schema$node.hardBreak,
|
|
74
|
+
mediaGroup = _newState$schema$node.mediaGroup;
|
|
75
|
+
// Media group is ignored for now
|
|
76
|
+
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
77
|
+
var ignoredNodeTypes = [text === null || text === void 0 ? void 0 : text.name, hardBreak === null || hardBreak === void 0 ? void 0 : hardBreak.name, mediaGroup === null || mediaGroup === void 0 ? void 0 : mediaGroup.name];
|
|
76
78
|
var addedNodes = new Set();
|
|
77
79
|
var addedNodePos = new Map();
|
|
78
80
|
var localIds = new Set();
|
|
81
|
+
|
|
79
82
|
// Process only the nodes added in the transactions
|
|
80
83
|
transactions.forEach(function (transaction) {
|
|
81
84
|
if (!transaction.docChanged) {
|
|
@@ -101,7 +104,7 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
101
104
|
addedNodePos.set(node, pos);
|
|
102
105
|
} else {
|
|
103
106
|
if (!(node !== null && node !== void 0 && node.attrs.localId)) {
|
|
104
|
-
addLocalIdToNode(
|
|
107
|
+
addLocalIdToNode(pos, tr);
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
return true;
|
|
@@ -125,7 +128,7 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
125
128
|
if (!node.attrs.localId || localIds.has(node.attrs.localId)) {
|
|
126
129
|
var pos = addedNodePos.get(node);
|
|
127
130
|
if (pos !== undefined) {
|
|
128
|
-
addLocalIdToNode(
|
|
131
|
+
addLocalIdToNode(pos, tr);
|
|
129
132
|
modified = true;
|
|
130
133
|
}
|
|
131
134
|
}
|
|
@@ -144,15 +147,10 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
144
147
|
* Adds a local ID to a ProseMirror node
|
|
145
148
|
*
|
|
146
149
|
* This utility function updates a node's attributes to include a unique local ID.
|
|
147
|
-
* It preserves all existing attributes and marks while adding the new localId.
|
|
148
150
|
*
|
|
149
|
-
* @param node - The ProseMirror node to add a local ID to
|
|
150
151
|
* @param pos - The position of the node in the document
|
|
151
152
|
* @param tr - The transaction to apply the change to
|
|
152
|
-
* @returns The updated transaction with the node markup change
|
|
153
153
|
*/
|
|
154
|
-
var addLocalIdToNode = exports.addLocalIdToNode = function addLocalIdToNode(
|
|
155
|
-
tr.
|
|
156
|
-
localId: _adfSchema.uuid.generate()
|
|
157
|
-
}), node.marks);
|
|
154
|
+
var addLocalIdToNode = exports.addLocalIdToNode = function addLocalIdToNode(pos, tr) {
|
|
155
|
+
tr.setNodeAttribute(pos, 'localId', _adfSchema.uuid.generate());
|
|
158
156
|
};
|
|
@@ -28,14 +28,17 @@ export const createPlugin = () => {
|
|
|
28
28
|
let localIdWasAdded = false;
|
|
29
29
|
const {
|
|
30
30
|
text,
|
|
31
|
-
hardBreak
|
|
31
|
+
hardBreak,
|
|
32
|
+
mediaGroup
|
|
32
33
|
} = editorView.state.schema.nodes;
|
|
33
|
-
|
|
34
|
+
// Media group is ignored for now
|
|
35
|
+
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
36
|
+
const ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
|
|
34
37
|
editorView.state.doc.descendants((node, pos) => {
|
|
35
38
|
// Skip text nodes, hard breaks and nodes that already have local IDs
|
|
36
39
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId) {
|
|
37
40
|
localIdWasAdded = true;
|
|
38
|
-
addLocalIdToNode(
|
|
41
|
+
addLocalIdToNode(pos, tr);
|
|
39
42
|
}
|
|
40
43
|
return true; // Continue traversing
|
|
41
44
|
});
|
|
@@ -59,12 +62,16 @@ export const createPlugin = () => {
|
|
|
59
62
|
const tr = newState.tr;
|
|
60
63
|
const {
|
|
61
64
|
text,
|
|
62
|
-
hardBreak
|
|
65
|
+
hardBreak,
|
|
66
|
+
mediaGroup
|
|
63
67
|
} = newState.schema.nodes;
|
|
64
|
-
|
|
68
|
+
// Media group is ignored for now
|
|
69
|
+
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
70
|
+
const ignoredNodeTypes = [text === null || text === void 0 ? void 0 : text.name, hardBreak === null || hardBreak === void 0 ? void 0 : hardBreak.name, mediaGroup === null || mediaGroup === void 0 ? void 0 : mediaGroup.name];
|
|
65
71
|
const addedNodes = new Set();
|
|
66
72
|
const addedNodePos = new Map();
|
|
67
73
|
const localIds = new Set();
|
|
74
|
+
|
|
68
75
|
// Process only the nodes added in the transactions
|
|
69
76
|
transactions.forEach(transaction => {
|
|
70
77
|
if (!transaction.docChanged) {
|
|
@@ -90,7 +97,7 @@ export const createPlugin = () => {
|
|
|
90
97
|
addedNodePos.set(node, pos);
|
|
91
98
|
} else {
|
|
92
99
|
if (!(node !== null && node !== void 0 && node.attrs.localId)) {
|
|
93
|
-
addLocalIdToNode(
|
|
100
|
+
addLocalIdToNode(pos, tr);
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
103
|
return true;
|
|
@@ -110,7 +117,7 @@ export const createPlugin = () => {
|
|
|
110
117
|
if (!node.attrs.localId || localIds.has(node.attrs.localId)) {
|
|
111
118
|
const pos = addedNodePos.get(node);
|
|
112
119
|
if (pos !== undefined) {
|
|
113
|
-
addLocalIdToNode(
|
|
120
|
+
addLocalIdToNode(pos, tr);
|
|
114
121
|
modified = true;
|
|
115
122
|
}
|
|
116
123
|
}
|
|
@@ -124,16 +131,10 @@ export const createPlugin = () => {
|
|
|
124
131
|
* Adds a local ID to a ProseMirror node
|
|
125
132
|
*
|
|
126
133
|
* This utility function updates a node's attributes to include a unique local ID.
|
|
127
|
-
* It preserves all existing attributes and marks while adding the new localId.
|
|
128
134
|
*
|
|
129
|
-
* @param node - The ProseMirror node to add a local ID to
|
|
130
135
|
* @param pos - The position of the node in the document
|
|
131
136
|
* @param tr - The transaction to apply the change to
|
|
132
|
-
* @returns The updated transaction with the node markup change
|
|
133
137
|
*/
|
|
134
|
-
export const addLocalIdToNode = (
|
|
135
|
-
tr.
|
|
136
|
-
...node.attrs,
|
|
137
|
-
localId: uuid.generate()
|
|
138
|
-
}, node.marks);
|
|
138
|
+
export const addLocalIdToNode = (pos, tr) => {
|
|
139
|
+
tr.setNodeAttribute(pos, 'localId', uuid.generate());
|
|
139
140
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
5
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
3
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -34,13 +31,16 @@ export var createPlugin = function createPlugin() {
|
|
|
34
31
|
var localIdWasAdded = false;
|
|
35
32
|
var _editorView$state$sch = editorView.state.schema.nodes,
|
|
36
33
|
text = _editorView$state$sch.text,
|
|
37
|
-
hardBreak = _editorView$state$sch.hardBreak
|
|
38
|
-
|
|
34
|
+
hardBreak = _editorView$state$sch.hardBreak,
|
|
35
|
+
mediaGroup = _editorView$state$sch.mediaGroup;
|
|
36
|
+
// Media group is ignored for now
|
|
37
|
+
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
38
|
+
var ignoredNodeTypes = mediaGroup ? [text.name, hardBreak.name, mediaGroup.name] : [text.name, hardBreak.name];
|
|
39
39
|
editorView.state.doc.descendants(function (node, pos) {
|
|
40
40
|
// Skip text nodes, hard breaks and nodes that already have local IDs
|
|
41
41
|
if (!ignoredNodeTypes.includes(node.type.name) && !node.attrs.localId) {
|
|
42
42
|
localIdWasAdded = true;
|
|
43
|
-
addLocalIdToNode(
|
|
43
|
+
addLocalIdToNode(pos, tr);
|
|
44
44
|
}
|
|
45
45
|
return true; // Continue traversing
|
|
46
46
|
});
|
|
@@ -64,11 +64,15 @@ export var createPlugin = function createPlugin() {
|
|
|
64
64
|
var tr = newState.tr;
|
|
65
65
|
var _newState$schema$node = newState.schema.nodes,
|
|
66
66
|
text = _newState$schema$node.text,
|
|
67
|
-
hardBreak = _newState$schema$node.hardBreak
|
|
68
|
-
|
|
67
|
+
hardBreak = _newState$schema$node.hardBreak,
|
|
68
|
+
mediaGroup = _newState$schema$node.mediaGroup;
|
|
69
|
+
// Media group is ignored for now
|
|
70
|
+
// https://bitbucket.org/atlassian/adf-schema/src/fb2236147a0c2bc9c8efbdb75fd8f8c411df44ba/packages/adf-schema/src/next-schema/nodes/mediaGroup.ts#lines-12
|
|
71
|
+
var ignoredNodeTypes = [text === null || text === void 0 ? void 0 : text.name, hardBreak === null || hardBreak === void 0 ? void 0 : hardBreak.name, mediaGroup === null || mediaGroup === void 0 ? void 0 : mediaGroup.name];
|
|
69
72
|
var addedNodes = new Set();
|
|
70
73
|
var addedNodePos = new Map();
|
|
71
74
|
var localIds = new Set();
|
|
75
|
+
|
|
72
76
|
// Process only the nodes added in the transactions
|
|
73
77
|
transactions.forEach(function (transaction) {
|
|
74
78
|
if (!transaction.docChanged) {
|
|
@@ -94,7 +98,7 @@ export var createPlugin = function createPlugin() {
|
|
|
94
98
|
addedNodePos.set(node, pos);
|
|
95
99
|
} else {
|
|
96
100
|
if (!(node !== null && node !== void 0 && node.attrs.localId)) {
|
|
97
|
-
addLocalIdToNode(
|
|
101
|
+
addLocalIdToNode(pos, tr);
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
return true;
|
|
@@ -118,7 +122,7 @@ export var createPlugin = function createPlugin() {
|
|
|
118
122
|
if (!node.attrs.localId || localIds.has(node.attrs.localId)) {
|
|
119
123
|
var pos = addedNodePos.get(node);
|
|
120
124
|
if (pos !== undefined) {
|
|
121
|
-
addLocalIdToNode(
|
|
125
|
+
addLocalIdToNode(pos, tr);
|
|
122
126
|
modified = true;
|
|
123
127
|
}
|
|
124
128
|
}
|
|
@@ -137,15 +141,10 @@ export var createPlugin = function createPlugin() {
|
|
|
137
141
|
* Adds a local ID to a ProseMirror node
|
|
138
142
|
*
|
|
139
143
|
* This utility function updates a node's attributes to include a unique local ID.
|
|
140
|
-
* It preserves all existing attributes and marks while adding the new localId.
|
|
141
144
|
*
|
|
142
|
-
* @param node - The ProseMirror node to add a local ID to
|
|
143
145
|
* @param pos - The position of the node in the document
|
|
144
146
|
* @param tr - The transaction to apply the change to
|
|
145
|
-
* @returns The updated transaction with the node markup change
|
|
146
147
|
*/
|
|
147
|
-
export var addLocalIdToNode = function addLocalIdToNode(
|
|
148
|
-
tr.
|
|
149
|
-
localId: uuid.generate()
|
|
150
|
-
}), node.marks);
|
|
148
|
+
export var addLocalIdToNode = function addLocalIdToNode(pos, tr) {
|
|
149
|
+
tr.setNodeAttribute(pos, 'localId', uuid.generate());
|
|
151
150
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import { PluginKey, type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
export declare const localIdPluginKey: PluginKey<any>;
|
|
5
4
|
export declare const createPlugin: () => SafePlugin<any>;
|
|
@@ -7,11 +6,8 @@ export declare const createPlugin: () => SafePlugin<any>;
|
|
|
7
6
|
* Adds a local ID to a ProseMirror node
|
|
8
7
|
*
|
|
9
8
|
* This utility function updates a node's attributes to include a unique local ID.
|
|
10
|
-
* It preserves all existing attributes and marks while adding the new localId.
|
|
11
9
|
*
|
|
12
|
-
* @param node - The ProseMirror node to add a local ID to
|
|
13
10
|
* @param pos - The position of the node in the document
|
|
14
11
|
* @param tr - The transaction to apply the change to
|
|
15
|
-
* @returns The updated transaction with the node markup change
|
|
16
12
|
*/
|
|
17
|
-
export declare const addLocalIdToNode: (
|
|
13
|
+
export declare const addLocalIdToNode: (pos: number, tr: Transaction) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
2
|
import { PluginKey, type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
3
|
export declare const localIdPluginKey: PluginKey<any>;
|
|
5
4
|
export declare const createPlugin: () => SafePlugin<any>;
|
|
@@ -7,11 +6,8 @@ export declare const createPlugin: () => SafePlugin<any>;
|
|
|
7
6
|
* Adds a local ID to a ProseMirror node
|
|
8
7
|
*
|
|
9
8
|
* This utility function updates a node's attributes to include a unique local ID.
|
|
10
|
-
* It preserves all existing attributes and marks while adding the new localId.
|
|
11
9
|
*
|
|
12
|
-
* @param node - The ProseMirror node to add a local ID to
|
|
13
10
|
* @param pos - The position of the node in the document
|
|
14
11
|
* @param tr - The transaction to apply the change to
|
|
15
|
-
* @returns The updated transaction with the node markup change
|
|
16
12
|
*/
|
|
17
|
-
export declare const addLocalIdToNode: (
|
|
13
|
+
export declare const addLocalIdToNode: (pos: number, tr: Transaction) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-local-id",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "LocalId plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,18 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
|
-
"af:exports": {
|
|
31
|
-
".": "./src/index.ts"
|
|
32
|
-
},
|
|
33
30
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^50.2.
|
|
31
|
+
"@atlaskit/adf-schema": "^50.2.2",
|
|
35
32
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
36
33
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
37
34
|
"@babel/runtime": "^7.0.0",
|
|
38
35
|
"raf-schd": "^4.0.3"
|
|
39
36
|
},
|
|
40
37
|
"peerDependencies": {
|
|
41
|
-
"@atlaskit/editor-common": "^107.
|
|
38
|
+
"@atlaskit/editor-common": "^107.32.0",
|
|
42
39
|
"react": "^18.2.0"
|
|
43
40
|
},
|
|
44
41
|
"devDependencies": {
|