@atlaskit/editor-core 204.7.1 → 204.8.0
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 +33 -0
- package/dist/cjs/actions/index.js +8 -0
- package/dist/cjs/create-editor/ReactEditorView/handleEditorFocus.js +9 -0
- package/dist/cjs/ui/ToolbarHelp/index.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/actions/index.js +8 -0
- package/dist/es2019/create-editor/ReactEditorView/handleEditorFocus.js +9 -0
- package/dist/es2019/ui/ToolbarHelp/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/actions/index.js +8 -0
- package/dist/esm/create-editor/ReactEditorView/handleEditorFocus.js +9 -0
- package/dist/esm/ui/ToolbarHelp/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/actions/index.d.ts +8 -0
- package/dist/types-ts4.5/actions/index.d.ts +8 -0
- package/docs/0-intro.tsx +7 -7
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 204.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#126109](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126109)
|
|
8
|
+
[`b8eb107432364`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b8eb107432364) -
|
|
9
|
+
marked EditorActions as deprecated
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#130624](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130624)
|
|
14
|
+
[`8f52e4f05f49b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8f52e4f05f49b) -
|
|
15
|
+
updated docs to reflect our upgrade of editor-core to React 18
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 204.7.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#131485](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131485)
|
|
23
|
+
[`bd6274bb72cb1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd6274bb72cb1) -
|
|
24
|
+
ENGHEALTH-23692 Iconography uplift for editor-core
|
|
25
|
+
- [#131407](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131407)
|
|
26
|
+
[`59a88ee61a0c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/59a88ee61a0c5) -
|
|
27
|
+
[ux] EDF-2626: Add view isDestroyed check in editor auto-focusing logic to ensure bail before
|
|
28
|
+
posFromDOM and editor selection operations committed on destroyed docView instance, behind
|
|
29
|
+
platform_editor_posfromdom_null_fix
|
|
30
|
+
- [#131280](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131280)
|
|
31
|
+
[`9ff92ea2432f2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ff92ea2432f2) -
|
|
32
|
+
[ED-27082] Fix media overflow toolbar to show correct options + update separators between button
|
|
33
|
+
groups
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
|
|
3
36
|
## 204.7.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -33,6 +33,14 @@ var fakePluginKey = {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-26729 Internal documentation for deprecation (no external access)} Editor actions is no longer supported and will be removed in a future version. Please use the core actions, or Plugin APIs directly instead
|
|
38
|
+
* @example If you were using editorActions.getValue() replace with:
|
|
39
|
+
const { editorApi, preset } = usePreset(...);
|
|
40
|
+
editorApi?.core.actions.requestDocument((doc) => {
|
|
41
|
+
// use doc as desired
|
|
42
|
+
})
|
|
43
|
+
*/
|
|
36
44
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
45
|
var EditorActions = exports.default = /*#__PURE__*/function () {
|
|
38
46
|
function EditorActions() {
|
|
@@ -25,6 +25,14 @@ function handleEditorFocus(view) {
|
|
|
25
25
|
return window.setTimeout(fn, 0);
|
|
26
26
|
};
|
|
27
27
|
return react16OnlySetTimeout(function () {
|
|
28
|
+
// Due to race conditions during editor lifecycle transitions (e.g. SPA route changes during opening or closing)
|
|
29
|
+
// where the view (and its internal docView) may have been destroyed, the timeout callback may fire on a stale view.
|
|
30
|
+
// Bail out in that scenario to prevent operating on an unmounted view.
|
|
31
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_posfromdom_null_fix')) {
|
|
32
|
+
if (view !== null && view !== void 0 && view.isDestroyed) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
28
36
|
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
29
37
|
return;
|
|
30
38
|
}
|
|
@@ -43,6 +51,7 @@ function handleEditorFocus(view) {
|
|
|
43
51
|
view.focus();
|
|
44
52
|
return;
|
|
45
53
|
}
|
|
54
|
+
|
|
46
55
|
// set cursor/selection and focus
|
|
47
56
|
var anchor = view === null || view === void 0 ? void 0 : view.posAtDOM(range.startContainer, range.startOffset);
|
|
48
57
|
var head = view === null || view === void 0 ? void 0 : view.posAtDOM(range.endContainer, range.endOffset);
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
11
|
-
var
|
|
11
|
+
var _questionCircleQuestion = _interopRequireDefault(require("@atlaskit/icon/core/migration/question-circle--question"));
|
|
12
12
|
var _EditorContext = require("../EditorContext");
|
|
13
13
|
var _messages = require("./messages");
|
|
14
14
|
// Please, do not copy or use this kind of code below
|
|
@@ -59,7 +59,7 @@ var TooltipHelpTrigger = function TooltipHelpTrigger(_ref) {
|
|
|
59
59
|
onClick: showHelp,
|
|
60
60
|
title: displayTitle,
|
|
61
61
|
titlePosition: titlePosition,
|
|
62
|
-
iconBefore: /*#__PURE__*/_react.default.createElement(
|
|
62
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_questionCircleQuestion.default, {
|
|
63
63
|
label: displayTitle
|
|
64
64
|
})
|
|
65
65
|
});
|
|
@@ -23,6 +23,14 @@ const fakePluginKey = {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-26729 Internal documentation for deprecation (no external access)} Editor actions is no longer supported and will be removed in a future version. Please use the core actions, or Plugin APIs directly instead
|
|
28
|
+
* @example If you were using editorActions.getValue() replace with:
|
|
29
|
+
const { editorApi, preset } = usePreset(...);
|
|
30
|
+
editorApi?.core.actions.requestDocument((doc) => {
|
|
31
|
+
// use doc as desired
|
|
32
|
+
})
|
|
33
|
+
*/
|
|
26
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
35
|
export default class EditorActions {
|
|
28
36
|
constructor() {
|
|
@@ -14,6 +14,14 @@ export function handleEditorFocus(view) {
|
|
|
14
14
|
*/
|
|
15
15
|
const react16OnlySetTimeout = React !== null && React !== void 0 && React.startTransition && fg('platform_editor_react_18_autofocus_fix') ? fn => fn() : fn => window.setTimeout(fn, 0);
|
|
16
16
|
return react16OnlySetTimeout(() => {
|
|
17
|
+
// Due to race conditions during editor lifecycle transitions (e.g. SPA route changes during opening or closing)
|
|
18
|
+
// where the view (and its internal docView) may have been destroyed, the timeout callback may fire on a stale view.
|
|
19
|
+
// Bail out in that scenario to prevent operating on an unmounted view.
|
|
20
|
+
if (fg('platform_editor_posfromdom_null_fix')) {
|
|
21
|
+
if (view !== null && view !== void 0 && view.isDestroyed) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
17
25
|
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
18
26
|
return;
|
|
19
27
|
}
|
|
@@ -32,6 +40,7 @@ export function handleEditorFocus(view) {
|
|
|
32
40
|
view.focus();
|
|
33
41
|
return;
|
|
34
42
|
}
|
|
43
|
+
|
|
35
44
|
// set cursor/selection and focus
|
|
36
45
|
const anchor = view === null || view === void 0 ? void 0 : view.posAtDOM(range.startContainer, range.startOffset);
|
|
37
46
|
const head = view === null || view === void 0 ? void 0 : view.posAtDOM(range.endContainer, range.endOffset);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
3
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
-
import QuestionIcon from '@atlaskit/icon/
|
|
4
|
+
import QuestionIcon from '@atlaskit/icon/core/migration/question-circle--question';
|
|
5
5
|
import { useEditorContext } from '../EditorContext';
|
|
6
6
|
import { messages } from './messages';
|
|
7
7
|
// Please, do not copy or use this kind of code below
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "204.
|
|
2
|
+
export const version = "204.8.0";
|
|
@@ -27,6 +27,14 @@ var fakePluginKey = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-26729 Internal documentation for deprecation (no external access)} Editor actions is no longer supported and will be removed in a future version. Please use the core actions, or Plugin APIs directly instead
|
|
32
|
+
* @example If you were using editorActions.getValue() replace with:
|
|
33
|
+
const { editorApi, preset } = usePreset(...);
|
|
34
|
+
editorApi?.core.actions.requestDocument((doc) => {
|
|
35
|
+
// use doc as desired
|
|
36
|
+
})
|
|
37
|
+
*/
|
|
30
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
39
|
var EditorActions = /*#__PURE__*/function () {
|
|
32
40
|
function EditorActions() {
|
|
@@ -18,6 +18,14 @@ export function handleEditorFocus(view) {
|
|
|
18
18
|
return window.setTimeout(fn, 0);
|
|
19
19
|
};
|
|
20
20
|
return react16OnlySetTimeout(function () {
|
|
21
|
+
// Due to race conditions during editor lifecycle transitions (e.g. SPA route changes during opening or closing)
|
|
22
|
+
// where the view (and its internal docView) may have been destroyed, the timeout callback may fire on a stale view.
|
|
23
|
+
// Bail out in that scenario to prevent operating on an unmounted view.
|
|
24
|
+
if (fg('platform_editor_posfromdom_null_fix')) {
|
|
25
|
+
if (view !== null && view !== void 0 && view.isDestroyed) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
21
29
|
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
22
30
|
return;
|
|
23
31
|
}
|
|
@@ -36,6 +44,7 @@ export function handleEditorFocus(view) {
|
|
|
36
44
|
view.focus();
|
|
37
45
|
return;
|
|
38
46
|
}
|
|
47
|
+
|
|
39
48
|
// set cursor/selection and focus
|
|
40
49
|
var anchor = view === null || view === void 0 ? void 0 : view.posAtDOM(range.startContainer, range.startOffset);
|
|
41
50
|
var head = view === null || view === void 0 ? void 0 : view.posAtDOM(range.endContainer, range.endOffset);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
3
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
-
import QuestionIcon from '@atlaskit/icon/
|
|
4
|
+
import QuestionIcon from '@atlaskit/icon/core/migration/question-circle--question';
|
|
5
5
|
import { useEditorContext } from '../EditorContext';
|
|
6
6
|
import { messages } from './messages';
|
|
7
7
|
// Please, do not copy or use this kind of code below
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "204.
|
|
2
|
+
export var version = "204.8.0";
|
|
@@ -4,6 +4,14 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
4
4
|
import type { ContextUpdateHandler, EditorActionsOptions, FeatureFlags, ReplaceRawValue, GetResolvedEditorStateReason, Transformer } from '@atlaskit/editor-common/types';
|
|
5
5
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-26729 Internal documentation for deprecation (no external access)} Editor actions is no longer supported and will be removed in a future version. Please use the core actions, or Plugin APIs directly instead
|
|
9
|
+
* @example If you were using editorActions.getValue() replace with:
|
|
10
|
+
const { editorApi, preset } = usePreset(...);
|
|
11
|
+
editorApi?.core.actions.requestDocument((doc) => {
|
|
12
|
+
// use doc as desired
|
|
13
|
+
})
|
|
14
|
+
*/
|
|
7
15
|
export default class EditorActions<T = any> implements EditorActionsOptions<T> {
|
|
8
16
|
private editorView?;
|
|
9
17
|
private contentTransformer?;
|
|
@@ -4,6 +4,14 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
4
4
|
import type { ContextUpdateHandler, EditorActionsOptions, FeatureFlags, ReplaceRawValue, GetResolvedEditorStateReason, Transformer } from '@atlaskit/editor-common/types';
|
|
5
5
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-26729 Internal documentation for deprecation (no external access)} Editor actions is no longer supported and will be removed in a future version. Please use the core actions, or Plugin APIs directly instead
|
|
9
|
+
* @example If you were using editorActions.getValue() replace with:
|
|
10
|
+
const { editorApi, preset } = usePreset(...);
|
|
11
|
+
editorApi?.core.actions.requestDocument((doc) => {
|
|
12
|
+
// use doc as desired
|
|
13
|
+
})
|
|
14
|
+
*/
|
|
7
15
|
export default class EditorActions<T = any> implements EditorActionsOptions<T> {
|
|
8
16
|
private editorView?;
|
|
9
17
|
private contentTransformer?;
|
package/docs/0-intro.tsx
CHANGED
|
@@ -18,17 +18,17 @@ ${(<AtlassianInternalWarning />)}
|
|
|
18
18
|
|
|
19
19
|
## Prerequisites
|
|
20
20
|
|
|
21
|
-
* **React
|
|
21
|
+
* **React 18:** at the time of writing, the Atlassian Editor is built on top of React 18 and doesn’t explicitly support any higher versions of React yet, which means both the \`react\` and \`react-dom\` libraries and their dependencies need to be set to React 18 compatible version.
|
|
22
22
|
* **Singleton:** the ProseMirror libraries in use and the document format \(Atlassian Document Format, ADF\) demand that some of the libraries using them are singletons, as multiple versions of the library will cause breaking issues. So, consumers of the Atlassian Editor need to enforce these singletons; this is usually done by deduplicating after installing the dependencies or by setting libraries to specific versions through resolutions to avoid multiple versions. Our recommendation is to use [yarn-deduplicate](https://www.npmjs.com/package/yarn-deduplicate).
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
26
|
-
1. Install the editor libraries
|
|
26
|
+
1. Install the editor libraries
|
|
27
27
|
- **npm:** \`npm install --save @atlaskit/editor-core @atlaskit/css-reset\`
|
|
28
28
|
- **yarn:** \`yarn add @atlaskit/editor-core @atlaskit/css-reset\`
|
|
29
29
|
|
|
30
30
|
2. Deduplicate the dependencies \(if necessary\) by setting resolutions to avoid multiple versions of the editor libraries or by running [npm dedupe](https://docs.npmjs.com/cli/v6/commands/npm-dedupe) or [yarn dedupe](https://yarnpkg.com/cli/dedupe) after installation.
|
|
31
|
-
3. Setup the CSS reset in your application
|
|
31
|
+
3. Setup the CSS reset in your application
|
|
32
32
|
\`import '@atlaskit/css-reset';\`
|
|
33
33
|
|
|
34
34
|
## Usage
|
|
@@ -112,7 +112,7 @@ const createPreset = () =>
|
|
|
112
112
|
}
|
|
113
113
|
return builder; // Don't add the plugin
|
|
114
114
|
});
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
const { preset } = usePreset(createPreset);
|
|
117
117
|
`}
|
|
118
118
|
|
|
@@ -199,7 +199,7 @@ ${code`
|
|
|
199
199
|
const createPreset = () =>
|
|
200
200
|
createDefaultPreset({ featureFlags: {}, paste: {} });
|
|
201
201
|
const { preset } = usePreset(createPreset);
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
return <ComposableEditor appearance='full-page' preset={preset} />;
|
|
204
204
|
// Or full-width
|
|
205
205
|
return <ComposableEditor appearance='full-width' preset={preset} />;
|
|
@@ -231,7 +231,7 @@ ${code`
|
|
|
231
231
|
|
|
232
232
|
### Collapsible Editor
|
|
233
233
|
|
|
234
|
-
Sometimes, you may not want to display the whole Editor initially, and you'd prefer to show it in a collapsed state so that users can expand it when needed.
|
|
234
|
+
Sometimes, you may not want to display the whole Editor initially, and you'd prefer to show it in a collapsed state so that users can expand it when needed.
|
|
235
235
|
|
|
236
236
|
Here's how you can implement this behavior:
|
|
237
237
|
|
|
@@ -368,7 +368,7 @@ function EditorInternal() {
|
|
|
368
368
|
const { editorApi, preset } = usePreset(createPreset);
|
|
369
369
|
|
|
370
370
|
// We memoise the transformer in case this component renders frequently
|
|
371
|
-
const transformer = useMemo(() =>
|
|
371
|
+
const transformer = useMemo(() =>
|
|
372
372
|
editorApi?.core?.actions?.createTransformer((schema) => new BitbucketTransformer(schema))
|
|
373
373
|
, [editorApi])
|
|
374
374
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "204.
|
|
3
|
+
"version": "204.8.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"@atlaskit/media-test-helpers": "^35.0.0",
|
|
101
101
|
"@atlaskit/modal-dialog": "^13.4.0",
|
|
102
102
|
"@atlaskit/primitives": "^14.2.0",
|
|
103
|
-
"@atlaskit/renderer": "^114.
|
|
103
|
+
"@atlaskit/renderer": "^114.5.0",
|
|
104
104
|
"@atlaskit/smart-card": "^36.0.0",
|
|
105
105
|
"@atlaskit/synchrony-test-helpers": "^3.1.0",
|
|
106
106
|
"@atlaskit/toggle": "^15.0.0",
|
|
@@ -567,6 +567,9 @@
|
|
|
567
567
|
},
|
|
568
568
|
"platform_editor_keep_focus_on_content_comp_clicks": {
|
|
569
569
|
"type": "boolean"
|
|
570
|
+
},
|
|
571
|
+
"platform_editor_posfromdom_null_fix": {
|
|
572
|
+
"type": "boolean"
|
|
570
573
|
}
|
|
571
574
|
},
|
|
572
575
|
"stricter": {
|