@atlaskit/editor-plugin-local-id 14.0.12 → 14.0.14
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 +12 -0
- package/dist/cjs/pm-plugins/add-missing-local-ids.js +2 -2
- package/dist/cjs/pm-plugins/generateShortUUID.js +2 -2
- package/dist/cjs/pm-plugins/main.js +3 -3
- package/dist/cjs/pm-plugins/watchmen.js +6 -5
- package/dist/es2019/pm-plugins/add-missing-local-ids.js +1 -1
- package/dist/es2019/pm-plugins/generateShortUUID.js +1 -1
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/pm-plugins/watchmen.js +2 -1
- package/dist/esm/pm-plugins/add-missing-local-ids.js +1 -1
- package/dist/esm/pm-plugins/generateShortUUID.js +1 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/pm-plugins/watchmen.js +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.localIdNotEmpty = exports.batchAddLocalIdToNodes = exports.addMissingLocalIdsToDocument = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var
|
|
9
|
+
var _batchAttrsStep = require("@atlaskit/adf-schema/steps/batch-attrs-step");
|
|
10
10
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
11
11
|
var _generateShortUUID = require("./generateShortUUID");
|
|
12
12
|
var localIdNotEmpty = exports.localIdNotEmpty = function localIdNotEmpty(localId) {
|
|
@@ -66,6 +66,6 @@ var batchAddLocalIdToNodes = exports.batchAddLocalIdToNodes = function batchAddL
|
|
|
66
66
|
nodeType: node.type.name
|
|
67
67
|
};
|
|
68
68
|
});
|
|
69
|
-
tr.step(new
|
|
69
|
+
tr.step(new _batchAttrsStep.BatchAttrsStep(batchData));
|
|
70
70
|
tr.setMeta('addToHistory', false);
|
|
71
71
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.generatedShortUUIDs = exports.generateShortUUID = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uuid = require("@atlaskit/adf-schema/uuid");
|
|
8
8
|
/**
|
|
9
9
|
* Global Set to track currently generated and existing short UUIDs in the document.
|
|
10
10
|
* Used to prevent duplicate short IDs when using crypto.randomUUID().
|
|
@@ -32,5 +32,5 @@ var generateShortUUID = exports.generateShortUUID = function generateShortUUID()
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
// Fallback to full UUID if short UUID generation fails or max retries exceeded
|
|
35
|
-
return
|
|
35
|
+
return _uuid.uuid.generate();
|
|
36
36
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.localIdPluginKey = exports.createPlugin = void 0;
|
|
8
8
|
var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
|
|
9
|
-
var
|
|
9
|
+
var _overrideDocumentStep = require("@atlaskit/adf-schema/steps/override-document-step");
|
|
10
10
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -121,7 +121,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
121
121
|
// transactions through. Ordinary remote edits are still skipped, and
|
|
122
122
|
// existing localIds are never overwritten.
|
|
123
123
|
Boolean(transaction.getMeta('isRemote')) && !transaction.steps.some(function (step) {
|
|
124
|
-
return step instanceof
|
|
124
|
+
return step instanceof _overrideDocumentStep.OverrideDocumentStep;
|
|
125
125
|
})) {
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
@@ -136,7 +136,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
136
136
|
// Steps with a slice are scanned for nodes that need localIds.
|
|
137
137
|
// OverrideDocumentStep (template replacement) has no `slice`, so we also
|
|
138
138
|
// scan it so the inserted template nodes get localIds.
|
|
139
|
-
var isTemplateOverrideStep = step instanceof
|
|
139
|
+
var isTemplateOverrideStep = step instanceof _overrideDocumentStep.OverrideDocumentStep;
|
|
140
140
|
if (!(0, _utils.stepHasSlice)(step) && !isTemplateOverrideStep) {
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.localIdWatchmenPluginKey = exports.createWatchmenPlugin = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var
|
|
9
|
+
var _batchAttrsStep = require("@atlaskit/adf-schema/steps/batch-attrs-step");
|
|
10
|
+
var _setAttrs = require("@atlaskit/adf-schema/steps/set-attrs");
|
|
10
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
13
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
@@ -55,9 +56,9 @@ var getReplacementStatusCode = function getReplacementStatusCode(tr, step) {
|
|
|
55
56
|
var method;
|
|
56
57
|
if (step instanceof _transform.AttrStep || step instanceof _transform.DocAttrStep) {
|
|
57
58
|
method = 'ByAttr';
|
|
58
|
-
} else if (step instanceof
|
|
59
|
+
} else if (step instanceof _setAttrs.SetAttrsStep) {
|
|
59
60
|
method = 'BySetAttrs';
|
|
60
|
-
} else if (step instanceof
|
|
61
|
+
} else if (step instanceof _batchAttrsStep.BatchAttrsStep) {
|
|
61
62
|
method = 'ByBatchAttrs';
|
|
62
63
|
} else if (step instanceof _transform.ReplaceStep) {
|
|
63
64
|
var isDeleting = step.from < step.to; // range has content to remove
|
|
@@ -371,9 +372,9 @@ var processTransaction = function processTransaction(tr, currentState) {
|
|
|
371
372
|
var postDoc = (_tr$docs2 = (_tr$docs3 = tr.docs) === null || _tr$docs3 === void 0 ? void 0 : _tr$docs3[index + 1]) !== null && _tr$docs2 !== void 0 ? _tr$docs2 : tr.doc;
|
|
372
373
|
if (step instanceof _transform.AttrStep || step instanceof _transform.DocAttrStep) {
|
|
373
374
|
result = handleAttrStep(tr, step, localIdStatus, preDoc);
|
|
374
|
-
} else if (step instanceof
|
|
375
|
+
} else if (step instanceof _setAttrs.SetAttrsStep) {
|
|
375
376
|
result = handleSetAttrsStep(tr, step, localIdStatus, preDoc);
|
|
376
|
-
} else if (step instanceof
|
|
377
|
+
} else if (step instanceof _batchAttrsStep.BatchAttrsStep) {
|
|
377
378
|
result = handleBatchAttrsStep(tr, step, localIdStatus, preDoc);
|
|
378
379
|
} else if (step instanceof _transform.ReplaceStep) {
|
|
379
380
|
result = handleReplaceStep(tr, step, localIdStatus, preDoc, postDoc);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { BatchAttrsStep } from '@atlaskit/adf-schema/steps/batch-attrs-step';
|
|
2
2
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
3
3
|
import { generateShortUUID, generatedShortUUIDs } from './generateShortUUID';
|
|
4
4
|
export const localIdNotEmpty = localId => typeof localId === 'string' && localId.trim().length > 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OverrideDocumentStep } from '@atlaskit/adf-schema/steps';
|
|
1
|
+
import { OverrideDocumentStep } from '@atlaskit/adf-schema/steps/override-document-step';
|
|
2
2
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BatchAttrsStep
|
|
1
|
+
import { BatchAttrsStep } from '@atlaskit/adf-schema/steps/batch-attrs-step';
|
|
2
|
+
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
2
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import { AttrStep, DocAttrStep, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { BatchAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
2
|
+
import { BatchAttrsStep } from '@atlaskit/adf-schema/steps/batch-attrs-step';
|
|
3
3
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
4
4
|
import { generateShortUUID, generatedShortUUIDs } from './generateShortUUID';
|
|
5
5
|
export var localIdNotEmpty = function localIdNotEmpty(localId) {
|
|
@@ -2,7 +2,7 @@ import _toArray from "@babel/runtime/helpers/toArray";
|
|
|
2
2
|
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; } } }; }
|
|
3
3
|
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; } }
|
|
4
4
|
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; }
|
|
5
|
-
import { OverrideDocumentStep } from '@atlaskit/adf-schema/steps';
|
|
5
|
+
import { OverrideDocumentStep } from '@atlaskit/adf-schema/steps/override-document-step';
|
|
6
6
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
8
|
import { stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
@@ -2,7 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
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; } } }; }
|
|
3
3
|
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; } }
|
|
4
4
|
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; }
|
|
5
|
-
import { BatchAttrsStep
|
|
5
|
+
import { BatchAttrsStep } from '@atlaskit/adf-schema/steps/batch-attrs-step';
|
|
6
|
+
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
6
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
8
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
9
|
import { AttrStep, DocAttrStep, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-local-id",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.14",
|
|
4
4
|
"description": "LocalId plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
28
28
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
29
29
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
30
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
30
|
+
"@atlaskit/tmp-editor-statsig": "^174.0.0",
|
|
31
31
|
"@babel/runtime": "^7.0.0",
|
|
32
32
|
"raf-schd": "^4.0.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^120.
|
|
35
|
+
"@atlaskit/editor-common": "^120.12.0",
|
|
36
36
|
"react": "^18.2.0 || ^19.2.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|