@atlaskit/editor-core 229.1.6 → 229.1.8
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 +20 -0
- package/dist/cjs/create-editor/ReactEditorView.js +14 -32
- package/dist/cjs/presets/default.js +1 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +15 -33
- package/dist/es2019/presets/default.js +1 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +14 -32
- package/dist/esm/presets/default.js +1 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +9 -12
- package/dist/cjs/create-editor/ReactEditorView/focusEditorElement.js +0 -15
- package/dist/es2019/create-editor/ReactEditorView/focusEditorElement.js +0 -9
- package/dist/esm/create-editor/ReactEditorView/focusEditorElement.js +0 -9
- package/dist/types/create-editor/ReactEditorView/focusEditorElement.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 229.1.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 229.1.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`1ee5ac1d4338d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1ee5ac1d4338d) -
|
|
14
|
+
Cleaning up cc_editor_focus_before_editor_on_load and platform_editor_no_cursor_on_edit_page_init
|
|
15
|
+
|
|
16
|
+
Cursor suppression on load is now driven by the presence of the interaction plugin rather than the
|
|
17
|
+
experiment, so only editors that opt into that plugin skip focus on a document with content.
|
|
18
|
+
`cc_editor_focus_before_editor_on_load` shipped disabled, so the pre-editor focus element has been
|
|
19
|
+
removed.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 229.1.6
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -36,7 +36,6 @@ var _editorSsrRenderer = require("@atlaskit/editor-ssr-renderer");
|
|
|
36
36
|
var _createSsrEditorState = require("@atlaskit/editor-ssr-renderer/create-ssr-editor-state");
|
|
37
37
|
var _createSsrPmPlugins = require("@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins");
|
|
38
38
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
39
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
40
39
|
var _addUfoCustomData = require("@atlaskit/react-ufo/add-ufo-custom-data");
|
|
41
40
|
var _getInteractionId = require("@atlaskit/react-ufo/get-interaction-id");
|
|
42
41
|
var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
|
|
@@ -58,7 +57,6 @@ var _createErrorReporter = require("./createErrorReporter");
|
|
|
58
57
|
var _createPMPlugins = require("./createPMPlugins");
|
|
59
58
|
var _filterPluginsForReconfigure = require("./filter-plugins-for-reconfigure");
|
|
60
59
|
var _messages = require("./messages");
|
|
61
|
-
var _focusEditorElement = require("./ReactEditorView/focusEditorElement");
|
|
62
60
|
var _getUAPrefix = require("./ReactEditorView/getUAPrefix");
|
|
63
61
|
var _handleEditorFocus = require("./ReactEditorView/handleEditorFocus");
|
|
64
62
|
var _useDispatchTransaction = require("./ReactEditorView/useDispatchTransaction");
|
|
@@ -116,7 +114,6 @@ function ReactEditorView(props) {
|
|
|
116
114
|
errorReporterHandler = _props$editorProps.errorReporterHandler,
|
|
117
115
|
defaultValue = _props$editorProps.defaultValue,
|
|
118
116
|
shouldFocus = _props$editorProps.shouldFocus,
|
|
119
|
-
__livePage = _props$editorProps.__livePage,
|
|
120
117
|
onEditorCreated = props.onEditorCreated,
|
|
121
118
|
onEditorDestroyed = props.onEditorDestroyed;
|
|
122
119
|
|
|
@@ -820,21 +817,14 @@ function ReactEditorView(props) {
|
|
|
820
817
|
}
|
|
821
818
|
if (shouldFocus && editorView !== null && editorView !== void 0 && (_editorView$props$edi = (_editorView$props = editorView.props).editable) !== null && _editorView$props$edi !== void 0 && _editorView$props$edi.call(_editorView$props, editorView.state)) {
|
|
822
819
|
if (!mitigateScrollJump) {
|
|
823
|
-
var
|
|
824
|
-
|
|
820
|
+
var _pluginInjectionAPI$c3;
|
|
821
|
+
var focusesImmediately = (0, _isChromeless.isChromeless)(props.editorProps.appearance) || (0, _document.isEmptyDocument)(editorView.state.doc) || ((_pluginInjectionAPI$c3 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c3 === void 0 ? void 0 : _pluginInjectionAPI$c3.interaction) === undefined;
|
|
822
|
+
if (focusesImmediately) {
|
|
825
823
|
focusTimeoutId.current = (0, _handleEditorFocus.handleEditorFocus)(editorView);
|
|
826
824
|
}
|
|
827
|
-
if ((0, _isChromeless.isChromeless)(props.editorProps.appearance)) {
|
|
828
|
-
focusTimeoutId.current = (0, _handleEditorFocus.handleEditorFocus)(editorView);
|
|
829
|
-
}
|
|
830
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && (0, _fg.fg)('cc_editor_focus_before_editor_on_load')) {
|
|
831
|
-
if (!disabled && shouldFocus && !(0, _document.isEmptyDocument)(editorView.state.doc)) {
|
|
832
|
-
(0, _focusEditorElement.focusEditorElement)(editorId.current);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
825
|
}
|
|
836
826
|
}
|
|
837
|
-
}, [editorView, shouldFocus,
|
|
827
|
+
}, [editorView, shouldFocus, mitigateScrollJump, disabled, props.editorProps.appearance]);
|
|
838
828
|
var scrollElement = _react.default.useRef();
|
|
839
829
|
var possibleListeners = _react.default.useRef([]);
|
|
840
830
|
(0, _react.useEffect)(function () {
|
|
@@ -961,11 +951,7 @@ function ReactEditorView(props) {
|
|
|
961
951
|
}, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump, scrollRestorePerfEnabled]);
|
|
962
952
|
var isPageAppearance = (0, _isFullPage.isFullPage)(nextAppearance) || nextAppearance === 'max';
|
|
963
953
|
var createEditor = (0, _react.useCallback)(function (assistiveLabel, assistiveDescribedBy) {
|
|
964
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
965
|
-
tabIndex: -1,
|
|
966
|
-
"data-focus-id": editorId.current,
|
|
967
|
-
"data-testid": "react-editor-view-inital-focus-element"
|
|
968
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
954
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
969
955
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
970
956
|
className: "ProseMirror ".concat((0, _getUAPrefix.getUAPrefix)()),
|
|
971
957
|
key: "ProseMirror",
|
|
@@ -990,7 +976,7 @@ function ReactEditorView(props) {
|
|
|
990
976
|
dangerouslySetInnerHTML: {
|
|
991
977
|
__html: ''
|
|
992
978
|
}
|
|
993
|
-
})
|
|
979
|
+
});
|
|
994
980
|
}, [handleEditorViewRef, isPageAppearance, props.intl]);
|
|
995
981
|
var previousPreset = (0, _hooks.usePreviousState)(preset);
|
|
996
982
|
(0, _react.useLayoutEffect)(function () {
|
|
@@ -1009,26 +995,22 @@ function ReactEditorView(props) {
|
|
|
1009
995
|
return;
|
|
1010
996
|
}
|
|
1011
997
|
if (viewRef.current && previousDisabledState !== disabled) {
|
|
998
|
+
var _pluginInjectionAPI$c4;
|
|
1012
999
|
// Disables the contentEditable attribute of the editor if the editor is disabled
|
|
1013
1000
|
viewRef.current.setProps({
|
|
1014
1001
|
editable: function editable(_state) {
|
|
1015
1002
|
return !disabled;
|
|
1016
1003
|
}
|
|
1017
1004
|
});
|
|
1018
|
-
var
|
|
1019
|
-
if (!disabled && shouldFocus &&
|
|
1005
|
+
var focusesImmediately = (0, _document.isEmptyDocument)(viewRef.current.state.doc) || ((_pluginInjectionAPI$c4 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c4 === void 0 ? void 0 : _pluginInjectionAPI$c4.interaction) === undefined;
|
|
1006
|
+
if (!disabled && shouldFocus && focusesImmediately) {
|
|
1020
1007
|
focusTimeoutId.current = (0, _handleEditorFocus.handleEditorFocus)(viewRef.current);
|
|
1021
1008
|
}
|
|
1022
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && (0, _fg.fg)('cc_editor_focus_before_editor_on_load')) {
|
|
1023
|
-
if (!disabled && shouldFocus && !(0, _document.isEmptyDocument)(viewRef.current.state.doc)) {
|
|
1024
|
-
(0, _focusEditorElement.focusEditorElement)(editorId.current);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
1009
|
}
|
|
1028
|
-
}, [disabled, shouldFocus, previousDisabledState
|
|
1010
|
+
}, [disabled, shouldFocus, previousDisabledState]);
|
|
1029
1011
|
(0, _react.useLayoutEffect)(function () {
|
|
1030
|
-
var _pluginInjectionAPI$
|
|
1031
|
-
(_pluginInjectionAPI$
|
|
1012
|
+
var _pluginInjectionAPI$c5;
|
|
1013
|
+
(_pluginInjectionAPI$c5 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c5 === void 0 || (_pluginInjectionAPI$c5 = _pluginInjectionAPI$c5.core) === null || _pluginInjectionAPI$c5 === void 0 || (_pluginInjectionAPI$c5 = _pluginInjectionAPI$c5.actions) === null || _pluginInjectionAPI$c5 === void 0 || _pluginInjectionAPI$c5.updateAppearance(nextAppearance);
|
|
1032
1014
|
}, [nextAppearance]);
|
|
1033
1015
|
(0, _useFireFullWidthEvent.useFireFullWidthEvent)(nextAppearance, dispatchAnalyticsEvent);
|
|
1034
1016
|
|
|
@@ -1057,7 +1039,7 @@ function ReactEditorView(props) {
|
|
|
1057
1039
|
// In separate memo, because some props like `props.intl` that need only for rendering
|
|
1058
1040
|
// changes many times, but we don't want to process plugins and ADF document for each unnecessary changes.
|
|
1059
1041
|
var ssrDeps = (0, _react.useMemo)(function () {
|
|
1060
|
-
var _pluginInjectionAPI$
|
|
1042
|
+
var _pluginInjectionAPI$c6;
|
|
1061
1043
|
if (!(0, _coreUtils.isSSR)()) {
|
|
1062
1044
|
return null;
|
|
1063
1045
|
}
|
|
@@ -1078,7 +1060,7 @@ function ReactEditorView(props) {
|
|
|
1078
1060
|
return buildDoc(schema);
|
|
1079
1061
|
};
|
|
1080
1062
|
var doc = (0, _ssrMeasures.profileSSROperation)("".concat(SSR_TRACE_SEGMENT_NAME, "/buildDoc"), doBuildDoc, onSSRMeasure);
|
|
1081
|
-
var isViewMode = ((_pluginInjectionAPI$
|
|
1063
|
+
var isViewMode = ((_pluginInjectionAPI$c6 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c6 === void 0 || (_pluginInjectionAPI$c6 = _pluginInjectionAPI$c6.editorViewMode) === null || _pluginInjectionAPI$c6 === void 0 || (_pluginInjectionAPI$c6 = _pluginInjectionAPI$c6.sharedState.currentState()) === null || _pluginInjectionAPI$c6 === void 0 ? void 0 : _pluginInjectionAPI$c6.mode) === 'view';
|
|
1082
1064
|
var ariaReadonly = isViewMode && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_viewmode_aria_readonly_a11y') ? 'true' : undefined;
|
|
1083
1065
|
|
|
1084
1066
|
// When the platform_editor_ssr_toolbar_optimistic is on, we create SSR-safe PM plugins and EditorState
|
|
@@ -44,7 +44,6 @@ var _unsupportedContent = require("@atlaskit/editor-plugins/unsupported-content"
|
|
|
44
44
|
var _userIntent = require("@atlaskit/editor-plugins/user-intent");
|
|
45
45
|
var _width = require("@atlaskit/editor-plugins/width");
|
|
46
46
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
47
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
48
47
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
49
48
|
var _isFullPage = require("../utils/is-full-page");
|
|
50
49
|
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; }
|
|
@@ -69,7 +68,7 @@ function createDefaultPreset(options) {
|
|
|
69
68
|
initialUserPreferences: {
|
|
70
69
|
toolbarDockingPosition: isFullPage ? 'none' : 'top'
|
|
71
70
|
}
|
|
72
|
-
}]).maybeAdd(_interaction.interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage)
|
|
71
|
+
}]).maybeAdd(_interaction.interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage)).add(_composition.compositionPlugin).add([_contextIdentifier.contextIdentifierPlugin, {
|
|
73
72
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
74
73
|
}]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(options.allowUndoRedoButtons)).add(_userIntent.userIntentPlugin).maybeAdd([_toolbar.toolbarPlugin, options.toolbar || {}], Boolean((_options$toolbar = options.toolbar) === null || _options$toolbar === void 0 ? void 0 : _options$toolbar.enableNewToolbarExperience)).add([_primaryToolbar.primaryToolbarPlugin, {
|
|
75
74
|
contextualFormattingEnabled: isFullPage
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
8
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
|
-
var version = exports.version = "229.1.
|
|
9
|
+
var version = exports.version = "229.1.7";
|
|
@@ -25,7 +25,6 @@ import { EditorSSRRenderer } from '@atlaskit/editor-ssr-renderer';
|
|
|
25
25
|
import { createSSREditorState } from '@atlaskit/editor-ssr-renderer/create-ssr-editor-state';
|
|
26
26
|
import { createSSRPMPlugins } from '@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins';
|
|
27
27
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
28
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
29
28
|
import { addUFOCustomData } from '@atlaskit/react-ufo/add-ufo-custom-data';
|
|
30
29
|
import { getInteractionId } from '@atlaskit/react-ufo/get-interaction-id';
|
|
31
30
|
import { abortAll, getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
@@ -47,7 +46,6 @@ import { createErrorReporter } from './createErrorReporter';
|
|
|
47
46
|
import { createPMPlugins } from './createPMPlugins';
|
|
48
47
|
import { filterPluginsForReconfigure } from './filter-plugins-for-reconfigure';
|
|
49
48
|
import { editorMessages } from './messages';
|
|
50
|
-
import { focusEditorElement } from './ReactEditorView/focusEditorElement';
|
|
51
49
|
import { getUAPrefix } from './ReactEditorView/getUAPrefix';
|
|
52
50
|
import { handleEditorFocus } from './ReactEditorView/handleEditorFocus';
|
|
53
51
|
import { useDispatchTransaction } from './ReactEditorView/useDispatchTransaction';
|
|
@@ -86,8 +84,7 @@ export function ReactEditorView(props) {
|
|
|
86
84
|
featureFlags: editorPropFeatureFlags,
|
|
87
85
|
errorReporterHandler,
|
|
88
86
|
defaultValue,
|
|
89
|
-
shouldFocus
|
|
90
|
-
__livePage
|
|
87
|
+
shouldFocus
|
|
91
88
|
},
|
|
92
89
|
onEditorCreated,
|
|
93
90
|
onEditorDestroyed
|
|
@@ -768,21 +765,14 @@ export function ReactEditorView(props) {
|
|
|
768
765
|
}
|
|
769
766
|
if (shouldFocus && editorView !== null && editorView !== void 0 && (_editorView$props$edi = (_editorView$props = editorView.props).editable) !== null && _editorView$props$edi !== void 0 && _editorView$props$edi.call(_editorView$props, editorView.state)) {
|
|
770
767
|
if (!mitigateScrollJump) {
|
|
771
|
-
|
|
772
|
-
|
|
768
|
+
var _pluginInjectionAPI$c5;
|
|
769
|
+
const focusesImmediately = isChromeless(props.editorProps.appearance) || isEmptyDocument(editorView.state.doc) || ((_pluginInjectionAPI$c5 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c5 === void 0 ? void 0 : _pluginInjectionAPI$c5.interaction) === undefined;
|
|
770
|
+
if (focusesImmediately) {
|
|
773
771
|
focusTimeoutId.current = handleEditorFocus(editorView);
|
|
774
772
|
}
|
|
775
|
-
if (isChromeless(props.editorProps.appearance)) {
|
|
776
|
-
focusTimeoutId.current = handleEditorFocus(editorView);
|
|
777
|
-
}
|
|
778
|
-
if (expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && fg('cc_editor_focus_before_editor_on_load')) {
|
|
779
|
-
if (!disabled && shouldFocus && !isEmptyDocument(editorView.state.doc)) {
|
|
780
|
-
focusEditorElement(editorId.current);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
773
|
}
|
|
784
774
|
}
|
|
785
|
-
}, [editorView, shouldFocus,
|
|
775
|
+
}, [editorView, shouldFocus, mitigateScrollJump, disabled, props.editorProps.appearance]);
|
|
786
776
|
const scrollElement = React.useRef();
|
|
787
777
|
const possibleListeners = React.useRef([]);
|
|
788
778
|
useEffect(() => {
|
|
@@ -891,11 +881,7 @@ export function ReactEditorView(props) {
|
|
|
891
881
|
}, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump, scrollRestorePerfEnabled]);
|
|
892
882
|
const isPageAppearance = isFullPage(nextAppearance) || nextAppearance === 'max';
|
|
893
883
|
const createEditor = useCallback((assistiveLabel, assistiveDescribedBy) => {
|
|
894
|
-
return /*#__PURE__*/React.createElement(
|
|
895
|
-
tabIndex: -1,
|
|
896
|
-
"data-focus-id": editorId.current,
|
|
897
|
-
"data-testid": "react-editor-view-inital-focus-element"
|
|
898
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
884
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
899
885
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
900
886
|
className: `ProseMirror ${getUAPrefix()}`,
|
|
901
887
|
key: "ProseMirror",
|
|
@@ -920,7 +906,7 @@ export function ReactEditorView(props) {
|
|
|
920
906
|
dangerouslySetInnerHTML: {
|
|
921
907
|
__html: ''
|
|
922
908
|
}
|
|
923
|
-
})
|
|
909
|
+
});
|
|
924
910
|
}, [handleEditorViewRef, isPageAppearance, props.intl]);
|
|
925
911
|
const previousPreset = usePreviousState(preset);
|
|
926
912
|
useLayoutEffect(() => {
|
|
@@ -939,24 +925,20 @@ export function ReactEditorView(props) {
|
|
|
939
925
|
return;
|
|
940
926
|
}
|
|
941
927
|
if (viewRef.current && previousDisabledState !== disabled) {
|
|
928
|
+
var _pluginInjectionAPI$c6;
|
|
942
929
|
// Disables the contentEditable attribute of the editor if the editor is disabled
|
|
943
930
|
viewRef.current.setProps({
|
|
944
931
|
editable: _state => !disabled
|
|
945
932
|
});
|
|
946
|
-
const
|
|
947
|
-
if (!disabled && shouldFocus &&
|
|
933
|
+
const focusesImmediately = isEmptyDocument(viewRef.current.state.doc) || ((_pluginInjectionAPI$c6 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c6 === void 0 ? void 0 : _pluginInjectionAPI$c6.interaction) === undefined;
|
|
934
|
+
if (!disabled && shouldFocus && focusesImmediately) {
|
|
948
935
|
focusTimeoutId.current = handleEditorFocus(viewRef.current);
|
|
949
936
|
}
|
|
950
|
-
if (expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && fg('cc_editor_focus_before_editor_on_load')) {
|
|
951
|
-
if (!disabled && shouldFocus && !isEmptyDocument(viewRef.current.state.doc)) {
|
|
952
|
-
focusEditorElement(editorId.current);
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
937
|
}
|
|
956
|
-
}, [disabled, shouldFocus, previousDisabledState
|
|
938
|
+
}, [disabled, shouldFocus, previousDisabledState]);
|
|
957
939
|
useLayoutEffect(() => {
|
|
958
|
-
var _pluginInjectionAPI$
|
|
959
|
-
(_pluginInjectionAPI$
|
|
940
|
+
var _pluginInjectionAPI$c7, _pluginInjectionAPI$c8, _pluginInjectionAPI$c9;
|
|
941
|
+
(_pluginInjectionAPI$c7 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c7 === void 0 ? void 0 : (_pluginInjectionAPI$c8 = _pluginInjectionAPI$c7.core) === null || _pluginInjectionAPI$c8 === void 0 ? void 0 : (_pluginInjectionAPI$c9 = _pluginInjectionAPI$c8.actions) === null || _pluginInjectionAPI$c9 === void 0 ? void 0 : _pluginInjectionAPI$c9.updateAppearance(nextAppearance);
|
|
960
942
|
}, [nextAppearance]);
|
|
961
943
|
useFireFullWidthEvent(nextAppearance, dispatchAnalyticsEvent);
|
|
962
944
|
|
|
@@ -986,7 +968,7 @@ export function ReactEditorView(props) {
|
|
|
986
968
|
// In separate memo, because some props like `props.intl` that need only for rendering
|
|
987
969
|
// changes many times, but we don't want to process plugins and ADF document for each unnecessary changes.
|
|
988
970
|
const ssrDeps = useMemo(() => {
|
|
989
|
-
var _pluginInjectionAPI$
|
|
971
|
+
var _pluginInjectionAPI$c0, _pluginInjectionAPI$c1, _pluginInjectionAPI$c10;
|
|
990
972
|
if (!isSSR()) {
|
|
991
973
|
return null;
|
|
992
974
|
}
|
|
@@ -1001,7 +983,7 @@ export function ReactEditorView(props) {
|
|
|
1001
983
|
const schema = profileSSROperation(`${SSR_TRACE_SEGMENT_NAME}/createSchema`, doCreateSchema, onSSRMeasure);
|
|
1002
984
|
const doBuildDoc = () => buildDoc(schema);
|
|
1003
985
|
const doc = profileSSROperation(`${SSR_TRACE_SEGMENT_NAME}/buildDoc`, doBuildDoc, onSSRMeasure);
|
|
1004
|
-
const isViewMode = ((_pluginInjectionAPI$
|
|
986
|
+
const isViewMode = ((_pluginInjectionAPI$c0 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c0 === void 0 ? void 0 : (_pluginInjectionAPI$c1 = _pluginInjectionAPI$c0.editorViewMode) === null || _pluginInjectionAPI$c1 === void 0 ? void 0 : (_pluginInjectionAPI$c10 = _pluginInjectionAPI$c1.sharedState.currentState()) === null || _pluginInjectionAPI$c10 === void 0 ? void 0 : _pluginInjectionAPI$c10.mode) === 'view';
|
|
1005
987
|
const ariaReadonly = isViewMode && isExperimentEnabled('platform_editor_viewmode_aria_readonly_a11y') ? 'true' : undefined;
|
|
1006
988
|
|
|
1007
989
|
// When the platform_editor_ssr_toolbar_optimistic is on, we create SSR-safe PM plugins and EditorState
|
|
@@ -37,7 +37,6 @@ import { unsupportedContentPlugin } from '@atlaskit/editor-plugins/unsupported-c
|
|
|
37
37
|
import { userIntentPlugin } from '@atlaskit/editor-plugins/user-intent';
|
|
38
38
|
import { widthPlugin } from '@atlaskit/editor-plugins/width';
|
|
39
39
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
40
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
41
40
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
42
41
|
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
43
42
|
|
|
@@ -62,7 +61,7 @@ export function createDefaultPreset(options) {
|
|
|
62
61
|
initialUserPreferences: {
|
|
63
62
|
toolbarDockingPosition: isFullPage ? 'none' : 'top'
|
|
64
63
|
}
|
|
65
|
-
}]).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage)
|
|
64
|
+
}]).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage)).add(compositionPlugin).add([contextIdentifierPlugin, {
|
|
66
65
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
67
66
|
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add(userIntentPlugin).maybeAdd([toolbarPlugin, options.toolbar || {}], Boolean((_options$toolbar = options.toolbar) === null || _options$toolbar === void 0 ? void 0 : _options$toolbar.enableNewToolbarExperience)).add([primaryToolbarPlugin, {
|
|
68
67
|
contextualFormattingEnabled: isFullPage
|
|
@@ -33,7 +33,6 @@ import { EditorSSRRenderer } from '@atlaskit/editor-ssr-renderer';
|
|
|
33
33
|
import { createSSREditorState } from '@atlaskit/editor-ssr-renderer/create-ssr-editor-state';
|
|
34
34
|
import { createSSRPMPlugins } from '@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins';
|
|
35
35
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
36
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
37
36
|
import { addUFOCustomData } from '@atlaskit/react-ufo/add-ufo-custom-data';
|
|
38
37
|
import { getInteractionId } from '@atlaskit/react-ufo/get-interaction-id';
|
|
39
38
|
import { abortAll, getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
|
|
@@ -55,7 +54,6 @@ import { createErrorReporter } from './createErrorReporter';
|
|
|
55
54
|
import { createPMPlugins } from './createPMPlugins';
|
|
56
55
|
import { filterPluginsForReconfigure } from './filter-plugins-for-reconfigure';
|
|
57
56
|
import { editorMessages } from './messages';
|
|
58
|
-
import { focusEditorElement } from './ReactEditorView/focusEditorElement';
|
|
59
57
|
import { getUAPrefix } from './ReactEditorView/getUAPrefix';
|
|
60
58
|
import { handleEditorFocus } from './ReactEditorView/handleEditorFocus';
|
|
61
59
|
import { useDispatchTransaction } from './ReactEditorView/useDispatchTransaction';
|
|
@@ -107,7 +105,6 @@ export function ReactEditorView(props) {
|
|
|
107
105
|
errorReporterHandler = _props$editorProps.errorReporterHandler,
|
|
108
106
|
defaultValue = _props$editorProps.defaultValue,
|
|
109
107
|
shouldFocus = _props$editorProps.shouldFocus,
|
|
110
|
-
__livePage = _props$editorProps.__livePage,
|
|
111
108
|
onEditorCreated = props.onEditorCreated,
|
|
112
109
|
onEditorDestroyed = props.onEditorDestroyed;
|
|
113
110
|
|
|
@@ -811,21 +808,14 @@ export function ReactEditorView(props) {
|
|
|
811
808
|
}
|
|
812
809
|
if (shouldFocus && editorView !== null && editorView !== void 0 && (_editorView$props$edi = (_editorView$props = editorView.props).editable) !== null && _editorView$props$edi !== void 0 && _editorView$props$edi.call(_editorView$props, editorView.state)) {
|
|
813
810
|
if (!mitigateScrollJump) {
|
|
814
|
-
var
|
|
815
|
-
|
|
811
|
+
var _pluginInjectionAPI$c3;
|
|
812
|
+
var focusesImmediately = isChromeless(props.editorProps.appearance) || isEmptyDocument(editorView.state.doc) || ((_pluginInjectionAPI$c3 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c3 === void 0 ? void 0 : _pluginInjectionAPI$c3.interaction) === undefined;
|
|
813
|
+
if (focusesImmediately) {
|
|
816
814
|
focusTimeoutId.current = handleEditorFocus(editorView);
|
|
817
815
|
}
|
|
818
|
-
if (isChromeless(props.editorProps.appearance)) {
|
|
819
|
-
focusTimeoutId.current = handleEditorFocus(editorView);
|
|
820
|
-
}
|
|
821
|
-
if (expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && fg('cc_editor_focus_before_editor_on_load')) {
|
|
822
|
-
if (!disabled && shouldFocus && !isEmptyDocument(editorView.state.doc)) {
|
|
823
|
-
focusEditorElement(editorId.current);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
816
|
}
|
|
827
817
|
}
|
|
828
|
-
}, [editorView, shouldFocus,
|
|
818
|
+
}, [editorView, shouldFocus, mitigateScrollJump, disabled, props.editorProps.appearance]);
|
|
829
819
|
var scrollElement = React.useRef();
|
|
830
820
|
var possibleListeners = React.useRef([]);
|
|
831
821
|
useEffect(function () {
|
|
@@ -952,11 +942,7 @@ export function ReactEditorView(props) {
|
|
|
952
942
|
}, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump, scrollRestorePerfEnabled]);
|
|
953
943
|
var isPageAppearance = isFullPage(nextAppearance) || nextAppearance === 'max';
|
|
954
944
|
var createEditor = useCallback(function (assistiveLabel, assistiveDescribedBy) {
|
|
955
|
-
return /*#__PURE__*/React.createElement(
|
|
956
|
-
tabIndex: -1,
|
|
957
|
-
"data-focus-id": editorId.current,
|
|
958
|
-
"data-testid": "react-editor-view-inital-focus-element"
|
|
959
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
945
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
960
946
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
961
947
|
className: "ProseMirror ".concat(getUAPrefix()),
|
|
962
948
|
key: "ProseMirror",
|
|
@@ -981,7 +967,7 @@ export function ReactEditorView(props) {
|
|
|
981
967
|
dangerouslySetInnerHTML: {
|
|
982
968
|
__html: ''
|
|
983
969
|
}
|
|
984
|
-
})
|
|
970
|
+
});
|
|
985
971
|
}, [handleEditorViewRef, isPageAppearance, props.intl]);
|
|
986
972
|
var previousPreset = usePreviousState(preset);
|
|
987
973
|
useLayoutEffect(function () {
|
|
@@ -1000,26 +986,22 @@ export function ReactEditorView(props) {
|
|
|
1000
986
|
return;
|
|
1001
987
|
}
|
|
1002
988
|
if (viewRef.current && previousDisabledState !== disabled) {
|
|
989
|
+
var _pluginInjectionAPI$c4;
|
|
1003
990
|
// Disables the contentEditable attribute of the editor if the editor is disabled
|
|
1004
991
|
viewRef.current.setProps({
|
|
1005
992
|
editable: function editable(_state) {
|
|
1006
993
|
return !disabled;
|
|
1007
994
|
}
|
|
1008
995
|
});
|
|
1009
|
-
var
|
|
1010
|
-
if (!disabled && shouldFocus &&
|
|
996
|
+
var focusesImmediately = isEmptyDocument(viewRef.current.state.doc) || ((_pluginInjectionAPI$c4 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c4 === void 0 ? void 0 : _pluginInjectionAPI$c4.interaction) === undefined;
|
|
997
|
+
if (!disabled && shouldFocus && focusesImmediately) {
|
|
1011
998
|
focusTimeoutId.current = handleEditorFocus(viewRef.current);
|
|
1012
999
|
}
|
|
1013
|
-
if (expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true) && fg('cc_editor_focus_before_editor_on_load')) {
|
|
1014
|
-
if (!disabled && shouldFocus && !isEmptyDocument(viewRef.current.state.doc)) {
|
|
1015
|
-
focusEditorElement(editorId.current);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
1000
|
}
|
|
1019
|
-
}, [disabled, shouldFocus, previousDisabledState
|
|
1001
|
+
}, [disabled, shouldFocus, previousDisabledState]);
|
|
1020
1002
|
useLayoutEffect(function () {
|
|
1021
|
-
var _pluginInjectionAPI$
|
|
1022
|
-
(_pluginInjectionAPI$
|
|
1003
|
+
var _pluginInjectionAPI$c5;
|
|
1004
|
+
(_pluginInjectionAPI$c5 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c5 === void 0 || (_pluginInjectionAPI$c5 = _pluginInjectionAPI$c5.core) === null || _pluginInjectionAPI$c5 === void 0 || (_pluginInjectionAPI$c5 = _pluginInjectionAPI$c5.actions) === null || _pluginInjectionAPI$c5 === void 0 || _pluginInjectionAPI$c5.updateAppearance(nextAppearance);
|
|
1023
1005
|
}, [nextAppearance]);
|
|
1024
1006
|
useFireFullWidthEvent(nextAppearance, dispatchAnalyticsEvent);
|
|
1025
1007
|
|
|
@@ -1048,7 +1030,7 @@ export function ReactEditorView(props) {
|
|
|
1048
1030
|
// In separate memo, because some props like `props.intl` that need only for rendering
|
|
1049
1031
|
// changes many times, but we don't want to process plugins and ADF document for each unnecessary changes.
|
|
1050
1032
|
var ssrDeps = useMemo(function () {
|
|
1051
|
-
var _pluginInjectionAPI$
|
|
1033
|
+
var _pluginInjectionAPI$c6;
|
|
1052
1034
|
if (!isSSR()) {
|
|
1053
1035
|
return null;
|
|
1054
1036
|
}
|
|
@@ -1069,7 +1051,7 @@ export function ReactEditorView(props) {
|
|
|
1069
1051
|
return buildDoc(schema);
|
|
1070
1052
|
};
|
|
1071
1053
|
var doc = profileSSROperation("".concat(SSR_TRACE_SEGMENT_NAME, "/buildDoc"), doBuildDoc, onSSRMeasure);
|
|
1072
|
-
var isViewMode = ((_pluginInjectionAPI$
|
|
1054
|
+
var isViewMode = ((_pluginInjectionAPI$c6 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c6 === void 0 || (_pluginInjectionAPI$c6 = _pluginInjectionAPI$c6.editorViewMode) === null || _pluginInjectionAPI$c6 === void 0 || (_pluginInjectionAPI$c6 = _pluginInjectionAPI$c6.sharedState.currentState()) === null || _pluginInjectionAPI$c6 === void 0 ? void 0 : _pluginInjectionAPI$c6.mode) === 'view';
|
|
1073
1055
|
var ariaReadonly = isViewMode && isExperimentEnabled('platform_editor_viewmode_aria_readonly_a11y') ? 'true' : undefined;
|
|
1074
1056
|
|
|
1075
1057
|
// When the platform_editor_ssr_toolbar_optimistic is on, we create SSR-safe PM plugins and EditorState
|
|
@@ -40,7 +40,6 @@ import { unsupportedContentPlugin } from '@atlaskit/editor-plugins/unsupported-c
|
|
|
40
40
|
import { userIntentPlugin } from '@atlaskit/editor-plugins/user-intent';
|
|
41
41
|
import { widthPlugin } from '@atlaskit/editor-plugins/width';
|
|
42
42
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
43
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
44
43
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
45
44
|
import { isFullPage as fullPageCheck } from '../utils/is-full-page';
|
|
46
45
|
|
|
@@ -64,7 +63,7 @@ export function createDefaultPreset(options) {
|
|
|
64
63
|
initialUserPreferences: {
|
|
65
64
|
toolbarDockingPosition: isFullPage ? 'none' : 'top'
|
|
66
65
|
}
|
|
67
|
-
}]).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage)
|
|
66
|
+
}]).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage)).add(compositionPlugin).add([contextIdentifierPlugin, {
|
|
68
67
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
69
68
|
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add(userIntentPlugin).maybeAdd([toolbarPlugin, options.toolbar || {}], Boolean((_options$toolbar = options.toolbar) === null || _options$toolbar === void 0 ? void 0 : _options$toolbar.enableNewToolbarExperience)).add([primaryToolbarPlugin, {
|
|
70
69
|
contextualFormattingEnabled: isFullPage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "229.1.
|
|
3
|
+
"version": "229.1.8",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
78
78
|
"@atlaskit/react-ufo": "^7.13.0",
|
|
79
79
|
"@atlaskit/task-decision": "^21.10.0",
|
|
80
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
81
|
-
"@atlaskit/tokens": "^
|
|
80
|
+
"@atlaskit/tmp-editor-statsig": "^203.0.0",
|
|
81
|
+
"@atlaskit/tokens": "^19.0.0",
|
|
82
82
|
"@atlaskit/tooltip": "^24.3.0",
|
|
83
83
|
"@atlaskit/width-detector": "^7.2.0",
|
|
84
84
|
"@babel/runtime": "^7.0.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"uuid": "^11.1.1"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@atlaskit/editor-common": "^123.
|
|
99
|
+
"@atlaskit/editor-common": "^123.8.0",
|
|
100
100
|
"@atlaskit/link-provider": "^5.7.0",
|
|
101
101
|
"@atlaskit/media-core": "^38.2.0",
|
|
102
102
|
"react": "^18.2.0 || ^19.2.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@atlaskit/docs": "^12.2.0",
|
|
117
117
|
"@atlaskit/drawer": "^14.3.0",
|
|
118
118
|
"@atlaskit/editor-plugin-alignment": "^20.0.0",
|
|
119
|
-
"@atlaskit/editor-plugin-annotation": "^19.
|
|
119
|
+
"@atlaskit/editor-plugin-annotation": "^19.2.0",
|
|
120
120
|
"@atlaskit/editor-plugin-base": "^20.0.0",
|
|
121
121
|
"@atlaskit/editor-plugin-card": "^25.0.0",
|
|
122
122
|
"@atlaskit/editor-plugin-code-block-advanced": "^19.0.0",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"@atlaskit/editor-plugin-text-color": "^19.0.0",
|
|
142
142
|
"@atlaskit/editor-plugin-toolbar-lists-indentation": "^20.0.0",
|
|
143
143
|
"@atlaskit/editor-plugin-track-changes": "^18.0.0",
|
|
144
|
-
"@atlaskit/editor-synced-block-provider": "^15.
|
|
144
|
+
"@atlaskit/editor-synced-block-provider": "^15.1.0",
|
|
145
145
|
"@atlaskit/editor-synced-block-renderer": "^17.0.0",
|
|
146
146
|
"@atlaskit/editor-test-helpers": "workspace:^",
|
|
147
147
|
"@atlaskit/form": "^17.2.0",
|
|
@@ -157,9 +157,9 @@
|
|
|
157
157
|
"@atlaskit/navigation-system": "^10.17.0",
|
|
158
158
|
"@atlaskit/popper": "^9.4.0",
|
|
159
159
|
"@atlaskit/portal": "^7.0.0",
|
|
160
|
-
"@atlaskit/profilecard": "^26.
|
|
160
|
+
"@atlaskit/profilecard": "^26.25.0",
|
|
161
161
|
"@atlaskit/radio": "^10.2.0",
|
|
162
|
-
"@atlaskit/renderer": "^
|
|
162
|
+
"@atlaskit/renderer": "^142.1.0",
|
|
163
163
|
"@atlaskit/section-message": "^10.2.0",
|
|
164
164
|
"@atlaskit/spinner": "^20.4.0",
|
|
165
165
|
"@atlaskit/synchrony-test-helpers": "workspace:^",
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"@atlassian/search-provider": "^20.0.0",
|
|
178
178
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
179
179
|
"@atlassian/testing-library": "^0.11.0",
|
|
180
|
-
"@atlassian/user-profile-card": "^1.
|
|
180
|
+
"@atlassian/user-profile-card": "^1.41.0",
|
|
181
181
|
"@emotion/jest": "^11.8.0",
|
|
182
182
|
"@testing-library/react": "^16.3.0",
|
|
183
183
|
"@types/diff": "^5.0.2",
|
|
@@ -266,9 +266,6 @@
|
|
|
266
266
|
"type": "boolean",
|
|
267
267
|
"referenceOnly": true
|
|
268
268
|
},
|
|
269
|
-
"cc_editor_focus_before_editor_on_load": {
|
|
270
|
-
"type": "boolean"
|
|
271
|
-
},
|
|
272
269
|
"platform_editor_adf_with_localid": {
|
|
273
270
|
"type": "boolean",
|
|
274
271
|
"referenceOnly": true
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.focusEditorElement = focusEditorElement;
|
|
7
|
-
function focusEditorElement(editorId) {
|
|
8
|
-
var parentElement = document.querySelector("[data-focus-id=\"".concat(editorId, "\"]"));
|
|
9
|
-
if (!(parentElement instanceof HTMLElement)) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
parentElement.focus({
|
|
13
|
-
preventScroll: true
|
|
14
|
-
});
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function focusEditorElement(editorId: string): void;
|