@atlaskit/editor-core 221.3.0 → 221.3.2
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 +22 -0
- package/dist/cjs/create-editor/ReactEditorView.js +66 -9
- package/dist/cjs/ui/Appearance/Comment/Comment-compiled.compiled.css +30 -0
- package/dist/cjs/ui/Appearance/Comment/Comment-compiled.js +275 -0
- package/dist/cjs/ui/Appearance/Comment/Comment-emotion.js +357 -0
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -344
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea-compiled.compiled.css +96 -0
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea-compiled.js +190 -0
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea-emotion.js +413 -0
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +10 -402
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbarNext.js +21 -2
- package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.js +6 -5
- package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-emotion.js +6 -4
- package/dist/cjs/ui/EditorContentContainer/styles/backgroundColorStyles.js +17 -6
- package/dist/cjs/ui/EditorContentContainer/styles/expandStyles.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +60 -9
- package/dist/es2019/ui/Appearance/Comment/Comment-compiled.compiled.css +30 -0
- package/dist/es2019/ui/Appearance/Comment/Comment-compiled.js +262 -0
- package/dist/es2019/ui/Appearance/Comment/Comment-emotion.js +344 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -337
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea-compiled.compiled.css +96 -0
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea-compiled.js +179 -0
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea-emotion.js +405 -0
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +8 -400
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbarNext.js +21 -2
- package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.js +6 -5
- package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-emotion.js +8 -6
- package/dist/es2019/ui/EditorContentContainer/styles/backgroundColorStyles.js +16 -5
- package/dist/es2019/ui/EditorContentContainer/styles/expandStyles.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +66 -9
- package/dist/esm/ui/Appearance/Comment/Comment-compiled.compiled.css +30 -0
- package/dist/esm/ui/Appearance/Comment/Comment-compiled.js +268 -0
- package/dist/esm/ui/Appearance/Comment/Comment-emotion.js +346 -0
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -339
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea-compiled.compiled.css +96 -0
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea-compiled.js +183 -0
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea-emotion.js +403 -0
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +10 -398
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbarNext.js +21 -2
- package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.js +6 -5
- package/dist/esm/ui/EditorContentContainer/EditorContentContainer-emotion.js +8 -6
- package/dist/esm/ui/EditorContentContainer/styles/backgroundColorStyles.js +16 -5
- package/dist/esm/ui/EditorContentContainer/styles/expandStyles.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/ui/Appearance/Comment/Comment-compiled.d.ts +30 -0
- package/dist/types/ui/Appearance/Comment/Comment-emotion.d.ts +20 -0
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +2 -20
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea-compiled.d.ts +56 -0
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea-emotion.d.ts +56 -0
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +6 -54
- package/dist/types/ui/EditorContentContainer/styles/backgroundColorStyles.d.ts +7 -0
- package/dist/types/ui/EditorContentContainer/styles/expandStyles.d.ts +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 221.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`92dbb82c2b7e5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/92dbb82c2b7e5) -
|
|
8
|
+
migrate compiled css for comment and fullpage
|
|
9
|
+
- [`29f99c0627c46`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/29f99c0627c46) -
|
|
10
|
+
Show text highlight on hyperlinks behind platform_editor_lovability_text_bg_color
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 221.3.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`3378314fe2ec1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3378314fe2ec1) -
|
|
18
|
+
Clean up experiment `platform_editor_chromeless_expand_fix`
|
|
19
|
+
- [`9d2c2c1c016bd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d2c2c1c016bd) -
|
|
20
|
+
[ux] Server-side render the editor toolbar (FullPageToolbarNext) with toolbar items enabled (not
|
|
21
|
+
hidden/disabled), so the toolbar is visible and interactive-looking on first paint — before
|
|
22
|
+
EditorView or collab edit is initialized. Clicks before editor is ready are noops.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 221.3.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -32,6 +32,8 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
32
32
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
33
33
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
34
34
|
var _editorSsrRenderer = require("@atlaskit/editor-ssr-renderer");
|
|
35
|
+
var _createSsrEditorState = require("@atlaskit/editor-ssr-renderer/create-ssr-editor-state");
|
|
36
|
+
var _createSsrPmPlugins = require("@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins");
|
|
35
37
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
36
38
|
var _interactionIdContext = require("@atlaskit/react-ufo/interaction-id-context");
|
|
37
39
|
var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
|
|
@@ -114,7 +116,12 @@ function ReactEditorView(props) {
|
|
|
114
116
|
__livePage = _props$editorProps.__livePage,
|
|
115
117
|
onEditorCreated = props.onEditorCreated,
|
|
116
118
|
onEditorDestroyed = props.onEditorDestroyed;
|
|
117
|
-
|
|
119
|
+
|
|
120
|
+
// Holds the best available EditorState before the ProseMirror EditorView has mounted.
|
|
121
|
+
// On SSR: set to the SSR-rendered state so toolbar plugins can read it via getEditorState().
|
|
122
|
+
// On client first render: set to initialEditorState for the same reason.
|
|
123
|
+
// Cleared to undefined once createEditorView runs and viewRef.current becomes available.
|
|
124
|
+
var preMountEditorStateRef = (0, _react.useRef)(undefined);
|
|
118
125
|
var editorRef = (0, _react.useRef)(null);
|
|
119
126
|
var viewRef = (0, _react.useRef)();
|
|
120
127
|
var focusTimeoutId = (0, _react.useRef)();
|
|
@@ -142,8 +149,8 @@ function ReactEditorView(props) {
|
|
|
142
149
|
return (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(editorPropFeatureFlags);
|
|
143
150
|
}, [editorPropFeatureFlags]);
|
|
144
151
|
var getEditorState = (0, _react.useCallback)(function () {
|
|
145
|
-
var
|
|
146
|
-
return (
|
|
152
|
+
var _preMountEditorStateR, _viewRef$current;
|
|
153
|
+
return (_preMountEditorStateR = preMountEditorStateRef.current) !== null && _preMountEditorStateR !== void 0 ? _preMountEditorStateR : (_viewRef$current = viewRef.current) === null || _viewRef$current === void 0 ? void 0 : _viewRef$current.state;
|
|
147
154
|
}, []);
|
|
148
155
|
var getEditorView = (0, _react.useCallback)(function () {
|
|
149
156
|
return viewRef.current;
|
|
@@ -266,12 +273,17 @@ function ReactEditorView(props) {
|
|
|
266
273
|
// so we can save some CPU time here.
|
|
267
274
|
return undefined;
|
|
268
275
|
}
|
|
269
|
-
|
|
276
|
+
var state = createEditorState({
|
|
270
277
|
props: props,
|
|
271
278
|
doc: defaultValue,
|
|
272
279
|
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
273
280
|
selectionAtStart: (0, _isFullPage.isFullPage)(nextAppearance)
|
|
274
281
|
});
|
|
282
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_ssr_toolbar_optimistic', 'isEnabled', true)) {
|
|
283
|
+
// CSR only, synchronously set preMountEditorStateRef so it's ready to be consumed by children including toolbar
|
|
284
|
+
preMountEditorStateRef.current = state;
|
|
285
|
+
}
|
|
286
|
+
return state;
|
|
275
287
|
},
|
|
276
288
|
// This is only used for the initial state - afterwards we will have `viewRef` available for use
|
|
277
289
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -672,6 +684,10 @@ function ReactEditorView(props) {
|
|
|
672
684
|
mount: node
|
|
673
685
|
}, getDirectEditorProps());
|
|
674
686
|
viewRef.current = view;
|
|
687
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_ssr_toolbar_optimistic', 'isEnabled', true)) {
|
|
688
|
+
// clears pre-mount state as soon as the final view is mounted
|
|
689
|
+
preMountEditorStateRef.current = undefined;
|
|
690
|
+
}
|
|
675
691
|
(0, _measureRender.measureRender)(_measureEnum.default.PROSEMIRROR_RENDERED, function (_ref3) {
|
|
676
692
|
var duration = _ref3.duration,
|
|
677
693
|
startTime = _ref3.startTime,
|
|
@@ -1037,17 +1053,56 @@ function ReactEditorView(props) {
|
|
|
1037
1053
|
return buildDoc(schema);
|
|
1038
1054
|
};
|
|
1039
1055
|
var doc = (0, _ssrMeasures.profileSSROperation)("".concat(SSR_TRACE_SEGMENT_NAME, "/buildDoc"), doBuildDoc, onSSRMeasure);
|
|
1056
|
+
|
|
1057
|
+
// When the platform_editor_ssr_toolbar_optimistic is on, we create SSR-safe PM plugins and EditorState
|
|
1058
|
+
// HERE in ssrDeps — before any children render — so that FullPageToolbarNext can read correct
|
|
1059
|
+
// plugin state via useSharedPluginStateWithSelector → currentState() → getEditorState().
|
|
1060
|
+
//
|
|
1061
|
+
// We also pass these pre-built pmPlugins and editorState to EditorSSRRenderer so it can
|
|
1062
|
+
// skip redundant creation (avoids double createPluginsList + EditorState.create).
|
|
1063
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_ssr_toolbar_optimistic', 'isEnabled', true)) {
|
|
1064
|
+
var ssrPMPlugins = (0, _ssrMeasures.profileSSROperation)("".concat(SSR_TRACE_SEGMENT_NAME, "/createSSRPMPlugins"), function () {
|
|
1065
|
+
return (0, _createSsrPmPlugins.createSSRPMPlugins)({
|
|
1066
|
+
plugins: plugins,
|
|
1067
|
+
schema: schema,
|
|
1068
|
+
portalProviderAPI: props.portalProviderAPI,
|
|
1069
|
+
getIntl: function getIntl() {
|
|
1070
|
+
return props.intl;
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
}, onSSRMeasure);
|
|
1074
|
+
var ssrState = (0, _ssrMeasures.profileSSROperation)("".concat(SSR_TRACE_SEGMENT_NAME, "/createSSREditorState"), function () {
|
|
1075
|
+
return (0, _createSsrEditorState.createSSREditorState)({
|
|
1076
|
+
doc: doc,
|
|
1077
|
+
schema: schema,
|
|
1078
|
+
pmPlugins: ssrPMPlugins
|
|
1079
|
+
});
|
|
1080
|
+
}, onSSRMeasure);
|
|
1081
|
+
return {
|
|
1082
|
+
plugins: plugins,
|
|
1083
|
+
schema: schema,
|
|
1084
|
+
doc: doc,
|
|
1085
|
+
ssrPMPlugins: ssrPMPlugins,
|
|
1086
|
+
ssrEditorState: ssrState
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1040
1089
|
return {
|
|
1041
1090
|
plugins: plugins,
|
|
1042
1091
|
schema: schema,
|
|
1043
|
-
doc: doc
|
|
1092
|
+
doc: doc,
|
|
1093
|
+
ssrPMPlugins: undefined,
|
|
1094
|
+
ssrEditorState: undefined
|
|
1044
1095
|
};
|
|
1045
|
-
}, [allowBlockType, buildDoc, props.preset, onSSRMeasure]);
|
|
1096
|
+
}, [allowBlockType, buildDoc, props.preset, onSSRMeasure, props.portalProviderAPI, props.intl]);
|
|
1097
|
+
// SSR only, synchronously set preMountEditorStateRef so it's ready to be consumed by children including toolbar
|
|
1098
|
+
if (ssrDeps !== null && ssrDeps !== void 0 && ssrDeps.ssrEditorState) {
|
|
1099
|
+
preMountEditorStateRef.current = ssrDeps.ssrEditorState;
|
|
1100
|
+
}
|
|
1046
1101
|
var _props$editorProps3 = props.editorProps,
|
|
1047
1102
|
assistiveLabel = _props$editorProps3.assistiveLabel,
|
|
1048
1103
|
assistiveDescribedBy = _props$editorProps3.assistiveDescribedBy;
|
|
1049
1104
|
var handleSsrEditorStateChanged = (0, _react.useCallback)(function (state) {
|
|
1050
|
-
|
|
1105
|
+
preMountEditorStateRef.current = state;
|
|
1051
1106
|
// Notify listeners about the initial SSR state
|
|
1052
1107
|
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
1053
1108
|
newEditorState: state,
|
|
@@ -1094,11 +1149,13 @@ function ReactEditorView(props) {
|
|
|
1094
1149
|
id: EDIT_AREA_ID,
|
|
1095
1150
|
"aria-describedby": assistiveDescribedBy,
|
|
1096
1151
|
"data-editor-id": editorId.current,
|
|
1097
|
-
onSSRMeasure: onSSRMeasure
|
|
1152
|
+
onSSRMeasure: onSSRMeasure,
|
|
1153
|
+
prebuiltPMPlugins: ssrDeps.ssrPMPlugins,
|
|
1154
|
+
prebuiltEditorState: ssrDeps.ssrEditorState
|
|
1098
1155
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1099
1156
|
,
|
|
1100
1157
|
onEditorStateChanged: (0, _expValEquals.expValEquals)('platform_editor_perf_lint_cleanup', 'isEnabled', true) ? handleSsrEditorStateChanged : function (state) {
|
|
1101
|
-
|
|
1158
|
+
preMountEditorStateRef.current = state;
|
|
1102
1159
|
// Notify listeners about the initial SSR state
|
|
1103
1160
|
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
1104
1161
|
newEditorState: state,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
._19itno8c{border:var(--ds-border-width,1px) solid var(--ds-border-input,#8c8f97)}
|
|
3
|
+
._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
|
|
4
|
+
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
5
|
+
._2rkopb1k{border-radius:var(--ds-radius-xlarge,9pt)}._13dfutpp .less-margin>.ProseMirror{margin-top:var(--ds-space-150,9pt)}
|
|
6
|
+
._16jlkb7n{flex-grow:1}
|
|
7
|
+
._18m91wug{overflow-y:auto}
|
|
8
|
+
._19bvv77o{padding-left:var(--ds-space-025,2px)}
|
|
9
|
+
._1bahesu3{justify-content:flex-end}
|
|
10
|
+
._1e0c1txw{display:flex}
|
|
11
|
+
._1ul9clpc{min-width:17pc}
|
|
12
|
+
._2lx21bp4{flex-direction:column}
|
|
13
|
+
._4cvr1h6o{align-items:center}
|
|
14
|
+
._4t3i1wug{height:auto}
|
|
15
|
+
._bfhk1j9a{background-color:var(--ds-background-input,#fff)}
|
|
16
|
+
._c71lmz22{max-height:var(--comment-editor-max-height)}
|
|
17
|
+
._ca0qutpp{padding-top:var(--ds-space-150,9pt)}
|
|
18
|
+
._ghozu2gc .less-margin>.ProseMirror{margin-bottom:var(--ds-space-100,8px)}
|
|
19
|
+
._gzr8u2gc .less-margin>.ProseMirror{margin-right:var(--ds-space-100,8px)}
|
|
20
|
+
._n3tdutpp{padding-bottom:var(--ds-space-150,9pt)}
|
|
21
|
+
._oafwu2gc .less-margin>.ProseMirror{margin-left:var(--ds-space-100,8px)}
|
|
22
|
+
._p12f1kw7{max-width:inherit}
|
|
23
|
+
._p7r11txw >div{display:flex}
|
|
24
|
+
._slp31hna{word-wrap:break-word}
|
|
25
|
+
._t1edidpf >div{flex-shrink:0}
|
|
26
|
+
._u5f3idpf{padding-right:0}
|
|
27
|
+
._u5f3v47k{padding-right:var(--ds-space-250,20px)}
|
|
28
|
+
._u5f3v77o{padding-right:var(--ds-space-025,2px)}
|
|
29
|
+
._vchhusvi{box-sizing:border-box}
|
|
30
|
+
@media (max-width:490px){._xugcidpf{padding-right:0}}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/* Comment-compiled.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.CommentEditorWithIntlCompiled = void 0;
|
|
10
|
+
require("./Comment-compiled.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
|
+
var _reactIntl = require("react-intl");
|
|
17
|
+
var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group"));
|
|
18
|
+
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
19
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
20
|
+
var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
|
|
21
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
22
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
23
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
26
|
+
var _ClickAreaBlock = _interopRequireDefault(require("../../Addon/ClickAreaBlock"));
|
|
27
|
+
var _contentComponentWrapper = require("../../Addon/ClickAreaBlock/contentComponentWrapper");
|
|
28
|
+
var _EditorContentContainer = _interopRequireDefault(require("../../EditorContentContainer/EditorContentContainer"));
|
|
29
|
+
var _PluginSlot = _interopRequireDefault(require("../../PluginSlot"));
|
|
30
|
+
var _getPrimaryToolbarComponents = require("../../Toolbar/getPrimaryToolbarComponents");
|
|
31
|
+
var _ToolbarWithSizeDetector = require("../../Toolbar/ToolbarWithSizeDetector");
|
|
32
|
+
var _WithFlash = _interopRequireDefault(require("../../WithFlash"));
|
|
33
|
+
var _CommentToolbar = require("./CommentToolbar");
|
|
34
|
+
var _Toolbar = require("./Toolbar");
|
|
35
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
36
|
+
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; }
|
|
37
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
38
|
+
* Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
39
|
+
* Used via `componentWithCondition` in `Comment.tsx`.
|
|
40
|
+
*
|
|
41
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
42
|
+
*/ // Ignored via go/ees005
|
|
43
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
44
|
+
var commentEditorCompiledStyles = {
|
|
45
|
+
commentEditorOld: "_19itno8c _2rkofajl _1e0c1txw _2lx21bp4 _1ul9clpc _4t3i1wug _bfhk1j9a _vchhusvi _p12f1kw7 _slp31hna _13dfutpp _gzr8u2gc _ghozu2gc _oafwu2gc",
|
|
46
|
+
commentEditor: "_19itno8c _2rko1qi0 _1e0c1txw _2lx21bp4 _1ul9clpc _4t3i1wug _bfhk1j9a _vchhusvi _p12f1kw7 _slp31hna _13dfutpp _gzr8u2gc _ghozu2gc _oafwu2gc",
|
|
47
|
+
modernisedEditor: "_2rkopb1k",
|
|
48
|
+
secondaryToolbar: "_vchhusvi _1bahesu3 _4cvr1h6o _1e0c1txw _ca0qutpp _u5f3v77o _n3tdutpp _19bvv77o",
|
|
49
|
+
mainToolbarCustomComponentsSlotNew: "_1e0c1txw _1bahesu3 _4cvr1h6o _16jlkb7n _u5f3v47k _p7r11txw _t1edidpf",
|
|
50
|
+
mainToolbarCustomComponentsSlotPaddingOverride: "_u5f3idpf",
|
|
51
|
+
mainToolbarCustomComponentsSlotTwoLineToolbar: "_xugcidpf",
|
|
52
|
+
contentAreaMaxHeight: "_c71lmz22 _18m91wug"
|
|
53
|
+
};
|
|
54
|
+
var appearance = 'comment';
|
|
55
|
+
var CommentEditorWithIntlCompiled = exports.CommentEditorWithIntlCompiled = function CommentEditorWithIntlCompiled(props) {
|
|
56
|
+
var _editorAPI$blockMenu$, _editorAPI$blockMenu;
|
|
57
|
+
var editorAPI = props.editorAPI;
|
|
58
|
+
|
|
59
|
+
// Get useStandardNodeWidth from block menu plugin shared state
|
|
60
|
+
// Only access editorAPI when the experiment is enabled to avoid performance impact
|
|
61
|
+
var useStandardNodeWidth = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && ((_editorAPI$blockMenu$ = editorAPI === null || editorAPI === void 0 || (_editorAPI$blockMenu = editorAPI.blockMenu) === null || _editorAPI$blockMenu === void 0 || (_editorAPI$blockMenu = _editorAPI$blockMenu.sharedState) === null || _editorAPI$blockMenu === void 0 || (_editorAPI$blockMenu = _editorAPI$blockMenu.currentState()) === null || _editorAPI$blockMenu === void 0 ? void 0 : _editorAPI$blockMenu.useStandardNodeWidth) !== null && _editorAPI$blockMenu$ !== void 0 ? _editorAPI$blockMenu$ : false);
|
|
62
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(editorAPI, ['maxContentSize', 'primaryToolbar', 'editorViewMode'], function (states) {
|
|
63
|
+
var _states$maxContentSiz, _states$primaryToolba, _states$editorViewMod;
|
|
64
|
+
return {
|
|
65
|
+
maxContentSizeReached: !!((_states$maxContentSiz = states.maxContentSizeState) !== null && _states$maxContentSiz !== void 0 && _states$maxContentSiz.maxContentSizeReached),
|
|
66
|
+
primaryToolbarComponentsState: (_states$primaryToolba = states.primaryToolbarState) === null || _states$primaryToolba === void 0 ? void 0 : _states$primaryToolba.components,
|
|
67
|
+
editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
68
|
+
};
|
|
69
|
+
}),
|
|
70
|
+
editorViewMode = _useSharedPluginState.editorViewMode,
|
|
71
|
+
primaryToolbarComponentsState = _useSharedPluginState.primaryToolbarComponentsState,
|
|
72
|
+
maxContentSizeReached = _useSharedPluginState.maxContentSizeReached;
|
|
73
|
+
var primaryToolbarState = (0, _getPrimaryToolbarComponents.getPrimaryToolbarComponents)(editorAPI, primaryToolbarComponentsState);
|
|
74
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(editorAPI, ['media']),
|
|
75
|
+
mediaState = _useSharedPluginState2.mediaState;
|
|
76
|
+
var intl = (0, _reactIntl.useIntl)();
|
|
77
|
+
var editorDOMElement = props.editorDOMElement,
|
|
78
|
+
editorView = props.editorView,
|
|
79
|
+
editorActions = props.editorActions,
|
|
80
|
+
eventDispatcher = props.eventDispatcher,
|
|
81
|
+
providerFactory = props.providerFactory,
|
|
82
|
+
contentComponents = props.contentComponents,
|
|
83
|
+
customContentComponents = props.customContentComponents,
|
|
84
|
+
customPrimaryToolbarComponents = props.customPrimaryToolbarComponents,
|
|
85
|
+
primaryToolbarComponentsProp = props.primaryToolbarComponents,
|
|
86
|
+
customSecondaryToolbarComponents = props.customSecondaryToolbarComponents,
|
|
87
|
+
popupsMountPoint = props.popupsMountPoint,
|
|
88
|
+
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
89
|
+
popupsScrollableElement = props.popupsScrollableElement,
|
|
90
|
+
maxHeight = props.maxHeight,
|
|
91
|
+
_props$minHeight = props.minHeight,
|
|
92
|
+
minHeight = _props$minHeight === void 0 ? 150 : _props$minHeight,
|
|
93
|
+
onSave = props.onSave,
|
|
94
|
+
onCancel = props.onCancel,
|
|
95
|
+
disabled = props.disabled,
|
|
96
|
+
dispatchAnalyticsEvent = props.dispatchAnalyticsEvent,
|
|
97
|
+
useStickyToolbar = props.useStickyToolbar,
|
|
98
|
+
pluginHooks = props.pluginHooks,
|
|
99
|
+
featureFlags = props.featureFlags,
|
|
100
|
+
innerRef = props.innerRef,
|
|
101
|
+
isEditorModernisationEnabled = props.isEditorModernisationEnabled;
|
|
102
|
+
var showSecondaryToolbar = !!onSave || !!onCancel || !!customSecondaryToolbarComponents;
|
|
103
|
+
var containerElement = _react.default.useRef(null);
|
|
104
|
+
|
|
105
|
+
// Wrapper container for toolbar and content area
|
|
106
|
+
var wrapperElementRef = (0, _react.useMemo)(function () {
|
|
107
|
+
return innerRef || /*#__PURE__*/_react.default.createRef();
|
|
108
|
+
}, [innerRef]);
|
|
109
|
+
var _useState = (0, _react.useState)(false),
|
|
110
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
111
|
+
saveButtonDisabled = _useState2[0],
|
|
112
|
+
setSaveButtonDisabled = _useState2[1];
|
|
113
|
+
(0, _react.useEffect)(function () {
|
|
114
|
+
if (mediaState) {
|
|
115
|
+
mediaState.subscribeToUploadInProgressState(setSaveButtonDisabled);
|
|
116
|
+
}
|
|
117
|
+
return function () {
|
|
118
|
+
return mediaState === null || mediaState === void 0 ? void 0 : mediaState.unsubscribeFromUploadInProgressState(setSaveButtonDisabled);
|
|
119
|
+
};
|
|
120
|
+
}, [mediaState]);
|
|
121
|
+
var handleSave = (0, _react.useCallback)(function () {
|
|
122
|
+
if (editorView && onSave) {
|
|
123
|
+
onSave(editorView);
|
|
124
|
+
}
|
|
125
|
+
}, [editorView, onSave]);
|
|
126
|
+
var handleCancel = (0, _react.useCallback)(function () {
|
|
127
|
+
if (editorView && onCancel) {
|
|
128
|
+
onCancel(editorView);
|
|
129
|
+
}
|
|
130
|
+
}, [editorView, onCancel]);
|
|
131
|
+
var isShortcutToFocusToolbar = (0, _react.useCallback)(function (event) {
|
|
132
|
+
//Alt + F9 to reach first element in this main toolbar
|
|
133
|
+
return event.altKey && (event.key === 'F9' || event.keyCode === 120);
|
|
134
|
+
}, []);
|
|
135
|
+
|
|
136
|
+
// When primary toolbar components is undefined, do not show two line editor toolbar
|
|
137
|
+
var isTwoLineToolbarEnabled = !!customPrimaryToolbarComponents;
|
|
138
|
+
var handleEscape = (0, _react.useCallback)(function (event) {
|
|
139
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
|
|
140
|
+
editorView === null || editorView === void 0 || editorView.focus();
|
|
141
|
+
}
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
event.stopPropagation();
|
|
144
|
+
}, [editorView]);
|
|
145
|
+
var primaryToolbarComponents = primaryToolbarComponentsProp;
|
|
146
|
+
if (Array.isArray(primaryToolbarState === null || primaryToolbarState === void 0 ? void 0 : primaryToolbarState.components) && Array.isArray(primaryToolbarComponents)) {
|
|
147
|
+
primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
|
|
148
|
+
}
|
|
149
|
+
var isToolbarAIFCEnabled = Boolean(editorAPI === null || editorAPI === void 0 ? void 0 : editorAPI.toolbar);
|
|
150
|
+
var wrapperStyle = (0, _react.useMemo)(function () {
|
|
151
|
+
return _objectSpread({
|
|
152
|
+
minHeight: "".concat(minHeight, "px")
|
|
153
|
+
}, maxHeight ? {
|
|
154
|
+
'--comment-editor-max-height': "".concat(maxHeight, "px")
|
|
155
|
+
} : {});
|
|
156
|
+
}, [minHeight, maxHeight]);
|
|
157
|
+
var customToolbarSlot = /*#__PURE__*/_react.default.createElement("div", {
|
|
158
|
+
className: (0, _runtime.ax)([commentEditorCompiledStyles.mainToolbarCustomComponentsSlotNew, isTwoLineToolbarEnabled && commentEditorCompiledStyles.mainToolbarCustomComponentsSlotTwoLineToolbar, isToolbarAIFCEnabled && commentEditorCompiledStyles.mainToolbarCustomComponentsSlotPaddingOverride])
|
|
159
|
+
}, customPrimaryToolbarComponents);
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_WithFlash.default, {
|
|
161
|
+
animate: maxContentSizeReached
|
|
162
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.WidthProvider, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
163
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- dynamic minHeight/maxHeight from props
|
|
164
|
+
style: wrapperStyle
|
|
165
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
166
|
+
,
|
|
167
|
+
className: (0, _runtime.ax)([(0, _expValEquals.expValEquals)('platform_editor_comment_editor_border_radius', 'isEnabled', true) ? commentEditorCompiledStyles.commentEditor : commentEditorCompiledStyles.commentEditorOld, isEditorModernisationEnabled && commentEditorCompiledStyles.modernisedEditor, "akEditor"]),
|
|
168
|
+
ref: wrapperElementRef
|
|
169
|
+
}, /*#__PURE__*/_react.default.createElement(_Toolbar.MainToolbar, {
|
|
170
|
+
isEditorModernisationEnabled: isEditorModernisationEnabled,
|
|
171
|
+
useStickyToolbar: useStickyToolbar,
|
|
172
|
+
twoLineEditorToolbar: isTwoLineToolbarEnabled,
|
|
173
|
+
isNewToolbarEnabled: isToolbarAIFCEnabled
|
|
174
|
+
}, isToolbarAIFCEnabled ? /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarArrowKeyNavigationProvider, {
|
|
175
|
+
editorView: editorView,
|
|
176
|
+
childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
|
|
177
|
+
isShortcutToFocusToolbar: isShortcutToFocusToolbar,
|
|
178
|
+
handleEscape: handleEscape,
|
|
179
|
+
editorAppearance: appearance,
|
|
180
|
+
useStickyToolbar: useStickyToolbar,
|
|
181
|
+
intl: intl
|
|
182
|
+
}, /*#__PURE__*/_react.default.createElement(_CommentToolbar.CommentToolbar, {
|
|
183
|
+
editorAPI: editorAPI,
|
|
184
|
+
editorView: editorView,
|
|
185
|
+
editorAppearance: appearance,
|
|
186
|
+
disabled: !!disabled,
|
|
187
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
188
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
189
|
+
popupsMountPoint: popupsMountPoint
|
|
190
|
+
}), customPrimaryToolbarComponents ? customToolbarSlot : null) : /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarArrowKeyNavigationProvider, {
|
|
191
|
+
editorView: editorView,
|
|
192
|
+
childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
|
|
193
|
+
isShortcutToFocusToolbar: isShortcutToFocusToolbar,
|
|
194
|
+
handleEscape: handleEscape,
|
|
195
|
+
editorAppearance: appearance,
|
|
196
|
+
useStickyToolbar: useStickyToolbar,
|
|
197
|
+
intl: intl
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement(_ToolbarWithSizeDetector.ToolbarWithSizeDetector
|
|
199
|
+
// Ignored via go/ees005
|
|
200
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
201
|
+
, {
|
|
202
|
+
editorView: editorView,
|
|
203
|
+
editorActions: editorActions
|
|
204
|
+
// Ignored via go/ees005
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
206
|
+
,
|
|
207
|
+
eventDispatcher: eventDispatcher
|
|
208
|
+
// Ignored via go/ees005
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
210
|
+
,
|
|
211
|
+
providerFactory: providerFactory,
|
|
212
|
+
appearance: appearance,
|
|
213
|
+
items: primaryToolbarComponents,
|
|
214
|
+
popupsMountPoint: popupsMountPoint,
|
|
215
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
216
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
217
|
+
disabled: !!disabled,
|
|
218
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
219
|
+
containerElement: containerElement.current,
|
|
220
|
+
twoLineEditorToolbar: isTwoLineToolbarEnabled
|
|
221
|
+
}), customToolbarSlot)), /*#__PURE__*/_react.default.createElement(_ClickAreaBlock.default, {
|
|
222
|
+
editorView: editorView,
|
|
223
|
+
editorDisabled: disabled
|
|
224
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.WidthConsumer, null, function (_ref) {
|
|
225
|
+
var width = _ref.width;
|
|
226
|
+
return /*#__PURE__*/_react.default.createElement(_EditorContentContainer.default, {
|
|
227
|
+
ref: containerElement,
|
|
228
|
+
isScrollable: maxHeight ? true : undefined
|
|
229
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
230
|
+
,
|
|
231
|
+
className: (0, _runtime.ax)([maxHeight && commentEditorCompiledStyles.contentAreaMaxHeight, (0, _classnames.default)('ak-editor-content-area', {
|
|
232
|
+
'less-margin': width < _editorSharedStyles.akEditorMobileBreakoutPoint
|
|
233
|
+
})]),
|
|
234
|
+
featureFlags: featureFlags,
|
|
235
|
+
viewMode: editorViewMode,
|
|
236
|
+
appearance: appearance,
|
|
237
|
+
useStandardNodeWidth: useStandardNodeWidth
|
|
238
|
+
}, customContentComponents && 'before' in customContentComponents ? (0, _contentComponentWrapper.contentComponentClickWrapper)(customContentComponents.before) : (0, _contentComponentWrapper.contentComponentClickWrapper)(customContentComponents), /*#__PURE__*/_react.default.createElement(_PluginSlot.default, {
|
|
239
|
+
editorView: editorView,
|
|
240
|
+
editorActions: editorActions,
|
|
241
|
+
eventDispatcher: eventDispatcher,
|
|
242
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
243
|
+
providerFactory: providerFactory,
|
|
244
|
+
appearance: appearance,
|
|
245
|
+
items: contentComponents,
|
|
246
|
+
popupsMountPoint: popupsMountPoint,
|
|
247
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
248
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
249
|
+
containerElement: containerElement.current,
|
|
250
|
+
disabled: !!disabled,
|
|
251
|
+
wrapperElement: wrapperElementRef.current,
|
|
252
|
+
pluginHooks: pluginHooks
|
|
253
|
+
}), editorDOMElement, customContentComponents && 'after' in customContentComponents ? (0, _contentComponentWrapper.contentComponentClickWrapper)(customContentComponents.after) : null);
|
|
254
|
+
}))), showSecondaryToolbar && /*#__PURE__*/_react.default.createElement("div", {
|
|
255
|
+
"data-testid": "ak-editor-secondary-toolbar",
|
|
256
|
+
className: (0, _runtime.ax)([commentEditorCompiledStyles.secondaryToolbar])
|
|
257
|
+
}, /*#__PURE__*/_react.default.createElement(_buttonGroup.default, null, !!onSave && /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
258
|
+
appearance: "primary",
|
|
259
|
+
onClick: handleSave,
|
|
260
|
+
testId: "comment-save-button",
|
|
261
|
+
isDisabled: disabled || saveButtonDisabled,
|
|
262
|
+
interactionName: "editor-comment-save-button"
|
|
263
|
+
}, intl.formatMessage(_messages.default.saveButton)), !!onCancel && /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
264
|
+
appearance: "subtle",
|
|
265
|
+
onClick: handleCancel,
|
|
266
|
+
testId: "comment-cancel-button",
|
|
267
|
+
isDisabled: disabled,
|
|
268
|
+
interactionName: "editor-comment-cancel-button"
|
|
269
|
+
}, intl.formatMessage(_messages.default.cancelButton))), /*#__PURE__*/_react.default.createElement("span", {
|
|
270
|
+
style: {
|
|
271
|
+
flexGrow: 1
|
|
272
|
+
}
|
|
273
|
+
}), customSecondaryToolbarComponents)));
|
|
274
|
+
};
|
|
275
|
+
CommentEditorWithIntlCompiled.displayName = 'CommentEditorAppearance';
|