@atlaskit/editor-core 203.11.2 → 203.11.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 +24 -0
- package/dist/cjs/create-editor/ReactEditorView/handleEditorFocus.js +15 -13
- package/dist/cjs/create-editor/ReactEditorViewNext.js +0 -2
- package/dist/cjs/ui/ContentStyles/layout.js +1 -1
- package/dist/cjs/use-preset.js +3 -15
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView/handleEditorFocus.js +15 -13
- package/dist/es2019/create-editor/ReactEditorViewNext.js +0 -2
- package/dist/es2019/ui/ContentStyles/layout.js +1 -1
- package/dist/es2019/use-preset.js +3 -15
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView/handleEditorFocus.js +15 -13
- package/dist/esm/create-editor/ReactEditorViewNext.js +0 -2
- package/dist/esm/ui/ContentStyles/layout.js +1 -1
- package/dist/esm/use-preset.js +3 -15
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/ReactEditorView/handleEditorFocus.d.ts +1 -1
- package/dist/types/create-editor/create-universal-preset.d.ts +2 -0
- package/dist/types/presets/universal.d.ts +2 -0
- package/dist/types/presets/useUniversalPreset.d.ts +2 -0
- package/dist/types-ts4.5/create-editor/ReactEditorView/handleEditorFocus.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +2 -0
- package/dist/types-ts4.5/presets/universal.d.ts +2 -0
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +2 -0
- package/package.json +16 -15
- package/dist/cjs/create-editor/ReactEditorView/usePluginPerformanceObserver.js +0 -49
- package/dist/es2019/create-editor/ReactEditorView/usePluginPerformanceObserver.js +0 -35
- package/dist/esm/create-editor/ReactEditorView/usePluginPerformanceObserver.js +0 -43
- package/dist/types/create-editor/ReactEditorView/usePluginPerformanceObserver.d.ts +0 -5
- package/dist/types-ts4.5/create-editor/ReactEditorView/usePluginPerformanceObserver.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 203.11.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#103354](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103354)
|
|
8
|
+
[`129cb98043b09`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/129cb98043b09) -
|
|
9
|
+
TypeError coming from handleEditorFocus has been increasing significantly. We've added a null
|
|
10
|
+
check to stop this TypeError.
|
|
11
|
+
- [#102744](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102744)
|
|
12
|
+
[`289c0169e410a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/289c0169e410a) -
|
|
13
|
+
ED-26243 Cleaned up platform_editor_drag_and_drop_target_v2 FG
|
|
14
|
+
|
|
15
|
+
## 203.11.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#103029](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103029)
|
|
20
|
+
[`bd4e16fcf521d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bd4e16fcf521d) -
|
|
21
|
+
Remove analytics for time in each lifecycle.
|
|
22
|
+
- [#102929](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102929)
|
|
23
|
+
[`29b9b5aa91e94`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/29b9b5aa91e94) -
|
|
24
|
+
Cleanup feature flag to fix editor API via usePreset in Strict Mode.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 203.11.2
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -6,39 +6,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.handleEditorFocus = handleEditorFocus;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
8
|
function handleEditorFocus(view) {
|
|
9
|
-
if (view.hasFocus()) {
|
|
9
|
+
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
return window.setTimeout(function () {
|
|
13
|
-
if (view.hasFocus()) {
|
|
13
|
+
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!window.getSelection) {
|
|
17
|
-
view.focus();
|
|
17
|
+
view === null || view === void 0 || view.focus();
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
var domSelection = window.getSelection();
|
|
21
21
|
if (!domSelection || domSelection.rangeCount === 0) {
|
|
22
|
-
view.focus();
|
|
22
|
+
view === null || view === void 0 || view.focus();
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
var range = domSelection.getRangeAt(0);
|
|
26
26
|
// if selection is outside editor focus and exit
|
|
27
|
-
if (range.startContainer.contains(view.dom)) {
|
|
27
|
+
if (view && range.startContainer.contains(view.dom)) {
|
|
28
28
|
view.focus();
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
// set cursor/selection and focus
|
|
32
|
-
var anchor = view.posAtDOM(range.startContainer, range.startOffset);
|
|
33
|
-
var head = view.posAtDOM(range.endContainer, range.endOffset);
|
|
32
|
+
var anchor = view === null || view === void 0 ? void 0 : view.posAtDOM(range.startContainer, range.startOffset);
|
|
33
|
+
var head = view === null || view === void 0 ? void 0 : view.posAtDOM(range.endContainer, range.endOffset);
|
|
34
34
|
// if anchor or head < 0 focus and exit
|
|
35
|
-
if (anchor < 0 || head < 0) {
|
|
36
|
-
view.focus();
|
|
35
|
+
if (anchor && anchor < 0 || head && head < 0) {
|
|
36
|
+
view === null || view === void 0 || view.focus();
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (view && anchor) {
|
|
40
|
+
var selection = _state.TextSelection.create(view.state.doc, anchor, head);
|
|
41
|
+
var tr = view.state.tr.setSelection(selection);
|
|
42
|
+
view.dispatch(tr);
|
|
43
|
+
view.focus();
|
|
44
|
+
}
|
|
43
45
|
}, 0);
|
|
44
46
|
}
|
|
@@ -39,7 +39,6 @@ var _getUAPrefix = require("./ReactEditorView/getUAPrefix");
|
|
|
39
39
|
var _handleEditorFocus = require("./ReactEditorView/handleEditorFocus");
|
|
40
40
|
var _useDispatchTransaction = require("./ReactEditorView/useDispatchTransaction");
|
|
41
41
|
var _useFireFullWidthEvent = require("./ReactEditorView/useFireFullWidthEvent");
|
|
42
|
-
var _usePluginPerformanceObserver = require("./ReactEditorView/usePluginPerformanceObserver");
|
|
43
42
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
44
43
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
45
44
|
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; }
|
|
@@ -535,7 +534,6 @@ function ReactEditorView(props) {
|
|
|
535
534
|
}
|
|
536
535
|
}, [disabled, shouldFocus, previousDisabledState]);
|
|
537
536
|
(0, _useFireFullWidthEvent.useFireFullWidthEvent)(nextAppearance, dispatchAnalyticsEvent);
|
|
538
|
-
(0, _usePluginPerformanceObserver.usePluginPerformanceObserver)(getCurrentEditorState, pluginInjectionAPI, dispatchAnalyticsEvent);
|
|
539
537
|
var editor = (0, _react.useMemo)(function () {
|
|
540
538
|
return createEditor(props.editorProps.assistiveLabel, props.editorProps.assistiveDescribedBy);
|
|
541
539
|
},
|
|
@@ -69,5 +69,5 @@ var layoutResponsiveStyles = function layoutResponsiveStyles(viewMode) {
|
|
|
69
69
|
|
|
70
70
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
71
71
|
var layoutStyles = exports.layoutStyles = function layoutStyles(viewMode) {
|
|
72
|
-
return (0, _react.css)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\
|
|
72
|
+
return (0, _react.css)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\tposition: relative;\n\n\t\t\t\tmin-width: 0;\n\t\t\t\t/* disable 4 borders when in view mode and advanced layouts is on */\n\t\t\t\tborder: ", "px\n\t\t\t\t\tsolid ", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t", "\n\t\t}\n\n\t\t// styles to support borders for layout\n\t\t[data-layout-section],\n\t\t.layoutSectionView-content-wrap {\n\t\t\t", "\n\t\t}\n\t}\n\n\t", "\n\n\t// hide separator when element is dragging on top of a layout column\n\t[data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {\n\t\tdisplay: none;\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), layoutSectionStyles(), "var(--ds-space-100, 8px)", _editorSharedStyles.akLayoutGutterOffset + ((0, _experiments.editorExperiment)('nested-dnd', true) && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_2') ? 8 : 0), _editorSharedStyles.akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', viewMode === 'view' || (0, _experiments.editorExperiment)('advanced_layouts', true) ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", _styles.LAYOUT_COLUMN_PADDING, _styles.LAYOUT_COLUMN_PADDING + ((0, _experiments.editorExperiment)('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), layoutColumnStyles(), (0, _experiments.editorExperiment)('advanced_layouts', true) ? layoutWithSeparatorBorderStyles(viewMode) : layoutBorderStyles(viewMode), (0, _experiments.editorExperiment)('advanced_layouts', true) && layoutResponsiveStyles(viewMode), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode, (0, _experiments.editorExperiment)('nested-dnd', true) && (0, _experiments.editorExperiment)('advanced_layouts', false) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", _editorSharedStyles.akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
73
73
|
};
|
package/dist/cjs/use-preset.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.usePreset = usePreset;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -56,21 +55,10 @@ function usePreset(createPreset) {
|
|
|
56
55
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
56
|
dependencies);
|
|
58
57
|
(0, _react.useLayoutEffect)(function () {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
}
|
|
58
|
+
return preset.apiResolver.on(function (api) {
|
|
59
|
+
setAPI(api);
|
|
60
|
+
});
|
|
64
61
|
}, [preset.apiResolver]);
|
|
65
|
-
|
|
66
|
-
// Deprecated approach (not compatible with strict mode)
|
|
67
|
-
(0, _react.useLayoutEffect)(function () {
|
|
68
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_fix_api_strict_mode')) {
|
|
69
|
-
preset.apiPromise.then(function (api) {
|
|
70
|
-
setAPI(api);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}, [preset.apiPromise]);
|
|
74
62
|
return {
|
|
75
63
|
editorApi: editorApi,
|
|
76
64
|
preset: preset
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
export function handleEditorFocus(view) {
|
|
3
|
-
if (view.hasFocus()) {
|
|
3
|
+
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
4
4
|
return;
|
|
5
5
|
}
|
|
6
6
|
return window.setTimeout(() => {
|
|
7
|
-
if (view.hasFocus()) {
|
|
7
|
+
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
if (!window.getSelection) {
|
|
11
|
-
view.focus();
|
|
11
|
+
view === null || view === void 0 ? void 0 : view.focus();
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const domSelection = window.getSelection();
|
|
15
15
|
if (!domSelection || domSelection.rangeCount === 0) {
|
|
16
|
-
view.focus();
|
|
16
|
+
view === null || view === void 0 ? void 0 : view.focus();
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const range = domSelection.getRangeAt(0);
|
|
20
20
|
// if selection is outside editor focus and exit
|
|
21
|
-
if (range.startContainer.contains(view.dom)) {
|
|
21
|
+
if (view && range.startContainer.contains(view.dom)) {
|
|
22
22
|
view.focus();
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
// set cursor/selection and focus
|
|
26
|
-
const anchor = view.posAtDOM(range.startContainer, range.startOffset);
|
|
27
|
-
const head = view.posAtDOM(range.endContainer, range.endOffset);
|
|
26
|
+
const anchor = view === null || view === void 0 ? void 0 : view.posAtDOM(range.startContainer, range.startOffset);
|
|
27
|
+
const head = view === null || view === void 0 ? void 0 : view.posAtDOM(range.endContainer, range.endOffset);
|
|
28
28
|
// if anchor or head < 0 focus and exit
|
|
29
|
-
if (anchor < 0 || head < 0) {
|
|
30
|
-
view.focus();
|
|
29
|
+
if (anchor && anchor < 0 || head && head < 0) {
|
|
30
|
+
view === null || view === void 0 ? void 0 : view.focus();
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
if (view && anchor) {
|
|
34
|
+
const selection = TextSelection.create(view.state.doc, anchor, head);
|
|
35
|
+
const tr = view.state.tr.setSelection(selection);
|
|
36
|
+
view.dispatch(tr);
|
|
37
|
+
view.focus();
|
|
38
|
+
}
|
|
37
39
|
}, 0);
|
|
38
40
|
}
|
|
@@ -29,7 +29,6 @@ import { getUAPrefix } from './ReactEditorView/getUAPrefix';
|
|
|
29
29
|
import { handleEditorFocus } from './ReactEditorView/handleEditorFocus';
|
|
30
30
|
import { useDispatchTransaction } from './ReactEditorView/useDispatchTransaction';
|
|
31
31
|
import { useFireFullWidthEvent } from './ReactEditorView/useFireFullWidthEvent';
|
|
32
|
-
import { usePluginPerformanceObserver } from './ReactEditorView/usePluginPerformanceObserver';
|
|
33
32
|
const EDIT_AREA_ID = 'ak-editor-textarea';
|
|
34
33
|
function ReactEditorView(props) {
|
|
35
34
|
var _media, _linking, _linking$smartLinks, _props$render, _props$render2;
|
|
@@ -508,7 +507,6 @@ function ReactEditorView(props) {
|
|
|
508
507
|
}
|
|
509
508
|
}, [disabled, shouldFocus, previousDisabledState]);
|
|
510
509
|
useFireFullWidthEvent(nextAppearance, dispatchAnalyticsEvent);
|
|
511
|
-
usePluginPerformanceObserver(getCurrentEditorState, pluginInjectionAPI, dispatchAnalyticsEvent);
|
|
512
510
|
const editor = useMemo(() => createEditor(props.editorProps.assistiveLabel, props.editorProps.assistiveDescribedBy),
|
|
513
511
|
// `createEditor` changes a little too frequently - we don't want to recreate the editor view in this case
|
|
514
512
|
// We should follow-up
|
|
@@ -314,7 +314,7 @@ export const layoutStyles = viewMode => css`
|
|
|
314
314
|
/* Inner cursor located 26px from left */
|
|
315
315
|
[data-layout-column] {
|
|
316
316
|
flex: 1;
|
|
317
|
-
|
|
317
|
+
position: relative;
|
|
318
318
|
|
|
319
319
|
min-width: 0;
|
|
320
320
|
/* disable 4 borders when in view mode and advanced layouts is on */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
|
|
5
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
5
|
|
|
@@ -43,21 +42,10 @@ export function usePreset(createPreset, dependencies = []) {
|
|
|
43
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
43
|
dependencies);
|
|
45
44
|
useLayoutEffect(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
}
|
|
45
|
+
return preset.apiResolver.on(api => {
|
|
46
|
+
setAPI(api);
|
|
47
|
+
});
|
|
51
48
|
}, [preset.apiResolver]);
|
|
52
|
-
|
|
53
|
-
// Deprecated approach (not compatible with strict mode)
|
|
54
|
-
useLayoutEffect(() => {
|
|
55
|
-
if (!fg('platform_editor_fix_api_strict_mode')) {
|
|
56
|
-
preset.apiPromise.then(api => {
|
|
57
|
-
setAPI(api);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}, [preset.apiPromise]);
|
|
61
49
|
return {
|
|
62
50
|
editorApi,
|
|
63
51
|
preset
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "203.11.
|
|
2
|
+
export const version = "203.11.4";
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
export function handleEditorFocus(view) {
|
|
3
|
-
if (view.hasFocus()) {
|
|
3
|
+
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
4
4
|
return;
|
|
5
5
|
}
|
|
6
6
|
return window.setTimeout(function () {
|
|
7
|
-
if (view.hasFocus()) {
|
|
7
|
+
if (view !== null && view !== void 0 && view.hasFocus()) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
if (!window.getSelection) {
|
|
11
|
-
view.focus();
|
|
11
|
+
view === null || view === void 0 || view.focus();
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
var domSelection = window.getSelection();
|
|
15
15
|
if (!domSelection || domSelection.rangeCount === 0) {
|
|
16
|
-
view.focus();
|
|
16
|
+
view === null || view === void 0 || view.focus();
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
var range = domSelection.getRangeAt(0);
|
|
20
20
|
// if selection is outside editor focus and exit
|
|
21
|
-
if (range.startContainer.contains(view.dom)) {
|
|
21
|
+
if (view && range.startContainer.contains(view.dom)) {
|
|
22
22
|
view.focus();
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
// set cursor/selection and focus
|
|
26
|
-
var anchor = view.posAtDOM(range.startContainer, range.startOffset);
|
|
27
|
-
var head = view.posAtDOM(range.endContainer, range.endOffset);
|
|
26
|
+
var anchor = view === null || view === void 0 ? void 0 : view.posAtDOM(range.startContainer, range.startOffset);
|
|
27
|
+
var head = view === null || view === void 0 ? void 0 : view.posAtDOM(range.endContainer, range.endOffset);
|
|
28
28
|
// if anchor or head < 0 focus and exit
|
|
29
|
-
if (anchor < 0 || head < 0) {
|
|
30
|
-
view.focus();
|
|
29
|
+
if (anchor && anchor < 0 || head && head < 0) {
|
|
30
|
+
view === null || view === void 0 || view.focus();
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
if (view && anchor) {
|
|
34
|
+
var selection = TextSelection.create(view.state.doc, anchor, head);
|
|
35
|
+
var tr = view.state.tr.setSelection(selection);
|
|
36
|
+
view.dispatch(tr);
|
|
37
|
+
view.focus();
|
|
38
|
+
}
|
|
37
39
|
}, 0);
|
|
38
40
|
}
|
|
@@ -33,7 +33,6 @@ import { getUAPrefix } from './ReactEditorView/getUAPrefix';
|
|
|
33
33
|
import { handleEditorFocus } from './ReactEditorView/handleEditorFocus';
|
|
34
34
|
import { useDispatchTransaction } from './ReactEditorView/useDispatchTransaction';
|
|
35
35
|
import { useFireFullWidthEvent } from './ReactEditorView/useFireFullWidthEvent';
|
|
36
|
-
import { usePluginPerformanceObserver } from './ReactEditorView/usePluginPerformanceObserver';
|
|
37
36
|
var EDIT_AREA_ID = 'ak-editor-textarea';
|
|
38
37
|
function ReactEditorView(props) {
|
|
39
38
|
var _media, _linking, _props$render, _props$render2;
|
|
@@ -525,7 +524,6 @@ function ReactEditorView(props) {
|
|
|
525
524
|
}
|
|
526
525
|
}, [disabled, shouldFocus, previousDisabledState]);
|
|
527
526
|
useFireFullWidthEvent(nextAppearance, dispatchAnalyticsEvent);
|
|
528
|
-
usePluginPerformanceObserver(getCurrentEditorState, pluginInjectionAPI, dispatchAnalyticsEvent);
|
|
529
527
|
var editor = useMemo(function () {
|
|
530
528
|
return createEditor(props.editorProps.assistiveLabel, props.editorProps.assistiveDescribedBy);
|
|
531
529
|
},
|
|
@@ -63,5 +63,5 @@ var layoutResponsiveStyles = function layoutResponsiveStyles(viewMode) {
|
|
|
63
63
|
|
|
64
64
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
65
65
|
export var layoutStyles = function layoutStyles(viewMode) {
|
|
66
|
-
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\
|
|
66
|
+
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", "\n\t\t[data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\tposition: relative;\n\n\t\t\t\tmin-width: 0;\n\t\t\t\t/* disable 4 borders when in view mode and advanced layouts is on */\n\t\t\t\tborder: ", "px\n\t\t\t\t\tsolid ", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t", "\n\t\t}\n\n\t\t// styles to support borders for layout\n\t\t[data-layout-section],\n\t\t.layoutSectionView-content-wrap {\n\t\t\t", "\n\t\t}\n\t}\n\n\t", "\n\n\t// hide separator when element is dragging on top of a layout column\n\t[data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {\n\t\tdisplay: none;\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), layoutSectionStyles(), "var(--ds-space-100, 8px)", akLayoutGutterOffset + (editorExperiment('nested-dnd', true) && fg('platform_editor_advanced_layouts_post_fix_patch_2') ? 8 : 0), akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', viewMode === 'view' || editorExperiment('advanced_layouts', true) ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", LAYOUT_COLUMN_PADDING, LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), layoutColumnStyles(), editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderStyles(viewMode) : layoutBorderStyles(viewMode), editorExperiment('advanced_layouts', true) && layoutResponsiveStyles(viewMode), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode, editorExperiment('nested-dnd', true) && editorExperiment('advanced_layouts', false) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
67
67
|
};
|
package/dist/esm/use-preset.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
|
|
6
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
6
|
|
|
@@ -50,21 +49,10 @@ export function usePreset(createPreset) {
|
|
|
50
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
50
|
dependencies);
|
|
52
51
|
useLayoutEffect(function () {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
}
|
|
52
|
+
return preset.apiResolver.on(function (api) {
|
|
53
|
+
setAPI(api);
|
|
54
|
+
});
|
|
58
55
|
}, [preset.apiResolver]);
|
|
59
|
-
|
|
60
|
-
// Deprecated approach (not compatible with strict mode)
|
|
61
|
-
useLayoutEffect(function () {
|
|
62
|
-
if (!fg('platform_editor_fix_api_strict_mode')) {
|
|
63
|
-
preset.apiPromise.then(function (api) {
|
|
64
|
-
setAPI(api);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}, [preset.apiPromise]);
|
|
68
56
|
return {
|
|
69
57
|
editorApi: editorApi,
|
|
70
58
|
preset: preset
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "203.11.
|
|
2
|
+
export var version = "203.11.4";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
export declare function handleEditorFocus(view: EditorView): number | undefined;
|
|
2
|
+
export declare function handleEditorFocus(view: EditorView | null): number | undefined;
|
|
@@ -179,6 +179,7 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
|
|
|
179
179
|
commands: {
|
|
180
180
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
181
181
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
182
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
182
183
|
};
|
|
183
184
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"imageUpload", {
|
|
184
185
|
actions: {
|
|
@@ -253,6 +254,7 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
|
|
|
253
254
|
commands: {
|
|
254
255
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
255
256
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
257
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
256
258
|
};
|
|
257
259
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
|
|
258
260
|
pluginConfiguration: import("@atlaskit/editor-plugins/annotation").AnnotationProviders | undefined;
|
|
@@ -231,6 +231,7 @@ export default function createUniversalPresetInternal({ appearance, props, featu
|
|
|
231
231
|
commands: {
|
|
232
232
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
233
233
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
234
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
234
235
|
};
|
|
235
236
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"imageUpload", {
|
|
236
237
|
actions: {
|
|
@@ -305,6 +306,7 @@ export default function createUniversalPresetInternal({ appearance, props, featu
|
|
|
305
306
|
commands: {
|
|
306
307
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
307
308
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
309
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
308
310
|
};
|
|
309
311
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
|
|
310
312
|
pluginConfiguration: import("@atlaskit/editor-plugins/annotation").AnnotationProviders | undefined;
|
|
@@ -179,6 +179,7 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
|
|
|
179
179
|
commands: {
|
|
180
180
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
181
181
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
182
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
182
183
|
};
|
|
183
184
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"imageUpload", {
|
|
184
185
|
actions: {
|
|
@@ -253,6 +254,7 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
|
|
|
253
254
|
commands: {
|
|
254
255
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
255
256
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
257
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
256
258
|
};
|
|
257
259
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
|
|
258
260
|
pluginConfiguration: import("@atlaskit/editor-plugins/annotation").AnnotationProviders | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
export declare function handleEditorFocus(view: EditorView): number | undefined;
|
|
2
|
+
export declare function handleEditorFocus(view: EditorView | null): number | undefined;
|
|
@@ -282,6 +282,7 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
|
|
|
282
282
|
commands: {
|
|
283
283
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
284
284
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
285
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
285
286
|
};
|
|
286
287
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined,
|
|
287
288
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"imageUpload", {
|
|
@@ -367,6 +368,7 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
|
|
|
367
368
|
commands: {
|
|
368
369
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
369
370
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
371
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
370
372
|
};
|
|
371
373
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined,
|
|
372
374
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
|
|
@@ -334,6 +334,7 @@ export default function createUniversalPresetInternal({ appearance, props, featu
|
|
|
334
334
|
commands: {
|
|
335
335
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
336
336
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
337
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
337
338
|
};
|
|
338
339
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined,
|
|
339
340
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"imageUpload", {
|
|
@@ -419,6 +420,7 @@ export default function createUniversalPresetInternal({ appearance, props, featu
|
|
|
419
420
|
commands: {
|
|
420
421
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
421
422
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
423
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
422
424
|
};
|
|
423
425
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined,
|
|
424
426
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
|
|
@@ -282,6 +282,7 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
|
|
|
282
282
|
commands: {
|
|
283
283
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
284
284
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
285
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
285
286
|
};
|
|
286
287
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined,
|
|
287
288
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"imageUpload", {
|
|
@@ -367,6 +368,7 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
|
|
|
367
368
|
commands: {
|
|
368
369
|
showMediaViewer: (media: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
369
370
|
hideMediaViewer: import("@atlaskit/editor-common/types").EditorCommand;
|
|
371
|
+
trackMediaPaste: (attrs: import("@atlaskit/adf-schema").MediaADFAttrs) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
370
372
|
};
|
|
371
373
|
}, import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined> | undefined,
|
|
372
374
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"annotation", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "203.11.
|
|
3
|
+
"version": "203.11.4",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,20 +43,20 @@
|
|
|
43
43
|
"@atlaskit/analytics-next": "^10.2.0",
|
|
44
44
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
45
45
|
"@atlaskit/button": "^20.3.0",
|
|
46
|
-
"@atlaskit/editor-common": "^99.
|
|
46
|
+
"@atlaskit/editor-common": "^99.3.0",
|
|
47
47
|
"@atlaskit/editor-json-transformer": "^8.21.0",
|
|
48
48
|
"@atlaskit/editor-plugin-quick-insert": "1.8.3",
|
|
49
49
|
"@atlaskit/editor-plugins": "^6.4.0",
|
|
50
50
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
51
51
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
52
52
|
"@atlaskit/emoji": "^67.12.0",
|
|
53
|
-
"@atlaskit/icon": "^23.
|
|
53
|
+
"@atlaskit/icon": "^23.4.0",
|
|
54
54
|
"@atlaskit/media-card": "^78.18.0",
|
|
55
|
-
"@atlaskit/mention": "^23.
|
|
55
|
+
"@atlaskit/mention": "^23.8.0",
|
|
56
56
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
57
57
|
"@atlaskit/task-decision": "^17.11.0",
|
|
58
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
59
|
-
"@atlaskit/tokens": "^3.
|
|
58
|
+
"@atlaskit/tmp-editor-statsig": "^2.36.0",
|
|
59
|
+
"@atlaskit/tokens": "^3.1.0",
|
|
60
60
|
"@atlaskit/tooltip": "^19.0.0",
|
|
61
61
|
"@atlaskit/width-detector": "^4.3.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@af/editor-libra": "*",
|
|
83
83
|
"@af/visual-regression": "*",
|
|
84
|
-
"@atlaskit/adf-utils": "^19.
|
|
84
|
+
"@atlaskit/adf-utils": "^19.17.0",
|
|
85
85
|
"@atlaskit/analytics-listeners": "^8.13.0",
|
|
86
|
-
"@atlaskit/collab-provider": "10.
|
|
86
|
+
"@atlaskit/collab-provider": "10.4.0",
|
|
87
87
|
"@atlaskit/editor-plugin-annotation": "1.26.11",
|
|
88
88
|
"@atlaskit/editor-plugin-card": "^4.5.0",
|
|
89
89
|
"@atlaskit/editor-plugin-list": "^3.9.0",
|
|
@@ -250,10 +250,6 @@
|
|
|
250
250
|
"type:": "boolean",
|
|
251
251
|
"referenceOnly": true
|
|
252
252
|
},
|
|
253
|
-
"platform_editor_drag_and_drop_target_v2": {
|
|
254
|
-
"type": "boolean",
|
|
255
|
-
"referenceOnly": true
|
|
256
|
-
},
|
|
257
253
|
"platform_editor_element_dnd_nested_fix_patch_5": {
|
|
258
254
|
"type": "boolean",
|
|
259
255
|
"referenceOnly": true
|
|
@@ -302,9 +298,6 @@
|
|
|
302
298
|
"type": "boolean",
|
|
303
299
|
"referenceOnly": true
|
|
304
300
|
},
|
|
305
|
-
"platform_editor_fix_api_strict_mode": {
|
|
306
|
-
"type": "boolean"
|
|
307
|
-
},
|
|
308
301
|
"platform_editor_use_nested_table_pm_nodes": {
|
|
309
302
|
"type": "boolean",
|
|
310
303
|
"referenceOnly": true
|
|
@@ -403,6 +396,14 @@
|
|
|
403
396
|
},
|
|
404
397
|
"platform_editor_ease_of_use_metrics": {
|
|
405
398
|
"type": "boolean"
|
|
399
|
+
},
|
|
400
|
+
"platform_editor_nested_tables_renderer_colgroup": {
|
|
401
|
+
"type": "boolean",
|
|
402
|
+
"referenceOnly": true
|
|
403
|
+
},
|
|
404
|
+
"platform_editor_table_use_shared_state_hook_fg": {
|
|
405
|
+
"type": "boolean",
|
|
406
|
+
"referenceOnly": true
|
|
406
407
|
}
|
|
407
408
|
},
|
|
408
409
|
"stricter": {
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePluginPerformanceObserver = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
9
|
-
var _countNodes = require("@atlaskit/editor-common/count-nodes");
|
|
10
|
-
var _pluginPerformanceObserver = require("../../utils/performance/plugin-performance-observer");
|
|
11
|
-
var usePluginPerformanceObserver = exports.usePluginPerformanceObserver = function usePluginPerformanceObserver(getEditorState, pluginInjectionAPI, dispatchAnalyticsEvent) {
|
|
12
|
-
var onPluginObservation = (0, _react.useCallback)(function (report) {
|
|
13
|
-
var _pluginInjectionAPI$c;
|
|
14
|
-
dispatchAnalyticsEvent({
|
|
15
|
-
action: _analytics.ACTION.TRANSACTION_DISPATCHED,
|
|
16
|
-
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
17
|
-
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
18
|
-
attributes: {
|
|
19
|
-
report: report,
|
|
20
|
-
participants: ((_pluginInjectionAPI$c = pluginInjectionAPI.current) === null || _pluginInjectionAPI$c === void 0 || (_pluginInjectionAPI$c = _pluginInjectionAPI$c.api().collabEdit) === null || _pluginInjectionAPI$c === void 0 || (_pluginInjectionAPI$c = _pluginInjectionAPI$c.sharedState.currentState()) === null || _pluginInjectionAPI$c === void 0 || (_pluginInjectionAPI$c = _pluginInjectionAPI$c.participants) === null || _pluginInjectionAPI$c === void 0 ? void 0 : _pluginInjectionAPI$c.size()) || 1
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}, [dispatchAnalyticsEvent, pluginInjectionAPI]);
|
|
24
|
-
var getPluginNames = (0, _react.useCallback)(function () {
|
|
25
|
-
var _getEditorState;
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
-
return (_getEditorState = getEditorState()) === null || _getEditorState === void 0 ? void 0 : _getEditorState.plugins.map(function (p) {
|
|
28
|
-
return p.key;
|
|
29
|
-
});
|
|
30
|
-
}, [getEditorState]);
|
|
31
|
-
var pluginPerformanceObserver = (0, _react.useMemo)(function () {
|
|
32
|
-
var state = getEditorState();
|
|
33
|
-
return new _pluginPerformanceObserver.PluginPerformanceObserver(function (report) {
|
|
34
|
-
return onPluginObservation(report);
|
|
35
|
-
}).withPlugins(function () {
|
|
36
|
-
return getPluginNames();
|
|
37
|
-
}).withNodeCounts(function () {
|
|
38
|
-
return state ? (0, _countNodes.countNodes)(state) : {
|
|
39
|
-
nodeCount: {},
|
|
40
|
-
extensionNodeCount: {}
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
}, [onPluginObservation, getPluginNames, getEditorState]);
|
|
44
|
-
(0, _react.useLayoutEffect)(function () {
|
|
45
|
-
return function () {
|
|
46
|
-
pluginPerformanceObserver.disconnect();
|
|
47
|
-
};
|
|
48
|
-
}, [pluginPerformanceObserver]);
|
|
49
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useCallback, useLayoutEffect, useMemo } from 'react';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { countNodes } from '@atlaskit/editor-common/count-nodes';
|
|
4
|
-
import { PluginPerformanceObserver } from '../../utils/performance/plugin-performance-observer';
|
|
5
|
-
export const usePluginPerformanceObserver = (getEditorState, pluginInjectionAPI, dispatchAnalyticsEvent) => {
|
|
6
|
-
const onPluginObservation = useCallback(report => {
|
|
7
|
-
var _pluginInjectionAPI$c, _pluginInjectionAPI$c2, _pluginInjectionAPI$c3, _pluginInjectionAPI$c4;
|
|
8
|
-
dispatchAnalyticsEvent({
|
|
9
|
-
action: ACTION.TRANSACTION_DISPATCHED,
|
|
10
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
11
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
12
|
-
attributes: {
|
|
13
|
-
report,
|
|
14
|
-
participants: ((_pluginInjectionAPI$c = pluginInjectionAPI.current) === null || _pluginInjectionAPI$c === void 0 ? void 0 : (_pluginInjectionAPI$c2 = _pluginInjectionAPI$c.api().collabEdit) === null || _pluginInjectionAPI$c2 === void 0 ? void 0 : (_pluginInjectionAPI$c3 = _pluginInjectionAPI$c2.sharedState.currentState()) === null || _pluginInjectionAPI$c3 === void 0 ? void 0 : (_pluginInjectionAPI$c4 = _pluginInjectionAPI$c3.participants) === null || _pluginInjectionAPI$c4 === void 0 ? void 0 : _pluginInjectionAPI$c4.size()) || 1
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}, [dispatchAnalyticsEvent, pluginInjectionAPI]);
|
|
18
|
-
const getPluginNames = useCallback(() => {
|
|
19
|
-
var _getEditorState;
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
return (_getEditorState = getEditorState()) === null || _getEditorState === void 0 ? void 0 : _getEditorState.plugins.map(p => p.key);
|
|
22
|
-
}, [getEditorState]);
|
|
23
|
-
const pluginPerformanceObserver = useMemo(() => {
|
|
24
|
-
const state = getEditorState();
|
|
25
|
-
return new PluginPerformanceObserver(report => onPluginObservation(report)).withPlugins(() => getPluginNames()).withNodeCounts(() => state ? countNodes(state) : {
|
|
26
|
-
nodeCount: {},
|
|
27
|
-
extensionNodeCount: {}
|
|
28
|
-
});
|
|
29
|
-
}, [onPluginObservation, getPluginNames, getEditorState]);
|
|
30
|
-
useLayoutEffect(() => {
|
|
31
|
-
return () => {
|
|
32
|
-
pluginPerformanceObserver.disconnect();
|
|
33
|
-
};
|
|
34
|
-
}, [pluginPerformanceObserver]);
|
|
35
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useCallback, useLayoutEffect, useMemo } from 'react';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { countNodes } from '@atlaskit/editor-common/count-nodes';
|
|
4
|
-
import { PluginPerformanceObserver } from '../../utils/performance/plugin-performance-observer';
|
|
5
|
-
export var usePluginPerformanceObserver = function usePluginPerformanceObserver(getEditorState, pluginInjectionAPI, dispatchAnalyticsEvent) {
|
|
6
|
-
var onPluginObservation = useCallback(function (report) {
|
|
7
|
-
var _pluginInjectionAPI$c;
|
|
8
|
-
dispatchAnalyticsEvent({
|
|
9
|
-
action: ACTION.TRANSACTION_DISPATCHED,
|
|
10
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
11
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
12
|
-
attributes: {
|
|
13
|
-
report: report,
|
|
14
|
-
participants: ((_pluginInjectionAPI$c = pluginInjectionAPI.current) === null || _pluginInjectionAPI$c === void 0 || (_pluginInjectionAPI$c = _pluginInjectionAPI$c.api().collabEdit) === null || _pluginInjectionAPI$c === void 0 || (_pluginInjectionAPI$c = _pluginInjectionAPI$c.sharedState.currentState()) === null || _pluginInjectionAPI$c === void 0 || (_pluginInjectionAPI$c = _pluginInjectionAPI$c.participants) === null || _pluginInjectionAPI$c === void 0 ? void 0 : _pluginInjectionAPI$c.size()) || 1
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}, [dispatchAnalyticsEvent, pluginInjectionAPI]);
|
|
18
|
-
var getPluginNames = useCallback(function () {
|
|
19
|
-
var _getEditorState;
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
return (_getEditorState = getEditorState()) === null || _getEditorState === void 0 ? void 0 : _getEditorState.plugins.map(function (p) {
|
|
22
|
-
return p.key;
|
|
23
|
-
});
|
|
24
|
-
}, [getEditorState]);
|
|
25
|
-
var pluginPerformanceObserver = useMemo(function () {
|
|
26
|
-
var state = getEditorState();
|
|
27
|
-
return new PluginPerformanceObserver(function (report) {
|
|
28
|
-
return onPluginObservation(report);
|
|
29
|
-
}).withPlugins(function () {
|
|
30
|
-
return getPluginNames();
|
|
31
|
-
}).withNodeCounts(function () {
|
|
32
|
-
return state ? countNodes(state) : {
|
|
33
|
-
nodeCount: {},
|
|
34
|
-
extensionNodeCount: {}
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
}, [onPluginObservation, getPluginNames, getEditorState]);
|
|
38
|
-
useLayoutEffect(function () {
|
|
39
|
-
return function () {
|
|
40
|
-
pluginPerformanceObserver.disconnect();
|
|
41
|
-
};
|
|
42
|
-
}, [pluginPerformanceObserver]);
|
|
43
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { type EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
4
|
-
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
export declare const usePluginPerformanceObserver: (getEditorState: () => EditorState, pluginInjectionAPI: React.MutableRefObject<EditorPluginInjectionAPI>, dispatchAnalyticsEvent: (payload: AnalyticsEventPayload) => void) => void;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { type EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
4
|
-
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
export declare const usePluginPerformanceObserver: (getEditorState: () => EditorState, pluginInjectionAPI: React.MutableRefObject<EditorPluginInjectionAPI>, dispatchAnalyticsEvent: (payload: AnalyticsEventPayload) => void) => void;
|