@atlaskit/editor-core 187.26.0 → 187.27.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 +16 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +9 -9
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +92 -155
- package/dist/cjs/use-preset.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +9 -9
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +73 -136
- package/dist/es2019/use-preset.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +9 -9
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +94 -157
- package/dist/esm/use-preset.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +10 -24
- package/dist/types/use-preset.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +10 -24
- package/dist/types-ts4.5/use-preset.d.ts +1 -1
- package/package.json +2 -2
|
@@ -4,9 +4,9 @@ import React from 'react';
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
7
|
-
import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap
|
|
7
|
+
import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding
|
|
9
|
+
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { wrapperStyle } from './styled';
|
|
11
11
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
12
12
|
import classnames from 'classnames';
|
|
@@ -94,12 +94,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
94
94
|
// so that we have image aligned with text
|
|
95
95
|
return 'full-width';
|
|
96
96
|
});
|
|
97
|
-
_defineProperty(this, "calcColumnLeftOffset", () => {
|
|
98
|
-
const {
|
|
99
|
-
offsetLeft
|
|
100
|
-
} = this.state;
|
|
101
|
-
return this.insideInlineLike ? calcColumnsFromPx(offsetLeft, this.props.lineLength, this.props.gridSize) : 0;
|
|
102
|
-
});
|
|
103
97
|
_defineProperty(this, "calcPxHeight", newWidth => {
|
|
104
98
|
const {
|
|
105
99
|
width = newWidth,
|
|
@@ -109,11 +103,8 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
109
103
|
});
|
|
110
104
|
_defineProperty(this, "saveWrapper", wrapper => this.wrapper = wrapper);
|
|
111
105
|
_defineProperty(this, "displayGuideline", guidelines => {
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
pluginInjectionApi
|
|
115
|
-
} = this.props;
|
|
116
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.guideline) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.actions) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.displayGuideline(this.props.view)({
|
|
106
|
+
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3, _this$props$pluginInj4;
|
|
107
|
+
return (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.dependencies) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.guideline) === null || _this$props$pluginInj3 === void 0 ? void 0 : (_this$props$pluginInj4 = _this$props$pluginInj3.actions) === null || _this$props$pluginInj4 === void 0 ? void 0 : _this$props$pluginInj4.displayGuideline(this.props.view)({
|
|
117
108
|
guidelines
|
|
118
109
|
});
|
|
119
110
|
});
|
|
@@ -142,9 +133,10 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
142
133
|
return calcMediaSingleMaxWidth(containerWidth);
|
|
143
134
|
}));
|
|
144
135
|
_defineProperty(this, "getRelativeGuides", () => {
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
136
|
+
const $pos = this.$pos;
|
|
137
|
+
const relativeGuides = $pos && $pos.nodeAfter && this.state.size.width ? getRelativeGuidelines(this.state.relativeGuides, {
|
|
138
|
+
node: $pos.nodeAfter,
|
|
139
|
+
pos: $pos.pos
|
|
148
140
|
}, this.props.view, this.props.lineLength, this.state.size) : [];
|
|
149
141
|
return relativeGuides;
|
|
150
142
|
});
|
|
@@ -159,51 +151,19 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
159
151
|
this.displayGuideline([...getGuidelinesWithHighlights(gap, MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines), ...relativeGuidelines]);
|
|
160
152
|
}
|
|
161
153
|
});
|
|
162
|
-
_defineProperty(this, "
|
|
163
|
-
|
|
164
|
-
_defineProperty(this, "calculateSizeState", (size, delta, originalWidth = 0, originalHeight, onResizeStop = false) => {
|
|
165
|
-
const calculatedWidth = this.roundPixelValue(size.width + delta.width);
|
|
154
|
+
_defineProperty(this, "calculateSizeState", (size, delta, onResizeStop = false) => {
|
|
155
|
+
const calculatedWidth = Math.round(size.width + delta.width);
|
|
166
156
|
const calculatedWidthWithLayout = this.calcNewSize(calculatedWidth, onResizeStop);
|
|
167
|
-
const calculatedHeightWithLayout = this.getHeightFromNewWidth(originalWidth, originalHeight, calculatedWidth);
|
|
168
157
|
return {
|
|
169
158
|
width: calculatedWidth,
|
|
170
|
-
height:
|
|
159
|
+
height: calculatedWidth / this.aspectRatio,
|
|
171
160
|
calculatedWidthWithLayout
|
|
172
161
|
};
|
|
173
162
|
});
|
|
174
163
|
_defineProperty(this, "selectCurrentMediaNode", () => {
|
|
175
164
|
// TODO: if adding !this.props.selected, it doesn't work if media single node is at top postion
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (propPos !== undefined) {
|
|
179
|
-
setNodeSelection(this.props.view, propPos);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
_defineProperty(this, "getParentNodeTypeNameFromCurrentPositionNode", () => {
|
|
184
|
-
const $pos = this.$pos;
|
|
185
|
-
if (!$pos) {
|
|
186
|
-
return undefined;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Supported Parent Nodes
|
|
190
|
-
const {
|
|
191
|
-
listItem,
|
|
192
|
-
expand,
|
|
193
|
-
tableCell,
|
|
194
|
-
tableHeader,
|
|
195
|
-
layoutSection,
|
|
196
|
-
nestedExpand
|
|
197
|
-
} = this.props.view.state.schema.nodes;
|
|
198
|
-
const parentNode = findParentNodeOfTypeClosestToPos($pos, [listItem, expand, tableCell, tableHeader, layoutSection, nestedExpand]);
|
|
199
|
-
|
|
200
|
-
// Return matched parent node name
|
|
201
|
-
if (parentNode) {
|
|
202
|
-
return parentNode.node.type.name;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Return undefined if parent node cannot be found
|
|
206
|
-
return undefined;
|
|
165
|
+
const pos = this.pos;
|
|
166
|
+
pos && setNodeSelection(this.props.view, pos);
|
|
207
167
|
});
|
|
208
168
|
_defineProperty(this, "handleResizeStart", () => {
|
|
209
169
|
this.setState({
|
|
@@ -212,13 +172,11 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
212
172
|
this.selectCurrentMediaNode();
|
|
213
173
|
this.setIsResizing(true);
|
|
214
174
|
this.updateSizeInPluginState(this.state.size.width);
|
|
215
|
-
// re-
|
|
175
|
+
// re-calculate guidelines
|
|
216
176
|
this.updateGuidelines();
|
|
217
177
|
});
|
|
218
178
|
_defineProperty(this, "handleResize", (size, delta) => {
|
|
219
179
|
const {
|
|
220
|
-
width: originalWidth,
|
|
221
|
-
height: originalHeight,
|
|
222
180
|
layout,
|
|
223
181
|
updateSize,
|
|
224
182
|
lineLength
|
|
@@ -227,7 +185,7 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
227
185
|
width,
|
|
228
186
|
height,
|
|
229
187
|
calculatedWidthWithLayout
|
|
230
|
-
} = this.calculateSizeState(size, delta
|
|
188
|
+
} = this.calculateSizeState(size, delta);
|
|
231
189
|
const guidelineSnaps = getGuidelineSnaps(this.state.guidelines, lineLength, layout);
|
|
232
190
|
this.updateActiveGuidelines(width, this.state.guidelines, guidelineSnaps);
|
|
233
191
|
const relativeSnaps = getRelativeGuideSnaps(this.state.relativeGuides, this.aspectRatio);
|
|
@@ -247,8 +205,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
247
205
|
});
|
|
248
206
|
_defineProperty(this, "handleResizeStop", (size, delta) => {
|
|
249
207
|
const {
|
|
250
|
-
width: originalWidth,
|
|
251
|
-
height: originalHeight,
|
|
252
208
|
updateSize,
|
|
253
209
|
dispatchAnalyticsEvent,
|
|
254
210
|
nodeType
|
|
@@ -257,14 +213,15 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
257
213
|
width,
|
|
258
214
|
height,
|
|
259
215
|
calculatedWidthWithLayout
|
|
260
|
-
} = this.calculateSizeState(size, delta,
|
|
216
|
+
} = this.calculateSizeState(size, delta, true);
|
|
261
217
|
if (dispatchAnalyticsEvent) {
|
|
218
|
+
const $pos = this.$pos;
|
|
262
219
|
const event = getMediaResizeAnalyticsEvent(nodeType || 'mediaSingle', {
|
|
263
220
|
width,
|
|
264
221
|
layout: calculatedWidthWithLayout.layout,
|
|
265
222
|
widthType: 'pixel',
|
|
266
223
|
snapType: getGuidelineTypeFromKey(this.lastSnappedGuidelineKeys, this.state.guidelines),
|
|
267
|
-
parentNode:
|
|
224
|
+
parentNode: $pos ? $pos.parent.type.name : undefined
|
|
268
225
|
});
|
|
269
226
|
if (event) {
|
|
270
227
|
dispatchAnalyticsEvent(event);
|
|
@@ -297,21 +254,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
297
254
|
guidelines: []
|
|
298
255
|
};
|
|
299
256
|
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Calculate media single node initial width if props.mediaSingleWidth is undefined
|
|
303
|
-
* (Mainly when switching from lagacy experience to new experience).
|
|
304
|
-
*
|
|
305
|
-
* @returns initial width in pixel
|
|
306
|
-
*/
|
|
307
|
-
calcInitialWidth() {
|
|
308
|
-
const {
|
|
309
|
-
width: origWidth,
|
|
310
|
-
lineLength: contentWidth,
|
|
311
|
-
containerWidth
|
|
312
|
-
} = this.props;
|
|
313
|
-
return Math.max(Math.min(origWidth || DEFAULT_IMAGE_WIDTH, contentWidth || containerWidth || akEditorDefaultLayoutWidth), MEDIA_SINGLE_MIN_PIXEL_WIDTH);
|
|
314
|
-
}
|
|
315
257
|
componentDidUpdate(prevProps) {
|
|
316
258
|
const offsetLeft = calculateOffsetLeft(this.insideInlineLike, this.insideLayout, this.props.view.dom, this.wrapper);
|
|
317
259
|
if (offsetLeft !== this.state.offsetLeft && offsetLeft >= 0) {
|
|
@@ -352,24 +294,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
352
294
|
}
|
|
353
295
|
return true;
|
|
354
296
|
}
|
|
355
|
-
|
|
356
|
-
// check if is inside of layout, table, expand, nestedExpand and list item
|
|
357
|
-
isNestedNode() {
|
|
358
|
-
return !!(this.$pos && this.$pos.parent.type.name !== 'doc');
|
|
359
|
-
}
|
|
360
|
-
getDefaultGuidelines() {
|
|
361
|
-
const {
|
|
362
|
-
lineLength,
|
|
363
|
-
containerWidth,
|
|
364
|
-
fullWidthMode
|
|
365
|
-
} = this.props;
|
|
366
|
-
|
|
367
|
-
// disable guidelines for nested media single node
|
|
368
|
-
return this.isNestedNode() ? [] : generateDefaultGuidelines(lineLength, containerWidth, fullWidthMode);
|
|
369
|
-
}
|
|
370
|
-
get wrappedLayout() {
|
|
371
|
-
return wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
372
|
-
}
|
|
373
297
|
async componentDidMount() {
|
|
374
298
|
const {
|
|
375
299
|
viewMediaClientConfig
|
|
@@ -383,6 +307,24 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
383
307
|
this.checkVideoFile(nextProps.viewMediaClientConfig);
|
|
384
308
|
}
|
|
385
309
|
}
|
|
310
|
+
get wrappedLayout() {
|
|
311
|
+
return wrappedLayouts.indexOf(this.props.layout) > -1;
|
|
312
|
+
}
|
|
313
|
+
get pos() {
|
|
314
|
+
if (typeof this.props.getPos !== 'function') {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
const pos = this.props.getPos();
|
|
318
|
+
if (Number.isNaN(pos) || typeof pos !== 'number') {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
return pos;
|
|
322
|
+
}
|
|
323
|
+
get $pos() {
|
|
324
|
+
const pos = this.pos;
|
|
325
|
+
// need to pass view because we may not get updated props in time
|
|
326
|
+
return pos && this.props.view.state.doc.resolve(pos);
|
|
327
|
+
}
|
|
386
328
|
get aspectRatio() {
|
|
387
329
|
const {
|
|
388
330
|
width,
|
|
@@ -391,9 +333,46 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
391
333
|
if (width) {
|
|
392
334
|
return width / height;
|
|
393
335
|
}
|
|
336
|
+
|
|
394
337
|
// TODO handle this case
|
|
395
338
|
return 1;
|
|
396
339
|
}
|
|
340
|
+
get insideInlineLike() {
|
|
341
|
+
const $pos = this.$pos;
|
|
342
|
+
if (!$pos) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
const {
|
|
346
|
+
listItem
|
|
347
|
+
} = this.props.view.state.schema.nodes;
|
|
348
|
+
return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
|
|
349
|
+
}
|
|
350
|
+
get insideLayout() {
|
|
351
|
+
const $pos = this.$pos;
|
|
352
|
+
if (!$pos) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
const {
|
|
356
|
+
layoutColumn
|
|
357
|
+
} = this.props.view.state.schema.nodes;
|
|
358
|
+
return !!findParentNodeOfTypeClosestToPos($pos, [layoutColumn]);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// check if is inside of layout, table, expand, nestedExpand and list item
|
|
362
|
+
isNestedNode() {
|
|
363
|
+
const $pos = this.$pos;
|
|
364
|
+
return !!($pos && $pos.parent.type !== $pos.parent.type.schema.nodes.doc);
|
|
365
|
+
}
|
|
366
|
+
getDefaultGuidelines() {
|
|
367
|
+
const {
|
|
368
|
+
lineLength,
|
|
369
|
+
containerWidth,
|
|
370
|
+
fullWidthMode
|
|
371
|
+
} = this.props;
|
|
372
|
+
|
|
373
|
+
// disable guidelines for nested media single node
|
|
374
|
+
return this.isNestedNode() ? [] : generateDefaultGuidelines(lineLength, containerWidth, fullWidthMode);
|
|
375
|
+
}
|
|
397
376
|
async checkVideoFile(viewMediaClientConfig) {
|
|
398
377
|
const $pos = this.$pos;
|
|
399
378
|
if (!$pos || !viewMediaClientConfig) {
|
|
@@ -419,48 +398,6 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
419
398
|
});
|
|
420
399
|
}
|
|
421
400
|
}
|
|
422
|
-
get $pos() {
|
|
423
|
-
if (typeof this.props.getPos !== 'function') {
|
|
424
|
-
return null;
|
|
425
|
-
}
|
|
426
|
-
const pos = this.props.getPos();
|
|
427
|
-
if (Number.isNaN(pos) || typeof pos !== 'number') {
|
|
428
|
-
return null;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// need to pass view because we may not get updated props in time
|
|
432
|
-
return this.props.view.state.doc.resolve(pos);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* The maxmimum number of grid columns this node can resize to.
|
|
437
|
-
*/
|
|
438
|
-
get gridWidth() {
|
|
439
|
-
const {
|
|
440
|
-
gridSize
|
|
441
|
-
} = this.props;
|
|
442
|
-
return !(this.wrappedLayout || this.insideInlineLike) ? gridSize / 2 : gridSize;
|
|
443
|
-
}
|
|
444
|
-
get insideInlineLike() {
|
|
445
|
-
const $pos = this.$pos;
|
|
446
|
-
if (!$pos) {
|
|
447
|
-
return false;
|
|
448
|
-
}
|
|
449
|
-
const {
|
|
450
|
-
listItem
|
|
451
|
-
} = this.props.view.state.schema.nodes;
|
|
452
|
-
return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
|
|
453
|
-
}
|
|
454
|
-
get insideLayout() {
|
|
455
|
-
const $pos = this.$pos;
|
|
456
|
-
if (!$pos) {
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
const {
|
|
460
|
-
layoutColumn
|
|
461
|
-
} = this.props.view.state.schema.nodes;
|
|
462
|
-
return !!findParentNodeOfTypeClosestToPos($pos, [layoutColumn]);
|
|
463
|
-
}
|
|
464
401
|
render() {
|
|
465
402
|
const {
|
|
466
403
|
width: origWidth,
|
|
@@ -21,7 +21,7 @@ import { usePresetContext } from './presets/context';
|
|
|
21
21
|
* , []);
|
|
22
22
|
*
|
|
23
23
|
* // Can execute typesafe commands based on plugin1 or 2
|
|
24
|
-
* const runCommand = () => editorApi.
|
|
24
|
+
* const runCommand = () => editorApi.dependencies.core.actions.execute(
|
|
25
25
|
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
26
26
|
* )
|
|
27
27
|
* return (
|
|
@@ -165,19 +165,19 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
_defineProperty(_assertThisInitialized(_this), "toggleLinkPanel", function (inputMethod) {
|
|
168
|
-
var _pluginInjectionApi$
|
|
168
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3;
|
|
169
169
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
170
|
-
return (_pluginInjectionApi$
|
|
170
|
+
return (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.hyperlink) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : false;
|
|
171
171
|
});
|
|
172
172
|
_defineProperty(_assertThisInitialized(_this), "insertMention", function (inputMethod) {
|
|
173
|
-
var _pluginInjectionApi$
|
|
173
|
+
var _pluginInjectionApi$d4;
|
|
174
174
|
var _this$props = _this.props,
|
|
175
175
|
editorView = _this$props.editorView,
|
|
176
176
|
pluginInjectionApi = _this$props.pluginInjectionApi;
|
|
177
177
|
if (!editorView) {
|
|
178
178
|
return true;
|
|
179
179
|
}
|
|
180
|
-
var pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
180
|
+
var pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies.mention) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.sharedState.currentState();
|
|
181
181
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
182
182
|
return false;
|
|
183
183
|
}
|
|
@@ -185,13 +185,13 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
185
185
|
return true;
|
|
186
186
|
});
|
|
187
187
|
_defineProperty(_assertThisInitialized(_this), "insertTable", function (inputMethod) {
|
|
188
|
-
var _pluginInjectionApi$
|
|
188
|
+
var _pluginInjectionApi$d5, _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
189
189
|
var _this$props2 = _this.props,
|
|
190
190
|
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
191
191
|
editorView = _this$props2.editorView;
|
|
192
192
|
var state = editorView.state,
|
|
193
193
|
dispatch = editorView.dispatch;
|
|
194
|
-
return (_pluginInjectionApi$
|
|
194
|
+
return (_pluginInjectionApi$d5 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.table) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : (_pluginInjectionApi$d7 = (_pluginInjectionApi$d8 = _pluginInjectionApi$d6.actions).insertTable) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.call(_pluginInjectionApi$d8, {
|
|
195
195
|
action: ACTION.INSERTED,
|
|
196
196
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
197
197
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
@@ -199,7 +199,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
199
199
|
inputMethod: inputMethod
|
|
200
200
|
},
|
|
201
201
|
eventType: EVENT_TYPE.TRACK
|
|
202
|
-
})(state, dispatch)) !== null && _pluginInjectionApi$
|
|
202
|
+
})(state, dispatch)) !== null && _pluginInjectionApi$d5 !== void 0 ? _pluginInjectionApi$d5 : false;
|
|
203
203
|
});
|
|
204
204
|
_defineProperty(_assertThisInitialized(_this), "createDate", function (inputMethod) {
|
|
205
205
|
var editorView = _this.props.editorView;
|
|
@@ -276,10 +276,10 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
276
276
|
};
|
|
277
277
|
});
|
|
278
278
|
_defineProperty(_assertThisInitialized(_this), "handleSelectedEmoji", function (emojiId) {
|
|
279
|
-
var _pluginInjectionApi$
|
|
279
|
+
var _pluginInjectionApi$d9;
|
|
280
280
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
281
281
|
_this.props.editorView.focus();
|
|
282
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
282
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.core.actions.execute((_pluginInjectionApi$d9 = pluginInjectionApi.dependencies.emoji) === null || _pluginInjectionApi$d9 === void 0 ? void 0 : _pluginInjectionApi$d9.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
|
|
283
283
|
_this.toggleEmojiPicker();
|
|
284
284
|
return true;
|
|
285
285
|
});
|