@atlaskit/editor-plugin-insert-block 1.3.11 → 1.3.13
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
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 1.3.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.3.12
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#117356](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117356)
|
|
14
|
+
[`9d772a51e5663`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9d772a51e5663) -
|
|
15
|
+
[ux] Fix inserting status from insert block dropdown.
|
|
16
|
+
|
|
17
|
+
Introduces new command on status plugin "insertStatus" which can be used by toolbars to insert a
|
|
18
|
+
status node.
|
|
19
|
+
|
|
20
|
+
Example:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
return pluginInjectionApi?.core?.actions.execute(
|
|
24
|
+
pluginInjectionApi?.status?.commands?.insertStatus(inputMethod),
|
|
25
|
+
);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 1.3.11
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -305,16 +305,14 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
305
305
|
return true;
|
|
306
306
|
});
|
|
307
307
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createStatus", function (inputMethod) {
|
|
308
|
-
var _pluginInjectionApi$
|
|
309
|
-
var
|
|
310
|
-
|
|
311
|
-
editorView = _this$props5.editorView;
|
|
312
|
-
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 || (_pluginInjectionApi$s2 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
308
|
+
var _pluginInjectionApi$c5, _pluginInjectionApi$s;
|
|
309
|
+
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
310
|
+
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 || (_pluginInjectionApi$s = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.insertStatus(inputMethod)));
|
|
313
311
|
});
|
|
314
312
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openMediaPicker", function (inputMethod) {
|
|
315
|
-
var _this$
|
|
316
|
-
onShowMediaPicker = _this$
|
|
317
|
-
dispatchAnalyticsEvent = _this$
|
|
313
|
+
var _this$props5 = _this.props,
|
|
314
|
+
onShowMediaPicker = _this$props5.onShowMediaPicker,
|
|
315
|
+
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
|
|
318
316
|
if (onShowMediaPicker) {
|
|
319
317
|
onShowMediaPicker();
|
|
320
318
|
if (dispatchAnalyticsEvent) {
|
|
@@ -334,38 +332,38 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
334
332
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTaskDecision", function (name, inputMethod) {
|
|
335
333
|
return function () {
|
|
336
334
|
var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
|
|
337
|
-
var _this$
|
|
338
|
-
_this$
|
|
339
|
-
state = _this$
|
|
340
|
-
dispatch = _this$
|
|
341
|
-
pluginInjectionApi = _this$
|
|
335
|
+
var _this$props6 = _this.props,
|
|
336
|
+
_this$props6$editorVi = _this$props6.editorView,
|
|
337
|
+
state = _this$props6$editorVi.state,
|
|
338
|
+
dispatch = _this$props6$editorVi.dispatch,
|
|
339
|
+
pluginInjectionApi = _this$props6.pluginInjectionApi;
|
|
342
340
|
var listType = name === 'action' ? 'taskList' : 'decisionList';
|
|
343
341
|
return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
|
|
344
342
|
};
|
|
345
343
|
});
|
|
346
344
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
|
|
347
345
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
346
|
+
var _this$props7 = _this.props,
|
|
347
|
+
_this$props7$editorVi = _this$props7.editorView,
|
|
348
|
+
state = _this$props7$editorVi.state,
|
|
349
|
+
dispatch = _this$props7$editorVi.dispatch,
|
|
350
|
+
pluginInjectionApi = _this$props7.pluginInjectionApi;
|
|
351
|
+
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
352
|
+
});
|
|
353
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
354
|
+
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
348
355
|
var _this$props8 = _this.props,
|
|
349
356
|
_this$props8$editorVi = _this$props8.editorView,
|
|
350
357
|
state = _this$props8$editorVi.state,
|
|
351
358
|
dispatch = _this$props8$editorVi.dispatch,
|
|
352
359
|
pluginInjectionApi = _this$props8.pluginInjectionApi;
|
|
353
|
-
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
354
|
-
});
|
|
355
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
356
|
-
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
357
|
-
var _this$props9 = _this.props,
|
|
358
|
-
_this$props9$editorVi = _this$props9.editorView,
|
|
359
|
-
state = _this$props9$editorVi.state,
|
|
360
|
-
dispatch = _this$props9$editorVi.dispatch,
|
|
361
|
-
pluginInjectionApi = _this$props9.pluginInjectionApi;
|
|
362
360
|
return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.expand) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.actions.insertExpand(state, dispatch)) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
|
|
363
361
|
});
|
|
364
362
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertBlockType", function (itemName) {
|
|
365
363
|
return function () {
|
|
366
|
-
var _this$
|
|
367
|
-
editorView = _this$
|
|
368
|
-
onInsertBlockType = _this$
|
|
364
|
+
var _this$props9 = _this.props,
|
|
365
|
+
editorView = _this$props9.editorView,
|
|
366
|
+
onInsertBlockType = _this$props9.onInsertBlockType;
|
|
369
367
|
var state = editorView.state,
|
|
370
368
|
dispatch = editorView.dispatch;
|
|
371
369
|
onInsertBlockType(itemName)(state, dispatch);
|
|
@@ -373,26 +371,26 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
373
371
|
};
|
|
374
372
|
});
|
|
375
373
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSelectedEmoji", function (emojiId) {
|
|
376
|
-
var _pluginInjectionApi$
|
|
374
|
+
var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
|
|
377
375
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
378
376
|
_this.props.editorView.focus();
|
|
379
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
377
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 || _pluginInjectionApi$c6.actions.execute((_pluginInjectionApi$e3 = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.commands.insertEmoji(emojiId, _analytics.INPUT_METHOD.PICKER));
|
|
380
378
|
_this.toggleEmojiPicker();
|
|
381
379
|
return true;
|
|
382
380
|
});
|
|
383
381
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openElementBrowser", function () {
|
|
384
|
-
var _pluginInjectionApi$
|
|
382
|
+
var _pluginInjectionApi$c7, _pluginInjectionApi$q;
|
|
385
383
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
386
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
384
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 || _pluginInjectionApi$c7.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
387
385
|
});
|
|
388
386
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref3) {
|
|
389
387
|
var item = _ref3.item,
|
|
390
388
|
inputMethod = _ref3.inputMethod;
|
|
391
|
-
var _this$
|
|
392
|
-
editorView = _this$
|
|
393
|
-
editorActions = _this$
|
|
394
|
-
handleImageUpload = _this$
|
|
395
|
-
expandEnabled = _this$
|
|
389
|
+
var _this$props10 = _this.props,
|
|
390
|
+
editorView = _this$props10.editorView,
|
|
391
|
+
editorActions = _this$props10.editorActions,
|
|
392
|
+
handleImageUpload = _this$props10.handleImageUpload,
|
|
393
|
+
expandEnabled = _this$props10.expandEnabled;
|
|
396
394
|
|
|
397
395
|
// need to do this before inserting nodes so scrollIntoView works properly
|
|
398
396
|
if (!editorView.hasFocus()) {
|
|
@@ -518,12 +516,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
518
516
|
value: function renderPopup() {
|
|
519
517
|
var _this3 = this;
|
|
520
518
|
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
521
|
-
var _this$
|
|
522
|
-
popupsMountPoint = _this$
|
|
523
|
-
popupsBoundariesElement = _this$
|
|
524
|
-
popupsScrollableElement = _this$
|
|
525
|
-
emojiProvider = _this$
|
|
526
|
-
replacePlusMenuWithElementBrowser = _this$
|
|
519
|
+
var _this$props11 = this.props,
|
|
520
|
+
popupsMountPoint = _this$props11.popupsMountPoint,
|
|
521
|
+
popupsBoundariesElement = _this$props11.popupsBoundariesElement,
|
|
522
|
+
popupsScrollableElement = _this$props11.popupsScrollableElement,
|
|
523
|
+
emojiProvider = _this$props11.emojiProvider,
|
|
524
|
+
replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
|
|
527
525
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref5) {
|
|
528
526
|
var name = _ref5.value.name;
|
|
529
527
|
return name === 'emoji';
|
|
@@ -562,11 +560,11 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
562
560
|
var _this$state = this.state,
|
|
563
561
|
isTableSelectorOpen = _this$state.isTableSelectorOpen,
|
|
564
562
|
isTableSelectorOpenedByKeyboard = _this$state.isTableSelectorOpenedByKeyboard;
|
|
565
|
-
var _this$
|
|
566
|
-
popupsMountPoint = _this$
|
|
567
|
-
popupsBoundariesElement = _this$
|
|
568
|
-
popupsScrollableElement = _this$
|
|
569
|
-
pluginInjectionApi = _this$
|
|
563
|
+
var _this$props12 = this.props,
|
|
564
|
+
popupsMountPoint = _this$props12.popupsMountPoint,
|
|
565
|
+
popupsBoundariesElement = _this$props12.popupsBoundariesElement,
|
|
566
|
+
popupsScrollableElement = _this$props12.popupsScrollableElement,
|
|
567
|
+
pluginInjectionApi = _this$props12.pluginInjectionApi;
|
|
570
568
|
var ref = (_this$tableButtonRef$ = this.tableButtonRef.current) !== null && _this$tableButtonRef$ !== void 0 ? _this$tableButtonRef$ : undefined;
|
|
571
569
|
if (!isTableSelectorOpen) {
|
|
572
570
|
return null;
|
|
@@ -578,8 +576,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
578
576
|
// Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
|
|
579
577
|
// So we can start typing right away.
|
|
580
578
|
var onUnmount = function onUnmount() {
|
|
581
|
-
var _pluginInjectionApi$
|
|
582
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
579
|
+
var _pluginInjectionApi$c8;
|
|
580
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 || (_pluginInjectionApi$c8 = _pluginInjectionApi$c8.actions) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : _pluginInjectionApi$c8.focus();
|
|
583
581
|
};
|
|
584
582
|
return (0, _react2.jsx)(_tableSelectorPopupWithListeners.default, {
|
|
585
583
|
target: ref,
|
|
@@ -617,9 +615,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
617
615
|
dropdownItems = _this$state2.dropdownItems,
|
|
618
616
|
emojiPickerOpen = _this$state2.emojiPickerOpen,
|
|
619
617
|
isTableSelectorOpen = _this$state2.isTableSelectorOpen;
|
|
620
|
-
var _this$
|
|
621
|
-
isDisabled = _this$
|
|
622
|
-
isReducedSpacing = _this$
|
|
618
|
+
var _this$props13 = this.props,
|
|
619
|
+
isDisabled = _this$props13.isDisabled,
|
|
620
|
+
isReducedSpacing = _this$props13.isReducedSpacing;
|
|
623
621
|
var isTableButtonVisible = buttons.some(function (_ref6) {
|
|
624
622
|
var value = _ref6.value;
|
|
625
623
|
return value.name === 'table';
|
|
@@ -314,12 +314,11 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
314
314
|
return true;
|
|
315
315
|
});
|
|
316
316
|
_defineProperty(this, "createStatus", inputMethod => {
|
|
317
|
-
var _pluginInjectionApi$
|
|
317
|
+
var _pluginInjectionApi$c5, _pluginInjectionApi$s, _pluginInjectionApi$s2;
|
|
318
318
|
const {
|
|
319
|
-
pluginInjectionApi
|
|
320
|
-
editorView
|
|
319
|
+
pluginInjectionApi
|
|
321
320
|
} = this.props;
|
|
322
|
-
return (
|
|
321
|
+
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 ? void 0 : (_pluginInjectionApi$s2 = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.insertStatus(inputMethod)));
|
|
323
322
|
});
|
|
324
323
|
_defineProperty(this, "openMediaPicker", inputMethod => {
|
|
325
324
|
const {
|
|
@@ -389,21 +388,21 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
389
388
|
return true;
|
|
390
389
|
});
|
|
391
390
|
_defineProperty(this, "handleSelectedEmoji", emojiId => {
|
|
392
|
-
var _pluginInjectionApi$
|
|
391
|
+
var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
|
|
393
392
|
const {
|
|
394
393
|
pluginInjectionApi
|
|
395
394
|
} = this.props;
|
|
396
395
|
this.props.editorView.focus();
|
|
397
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
396
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.actions.execute((_pluginInjectionApi$e3 = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
|
|
398
397
|
this.toggleEmojiPicker();
|
|
399
398
|
return true;
|
|
400
399
|
});
|
|
401
400
|
_defineProperty(this, "openElementBrowser", () => {
|
|
402
|
-
var _pluginInjectionApi$
|
|
401
|
+
var _pluginInjectionApi$c7, _pluginInjectionApi$q;
|
|
403
402
|
const {
|
|
404
403
|
pluginInjectionApi
|
|
405
404
|
} = this.props;
|
|
406
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
405
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : _pluginInjectionApi$c7.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
407
406
|
});
|
|
408
407
|
_defineProperty(this, "onItemActivated", ({
|
|
409
408
|
item,
|
|
@@ -635,8 +634,8 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
635
634
|
// Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
|
|
636
635
|
// So we can start typing right away.
|
|
637
636
|
const onUnmount = () => {
|
|
638
|
-
var _pluginInjectionApi$
|
|
639
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
637
|
+
var _pluginInjectionApi$c8, _pluginInjectionApi$c9;
|
|
638
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : (_pluginInjectionApi$c9 = _pluginInjectionApi$c8.actions) === null || _pluginInjectionApi$c9 === void 0 ? void 0 : _pluginInjectionApi$c9.focus();
|
|
640
639
|
};
|
|
641
640
|
return jsx(TableSelectorPopup, {
|
|
642
641
|
target: ref,
|
|
@@ -296,16 +296,14 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
296
296
|
return true;
|
|
297
297
|
});
|
|
298
298
|
_defineProperty(_assertThisInitialized(_this), "createStatus", function (inputMethod) {
|
|
299
|
-
var _pluginInjectionApi$
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
editorView = _this$props5.editorView;
|
|
303
|
-
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 || (_pluginInjectionApi$s2 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
299
|
+
var _pluginInjectionApi$c5, _pluginInjectionApi$s;
|
|
300
|
+
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
301
|
+
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : _pluginInjectionApi$c5.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.status) === null || _pluginInjectionApi$s === void 0 || (_pluginInjectionApi$s = _pluginInjectionApi$s.commands) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.insertStatus(inputMethod)));
|
|
304
302
|
});
|
|
305
303
|
_defineProperty(_assertThisInitialized(_this), "openMediaPicker", function (inputMethod) {
|
|
306
|
-
var _this$
|
|
307
|
-
onShowMediaPicker = _this$
|
|
308
|
-
dispatchAnalyticsEvent = _this$
|
|
304
|
+
var _this$props5 = _this.props,
|
|
305
|
+
onShowMediaPicker = _this$props5.onShowMediaPicker,
|
|
306
|
+
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
|
|
309
307
|
if (onShowMediaPicker) {
|
|
310
308
|
onShowMediaPicker();
|
|
311
309
|
if (dispatchAnalyticsEvent) {
|
|
@@ -325,38 +323,38 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
325
323
|
_defineProperty(_assertThisInitialized(_this), "insertTaskDecision", function (name, inputMethod) {
|
|
326
324
|
return function () {
|
|
327
325
|
var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
|
|
328
|
-
var _this$
|
|
329
|
-
_this$
|
|
330
|
-
state = _this$
|
|
331
|
-
dispatch = _this$
|
|
332
|
-
pluginInjectionApi = _this$
|
|
326
|
+
var _this$props6 = _this.props,
|
|
327
|
+
_this$props6$editorVi = _this$props6.editorView,
|
|
328
|
+
state = _this$props6$editorVi.state,
|
|
329
|
+
dispatch = _this$props6$editorVi.dispatch,
|
|
330
|
+
pluginInjectionApi = _this$props6.pluginInjectionApi;
|
|
333
331
|
var listType = name === 'action' ? 'taskList' : 'decisionList';
|
|
334
332
|
return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
|
|
335
333
|
};
|
|
336
334
|
});
|
|
337
335
|
_defineProperty(_assertThisInitialized(_this), "insertHorizontalRule", function (inputMethod) {
|
|
338
336
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
337
|
+
var _this$props7 = _this.props,
|
|
338
|
+
_this$props7$editorVi = _this$props7.editorView,
|
|
339
|
+
state = _this$props7$editorVi.state,
|
|
340
|
+
dispatch = _this$props7$editorVi.dispatch,
|
|
341
|
+
pluginInjectionApi = _this$props7.pluginInjectionApi;
|
|
342
|
+
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
343
|
+
});
|
|
344
|
+
_defineProperty(_assertThisInitialized(_this), "insertExpand", function () {
|
|
345
|
+
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
339
346
|
var _this$props8 = _this.props,
|
|
340
347
|
_this$props8$editorVi = _this$props8.editorView,
|
|
341
348
|
state = _this$props8$editorVi.state,
|
|
342
349
|
dispatch = _this$props8$editorVi.dispatch,
|
|
343
350
|
pluginInjectionApi = _this$props8.pluginInjectionApi;
|
|
344
|
-
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
345
|
-
});
|
|
346
|
-
_defineProperty(_assertThisInitialized(_this), "insertExpand", function () {
|
|
347
|
-
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
348
|
-
var _this$props9 = _this.props,
|
|
349
|
-
_this$props9$editorVi = _this$props9.editorView,
|
|
350
|
-
state = _this$props9$editorVi.state,
|
|
351
|
-
dispatch = _this$props9$editorVi.dispatch,
|
|
352
|
-
pluginInjectionApi = _this$props9.pluginInjectionApi;
|
|
353
351
|
return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.expand) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.actions.insertExpand(state, dispatch)) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
|
|
354
352
|
});
|
|
355
353
|
_defineProperty(_assertThisInitialized(_this), "insertBlockType", function (itemName) {
|
|
356
354
|
return function () {
|
|
357
|
-
var _this$
|
|
358
|
-
editorView = _this$
|
|
359
|
-
onInsertBlockType = _this$
|
|
355
|
+
var _this$props9 = _this.props,
|
|
356
|
+
editorView = _this$props9.editorView,
|
|
357
|
+
onInsertBlockType = _this$props9.onInsertBlockType;
|
|
360
358
|
var state = editorView.state,
|
|
361
359
|
dispatch = editorView.dispatch;
|
|
362
360
|
onInsertBlockType(itemName)(state, dispatch);
|
|
@@ -364,26 +362,26 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
364
362
|
};
|
|
365
363
|
});
|
|
366
364
|
_defineProperty(_assertThisInitialized(_this), "handleSelectedEmoji", function (emojiId) {
|
|
367
|
-
var _pluginInjectionApi$
|
|
365
|
+
var _pluginInjectionApi$c6, _pluginInjectionApi$e3;
|
|
368
366
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
369
367
|
_this.props.editorView.focus();
|
|
370
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
368
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 || _pluginInjectionApi$c6.actions.execute((_pluginInjectionApi$e3 = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
|
|
371
369
|
_this.toggleEmojiPicker();
|
|
372
370
|
return true;
|
|
373
371
|
});
|
|
374
372
|
_defineProperty(_assertThisInitialized(_this), "openElementBrowser", function () {
|
|
375
|
-
var _pluginInjectionApi$
|
|
373
|
+
var _pluginInjectionApi$c7, _pluginInjectionApi$q;
|
|
376
374
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
377
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
375
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c7 = pluginInjectionApi.core) === null || _pluginInjectionApi$c7 === void 0 || _pluginInjectionApi$c7.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
378
376
|
});
|
|
379
377
|
_defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref3) {
|
|
380
378
|
var item = _ref3.item,
|
|
381
379
|
inputMethod = _ref3.inputMethod;
|
|
382
|
-
var _this$
|
|
383
|
-
editorView = _this$
|
|
384
|
-
editorActions = _this$
|
|
385
|
-
handleImageUpload = _this$
|
|
386
|
-
expandEnabled = _this$
|
|
380
|
+
var _this$props10 = _this.props,
|
|
381
|
+
editorView = _this$props10.editorView,
|
|
382
|
+
editorActions = _this$props10.editorActions,
|
|
383
|
+
handleImageUpload = _this$props10.handleImageUpload,
|
|
384
|
+
expandEnabled = _this$props10.expandEnabled;
|
|
387
385
|
|
|
388
386
|
// need to do this before inserting nodes so scrollIntoView works properly
|
|
389
387
|
if (!editorView.hasFocus()) {
|
|
@@ -509,12 +507,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
509
507
|
value: function renderPopup() {
|
|
510
508
|
var _this3 = this;
|
|
511
509
|
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
512
|
-
var _this$
|
|
513
|
-
popupsMountPoint = _this$
|
|
514
|
-
popupsBoundariesElement = _this$
|
|
515
|
-
popupsScrollableElement = _this$
|
|
516
|
-
emojiProvider = _this$
|
|
517
|
-
replacePlusMenuWithElementBrowser = _this$
|
|
510
|
+
var _this$props11 = this.props,
|
|
511
|
+
popupsMountPoint = _this$props11.popupsMountPoint,
|
|
512
|
+
popupsBoundariesElement = _this$props11.popupsBoundariesElement,
|
|
513
|
+
popupsScrollableElement = _this$props11.popupsScrollableElement,
|
|
514
|
+
emojiProvider = _this$props11.emojiProvider,
|
|
515
|
+
replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
|
|
518
516
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref5) {
|
|
519
517
|
var name = _ref5.value.name;
|
|
520
518
|
return name === 'emoji';
|
|
@@ -553,11 +551,11 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
553
551
|
var _this$state = this.state,
|
|
554
552
|
isTableSelectorOpen = _this$state.isTableSelectorOpen,
|
|
555
553
|
isTableSelectorOpenedByKeyboard = _this$state.isTableSelectorOpenedByKeyboard;
|
|
556
|
-
var _this$
|
|
557
|
-
popupsMountPoint = _this$
|
|
558
|
-
popupsBoundariesElement = _this$
|
|
559
|
-
popupsScrollableElement = _this$
|
|
560
|
-
pluginInjectionApi = _this$
|
|
554
|
+
var _this$props12 = this.props,
|
|
555
|
+
popupsMountPoint = _this$props12.popupsMountPoint,
|
|
556
|
+
popupsBoundariesElement = _this$props12.popupsBoundariesElement,
|
|
557
|
+
popupsScrollableElement = _this$props12.popupsScrollableElement,
|
|
558
|
+
pluginInjectionApi = _this$props12.pluginInjectionApi;
|
|
561
559
|
var ref = (_this$tableButtonRef$ = this.tableButtonRef.current) !== null && _this$tableButtonRef$ !== void 0 ? _this$tableButtonRef$ : undefined;
|
|
562
560
|
if (!isTableSelectorOpen) {
|
|
563
561
|
return null;
|
|
@@ -569,8 +567,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
569
567
|
// Popup will be unmounted to ensure that the new table has a selection with a blinking cursor.
|
|
570
568
|
// So we can start typing right away.
|
|
571
569
|
var onUnmount = function onUnmount() {
|
|
572
|
-
var _pluginInjectionApi$
|
|
573
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
570
|
+
var _pluginInjectionApi$c8;
|
|
571
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 || (_pluginInjectionApi$c8 = _pluginInjectionApi$c8.actions) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : _pluginInjectionApi$c8.focus();
|
|
574
572
|
};
|
|
575
573
|
return jsx(TableSelectorPopup, {
|
|
576
574
|
target: ref,
|
|
@@ -608,9 +606,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
608
606
|
dropdownItems = _this$state2.dropdownItems,
|
|
609
607
|
emojiPickerOpen = _this$state2.emojiPickerOpen,
|
|
610
608
|
isTableSelectorOpen = _this$state2.isTableSelectorOpen;
|
|
611
|
-
var _this$
|
|
612
|
-
isDisabled = _this$
|
|
613
|
-
isReducedSpacing = _this$
|
|
609
|
+
var _this$props13 = this.props,
|
|
610
|
+
isDisabled = _this$props13.isDisabled,
|
|
611
|
+
isReducedSpacing = _this$props13.isReducedSpacing;
|
|
614
612
|
var isTableButtonVisible = buttons.some(function (_ref6) {
|
|
615
613
|
var value = _ref6.value;
|
|
616
614
|
return value.name === 'table';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/editor-common": "^84.
|
|
36
|
+
"@atlaskit/editor-common": "^84.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.4.0",
|
|
38
38
|
"@atlaskit/editor-plugin-block-type": "^3.8.0",
|
|
39
|
-
"@atlaskit/editor-plugin-code-block": "^
|
|
39
|
+
"@atlaskit/editor-plugin-code-block": "^3.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-date": "^2.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-emoji": "^2.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-expand": "^2.0.0",
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"@atlaskit/editor-plugin-placeholder-text": "^1.4.0",
|
|
51
51
|
"@atlaskit/editor-plugin-quick-insert": "^1.1.0",
|
|
52
52
|
"@atlaskit/editor-plugin-rule": "^1.5.0",
|
|
53
|
-
"@atlaskit/editor-plugin-status": "^2.
|
|
53
|
+
"@atlaskit/editor-plugin-status": "^2.1.0",
|
|
54
54
|
"@atlaskit/editor-plugin-table": "^7.19.0",
|
|
55
55
|
"@atlaskit/editor-plugin-tasks-and-decisions": "^2.0.0",
|
|
56
56
|
"@atlaskit/editor-plugin-type-ahead": "^1.4.0",
|
|
57
57
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
58
58
|
"@atlaskit/editor-shared-styles": "^2.12.0",
|
|
59
59
|
"@atlaskit/emoji": "^67.6.0",
|
|
60
|
-
"@atlaskit/icon": "^22.
|
|
61
|
-
"@atlaskit/primitives": "^10.
|
|
60
|
+
"@atlaskit/icon": "^22.6.0",
|
|
61
|
+
"@atlaskit/primitives": "^10.1.0",
|
|
62
62
|
"@atlaskit/theme": "^12.11.0",
|
|
63
63
|
"@atlaskit/tokens": "^1.53.0",
|
|
64
64
|
"@babel/runtime": "^7.0.0",
|