@atlaskit/editor-core 205.6.1 → 205.7.1
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 +21 -0
- package/dist/cjs/actions/index.js +20 -2
- package/dist/cjs/utils/extensions.js +6 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/actions/index.js +21 -1
- package/dist/es2019/utils/extensions.js +4 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/actions/index.js +20 -2
- package/dist/esm/utils/extensions.js +6 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/actions/index.d.ts +19 -1
- package/dist/types-ts4.5/actions/index.d.ts +19 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 205.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#145932](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145932)
|
|
8
|
+
[`c771b0db325a2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c771b0db325a2) -
|
|
9
|
+
Add comment to show example how to migrate editorActions.getNodeByLocalId to the editorAPI
|
|
10
|
+
equivalent
|
|
11
|
+
|
|
12
|
+
## 205.7.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#145243](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145243)
|
|
17
|
+
[`7d32c3cc54ceb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7d32c3cc54ceb) -
|
|
18
|
+
Exposes a new getNodeWithPosByLocalId(localId: string) function in the ExtensionAPI
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 205.6.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -41,7 +41,15 @@ var fakePluginKey = {
|
|
|
41
41
|
editorApi?.core.actions.requestDocument((doc) => {
|
|
42
42
|
// use doc as desired
|
|
43
43
|
})
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
* If you were using editorActions.getNodeByLocalId(localId) replace with:
|
|
46
|
+
const { editorApi, preset } = usePreset(...);
|
|
47
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
48
|
+
// Use nodeWithPos as desired
|
|
49
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
50
|
+
const node = nodeWithPos.node;
|
|
51
|
+
const nodePos = nodeWithPos.pos;
|
|
52
|
+
*/
|
|
45
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
54
|
var EditorActions = exports.default = /*#__PURE__*/function () {
|
|
47
55
|
function EditorActions() {
|
|
@@ -295,7 +303,17 @@ var EditorActions = exports.default = /*#__PURE__*/function () {
|
|
|
295
303
|
return _getValue.apply(this, arguments);
|
|
296
304
|
}
|
|
297
305
|
return getValue;
|
|
298
|
-
}()
|
|
306
|
+
}() // eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
307
|
+
/**
|
|
308
|
+
* @deprecated - please use `getNodeWithPosByLocalId` found in the core plugin actions instead
|
|
309
|
+
* @example
|
|
310
|
+
const { editorApi, preset } = usePreset(...);
|
|
311
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
312
|
+
// Use nodeWithPos as desired
|
|
313
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
314
|
+
const node = nodeWithPos.node;
|
|
315
|
+
const nodePos = nodeWithPos.pos;
|
|
316
|
+
*/
|
|
299
317
|
}, {
|
|
300
318
|
key: "getNodeByLocalId",
|
|
301
319
|
value: function getNodeByLocalId(id) {
|
|
@@ -65,6 +65,12 @@ var dummyExtensionAPI = {
|
|
|
65
65
|
_editInLegacyMacroBrowser: function _editInLegacyMacroBrowser() {
|
|
66
66
|
return showDummyAPIWarning('_editInLegacyMacroBrowser');
|
|
67
67
|
},
|
|
68
|
+
getNodeWithPosByLocalId: function getNodeWithPosByLocalId() {
|
|
69
|
+
return {
|
|
70
|
+
node: null,
|
|
71
|
+
pos: null
|
|
72
|
+
};
|
|
73
|
+
},
|
|
68
74
|
doc: {
|
|
69
75
|
insertAfter: function insertAfter() {
|
|
70
76
|
return showDummyAPIWarning('doc:insertAfter');
|
|
@@ -31,7 +31,15 @@ const fakePluginKey = {
|
|
|
31
31
|
editorApi?.core.actions.requestDocument((doc) => {
|
|
32
32
|
// use doc as desired
|
|
33
33
|
})
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
* If you were using editorActions.getNodeByLocalId(localId) replace with:
|
|
36
|
+
const { editorApi, preset } = usePreset(...);
|
|
37
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
38
|
+
// Use nodeWithPos as desired
|
|
39
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
40
|
+
const node = nodeWithPos.node;
|
|
41
|
+
const nodePos = nodeWithPos.pos;
|
|
42
|
+
*/
|
|
35
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
44
|
export default class EditorActions {
|
|
37
45
|
constructor() {
|
|
@@ -213,6 +221,18 @@ export default class EditorActions {
|
|
|
213
221
|
throw e;
|
|
214
222
|
}
|
|
215
223
|
}
|
|
224
|
+
|
|
225
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated - please use `getNodeWithPosByLocalId` found in the core plugin actions instead
|
|
228
|
+
* @example
|
|
229
|
+
const { editorApi, preset } = usePreset(...);
|
|
230
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
231
|
+
// Use nodeWithPos as desired
|
|
232
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
233
|
+
const node = nodeWithPos.node;
|
|
234
|
+
const nodePos = nodeWithPos.pos;
|
|
235
|
+
*/
|
|
216
236
|
getNodeByLocalId(id) {
|
|
217
237
|
var _this$editorView;
|
|
218
238
|
if ((_this$editorView = this.editorView) !== null && _this$editorView !== void 0 && _this$editorView.state) {
|
|
@@ -49,6 +49,10 @@ const showDummyAPIWarning = location => {
|
|
|
49
49
|
const dummyExtensionAPI = {
|
|
50
50
|
editInContextPanel: () => showDummyAPIWarning('editInContextPanel'),
|
|
51
51
|
_editInLegacyMacroBrowser: () => showDummyAPIWarning('_editInLegacyMacroBrowser'),
|
|
52
|
+
getNodeWithPosByLocalId: () => ({
|
|
53
|
+
node: null,
|
|
54
|
+
pos: null
|
|
55
|
+
}),
|
|
52
56
|
doc: {
|
|
53
57
|
insertAfter: () => showDummyAPIWarning('doc:insertAfter'),
|
|
54
58
|
scrollTo: () => showDummyAPIWarning('doc:scrollTo'),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "205.
|
|
2
|
+
export const version = "205.7.1";
|
|
@@ -35,7 +35,15 @@ var fakePluginKey = {
|
|
|
35
35
|
editorApi?.core.actions.requestDocument((doc) => {
|
|
36
36
|
// use doc as desired
|
|
37
37
|
})
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
* If you were using editorActions.getNodeByLocalId(localId) replace with:
|
|
40
|
+
const { editorApi, preset } = usePreset(...);
|
|
41
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
42
|
+
// Use nodeWithPos as desired
|
|
43
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
44
|
+
const node = nodeWithPos.node;
|
|
45
|
+
const nodePos = nodeWithPos.pos;
|
|
46
|
+
*/
|
|
39
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
48
|
var EditorActions = /*#__PURE__*/function () {
|
|
41
49
|
function EditorActions() {
|
|
@@ -289,7 +297,17 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
289
297
|
return _getValue.apply(this, arguments);
|
|
290
298
|
}
|
|
291
299
|
return getValue;
|
|
292
|
-
}()
|
|
300
|
+
}() // eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
301
|
+
/**
|
|
302
|
+
* @deprecated - please use `getNodeWithPosByLocalId` found in the core plugin actions instead
|
|
303
|
+
* @example
|
|
304
|
+
const { editorApi, preset } = usePreset(...);
|
|
305
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
306
|
+
// Use nodeWithPos as desired
|
|
307
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
308
|
+
const node = nodeWithPos.node;
|
|
309
|
+
const nodePos = nodeWithPos.pos;
|
|
310
|
+
*/
|
|
293
311
|
}, {
|
|
294
312
|
key: "getNodeByLocalId",
|
|
295
313
|
value: function getNodeByLocalId(id) {
|
|
@@ -57,6 +57,12 @@ var dummyExtensionAPI = {
|
|
|
57
57
|
_editInLegacyMacroBrowser: function _editInLegacyMacroBrowser() {
|
|
58
58
|
return showDummyAPIWarning('_editInLegacyMacroBrowser');
|
|
59
59
|
},
|
|
60
|
+
getNodeWithPosByLocalId: function getNodeWithPosByLocalId() {
|
|
61
|
+
return {
|
|
62
|
+
node: null,
|
|
63
|
+
pos: null
|
|
64
|
+
};
|
|
65
|
+
},
|
|
60
66
|
doc: {
|
|
61
67
|
insertAfter: function insertAfter() {
|
|
62
68
|
return showDummyAPIWarning('doc:insertAfter');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "205.
|
|
2
|
+
export var version = "205.7.1";
|
|
@@ -11,7 +11,15 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
11
11
|
editorApi?.core.actions.requestDocument((doc) => {
|
|
12
12
|
// use doc as desired
|
|
13
13
|
})
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
* If you were using editorActions.getNodeByLocalId(localId) replace with:
|
|
16
|
+
const { editorApi, preset } = usePreset(...);
|
|
17
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
18
|
+
// Use nodeWithPos as desired
|
|
19
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
20
|
+
const node = nodeWithPos.node;
|
|
21
|
+
const nodePos = nodeWithPos.pos;
|
|
22
|
+
*/
|
|
15
23
|
export default class EditorActions<T = any> implements EditorActionsOptions<T> {
|
|
16
24
|
private editorView?;
|
|
17
25
|
private contentTransformer?;
|
|
@@ -42,6 +50,16 @@ export default class EditorActions<T = any> implements EditorActionsOptions<T> {
|
|
|
42
50
|
* WARNING: this may be called repeatedly, async with care
|
|
43
51
|
*/
|
|
44
52
|
getValue(): Promise<import("@atlaskit/editor-json-transformer").JSONDocNode | T | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated - please use `getNodeWithPosByLocalId` found in the core plugin actions instead
|
|
55
|
+
* @example
|
|
56
|
+
const { editorApi, preset } = usePreset(...);
|
|
57
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
58
|
+
// Use nodeWithPos as desired
|
|
59
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
60
|
+
const node = nodeWithPos.node;
|
|
61
|
+
const nodePos = nodeWithPos.pos;
|
|
62
|
+
*/
|
|
45
63
|
getNodeByLocalId(id: string): Node | undefined;
|
|
46
64
|
getNodeByFragmentLocalId(id: string): Node | undefined;
|
|
47
65
|
/**
|
|
@@ -11,7 +11,15 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
11
11
|
editorApi?.core.actions.requestDocument((doc) => {
|
|
12
12
|
// use doc as desired
|
|
13
13
|
})
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
* If you were using editorActions.getNodeByLocalId(localId) replace with:
|
|
16
|
+
const { editorApi, preset } = usePreset(...);
|
|
17
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
18
|
+
// Use nodeWithPos as desired
|
|
19
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
20
|
+
const node = nodeWithPos.node;
|
|
21
|
+
const nodePos = nodeWithPos.pos;
|
|
22
|
+
*/
|
|
15
23
|
export default class EditorActions<T = any> implements EditorActionsOptions<T> {
|
|
16
24
|
private editorView?;
|
|
17
25
|
private contentTransformer?;
|
|
@@ -42,6 +50,16 @@ export default class EditorActions<T = any> implements EditorActionsOptions<T> {
|
|
|
42
50
|
* WARNING: this may be called repeatedly, async with care
|
|
43
51
|
*/
|
|
44
52
|
getValue(): Promise<import("@atlaskit/editor-json-transformer").JSONDocNode | T | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated - please use `getNodeWithPosByLocalId` found in the core plugin actions instead
|
|
55
|
+
* @example
|
|
56
|
+
const { editorApi, preset } = usePreset(...);
|
|
57
|
+
const extensionAPI = editorAPI?.extension?.actions?.api();
|
|
58
|
+
// Use nodeWithPos as desired
|
|
59
|
+
const nodeWithPos = extensionAPI.getNodeWithPosByLocalId(localId);
|
|
60
|
+
const node = nodeWithPos.node;
|
|
61
|
+
const nodePos = nodeWithPos.pos;
|
|
62
|
+
*/
|
|
45
63
|
getNodeByLocalId(id: string): Node | undefined;
|
|
46
64
|
getNodeByFragmentLocalId(id: string): Node | undefined;
|
|
47
65
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "205.
|
|
3
|
+
"version": "205.7.1",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
47
47
|
"@atlaskit/button": "^23.0.0",
|
|
48
48
|
"@atlaskit/css": "^0.10.0",
|
|
49
|
-
"@atlaskit/editor-common": "^103.
|
|
49
|
+
"@atlaskit/editor-common": "^103.16.0",
|
|
50
50
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
51
51
|
"@atlaskit/editor-performance-metrics": "^2.1.0",
|
|
52
52
|
"@atlaskit/editor-plugin-quick-insert": "^2.4.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@atlaskit/platform-feature-flags-react": "^0.1.0",
|
|
62
62
|
"@atlaskit/react-ufo": "^3.6.0",
|
|
63
63
|
"@atlaskit/task-decision": "^19.1.0",
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
64
|
+
"@atlaskit/tmp-editor-statsig": "^4.14.0",
|
|
65
65
|
"@atlaskit/tokens": "^4.8.0",
|
|
66
66
|
"@atlaskit/tooltip": "^20.0.0",
|
|
67
67
|
"@atlaskit/width-detector": "^5.0.0",
|