@atlaskit/editor-core 187.23.2 → 187.24.1
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 +17 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +2 -1
- package/dist/cjs/editor-next/editor-internal.js +3 -0
- package/dist/cjs/plugins/base/index.js +2 -1
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +58 -27
- package/dist/cjs/plugins/text-color/commands/toggle-color.js +1 -1
- package/dist/cjs/presets/context.js +40 -0
- package/dist/cjs/ui/EditorContext/index.js +2 -1
- package/dist/cjs/use-preset.js +51 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +2 -1
- package/dist/es2019/editor-next/editor-internal.js +3 -0
- package/dist/es2019/plugins/base/index.js +2 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +46 -16
- package/dist/es2019/plugins/text-color/commands/toggle-color.js +2 -2
- package/dist/es2019/presets/context.js +25 -0
- package/dist/es2019/ui/EditorContext/index.js +2 -1
- package/dist/es2019/use-preset.js +45 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +2 -1
- package/dist/esm/editor-next/editor-internal.js +3 -0
- package/dist/esm/plugins/base/index.js +2 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +58 -28
- package/dist/esm/plugins/text-color/commands/toggle-color.js +2 -2
- package/dist/esm/presets/context.js +26 -0
- package/dist/esm/ui/EditorContext/index.js +2 -1
- package/dist/esm/use-preset.js +45 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +2 -0
- package/dist/types/labs/next/presets/default.d.ts +28 -28
- package/dist/types/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types/plugins/emoji/index.d.ts +2 -2
- package/dist/types/plugins/find-replace/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +7 -4
- package/dist/types/presets/context.d.ts +15 -0
- package/dist/types/use-preset.d.ts +48 -0
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +2 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -28
- package/dist/types-ts4.5/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types-ts4.5/plugins/emoji/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/find-replace/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +7 -4
- package/dist/types-ts4.5/presets/context.d.ts +15 -0
- package/dist/types-ts4.5/use-preset.d.ts +52 -0
- package/package.json +7 -4
- package/report.api.md +6 -0
- package/tmp/api-report-tmp.d.ts +6 -0
- package/use-preset/package.json +15 -0
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/version.json +0 -5
- package/dist/esm/version.json +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5c3064cffe3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5c3064cffe3) - Remove a selection hack for Chrome 88 to improve foucs/blur performance
|
|
8
|
+
- [`51e6a0128eb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/51e6a0128eb) - ED-18969 Implemented relative guideline
|
|
9
|
+
|
|
10
|
+
## 187.24.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`24fc3925d73`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24fc3925d73) - Add a new hook called `usePreset` accesed via `@atlaskit/editor-core/use-preset`. This hook can be used to safely access state and commands from outside the editor using `EditorContext`.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 187.23.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -87,7 +87,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
87
87
|
(0, _inherits2.default)(ReactEditorView, _React$Component);
|
|
88
88
|
var _super = _createSuper(ReactEditorView);
|
|
89
89
|
function ReactEditorView(props, context) {
|
|
90
|
-
var _props$editorProps, _props$editorProps$pe, _props$editorProps$pe2;
|
|
90
|
+
var _props$setEditorApi, _props$editorProps, _props$editorProps$pe, _props$editorProps$pe2;
|
|
91
91
|
var _this;
|
|
92
92
|
(0, _classCallCheck2.default)(this, ReactEditorView);
|
|
93
93
|
_this = _super.call(this, props, context);
|
|
@@ -536,6 +536,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
536
536
|
getEditorState: _this.getEditorState,
|
|
537
537
|
getEditorView: _this.getEditorView
|
|
538
538
|
});
|
|
539
|
+
(_props$setEditorApi = props.setEditorApi) === null || _props$setEditorApi === void 0 ? void 0 : _props$setEditorApi.call(props, _this.pluginInjectionAPI.api());
|
|
539
540
|
_this.eventDispatcher = new _eventDispatcher.EventDispatcher();
|
|
540
541
|
_this.dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
|
|
541
542
|
_this.errorReporter = (0, _createEditor.createErrorReporter)(props.editorProps.errorReporterHandler);
|
|
@@ -18,6 +18,7 @@ var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props"
|
|
|
18
18
|
var _ReactEditorViewNext = _interopRequireDefault(require("../create-editor/ReactEditorViewNext"));
|
|
19
19
|
var _contextAdapter = require("../nodeviews/context-adapter");
|
|
20
20
|
var _EditorContext = _interopRequireDefault(require("../ui/EditorContext"));
|
|
21
|
+
var _context = require("../presets/context");
|
|
21
22
|
var _RenderTracking = require("../utils/performance/components/RenderTracking");
|
|
22
23
|
var _useMeasureEditorMountTime = _interopRequireDefault(require("./hooks/useMeasureEditorMountTime"));
|
|
23
24
|
var _useProviderFactory = _interopRequireDefault(require("./hooks/useProviderFactory"));
|
|
@@ -57,6 +58,7 @@ function EditorInternalWithoutHooks(_ref) {
|
|
|
57
58
|
onEditorDestroyed = _ref.onEditorDestroyed,
|
|
58
59
|
preset = _ref.preset;
|
|
59
60
|
var Component = (0, _createEditor.getUiComponent)(props.appearance);
|
|
61
|
+
var setEditorApi = (0, _context.useSetPresetContext)();
|
|
60
62
|
var overriddenEditorProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
61
63
|
onSave: props.onSave ? handleSave : undefined,
|
|
62
64
|
// noop all analytic events, even if a handler is still passed.
|
|
@@ -101,6 +103,7 @@ function EditorInternalWithoutHooks(_ref) {
|
|
|
101
103
|
onEditorDestroyed: onEditorDestroyed,
|
|
102
104
|
disabled: props.disabled,
|
|
103
105
|
preset: preset,
|
|
106
|
+
setEditorApi: setEditorApi,
|
|
104
107
|
render: function render(_ref2) {
|
|
105
108
|
var _props$featureFlags, _props$featureFlags2;
|
|
106
109
|
var editor = _ref2.editor,
|
|
@@ -8,6 +8,7 @@ exports.isChromeWithSelectionBug = exports.default = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
10
10
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
13
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
14
|
var _filterSteps = _interopRequireDefault(require("./pm-plugins/filter-steps"));
|
|
@@ -97,7 +98,7 @@ var basePlugin = function basePlugin(options, api) {
|
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
|
-
if (isChromeWithSelectionBug) {
|
|
101
|
+
if (isChromeWithSelectionBug && !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.disable-chrome-88-selection-fix_uk53m')) {
|
|
101
102
|
plugins.push({
|
|
102
103
|
name: 'fixChrome88SelectionPlugin',
|
|
103
104
|
plugin: function plugin() {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.resizerNextTestId = exports.default = void 0;
|
|
7
|
+
exports.resizerNextTestId = exports.default = exports.ResizableMediaSingleNext = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -43,22 +43,27 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
43
43
|
var _this;
|
|
44
44
|
(0, _classCallCheck2.default)(this, ResizableMediaSingleNext);
|
|
45
45
|
_this = _super.call(this, props);
|
|
46
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "guidelines", []);
|
|
47
46
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastSnappedGuidelineKeys", []);
|
|
48
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
47
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateGuidelines", function () {
|
|
49
48
|
var _this$props = _this.props,
|
|
50
49
|
view = _this$props.view,
|
|
51
50
|
lineLength = _this$props.lineLength;
|
|
52
51
|
var defaultGuidelines = _this.getDefaultGuidelines();
|
|
52
|
+
var _generateDynamicGuide = (0, _guideline.generateDynamicGuidelines)(view.state, lineLength, {
|
|
53
|
+
styles: {
|
|
54
|
+
lineStyle: 'dashed'
|
|
55
|
+
},
|
|
56
|
+
show: false
|
|
57
|
+
}),
|
|
58
|
+
relativeGuides = _generateDynamicGuide.relativeGuides,
|
|
59
|
+
dynamicGuides = _generateDynamicGuide.dynamicGuides;
|
|
60
|
+
|
|
53
61
|
// disable guidelines for nested media single node
|
|
54
|
-
var dynamicGuidelines = _this.isNestedNode() ? [] :
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
show: false
|
|
62
|
+
var dynamicGuidelines = _this.isNestedNode() ? [] : dynamicGuides;
|
|
63
|
+
_this.setState({
|
|
64
|
+
relativeGuides: relativeGuides,
|
|
65
|
+
guidelines: [].concat((0, _toConsumableArray2.default)(defaultGuidelines), (0, _toConsumableArray2.default)(dynamicGuidelines))
|
|
59
66
|
});
|
|
60
|
-
var guidelines = [].concat((0, _toConsumableArray2.default)(defaultGuidelines), (0, _toConsumableArray2.default)(dynamicGuidelines));
|
|
61
|
-
return guidelines;
|
|
62
67
|
});
|
|
63
68
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calcNewSize", function (newWidth, stop) {
|
|
64
69
|
var _this$props2 = _this.props,
|
|
@@ -67,7 +72,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
67
72
|
containerWidth = _this$props2.containerWidth,
|
|
68
73
|
lineLength = _this$props2.lineLength,
|
|
69
74
|
fullWidthMode = _this$props2.fullWidthMode;
|
|
70
|
-
var newPct = (0, _ui.calcPctFromPx)(newWidth,
|
|
75
|
+
var newPct = (0, _ui.calcPctFromPx)(newWidth, lineLength) * 100;
|
|
71
76
|
_this.setState({
|
|
72
77
|
resizedPctWidth: newPct
|
|
73
78
|
});
|
|
@@ -149,6 +154,13 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
149
154
|
}
|
|
150
155
|
return (0, _mediaSingle.calcMediaSingleMaxWidth)(containerWidth);
|
|
151
156
|
}));
|
|
157
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getRelativeGuides", function () {
|
|
158
|
+
var relativeGuides = _this.$pos && _this.$pos.nodeAfter && _this.state.size.width ? (0, _guideline.getRelativeGuidelines)(_this.state.relativeGuides, {
|
|
159
|
+
node: _this.$pos.nodeAfter,
|
|
160
|
+
pos: _this.$pos.pos
|
|
161
|
+
}, _this.props.view, _this.props.lineLength, _this.state.size) : [];
|
|
162
|
+
return relativeGuides;
|
|
163
|
+
});
|
|
152
164
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateActiveGuidelines", function () {
|
|
153
165
|
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
154
166
|
var guidelines = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -158,7 +170,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
158
170
|
gap = _findClosestSnap.gap,
|
|
159
171
|
activeGuidelineKeys = _findClosestSnap.keys;
|
|
160
172
|
_this.lastSnappedGuidelineKeys = activeGuidelineKeys;
|
|
161
|
-
|
|
173
|
+
var relativeGuidelines = activeGuidelineKeys.length ? [] : _this.getRelativeGuides();
|
|
174
|
+
_this.displayGuideline([].concat((0, _toConsumableArray2.default)((0, _guideline.getGuidelinesWithHighlights)(gap, _mediaSingle.MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines)), (0, _toConsumableArray2.default)(relativeGuidelines)));
|
|
162
175
|
}
|
|
163
176
|
});
|
|
164
177
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "roundPixelValue", function (value) {
|
|
@@ -221,7 +234,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
221
234
|
_this.setIsResizing(true);
|
|
222
235
|
_this.updateSizeInPluginState(_this.state.size.width);
|
|
223
236
|
// re-calucate guidelines
|
|
224
|
-
_this.
|
|
237
|
+
_this.updateGuidelines();
|
|
225
238
|
return 0;
|
|
226
239
|
});
|
|
227
240
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResize", (0, _throttle.default)(function (size, delta) {
|
|
@@ -235,14 +248,17 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
235
248
|
width = _this$calculateSizeSt.width,
|
|
236
249
|
height = _this$calculateSizeSt.height,
|
|
237
250
|
calculatedWidthWithLayout = _this$calculateSizeSt.calculatedWidthWithLayout;
|
|
238
|
-
var guidelineSnaps = (0, _guideline.getGuidelineSnaps)(_this.guidelines, lineLength, layout);
|
|
239
|
-
_this.updateActiveGuidelines(width, _this.guidelines, guidelineSnaps);
|
|
251
|
+
var guidelineSnaps = (0, _guideline.getGuidelineSnaps)(_this.state.guidelines, lineLength, layout);
|
|
252
|
+
_this.updateActiveGuidelines(width, _this.state.guidelines, guidelineSnaps);
|
|
253
|
+
var relativeSnaps = (0, _guideline.getRelativeGuideSnaps)(_this.state.relativeGuides, _this.aspectRatio);
|
|
240
254
|
_this.setState({
|
|
241
255
|
size: {
|
|
242
256
|
width: width,
|
|
243
257
|
height: height
|
|
244
258
|
},
|
|
245
|
-
snaps:
|
|
259
|
+
snaps: {
|
|
260
|
+
x: [].concat((0, _toConsumableArray2.default)(guidelineSnaps.snaps.x || []), (0, _toConsumableArray2.default)(relativeSnaps))
|
|
261
|
+
}
|
|
246
262
|
});
|
|
247
263
|
_this.updateSizeInPluginState(width);
|
|
248
264
|
if (calculatedWidthWithLayout.layout !== layout) {
|
|
@@ -265,7 +281,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
265
281
|
width: width,
|
|
266
282
|
layout: calculatedWidthWithLayout.layout,
|
|
267
283
|
widthType: 'pixel',
|
|
268
|
-
snapType: (0, _guideline.getGuidelineTypeFromKey)(_this.lastSnappedGuidelineKeys, _this.guidelines),
|
|
284
|
+
snapType: (0, _guideline.getGuidelineTypeFromKey)(_this.lastSnappedGuidelineKeys, _this.state.guidelines),
|
|
269
285
|
parentNode: _this.getParentNodeTypeNameFromCurrentPositionNode()
|
|
270
286
|
});
|
|
271
287
|
if (event) {
|
|
@@ -294,7 +310,9 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
294
310
|
width: initialWidth,
|
|
295
311
|
height: _this.calcPxHeight(initialWidth)
|
|
296
312
|
},
|
|
297
|
-
snaps: {}
|
|
313
|
+
snaps: {},
|
|
314
|
+
relativeGuides: {},
|
|
315
|
+
guidelines: []
|
|
298
316
|
};
|
|
299
317
|
return _this;
|
|
300
318
|
}
|
|
@@ -413,6 +431,18 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
413
431
|
this.checkVideoFile(nextProps.viewMediaClientConfig);
|
|
414
432
|
}
|
|
415
433
|
}
|
|
434
|
+
}, {
|
|
435
|
+
key: "aspectRatio",
|
|
436
|
+
get: function get() {
|
|
437
|
+
var _this$props8 = this.props,
|
|
438
|
+
width = _this$props8.width,
|
|
439
|
+
height = _this$props8.height;
|
|
440
|
+
if (width) {
|
|
441
|
+
return width / height;
|
|
442
|
+
}
|
|
443
|
+
// TODO handle this case
|
|
444
|
+
return 1;
|
|
445
|
+
}
|
|
416
446
|
}, {
|
|
417
447
|
key: "checkVideoFile",
|
|
418
448
|
value: function () {
|
|
@@ -515,15 +545,15 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
515
545
|
key: "render",
|
|
516
546
|
value: function render() {
|
|
517
547
|
var _this3 = this;
|
|
518
|
-
var _this$
|
|
519
|
-
origWidth = _this$
|
|
520
|
-
layout = _this$
|
|
521
|
-
pctWidth = _this$
|
|
522
|
-
containerWidth = _this$
|
|
523
|
-
fullWidthMode = _this$
|
|
524
|
-
selected = _this$
|
|
525
|
-
children = _this$
|
|
526
|
-
lineLength = _this$
|
|
548
|
+
var _this$props9 = this.props,
|
|
549
|
+
origWidth = _this$props9.width,
|
|
550
|
+
layout = _this$props9.layout,
|
|
551
|
+
pctWidth = _this$props9.pctWidth,
|
|
552
|
+
containerWidth = _this$props9.containerWidth,
|
|
553
|
+
fullWidthMode = _this$props9.fullWidthMode,
|
|
554
|
+
selected = _this$props9.selected,
|
|
555
|
+
children = _this$props9.children,
|
|
556
|
+
lineLength = _this$props9.lineLength;
|
|
527
557
|
var _this$state = this.state,
|
|
528
558
|
isResizing = _this$state.isResizing,
|
|
529
559
|
size = _this$state.size;
|
|
@@ -573,5 +603,6 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
573
603
|
}]);
|
|
574
604
|
return ResizableMediaSingleNext;
|
|
575
605
|
}(_react.default.Component);
|
|
606
|
+
exports.ResizableMediaSingleNext = ResizableMediaSingleNext;
|
|
576
607
|
var _default = ResizableMediaSingleNext;
|
|
577
608
|
exports.default = _default;
|
|
@@ -27,7 +27,7 @@ var toggleColor = function toggleColor(color) {
|
|
|
27
27
|
color: color
|
|
28
28
|
});
|
|
29
29
|
state.tr.scrollIntoView();
|
|
30
|
-
(0, _preset.
|
|
30
|
+
(0, _preset.editorCommandToPMCommand)((0, _mark.toggleMark)(textColor, {
|
|
31
31
|
color: color
|
|
32
32
|
}))(state, dispatch);
|
|
33
33
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useSetPresetContext = exports.usePresetContext = exports.PresetContextProvider = exports.EditorAPIContext = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
var EditorAPIContext = /*#__PURE__*/_react.default.createContext({});
|
|
14
|
+
exports.EditorAPIContext = EditorAPIContext;
|
|
15
|
+
var PresetContextProvider = function PresetContextProvider(_ref) {
|
|
16
|
+
var children = _ref.children;
|
|
17
|
+
var _useState = (0, _react.useState)(),
|
|
18
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
19
|
+
editorApi = _useState2[0],
|
|
20
|
+
setEditorApi = _useState2[1];
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(EditorAPIContext.Provider, {
|
|
22
|
+
value: {
|
|
23
|
+
editorApi: editorApi,
|
|
24
|
+
setEditorApi: setEditorApi
|
|
25
|
+
}
|
|
26
|
+
}, children);
|
|
27
|
+
};
|
|
28
|
+
exports.PresetContextProvider = PresetContextProvider;
|
|
29
|
+
var usePresetContext = function usePresetContext() {
|
|
30
|
+
var _useContext = (0, _react.useContext)(EditorAPIContext),
|
|
31
|
+
editorApi = _useContext.editorApi;
|
|
32
|
+
return editorApi;
|
|
33
|
+
};
|
|
34
|
+
exports.usePresetContext = usePresetContext;
|
|
35
|
+
var useSetPresetContext = function useSetPresetContext() {
|
|
36
|
+
var _useContext2 = (0, _react.useContext)(EditorAPIContext),
|
|
37
|
+
setEditorApi = _useContext2.setEditorApi;
|
|
38
|
+
return setEditorApi;
|
|
39
|
+
};
|
|
40
|
+
exports.useSetPresetContext = useSetPresetContext;
|
|
@@ -14,6 +14,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
16
|
var _actions = _interopRequireDefault(require("../../actions"));
|
|
17
|
+
var _context = require("../../presets/context");
|
|
17
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
18
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
20
|
var EditorContext = /*#__PURE__*/_react.default.createContext({});
|
|
@@ -43,7 +44,7 @@ var LegacyEditorContext = /*#__PURE__*/function (_React$Component) {
|
|
|
43
44
|
value: function render() {
|
|
44
45
|
return /*#__PURE__*/_react.default.createElement(EditorContext.Provider, {
|
|
45
46
|
value: this.getChildContext()
|
|
46
|
-
}, this.props.children);
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_context.PresetContextProvider, null, this.props.children));
|
|
47
48
|
}
|
|
48
49
|
}]);
|
|
49
50
|
return LegacyEditorContext;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePreset = usePreset;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _context = require("./presets/context");
|
|
9
|
+
/**
|
|
10
|
+
* Creates a preset.
|
|
11
|
+
*
|
|
12
|
+
* Takes an input function that returns a preset (and memoizes it) depending
|
|
13
|
+
* on the dependency array provided.
|
|
14
|
+
*
|
|
15
|
+
* Returns a pluginInjectionApi in order to apply actions and subscribe to plugin
|
|
16
|
+
* changes outside of the editor.
|
|
17
|
+
*
|
|
18
|
+
* @param createPreset
|
|
19
|
+
* @param dependencies
|
|
20
|
+
* @returns PresetAPI ({ pluginInjectionApi, preset, actionBuilder })
|
|
21
|
+
*
|
|
22
|
+
* Example:
|
|
23
|
+
* ```ts
|
|
24
|
+
* function ExampleEditor() {
|
|
25
|
+
* const { preset, editorApi } = usePreset(() =>
|
|
26
|
+
* new EditorPresetBuilder().add(plugin1).add(plugin2)
|
|
27
|
+
* , []);
|
|
28
|
+
*
|
|
29
|
+
* // Can execute typesafe commands based on plugin1 or 2
|
|
30
|
+
* const runCommand = () => editorApi.executeCommand(
|
|
31
|
+
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
32
|
+
* )
|
|
33
|
+
* return (
|
|
34
|
+
* <>
|
|
35
|
+
* <Editor preset={preset} />
|
|
36
|
+
* <Button onClick={runCommand}>Run command</Button>
|
|
37
|
+
* </>
|
|
38
|
+
* )
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function usePreset(createPreset, dependencies) {
|
|
43
|
+
var editorApi = (0, _context.usePresetContext)();
|
|
44
|
+
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
var preset = (0, _react.useMemo)(createPreset, dependencies);
|
|
47
|
+
return {
|
|
48
|
+
editorApi: editorApi,
|
|
49
|
+
preset: preset
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.24.1";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -86,7 +86,7 @@ export class ReactEditorView extends React.Component {
|
|
|
86
86
|
return ((_this$props$editorPro3 = this.props.editorProps) === null || _this$props$editorPro3 === void 0 ? void 0 : (_this$props$editorPro4 = _this$props$editorPro3.performanceTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : (_this$props$editorPro5 = _this$props$editorPro4.transactionTracking) === null || _this$props$editorPro5 === void 0 ? void 0 : _this$props$editorPro5.enabled) === false;
|
|
87
87
|
}
|
|
88
88
|
constructor(props, context) {
|
|
89
|
-
var _props$editorProps, _props$editorProps$pe, _props$editorProps$pe2;
|
|
89
|
+
var _props$setEditorApi, _props$editorProps, _props$editorProps$pe, _props$editorProps$pe2;
|
|
90
90
|
super(props, context);
|
|
91
91
|
_defineProperty(this, "editorRef", /*#__PURE__*/React.createRef());
|
|
92
92
|
// ProseMirror is instantiated prior to the initial React render cycle,
|
|
@@ -532,6 +532,7 @@ export class ReactEditorView extends React.Component {
|
|
|
532
532
|
getEditorState: this.getEditorState,
|
|
533
533
|
getEditorView: this.getEditorView
|
|
534
534
|
});
|
|
535
|
+
(_props$setEditorApi = props.setEditorApi) === null || _props$setEditorApi === void 0 ? void 0 : _props$setEditorApi.call(props, this.pluginInjectionAPI.api());
|
|
535
536
|
this.eventDispatcher = new EventDispatcher();
|
|
536
537
|
this.dispatch = createDispatch(this.eventDispatcher);
|
|
537
538
|
this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
|
|
@@ -10,6 +10,7 @@ import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from
|
|
|
10
10
|
import ReactEditorView from '../create-editor/ReactEditorViewNext';
|
|
11
11
|
import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
12
12
|
import EditorContext from '../ui/EditorContext';
|
|
13
|
+
import { useSetPresetContext } from '../presets/context';
|
|
13
14
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
14
15
|
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
|
15
16
|
import useProviderFactory from './hooks/useProviderFactory';
|
|
@@ -51,6 +52,7 @@ export function EditorInternalWithoutHooks({
|
|
|
51
52
|
}) {
|
|
52
53
|
var _props$performanceTra, _props$performanceTra2, _props$performanceTra3, _props$performanceTra4;
|
|
53
54
|
const Component = getUiComponent(props.appearance);
|
|
55
|
+
const setEditorApi = useSetPresetContext();
|
|
54
56
|
const overriddenEditorProps = {
|
|
55
57
|
...props,
|
|
56
58
|
onSave: props.onSave ? handleSave : undefined,
|
|
@@ -95,6 +97,7 @@ export function EditorInternalWithoutHooks({
|
|
|
95
97
|
onEditorDestroyed: onEditorDestroyed,
|
|
96
98
|
disabled: props.disabled,
|
|
97
99
|
preset: preset,
|
|
100
|
+
setEditorApi: setEditorApi,
|
|
98
101
|
render: ({
|
|
99
102
|
editor,
|
|
100
103
|
view,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { baseKeymap } from '@atlaskit/editor-prosemirror/commands';
|
|
2
2
|
import { history } from '@atlaskit/editor-prosemirror/history';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { doc, paragraph, text } from '@atlaskit/adf-schema';
|
|
5
6
|
import filterStepsPlugin from './pm-plugins/filter-steps';
|
|
@@ -74,7 +75,7 @@ const basePlugin = (options, api) => {
|
|
|
74
75
|
plugin: () => scrollGutter(options.allowScrollGutter)
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
if (isChromeWithSelectionBug) {
|
|
78
|
+
if (isChromeWithSelectionBug && !getBooleanFF('platform.editor.disable-chrome-88-selection-fix_uk53m')) {
|
|
78
79
|
plugins.push({
|
|
79
80
|
name: 'fixChrome88SelectionPlugin',
|
|
80
81
|
plugin: () => fixChrome88SelectionPlugin()
|
|
@@ -12,32 +12,38 @@ import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
|
12
12
|
import classnames from 'classnames';
|
|
13
13
|
import { richMediaClassName, resizerStyles } from '@atlaskit/editor-common/styles';
|
|
14
14
|
import { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, calculateOffsetLeft, DEFAULT_IMAGE_WIDTH, calcMediaSingleMaxWidth } from '@atlaskit/editor-common/media-single';
|
|
15
|
-
import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelineTypeFromKey } from '@atlaskit/editor-common/guideline';
|
|
15
|
+
import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelineTypeFromKey, getRelativeGuideSnaps, getRelativeGuidelines } from '@atlaskit/editor-common/guideline';
|
|
16
16
|
import memoizeOne from 'memoize-one';
|
|
17
17
|
import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
|
|
18
18
|
import throttle from 'lodash/throttle';
|
|
19
19
|
import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
|
|
20
20
|
export const resizerNextTestId = 'mediaSingle.resizerNext.testid';
|
|
21
|
-
class ResizableMediaSingleNext extends React.Component {
|
|
21
|
+
export class ResizableMediaSingleNext extends React.Component {
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
|
-
_defineProperty(this, "guidelines", []);
|
|
25
24
|
_defineProperty(this, "lastSnappedGuidelineKeys", []);
|
|
26
|
-
_defineProperty(this, "
|
|
25
|
+
_defineProperty(this, "updateGuidelines", () => {
|
|
27
26
|
const {
|
|
28
27
|
view,
|
|
29
28
|
lineLength
|
|
30
29
|
} = this.props;
|
|
31
30
|
const defaultGuidelines = this.getDefaultGuidelines();
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const {
|
|
32
|
+
relativeGuides,
|
|
33
|
+
dynamicGuides
|
|
34
|
+
} = generateDynamicGuidelines(view.state, lineLength, {
|
|
34
35
|
styles: {
|
|
35
36
|
lineStyle: 'dashed'
|
|
36
37
|
},
|
|
37
38
|
show: false
|
|
38
39
|
});
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
// disable guidelines for nested media single node
|
|
42
|
+
const dynamicGuidelines = this.isNestedNode() ? [] : dynamicGuides;
|
|
43
|
+
this.setState({
|
|
44
|
+
relativeGuides,
|
|
45
|
+
guidelines: [...defaultGuidelines, ...dynamicGuidelines]
|
|
46
|
+
});
|
|
41
47
|
});
|
|
42
48
|
_defineProperty(this, "calcNewSize", (newWidth, stop) => {
|
|
43
49
|
const {
|
|
@@ -49,7 +55,7 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
49
55
|
lineLength,
|
|
50
56
|
fullWidthMode
|
|
51
57
|
} = this.props;
|
|
52
|
-
const newPct = calcPctFromPx(newWidth,
|
|
58
|
+
const newPct = calcPctFromPx(newWidth, lineLength) * 100;
|
|
53
59
|
this.setState({
|
|
54
60
|
resizedPctWidth: newPct
|
|
55
61
|
});
|
|
@@ -135,6 +141,13 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
135
141
|
}
|
|
136
142
|
return calcMediaSingleMaxWidth(containerWidth);
|
|
137
143
|
}));
|
|
144
|
+
_defineProperty(this, "getRelativeGuides", () => {
|
|
145
|
+
const relativeGuides = this.$pos && this.$pos.nodeAfter && this.state.size.width ? getRelativeGuidelines(this.state.relativeGuides, {
|
|
146
|
+
node: this.$pos.nodeAfter,
|
|
147
|
+
pos: this.$pos.pos
|
|
148
|
+
}, this.props.view, this.props.lineLength, this.state.size) : [];
|
|
149
|
+
return relativeGuides;
|
|
150
|
+
});
|
|
138
151
|
_defineProperty(this, "updateActiveGuidelines", (width = 0, guidelines, guidelineSnapsReference) => {
|
|
139
152
|
if (guidelineSnapsReference.snaps.x) {
|
|
140
153
|
const {
|
|
@@ -142,7 +155,8 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
142
155
|
keys: activeGuidelineKeys
|
|
143
156
|
} = findClosestSnap(width, guidelineSnapsReference.snaps.x, guidelineSnapsReference.guidelineReference, MEDIA_SINGLE_SNAP_GAP);
|
|
144
157
|
this.lastSnappedGuidelineKeys = activeGuidelineKeys;
|
|
145
|
-
|
|
158
|
+
const relativeGuidelines = activeGuidelineKeys.length ? [] : this.getRelativeGuides();
|
|
159
|
+
this.displayGuideline([...getGuidelinesWithHighlights(gap, MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines), ...relativeGuidelines]);
|
|
146
160
|
}
|
|
147
161
|
});
|
|
148
162
|
_defineProperty(this, "roundPixelValue", value => Math.round(value));
|
|
@@ -199,7 +213,7 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
199
213
|
this.setIsResizing(true);
|
|
200
214
|
this.updateSizeInPluginState(this.state.size.width);
|
|
201
215
|
// re-calucate guidelines
|
|
202
|
-
this.
|
|
216
|
+
this.updateGuidelines();
|
|
203
217
|
return 0;
|
|
204
218
|
});
|
|
205
219
|
_defineProperty(this, "handleResize", throttle((size, delta) => {
|
|
@@ -215,14 +229,17 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
215
229
|
height,
|
|
216
230
|
calculatedWidthWithLayout
|
|
217
231
|
} = this.calculateSizeState(size, delta, originalWidth, originalHeight);
|
|
218
|
-
const guidelineSnaps = getGuidelineSnaps(this.guidelines, lineLength, layout);
|
|
219
|
-
this.updateActiveGuidelines(width, this.guidelines, guidelineSnaps);
|
|
232
|
+
const guidelineSnaps = getGuidelineSnaps(this.state.guidelines, lineLength, layout);
|
|
233
|
+
this.updateActiveGuidelines(width, this.state.guidelines, guidelineSnaps);
|
|
234
|
+
const relativeSnaps = getRelativeGuideSnaps(this.state.relativeGuides, this.aspectRatio);
|
|
220
235
|
this.setState({
|
|
221
236
|
size: {
|
|
222
237
|
width,
|
|
223
238
|
height
|
|
224
239
|
},
|
|
225
|
-
snaps:
|
|
240
|
+
snaps: {
|
|
241
|
+
x: [...(guidelineSnaps.snaps.x || []), ...relativeSnaps]
|
|
242
|
+
}
|
|
226
243
|
});
|
|
227
244
|
this.updateSizeInPluginState(width);
|
|
228
245
|
if (calculatedWidthWithLayout.layout !== layout) {
|
|
@@ -247,7 +264,7 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
247
264
|
width,
|
|
248
265
|
layout: calculatedWidthWithLayout.layout,
|
|
249
266
|
widthType: 'pixel',
|
|
250
|
-
snapType: getGuidelineTypeFromKey(this.lastSnappedGuidelineKeys, this.guidelines),
|
|
267
|
+
snapType: getGuidelineTypeFromKey(this.lastSnappedGuidelineKeys, this.state.guidelines),
|
|
251
268
|
parentNode: this.getParentNodeTypeNameFromCurrentPositionNode()
|
|
252
269
|
});
|
|
253
270
|
if (event) {
|
|
@@ -276,7 +293,9 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
276
293
|
width: initialWidth,
|
|
277
294
|
height: this.calcPxHeight(initialWidth)
|
|
278
295
|
},
|
|
279
|
-
snaps: {}
|
|
296
|
+
snaps: {},
|
|
297
|
+
relativeGuides: {},
|
|
298
|
+
guidelines: []
|
|
280
299
|
};
|
|
281
300
|
}
|
|
282
301
|
|
|
@@ -365,6 +384,17 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
365
384
|
this.checkVideoFile(nextProps.viewMediaClientConfig);
|
|
366
385
|
}
|
|
367
386
|
}
|
|
387
|
+
get aspectRatio() {
|
|
388
|
+
const {
|
|
389
|
+
width,
|
|
390
|
+
height
|
|
391
|
+
} = this.props;
|
|
392
|
+
if (width) {
|
|
393
|
+
return width / height;
|
|
394
|
+
}
|
|
395
|
+
// TODO handle this case
|
|
396
|
+
return 1;
|
|
397
|
+
}
|
|
368
398
|
async checkVideoFile(viewMediaClientConfig) {
|
|
369
399
|
const $pos = this.$pos;
|
|
370
400
|
if (!$pos || !viewMediaClientConfig) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toggleMark } from '@atlaskit/editor-common/mark';
|
|
2
2
|
import { ACTIONS, pluginKey } from '../pm-plugins/main';
|
|
3
3
|
import { getDisabledState } from '../utils/disabled';
|
|
4
|
-
import {
|
|
4
|
+
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
5
5
|
export const toggleColor = color => (state, dispatch) => {
|
|
6
6
|
const {
|
|
7
7
|
textColor
|
|
@@ -22,7 +22,7 @@ export const toggleColor = color => (state, dispatch) => {
|
|
|
22
22
|
color
|
|
23
23
|
});
|
|
24
24
|
state.tr.scrollIntoView();
|
|
25
|
-
|
|
25
|
+
editorCommandToPMCommand(toggleMark(textColor, {
|
|
26
26
|
color
|
|
27
27
|
}))(state, dispatch);
|
|
28
28
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useState, useContext } from 'react';
|
|
2
|
+
export const EditorAPIContext = /*#__PURE__*/React.createContext({});
|
|
3
|
+
export const PresetContextProvider = ({
|
|
4
|
+
children
|
|
5
|
+
}) => {
|
|
6
|
+
const [editorApi, setEditorApi] = useState();
|
|
7
|
+
return /*#__PURE__*/React.createElement(EditorAPIContext.Provider, {
|
|
8
|
+
value: {
|
|
9
|
+
editorApi,
|
|
10
|
+
setEditorApi
|
|
11
|
+
}
|
|
12
|
+
}, children);
|
|
13
|
+
};
|
|
14
|
+
export const usePresetContext = () => {
|
|
15
|
+
const {
|
|
16
|
+
editorApi
|
|
17
|
+
} = useContext(EditorAPIContext);
|
|
18
|
+
return editorApi;
|
|
19
|
+
};
|
|
20
|
+
export const useSetPresetContext = () => {
|
|
21
|
+
const {
|
|
22
|
+
setEditorApi
|
|
23
|
+
} = useContext(EditorAPIContext);
|
|
24
|
+
return setEditorApi;
|
|
25
|
+
};
|