@atlaskit/editor-core 238.0.3 → 238.0.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 +9 -0
- package/dist/cjs/create-editor/ReactEditorView.js +50 -193
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.compiled.css +1 -26
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +5 -27
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +29 -152
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.compiled.css +1 -26
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +5 -27
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +49 -192
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.compiled.css +1 -26
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +5 -27
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 238.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`31dd8d40ffba2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/31dd8d40ffba2) -
|
|
8
|
+
Cleanup `experiment` `cc-markdown-mode`. Markdown mode is unshipped: the markdown schema rebuild,
|
|
9
|
+
source-view toolbar bridge, and markdown-mode layout paths are removed.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 238.0.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.ReactEditorView = ReactEditorView;
|
|
9
9
|
exports.default = void 0;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _reactIntl = require("react-intl");
|
|
@@ -33,7 +33,6 @@ var _useConstructor = _interopRequireDefault(require("@atlaskit/editor-common/us
|
|
|
33
33
|
var _usePreviousState = _interopRequireDefault(require("@atlaskit/editor-common/usePreviousState"));
|
|
34
34
|
var _analytics = require("@atlaskit/editor-common/utils/analytics");
|
|
35
35
|
var _document = require("@atlaskit/editor-common/utils/document");
|
|
36
|
-
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
37
36
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
38
37
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
39
38
|
var _createSsrEditorState = require("@atlaskit/editor-ssr-renderer/create-ssr-editor-state");
|
|
@@ -44,7 +43,6 @@ var _addUfoCustomData = require("@atlaskit/react-ufo/add-ufo-custom-data");
|
|
|
44
43
|
var _getInteractionId = require("@atlaskit/react-ufo/get-interaction-id");
|
|
45
44
|
var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
|
|
46
45
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
47
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
48
46
|
var _useProviders = require("../composable-editor/hooks/useProviders");
|
|
49
47
|
var _featureFlagsFromProps = require("../utils/feature-flags-from-props");
|
|
50
48
|
var _getEditorDomSize = require("../utils/getEditorDomSize");
|
|
@@ -67,45 +65,14 @@ var _handleEditorFocus = require("./ReactEditorView/handleEditorFocus");
|
|
|
67
65
|
var _useDispatchTransaction = require("./ReactEditorView/useDispatchTransaction");
|
|
68
66
|
var _useFireFullWidthEvent = require("./ReactEditorView/useFireFullWidthEvent");
|
|
69
67
|
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); }
|
|
70
|
-
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; }
|
|
71
|
-
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; }
|
|
72
68
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
73
69
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
74
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
70
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
71
|
+
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; }
|
|
72
|
+
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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
75
73
|
var EDIT_AREA_ID = 'ak-editor-textarea';
|
|
76
74
|
var SSR_TRACE_SEGMENT_NAME = 'reactEditorView';
|
|
77
75
|
var bootStartTime = (0, _isPerformanceApiAvailable.isPerformanceAPIAvailable)() ? performance.now() : undefined;
|
|
78
|
-
// `markdown↔rich` toggles drop different node/mark sets, so the unique
|
|
79
|
-
// name set is enough to detect when a destructive rebuild is needed.
|
|
80
|
-
function sameNames(a, b) {
|
|
81
|
-
var setA = new Set(a);
|
|
82
|
-
var setB = new Set(b);
|
|
83
|
-
if (setA.size !== setB.size) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
var _iterator = _createForOfIteratorHelper(setA),
|
|
87
|
-
_step;
|
|
88
|
-
try {
|
|
89
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
90
|
-
var name = _step.value;
|
|
91
|
-
if (!setB.has(name)) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
} catch (err) {
|
|
96
|
-
_iterator.e(err);
|
|
97
|
-
} finally {
|
|
98
|
-
_iterator.f();
|
|
99
|
-
}
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
function schemaShapeChanged(current, next) {
|
|
103
|
-
return !sameNames(Object.keys(current.nodes), next.nodes.map(function (n) {
|
|
104
|
-
return n.name;
|
|
105
|
-
})) || !sameNames(Object.keys(current.marks), next.marks.map(function (m) {
|
|
106
|
-
return m.name;
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
76
|
function ReactEditorView(props) {
|
|
110
77
|
var _pluginInjectionAPI$c, _media, _linking, _document$querySelect, _props$render, _props$render2;
|
|
111
78
|
// Should be always the first statement in the component
|
|
@@ -413,15 +380,8 @@ function ReactEditorView(props) {
|
|
|
413
380
|
};
|
|
414
381
|
}, [eventDispatcher]);
|
|
415
382
|
|
|
416
|
-
// Bumped after `reconfigureState` so the render prop re-reads the
|
|
417
|
-
// in-place-mutated `config.current` (contentComponents / toolbar
|
|
418
|
-
// components from the rebuilt preset).
|
|
419
|
-
var _useState = (0, _react.useState)(0),
|
|
420
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
421
|
-
bumpConfigVersion = _useState2[1];
|
|
422
|
-
|
|
423
383
|
// Preset reference last processed by reconfigureState. Used to skip the
|
|
424
|
-
// destructive
|
|
384
|
+
// destructive plugin filter when reconfigure is
|
|
425
385
|
// called with the same preset.
|
|
426
386
|
var lastProcessedPresetRef = (0, _react.useRef)(null);
|
|
427
387
|
var reconfigureState = (0, _react.useCallback)(function (props) {
|
|
@@ -440,15 +400,10 @@ function ReactEditorView(props) {
|
|
|
440
400
|
var previousPluginNames = new Set(pluginInjectionAPI.current.getRegisteredPluginNames());
|
|
441
401
|
var editorPlugins = (0, _createPluginsList.default)(props.preset, 'allowBlockType' in props.editorProps ? props.editorProps : {}, pluginInjectionAPI.current);
|
|
442
402
|
|
|
443
|
-
// Capture once, before
|
|
444
|
-
//
|
|
445
|
-
//
|
|
403
|
+
// Capture once, before the downstream block updates the ref — the
|
|
404
|
+
// filter is destructive and only wants to run when the preset has
|
|
405
|
+
// actually changed.
|
|
446
406
|
var presetChanged = lastProcessedPresetRef.current !== props.preset;
|
|
447
|
-
|
|
448
|
-
// Build a candidate config from the *unfiltered* plugin list so we can
|
|
449
|
-
// decide whether the schema rebuild path will run. Both the rebuild
|
|
450
|
-
// decision and the drop-filter decision below depend on this answer,
|
|
451
|
-
// so it has to be computed up-front.
|
|
452
407
|
var buildConfig = function buildConfig(plugins) {
|
|
453
408
|
var _c$pmPlugins;
|
|
454
409
|
var c = (0, _createEditor.processPluginsList)(plugins);
|
|
@@ -457,16 +412,6 @@ function ReactEditorView(props) {
|
|
|
457
412
|
};
|
|
458
413
|
var nextConfig = buildConfig(editorPlugins);
|
|
459
414
|
|
|
460
|
-
// `state.reconfigure` preserves the original schema, so a preset
|
|
461
|
-
// toggle that should change schema (markdown↔rich) needs a fresh
|
|
462
|
-
// `EditorState`. Resets all plugin state including undo history.
|
|
463
|
-
//
|
|
464
|
-
// Compare schema *shape* (node + mark name sets) rather than preset
|
|
465
|
-
// identity: consumers commonly recreate the preset object on every
|
|
466
|
-
// parent re-render, and a destructive rebuild on a no-op identity
|
|
467
|
-
// change tears down all plugin state (e.g. unmounts the AI palette).
|
|
468
|
-
var shouldRebuildSchema = presetChanged && schemaShapeChanged(viewRef.current.state.schema, nextConfig) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc-markdown-mode', 'isEnabled', true);
|
|
469
|
-
|
|
470
415
|
// `state.reconfigure` keeps the original schema, so switching presets
|
|
471
416
|
// can leave the editor inconsistent in two ways:
|
|
472
417
|
// 1. The new preset may add plugins that reference schema nodes or
|
|
@@ -475,25 +420,14 @@ function ReactEditorView(props) {
|
|
|
475
420
|
// injection API even when the new preset doesn't re-register
|
|
476
421
|
// them, so listeners still fire against a state that no longer
|
|
477
422
|
// has their pmPlugin.
|
|
478
|
-
//
|
|
479
|
-
// When the schema is being rebuilt below, the new schema is built
|
|
480
|
-
// from the *unfiltered* plugin list — so dropping plugins whose
|
|
481
|
-
// nodes/marks the OLD schema lacks would wrongly remove the very
|
|
482
|
-
// plugins the rebuild is meant to admit. Skip the drop step in that
|
|
483
|
-
// case (purpose 1) but always reconcile the injection API
|
|
484
|
-
// (purpose 2). When NOT rebuilding, run both — even under the
|
|
485
|
-
// `cc-markdown-mode` experiment, otherwise no-op preset identity
|
|
486
|
-
// changes would silently leave a broken plugin/schema mismatch.
|
|
487
423
|
if (presetChanged) {
|
|
488
|
-
var
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
dropped = _result.dropped;
|
|
424
|
+
var _filterPluginsForReco = (0, _filterPluginsForReconfigure.filterPluginsForReconfigure)(editorPlugins, viewRef.current.state.schema, previousPluginNames),
|
|
425
|
+
dropped = _filterPluginsForReco.dropped,
|
|
426
|
+
kept = _filterPluginsForReco.kept;
|
|
427
|
+
if (dropped.length > 0) {
|
|
428
|
+
editorPlugins = kept;
|
|
429
|
+
// Plugin list changed — rebuild candidate config to match.
|
|
430
|
+
nextConfig = buildConfig(editorPlugins);
|
|
497
431
|
}
|
|
498
432
|
var keptPluginNames = new Set(editorPlugins.map(function (p) {
|
|
499
433
|
return p === null || p === void 0 ? void 0 : p.name;
|
|
@@ -511,71 +445,25 @@ function ReactEditorView(props) {
|
|
|
511
445
|
}
|
|
512
446
|
config.current = nextConfig;
|
|
513
447
|
var state = viewRef.current.state;
|
|
514
|
-
var
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
// Old selection's positions / node types may not map onto the new schema.
|
|
534
|
-
newSelection = _state2.Selection.atStart(newDoc);
|
|
535
|
-
}
|
|
536
|
-
var plugins = (0, _createPMPlugins.createPMPlugins)({
|
|
537
|
-
schema: newSchema,
|
|
538
|
-
dispatch: dispatch,
|
|
539
|
-
errorReporter: errorReporter,
|
|
540
|
-
editorConfig: config.current,
|
|
541
|
-
eventDispatcher: eventDispatcher,
|
|
542
|
-
providerFactory: props.providerFactory,
|
|
543
|
-
portalProviderAPI: props.portalProviderAPI,
|
|
544
|
-
nodeViewPortalProviderAPI: props.nodeViewPortalProviderAPI,
|
|
545
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
546
|
-
featureFlags: featureFlags,
|
|
547
|
-
getIntl: function getIntl() {
|
|
548
|
-
return props.intl;
|
|
549
|
-
},
|
|
550
|
-
onEditorStateUpdated: pluginInjectionAPI.current.onEditorViewUpdated
|
|
551
|
-
});
|
|
552
|
-
newState = _state2.EditorState.create({
|
|
553
|
-
schema: newSchema,
|
|
554
|
-
doc: newDoc,
|
|
555
|
-
selection: newSelection,
|
|
556
|
-
plugins: plugins
|
|
557
|
-
});
|
|
558
|
-
} else {
|
|
559
|
-
var _plugins = (0, _createPMPlugins.createPMPlugins)({
|
|
560
|
-
schema: state.schema,
|
|
561
|
-
dispatch: dispatch,
|
|
562
|
-
errorReporter: errorReporter,
|
|
563
|
-
editorConfig: config.current,
|
|
564
|
-
eventDispatcher: eventDispatcher,
|
|
565
|
-
providerFactory: props.providerFactory,
|
|
566
|
-
portalProviderAPI: props.portalProviderAPI,
|
|
567
|
-
nodeViewPortalProviderAPI: props.nodeViewPortalProviderAPI,
|
|
568
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
569
|
-
featureFlags: featureFlags,
|
|
570
|
-
getIntl: function getIntl() {
|
|
571
|
-
return props.intl;
|
|
572
|
-
},
|
|
573
|
-
onEditorStateUpdated: pluginInjectionAPI.current.onEditorViewUpdated
|
|
574
|
-
});
|
|
575
|
-
newState = state.reconfigure({
|
|
576
|
-
plugins: _plugins
|
|
577
|
-
});
|
|
578
|
-
}
|
|
448
|
+
var plugins = (0, _createPMPlugins.createPMPlugins)({
|
|
449
|
+
schema: state.schema,
|
|
450
|
+
dispatch: dispatch,
|
|
451
|
+
errorReporter: errorReporter,
|
|
452
|
+
editorConfig: config.current,
|
|
453
|
+
eventDispatcher: eventDispatcher,
|
|
454
|
+
providerFactory: props.providerFactory,
|
|
455
|
+
portalProviderAPI: props.portalProviderAPI,
|
|
456
|
+
nodeViewPortalProviderAPI: props.nodeViewPortalProviderAPI,
|
|
457
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
458
|
+
featureFlags: featureFlags,
|
|
459
|
+
getIntl: function getIntl() {
|
|
460
|
+
return props.intl;
|
|
461
|
+
},
|
|
462
|
+
onEditorStateUpdated: pluginInjectionAPI.current.onEditorViewUpdated
|
|
463
|
+
});
|
|
464
|
+
var newState = state.reconfigure({
|
|
465
|
+
plugins: plugins
|
|
466
|
+
});
|
|
579
467
|
if (presetChanged) {
|
|
580
468
|
lastProcessedPresetRef.current = props.preset;
|
|
581
469
|
}
|
|
@@ -586,37 +474,6 @@ function ReactEditorView(props) {
|
|
|
586
474
|
var result = viewRef.current.update(_objectSpread(_objectSpread({}, viewRef.current.props), {}, {
|
|
587
475
|
state: newState
|
|
588
476
|
}));
|
|
589
|
-
|
|
590
|
-
// The new collab-edit plugin instance starts with `isReady=false`.
|
|
591
|
-
// The rebind path in editor-plugin-collab-edit's initialize.ts is
|
|
592
|
-
// gated on `provider.getInitPayload`, which the Confluence NCS
|
|
593
|
-
// provider does not implement, so the placeholder spinner would
|
|
594
|
-
// never clear. Re-seeding here is safe: the prior state must have
|
|
595
|
-
// had `isReady=true` for the user to have triggered the toggle.
|
|
596
|
-
//
|
|
597
|
-
// Must run AFTER `view.update({ state: newState })`: that call resets
|
|
598
|
-
// the view's state to the captured `newState` reference, so a
|
|
599
|
-
// dispatch placed before it would advance `view.state` to a value
|
|
600
|
-
// that `update` then silently overwrites — discarding the meta and
|
|
601
|
-
// leaving `isReady=false`.
|
|
602
|
-
if (shouldRebuildSchema) {
|
|
603
|
-
// `state.collabEditPlugin$` is the property PM derives from the
|
|
604
|
-
// collab plugin's PluginKey; cast through `unknown` to read it.
|
|
605
|
-
var collabState = viewRef.current.state.collabEditPlugin$;
|
|
606
|
-
if (collabState && collabState.isReady !== true) {
|
|
607
|
-
viewRef.current.dispatch(viewRef.current.state.tr.setMeta('collabInitialised', true));
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// EDITOR-6702: gated until we have a broader gate; reconfigure is a
|
|
612
|
-
// low-level path so use NoExposure.
|
|
613
|
-
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc-markdown-mode', 'isEnabled', true)) {
|
|
614
|
-
// Force a render so PluginSlot picks up the new preset's content
|
|
615
|
-
// components against the new state.
|
|
616
|
-
bumpConfigVersion(function (v) {
|
|
617
|
-
return v + 1;
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
477
|
return result;
|
|
621
478
|
}, [blur, dispatchAnalyticsEvent, eventDispatcher, dispatch, errorReporter, featureFlags]);
|
|
622
479
|
var onEditorViewUpdated = (0, _react.useCallback)(function (_ref2) {
|
|
@@ -785,10 +642,10 @@ function ReactEditorView(props) {
|
|
|
785
642
|
});
|
|
786
643
|
return view;
|
|
787
644
|
}, [getDirectEditorProps, dispatchAnalyticsEvent]);
|
|
788
|
-
var
|
|
789
|
-
|
|
790
|
-
editorView =
|
|
791
|
-
setEditorView =
|
|
645
|
+
var _useState = (0, _react.useState)(undefined),
|
|
646
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
647
|
+
editorView = _useState2[0],
|
|
648
|
+
setEditorView = _useState2[1];
|
|
792
649
|
|
|
793
650
|
// Detects if the editor is nested inside an extension - ie. it is a Legacy Content Extension (LCE)
|
|
794
651
|
var isNestedEditor = (0, _react.useRef)(null);
|
|
@@ -837,19 +694,19 @@ function ReactEditorView(props) {
|
|
|
837
694
|
return function () {
|
|
838
695
|
if (scrollElement.current) {
|
|
839
696
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
840
|
-
var
|
|
841
|
-
|
|
697
|
+
var _iterator = _createForOfIteratorHelper(possibleListeners.current),
|
|
698
|
+
_step;
|
|
842
699
|
try {
|
|
843
|
-
for (
|
|
700
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
844
701
|
var _scrollElement$curren;
|
|
845
|
-
var possibleListener =
|
|
702
|
+
var possibleListener = _step.value;
|
|
846
703
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
847
704
|
(_scrollElement$curren = scrollElement.current) === null || _scrollElement$curren === void 0 || _scrollElement$curren.removeEventListener.apply(_scrollElement$curren, (0, _toConsumableArray2.default)(possibleListener));
|
|
848
705
|
}
|
|
849
706
|
} catch (err) {
|
|
850
|
-
|
|
707
|
+
_iterator.e(err);
|
|
851
708
|
} finally {
|
|
852
|
-
|
|
709
|
+
_iterator.f();
|
|
853
710
|
}
|
|
854
711
|
}
|
|
855
712
|
scrollElement.current = null;
|
|
@@ -861,19 +718,19 @@ function ReactEditorView(props) {
|
|
|
861
718
|
scrollElement.current = document.querySelector('[data-editor-scroll-container]');
|
|
862
719
|
var cleanupListeners = function cleanupListeners() {
|
|
863
720
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
864
|
-
var
|
|
865
|
-
|
|
721
|
+
var _iterator2 = _createForOfIteratorHelper(possibleListeners.current),
|
|
722
|
+
_step2;
|
|
866
723
|
try {
|
|
867
|
-
for (
|
|
724
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
868
725
|
var _scrollElement$curren2;
|
|
869
|
-
var possibleListener =
|
|
726
|
+
var possibleListener = _step2.value;
|
|
870
727
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
871
728
|
(_scrollElement$curren2 = scrollElement.current) === null || _scrollElement$curren2 === void 0 || _scrollElement$curren2.removeEventListener.apply(_scrollElement$curren2, (0, _toConsumableArray2.default)(possibleListener));
|
|
872
729
|
}
|
|
873
730
|
} catch (err) {
|
|
874
|
-
|
|
731
|
+
_iterator2.e(err);
|
|
875
732
|
} finally {
|
|
876
|
-
|
|
733
|
+
_iterator2.f();
|
|
877
734
|
}
|
|
878
735
|
};
|
|
879
736
|
if (scrollElement.current) {
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
._v5641fxv{transition:max-width .5s cubic-bezier(.15,1,.3,1)}
|
|
2
|
-
._v5642kub{transition:padding 0ms cubic-bezier(.15,1,.3,1)}.
|
|
3
|
-
._11bl1txw >.ak-editor-content-area>[data-testid=plugins-components-wrapper]{display:flex}
|
|
4
|
-
._12glglyw[data-markdown-mode-hide-prosemirror=true]>.ak-editor-content-area>.ProseMirror{display:none}
|
|
5
|
-
._13jk1txw >.ak-editor-content-area{display:flex}
|
|
6
|
-
._13svglyw .ProseMirror>ol:not([data-node-type=actionList]):not([data-node-type=decisionList]){clear:none}
|
|
7
|
-
._13t61wug >.ak-editor-content-area>[data-testid=plugins-components-wrapper]{flex-basis:auto}
|
|
8
|
-
._1593idpf >.ak-editor-content-area>[data-testid=plugins-components-wrapper]{min-height:0}
|
|
2
|
+
._v5642kub{transition:padding 0ms cubic-bezier(.15,1,.3,1)}._13svglyw .ProseMirror>ol:not([data-node-type=actionList]):not([data-node-type=decisionList]){clear:none}
|
|
9
3
|
._16jlkb7n{flex-grow:1}
|
|
10
4
|
._17q71osq .fabric-editor--full-width-mode .extension-container.inline{max-width:100%}
|
|
11
5
|
._18q6usvi .ProseMirror{box-sizing:border-box}
|
|
@@ -16,26 +10,18 @@
|
|
|
16
10
|
._19bvt9kd{padding-left:72px}
|
|
17
11
|
._19pk1wug{margin-top:auto}
|
|
18
12
|
._19pkidpf{margin-top:0}
|
|
19
|
-
._1a1d1osq >.ak-editor-content-area{height:100%}
|
|
20
13
|
._1b7c1kw7 .fabric-editor--full-width-mode td .extension-container.inline{max-width:inherit}
|
|
21
14
|
._1bsb1osq{width:100%}
|
|
22
15
|
._1e0c1txw{display:flex}
|
|
23
|
-
._1e0cglyw{display:none}
|
|
24
|
-
._1e8kkb7n >.ak-editor-content-area>[data-testid=plugins-components-wrapper]{flex-grow:1}
|
|
25
16
|
._1f38dez1{container-name:editor-area}
|
|
26
17
|
._1gl01ejb .ProseMirror>p:last-child{margin-bottom:var(--ds-space-300,24px)}
|
|
27
18
|
._1k8i1osq .ProseMirror .pm-table-wrapper>table{width:100%}
|
|
28
|
-
._1n5qidpf >.ak-editor-content-area{padding-left:0}
|
|
29
19
|
._1nw4glyw .ProseMirror>h1{clear:none}
|
|
30
20
|
._1qzyglyw .ProseMirror>h3{clear:none}
|
|
31
21
|
._1rnyglyw .ProseMirror>h5{clear:none}
|
|
32
22
|
._1tb2idpf .ProseMirror .pm-table-wrapper>table{margin-left:0}
|
|
33
|
-
._1ul9idpf{min-width:0}
|
|
34
|
-
._1vbxidpf >.ak-editor-content-area{min-height:0}
|
|
35
23
|
._1wpzesu3{align-self:flex-end}
|
|
36
|
-
._1wrrusvi >.ak-editor-content-area{box-sizing:border-box}
|
|
37
24
|
._1wxymslj .fabric-editor--full-width-mode .extension-container{max-width:calc(100% - 4px)}
|
|
38
|
-
._1xouidpf >.ak-editor-content-area{min-width:0}
|
|
39
25
|
._2hwx1wug{margin-right:auto}
|
|
40
26
|
._2hwxidpf{margin-right:0}
|
|
41
27
|
._2lx21bp4{flex-direction:column}
|
|
@@ -43,24 +29,16 @@
|
|
|
43
29
|
._4t3i1ap5{height:calc(100% - 105px)}
|
|
44
30
|
._4t3i1osq{height:100%}
|
|
45
31
|
._4t3ibhu0{height:calc(100% - var(--ak-editor-fullpage-toolbar-height))}
|
|
46
|
-
._4tbp1osq >.ak-editor-content-area{width:100%}
|
|
47
|
-
._71ybidpf >.ak-editor-content-area{padding-right:0}
|
|
48
32
|
._7cca15wb{container-type:inline-size}
|
|
49
33
|
._7uc0glyw .ProseMirror>ul{clear:none}
|
|
50
34
|
._8j6w1lxk.ak-editor-content-area-no-toolbar{height:calc(100% + 1px)}
|
|
51
35
|
._8vye1n1a .ProseMirror .pm-table-wrapper>table{margin-right:-1px}
|
|
52
36
|
._9dtbmslj .fabric-editor--full-width-mode .multiBodiedExtension--container{max-width:calc(100% - 4px)}
|
|
53
|
-
._amwgglyw[data-markdown-mode-hide-scroll-gutter=true]>.ak-editor-content-area>[data-vc=scroll-gutter]{display:none}
|
|
54
|
-
._bfhkhfxm{background-color:var(--ds-surface-sunken,#f8f8f8)}
|
|
55
|
-
._boivkb7n >.ak-editor-content-area>[data-testid=plugins-components-wrapper]{flex-shrink:1}
|
|
56
37
|
._ca0qidpf{padding-top:0}
|
|
57
38
|
._ca0qoahv{padding-top:var(--ds-space-600,3pc)}
|
|
58
|
-
._evz0idpf >.ak-editor-content-area{padding-bottom:0}
|
|
59
|
-
._fh67idpf >.ak-editor-content-area{padding-top:0}
|
|
60
39
|
._i92uagmp .fabric-editor--full-width-mode:not(:has(#chromeless-editor)) .fabric-editor-breakout-mark{transform:none!important}
|
|
61
40
|
._j9k7kb7n .ProseMirror{flex-grow:1}
|
|
62
41
|
._l4a11hrf .ProseMirror>*{clear:both}
|
|
63
|
-
._li931osq >.ak-editor-content-area>[data-testid=plugins-components-wrapper]{width:100%}
|
|
64
42
|
._n3tdidpf{padding-bottom:0}
|
|
65
43
|
._n3tdoahv{padding-bottom:var(--ds-space-600,3pc)}
|
|
66
44
|
._njlp131u{contain:layout style inline-size}
|
|
@@ -69,10 +47,7 @@
|
|
|
69
47
|
._otyr1wug{margin-bottom:auto}
|
|
70
48
|
._otyridpf{margin-bottom:0}
|
|
71
49
|
._p12f5kin{max-width:var(--ak-editor-content-area-max-width)}
|
|
72
|
-
._p12fglyw{max-width:none}
|
|
73
50
|
._pnffaq80 .fabric-editor--full-width-mode:not(:has(#chromeless-editor)) .fabric-editor-breakout-mark{width:100%!important}
|
|
74
|
-
._q0l01bp4 >.ak-editor-content-area{flex-direction:column}
|
|
75
|
-
._qgzyidpf >.ak-editor-content-area>[data-testid=plugins-components-wrapper]{min-width:0}
|
|
76
51
|
._qkfz261p .fabric-editor--full-width-mode:not(:has(#chromeless-editor)) .fabric-editor-breakout-mark{margin-left:unset!important}
|
|
77
52
|
._t2fzglyw .ProseMirror>p{clear:none}
|
|
78
53
|
._tynl4diq .fabric-editor--full-width-mode [data-layout-section]{max-width:calc(100% + 40px)}
|
|
@@ -13,10 +13,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _reactIntl = require("react-intl");
|
|
15
15
|
var _fullPage = require("@atlaskit/editor-common/messages/full-page");
|
|
16
|
-
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
17
16
|
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
18
17
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
19
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
20
18
|
var _ClickAreaBlock = require("../../Addon/ClickAreaBlock");
|
|
21
19
|
var _contentComponentWrapper = require("../../Addon/ClickAreaBlock/contentComponentWrapper");
|
|
22
20
|
var _ContextPanel = require("../../ContextPanel");
|
|
@@ -48,9 +46,6 @@ var compiledStyles = {
|
|
|
48
46
|
contentAreaWrapper: "_1bsb1osq _7cca15wb _1f38dez1 _njlp131u",
|
|
49
47
|
sidebarArea: "_4t3i1osq _vchhusvi _1wpzesu3 _1hgw1wug _1t1q1if8 _uj9widpf _13hh1y6m",
|
|
50
48
|
editorContentAreaProsemirrorStyle: "_j9k7kb7n _18q6usvi _l4a11hrf _1nw4glyw _yq1qglyw _1qzyglyw _ongaglyw _1rnyglyw _vtulglyw _13svglyw _t2fzglyw _7uc0glyw _1gl01ejb",
|
|
51
|
-
hideEditorContentAreaProsemirrorWithAttributeStyle: "_12glglyw",
|
|
52
|
-
hideEditorContentAreaScrollGutterWithAttributeStyle: "_amwgglyw",
|
|
53
|
-
hideEditorScrollGutterStyle: "_1e0cglyw",
|
|
54
49
|
fullWidthNonChromelessBreakoutBlockTableStyle: "_xpemaq80 _pnffaq80 _zr7faq80 _qkfz261p _i92uagmp",
|
|
55
50
|
editorContentAreaNew: "_19pk1wug _2hwx1wug _otyr1wug _18u01wug _v5641fxv _vwz41tcg _ca0qoahv _n3tdoahv _4t3i1ap5 _1bsb1osq _2lx21bp4 _16jlkb7n _p12f5kin _1uizkqmb",
|
|
56
51
|
tableFullPageEditorStylesNew: "_1tb2idpf _8vye1n1a _1k8i1osq",
|
|
@@ -60,9 +55,7 @@ var compiledStyles = {
|
|
|
60
55
|
editorContentGutterStyles: "_ca0qidpf _u5f31ex1 _n3tdidpf _19bv1ex1 _vchhusvi",
|
|
61
56
|
editorContentReducedGutterStyles: "_1d7gidpf _n2nw1tcg _d329idpf _105p1tcg",
|
|
62
57
|
contentAreaNew: "_19pkidpf _2hwxidpf _otyridpf _18u0idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _v5642kub _1e0c1txw _2lx2vrvc _4t3ibhu0 _vchhusvi _8j6w1lxk",
|
|
63
|
-
contentAreaHeightNoToolbar: "_4t3i1osq"
|
|
64
|
-
markdownModeContainerBackgroundStyle: "_bfhkhfxm _101j15vq",
|
|
65
|
-
markdownModeContentAreaStyle: "_19pkidpf _2hwxidpf _otyridpf _18u0idpf _vchhusvi _4t3i1osq _p12fglyw _1ul9idpf _n3tdidpf _ca0qidpf _1bsb1osq _fh67idpf _71ybidpf _evz0idpf _1n5qidpf _1wrrusvi _13jk1txw _q0l01bp4 _1a1d1osq _1vbxidpf _1xouidpf _4tbp1osq _1e8kkb7n _boivkb7n _13t61wug _11bl1txw _1593idpf _qgzyidpf _li931osq"
|
|
58
|
+
contentAreaHeightNoToolbar: "_4t3i1osq"
|
|
66
59
|
};
|
|
67
60
|
var CONTENT_AREA_TEST_ID = exports.CONTENT_AREA_TEST_ID = 'ak-editor-fp-content-area';
|
|
68
61
|
var EDITOR_CONTAINER = 'ak-editor-container';
|
|
@@ -92,17 +85,6 @@ var Content = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
92
85
|
}
|
|
93
86
|
};
|
|
94
87
|
}, []);
|
|
95
|
-
var markdownPluginCurrentView = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(props.editorAPI, ['markdownMode'], function (states) {
|
|
96
|
-
var _states$markdownModeS;
|
|
97
|
-
return (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view;
|
|
98
|
-
});
|
|
99
|
-
var markdownPluginCurrentIsMarkdownMode = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(props.editorAPI, ['markdownMode'], function (states) {
|
|
100
|
-
var _states$markdownModeS2;
|
|
101
|
-
return (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.isMarkdownMode;
|
|
102
|
-
});
|
|
103
|
-
var isMarkdownModeExperimentEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc-markdown-mode', 'isEnabled', true);
|
|
104
|
-
var shouldHideProseMirrorForMarkdownMode = isMarkdownModeExperimentEnabled && markdownPluginCurrentView !== 'preview' && markdownPluginCurrentIsMarkdownMode;
|
|
105
|
-
var shouldHideScrollGutterForMarkdownMode = isMarkdownModeExperimentEnabled && markdownPluginCurrentIsMarkdownMode;
|
|
106
88
|
var content = /*#__PURE__*/_react.default.createElement(_EditorContentContainer.default
|
|
107
89
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
108
90
|
, {
|
|
@@ -118,14 +100,12 @@ var Content = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
118
100
|
editorView: props.editorView,
|
|
119
101
|
editorDisabled: props.disabled
|
|
120
102
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
121
|
-
"data-markdown-mode-hide-prosemirror": shouldHideProseMirrorForMarkdownMode ? 'true' : undefined,
|
|
122
|
-
"data-markdown-mode-hide-scroll-gutter": shouldHideScrollGutterForMarkdownMode ? 'true' : undefined,
|
|
123
103
|
style: {
|
|
124
104
|
'--ak-editor-content-area-max-width': "".concat(contentAreaMaxWidth, "px")
|
|
125
105
|
}
|
|
126
106
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
127
107
|
,
|
|
128
|
-
className: (0, _runtime.ax)([compiledStyles.editorContentAreaNew, compiledStyles.editorContentAreaProsemirrorStyle,
|
|
108
|
+
className: (0, _runtime.ax)([compiledStyles.editorContentAreaNew, compiledStyles.editorContentAreaProsemirrorStyle, compiledStyles.tableFullPageEditorStylesNew, compiledStyles.fullWidthNonChromelessBreakoutBlockTableStyle,
|
|
129
109
|
// for breakout resizing, there's no need to restrict the width of codeblocks as they're always wrapped in a breakout mark
|
|
130
110
|
compiledStyles.editorContentAreaContainerStyleExcludeCodeBlockNew, compiledStyles.editorContentAreaContainerNestedDndStyle, "ak-editor-content-area-region"]),
|
|
131
111
|
"data-editor-editable-content": true,
|
|
@@ -164,15 +144,13 @@ var Content = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
164
144
|
paddingBottom: "".concat((_allowScrollGutter$gu = allowScrollGutter.gutterSize) !== null && _allowScrollGutter$gu !== void 0 ? _allowScrollGutter$gu : '120', "px")
|
|
165
145
|
},
|
|
166
146
|
"data-vc": "scroll-gutter",
|
|
167
|
-
"data-editor-scroll-gutter": "true"
|
|
168
|
-
className: (0, _runtime.ax)([shouldHideScrollGutterForMarkdownMode && compiledStyles.hideEditorScrollGutterStyle])
|
|
147
|
+
"data-editor-scroll-gutter": "true"
|
|
169
148
|
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
170
149
|
id: "editor-scroll-gutter",
|
|
171
150
|
style: {
|
|
172
151
|
paddingBottom: "".concat((_allowScrollGutter$gu2 = allowScrollGutter.gutterSize) !== null && _allowScrollGutter$gu2 !== void 0 ? _allowScrollGutter$gu2 : '120', "px")
|
|
173
152
|
},
|
|
174
|
-
"data-vc": "scroll-gutter"
|
|
175
|
-
className: (0, _runtime.ax)([shouldHideScrollGutterForMarkdownMode && compiledStyles.hideEditorScrollGutterStyle])
|
|
153
|
+
"data-vc": "scroll-gutter"
|
|
176
154
|
}))))));
|
|
177
155
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
178
156
|
"data-testid": CONTENT_AREA_TEST_ID,
|
|
@@ -181,7 +159,7 @@ var Content = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
181
159
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
182
160
|
"data-testid": EDITOR_CONTAINER,
|
|
183
161
|
"data-editor-container": 'true',
|
|
184
|
-
className: (0, _runtime.ax)([compiledStyles.contentAreaWrapper
|
|
162
|
+
className: (0, _runtime.ax)([compiledStyles.contentAreaWrapper])
|
|
185
163
|
}, props.UNSAFE_containLayout ? /*#__PURE__*/_react.default.createElement("div", {
|
|
186
164
|
"data-testid": "editor-contain-size-and-layout-wrapper",
|
|
187
165
|
className: (0, _runtime.ax)([containLayoutStyles.wrapper])
|
|
@@ -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 = "238.0.
|
|
9
|
+
var version = exports.version = "238.0.3";
|