@atlaskit/editor-core 189.3.38 → 189.4.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/plugins/extension/commands.js +9 -2
- package/dist/cjs/plugins/extension/index.js +15 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +2 -1
- package/dist/cjs/plugins/extension/toolbar.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +1 -8
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +29 -10
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionNodeWrapper.js +7 -0
- package/dist/cjs/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +154 -0
- package/dist/cjs/plugins/extension/utils.js +6 -4
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/ui/ContentStyles/extension.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/extension/commands.js +10 -3
- package/dist/es2019/plugins/extension/index.js +16 -2
- package/dist/es2019/plugins/extension/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/extension/toolbar.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +1 -8
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +29 -10
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionNodeWrapper.js +7 -0
- package/dist/es2019/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +159 -0
- package/dist/es2019/plugins/extension/utils.js +6 -4
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/ui/ContentStyles/extension.js +6 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/extension/commands.js +9 -2
- package/dist/esm/plugins/extension/index.js +16 -2
- package/dist/esm/plugins/extension/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/extension/toolbar.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +1 -8
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +29 -10
- package/dist/esm/plugins/extension/ui/Extension/ExtensionNodeWrapper.js +7 -0
- package/dist/esm/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +146 -0
- package/dist/esm/plugins/extension/utils.js +6 -4
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/ui/ContentStyles/extension.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/extension/commands.d.ts +2 -0
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +1 -0
- package/dist/types/plugins/extension/ui/Extension/ExtensionNodeWrapper.d.ts +7 -0
- package/dist/types/plugins/extension/ui/Extension/MultiBodiedExtension/index.d.ts +16 -0
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/extension/commands.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +1 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionNodeWrapper.d.ts +7 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/MultiBodiedExtension/index.d.ts +16 -0
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/package.json +7 -6
- package/dist/cjs/plugins/insert-block/index.js +0 -165
- package/dist/cjs/plugins/insert-block/types.js +0 -5
- package/dist/cjs/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -152
- package/dist/cjs/plugins/insert-block/ui/ElementBrowser/types.js +0 -5
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -42
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -66
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -217
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -49
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -565
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -250
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -12
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -20
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -30
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -11
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -5
- package/dist/es2019/plugins/insert-block/index.js +0 -159
- package/dist/es2019/plugins/insert-block/types.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -150
- package/dist/es2019/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -198
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -37
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -558
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -201
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -8
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -22
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -16
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +0 -158
- package/dist/esm/plugins/insert-block/types.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -146
- package/dist/esm/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -210
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -41
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -560
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -243
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -13
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -24
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -4
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
- package/dist/types/plugins/insert-block/index.d.ts +0 -16
- package/dist/types/plugins/insert-block/types.d.ts +0 -45
- package/dist/types/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
- package/dist/types/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -39
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
- package/dist/types-ts4.5/plugins/insert-block/index.d.ts +0 -16
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +0 -45
- package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
- package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -42
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
|
@@ -1,565 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.ToolbarInsertBlock = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
var _react2 = require("@emotion/react");
|
|
18
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
19
|
-
var _reactIntlNext = require("react-intl-next");
|
|
20
|
-
var _picker = require("@atlaskit/emoji/picker");
|
|
21
|
-
var _ui = require("@atlaskit/editor-common/ui");
|
|
22
|
-
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
23
|
-
var _styles = require("@atlaskit/editor-common/styles");
|
|
24
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
25
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
26
|
-
var _messages = require("./messages");
|
|
27
|
-
var _createItems3 = require("./create-items");
|
|
28
|
-
var _blockInsertMenu = require("./block-insert-menu");
|
|
29
|
-
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
30
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
31
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
|
-
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); }; }
|
|
33
|
-
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; } } /** @jsx jsx */
|
|
34
|
-
/**
|
|
35
|
-
* Checks if an element is detached (i.e. not in the current document)
|
|
36
|
-
*/
|
|
37
|
-
var isDetachedElement = function isDetachedElement(el) {
|
|
38
|
-
return !document.body.contains(el);
|
|
39
|
-
};
|
|
40
|
-
var noop = function noop() {};
|
|
41
|
-
var EmojiPickerWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_picker.EmojiPicker);
|
|
42
|
-
var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
43
|
-
(0, _inherits2.default)(ToolbarInsertBlock, _React$PureComponent);
|
|
44
|
-
var _super = _createSuper(ToolbarInsertBlock);
|
|
45
|
-
function ToolbarInsertBlock() {
|
|
46
|
-
var _this;
|
|
47
|
-
(0, _classCallCheck2.default)(this, ToolbarInsertBlock);
|
|
48
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
|
-
args[_key] = arguments[_key];
|
|
50
|
-
}
|
|
51
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
52
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
53
|
-
isPlusMenuOpen: false,
|
|
54
|
-
emojiPickerOpen: false,
|
|
55
|
-
isOpenedByKeyboard: false,
|
|
56
|
-
buttons: [],
|
|
57
|
-
dropdownItems: []
|
|
58
|
-
});
|
|
59
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOpenChange", function (attrs) {
|
|
60
|
-
var state = {
|
|
61
|
-
isPlusMenuOpen: attrs.isPlusMenuOpen,
|
|
62
|
-
emojiPickerOpen: _this.state.emojiPickerOpen
|
|
63
|
-
};
|
|
64
|
-
if (_this.state.emojiPickerOpen && !attrs.open) {
|
|
65
|
-
state.emojiPickerOpen = false;
|
|
66
|
-
}
|
|
67
|
-
_this.setState(state, function () {
|
|
68
|
-
var dispatchAnalyticsEvent = _this.props.dispatchAnalyticsEvent;
|
|
69
|
-
if (!dispatchAnalyticsEvent) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
var isPlusMenuOpen = _this.state.isPlusMenuOpen;
|
|
73
|
-
if (isPlusMenuOpen) {
|
|
74
|
-
return dispatchAnalyticsEvent({
|
|
75
|
-
action: _analytics.ACTION.OPENED,
|
|
76
|
-
actionSubject: _analytics.ACTION_SUBJECT.PLUS_MENU,
|
|
77
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return dispatchAnalyticsEvent({
|
|
81
|
-
action: _analytics.ACTION.CLOSED,
|
|
82
|
-
actionSubject: _analytics.ACTION_SUBJECT.PLUS_MENU,
|
|
83
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "togglePlusMenuVisibility", function (event) {
|
|
88
|
-
var isPlusMenuOpen = _this.state.isPlusMenuOpen;
|
|
89
|
-
_this.onOpenChange({
|
|
90
|
-
isPlusMenuOpen: !isPlusMenuOpen
|
|
91
|
-
});
|
|
92
|
-
if ((event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
93
|
-
var _ref;
|
|
94
|
-
(_ref = _this.plusButtonRef || _this.dropdownButtonRef) === null || _ref === void 0 || _ref.focus();
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleEmojiPicker", function () {
|
|
98
|
-
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
99
|
-
_this.setState(function (prevState) {
|
|
100
|
-
return {
|
|
101
|
-
emojiPickerOpen: !prevState.emojiPickerOpen
|
|
102
|
-
};
|
|
103
|
-
}, function () {
|
|
104
|
-
if (_this.state.emojiPickerOpen) {
|
|
105
|
-
var dispatchAnalyticsEvent = _this.props.dispatchAnalyticsEvent;
|
|
106
|
-
if (dispatchAnalyticsEvent) {
|
|
107
|
-
dispatchAnalyticsEvent({
|
|
108
|
-
action: _analytics.ACTION.OPENED,
|
|
109
|
-
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
110
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_EMOJI,
|
|
111
|
-
attributes: {
|
|
112
|
-
inputMethod: inputMethod
|
|
113
|
-
},
|
|
114
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEmojiPressEscape", function () {
|
|
121
|
-
var _this$emojiButtonRef;
|
|
122
|
-
_this.toggleEmojiPicker(_analytics.INPUT_METHOD.KEYBOARD);
|
|
123
|
-
(_this$emojiButtonRef = _this.emojiButtonRef) === null || _this$emojiButtonRef === void 0 || _this$emojiButtonRef.focus();
|
|
124
|
-
});
|
|
125
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEmojiClickOutside", function (e) {
|
|
126
|
-
// Ignore click events for detached elements.
|
|
127
|
-
// Workaround for FS-1322 - where two onClicks fire - one when the upload button is
|
|
128
|
-
// still in the document, and one once it's detached. Does not always occur, and
|
|
129
|
-
// may be a side effect of a react render optimisation
|
|
130
|
-
if (e.target && !isDetachedElement(e.target)) {
|
|
131
|
-
_this.toggleEmojiPicker(_analytics.INPUT_METHOD.TOOLBAR);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEmojiButtonRef", function (button) {
|
|
135
|
-
var ref = _reactDom.default.findDOMNode(button);
|
|
136
|
-
if (ref) {
|
|
137
|
-
_this.emojiButtonRef = ref;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handlePlusButtonRef", function (button) {
|
|
141
|
-
var ref = _reactDom.default.findDOMNode(button);
|
|
142
|
-
if (ref) {
|
|
143
|
-
_this.plusButtonRef = ref;
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleDropDownButtonRef", function (button) {
|
|
147
|
-
var ref = _reactDom.default.findDOMNode(button);
|
|
148
|
-
if (ref) {
|
|
149
|
-
_this.dropdownButtonRef = ref;
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
|
|
153
|
-
_this.togglePlusMenuVisibility();
|
|
154
|
-
});
|
|
155
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenByKeyboard", function (event) {
|
|
156
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
157
|
-
_this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
|
|
158
|
-
isOpenedByKeyboard: true
|
|
159
|
-
}));
|
|
160
|
-
event.preventDefault();
|
|
161
|
-
_this.togglePlusMenuVisibility();
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleLinkPanel", function (inputMethod) {
|
|
165
|
-
var _pluginInjectionApi$c, _pluginInjectionApi$h;
|
|
166
|
-
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
167
|
-
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : _pluginInjectionApi$h.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
168
|
-
});
|
|
169
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertMention", function (inputMethod) {
|
|
170
|
-
var _pluginInjectionApi$m, _pluginInjectionApi$m2;
|
|
171
|
-
var _this$props = _this.props,
|
|
172
|
-
editorView = _this$props.editorView,
|
|
173
|
-
pluginInjectionApi = _this$props.pluginInjectionApi;
|
|
174
|
-
if (!editorView) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
var pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mention) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.sharedState.currentState();
|
|
178
|
-
if (pluginState && pluginState.canInsertMention === false) {
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m2 = pluginInjectionApi.mention) === null || _pluginInjectionApi$m2 === void 0 || (_pluginInjectionApi$m2 = _pluginInjectionApi$m2.actions) === null || _pluginInjectionApi$m2 === void 0 ? void 0 : _pluginInjectionApi$m2.openTypeAhead(inputMethod));
|
|
182
|
-
});
|
|
183
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTable", function (inputMethod) {
|
|
184
|
-
var _pluginInjectionApi$t, _pluginInjectionApi$t2, _pluginInjectionApi$t3, _pluginInjectionApi$t4;
|
|
185
|
-
var _this$props2 = _this.props,
|
|
186
|
-
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
187
|
-
editorView = _this$props2.editorView;
|
|
188
|
-
var state = editorView.state,
|
|
189
|
-
dispatch = editorView.dispatch;
|
|
190
|
-
return (_pluginInjectionApi$t = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t2 = pluginInjectionApi.table) === null || _pluginInjectionApi$t2 === void 0 || (_pluginInjectionApi$t3 = (_pluginInjectionApi$t4 = _pluginInjectionApi$t2.actions).insertTable) === null || _pluginInjectionApi$t3 === void 0 ? void 0 : _pluginInjectionApi$t3.call(_pluginInjectionApi$t4, {
|
|
191
|
-
action: _analytics.ACTION.INSERTED,
|
|
192
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
193
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TABLE,
|
|
194
|
-
attributes: {
|
|
195
|
-
inputMethod: inputMethod
|
|
196
|
-
},
|
|
197
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
198
|
-
})(state, dispatch)) !== null && _pluginInjectionApi$t !== void 0 ? _pluginInjectionApi$t : false;
|
|
199
|
-
});
|
|
200
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDate", function (inputMethod) {
|
|
201
|
-
var _pluginInjectionApi$d;
|
|
202
|
-
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
203
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.date) === null || _pluginInjectionApi$d === void 0 || (_pluginInjectionApi$d = _pluginInjectionApi$d.commands) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.insertDate({
|
|
204
|
-
inputMethod: inputMethod
|
|
205
|
-
}));
|
|
206
|
-
return true;
|
|
207
|
-
});
|
|
208
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createPlaceholderText", function () {
|
|
209
|
-
var _pluginInjectionApi$p;
|
|
210
|
-
var _this$props3 = _this.props,
|
|
211
|
-
editorView = _this$props3.editorView,
|
|
212
|
-
pluginInjectionApi = _this$props3.pluginInjectionApi;
|
|
213
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$p = pluginInjectionApi.placeholderText) === null || _pluginInjectionApi$p === void 0 || _pluginInjectionApi$p.actions.showPlaceholderFloatingToolbar(editorView.state, editorView.dispatch);
|
|
214
|
-
return true;
|
|
215
|
-
});
|
|
216
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertLayoutColumns", function (inputMethod) {
|
|
217
|
-
var _pluginInjectionApi$l;
|
|
218
|
-
var _this$props4 = _this.props,
|
|
219
|
-
editorView = _this$props4.editorView,
|
|
220
|
-
pluginInjectionApi = _this$props4.pluginInjectionApi;
|
|
221
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
222
|
-
return true;
|
|
223
|
-
});
|
|
224
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createStatus", function (inputMethod) {
|
|
225
|
-
var _pluginInjectionApi$s, _pluginInjectionApi$s2;
|
|
226
|
-
var _this$props5 = _this.props,
|
|
227
|
-
pluginInjectionApi = _this$props5.pluginInjectionApi,
|
|
228
|
-
editorView = _this$props5.editorView;
|
|
229
|
-
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;
|
|
230
|
-
});
|
|
231
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openMediaPicker", function (inputMethod) {
|
|
232
|
-
var _this$props6 = _this.props,
|
|
233
|
-
onShowMediaPicker = _this$props6.onShowMediaPicker,
|
|
234
|
-
dispatchAnalyticsEvent = _this$props6.dispatchAnalyticsEvent;
|
|
235
|
-
if (onShowMediaPicker) {
|
|
236
|
-
onShowMediaPicker();
|
|
237
|
-
if (dispatchAnalyticsEvent) {
|
|
238
|
-
dispatchAnalyticsEvent({
|
|
239
|
-
action: _analytics.ACTION.OPENED,
|
|
240
|
-
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
241
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
242
|
-
attributes: {
|
|
243
|
-
inputMethod: inputMethod
|
|
244
|
-
},
|
|
245
|
-
eventType: _analytics.EVENT_TYPE.UI
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return true;
|
|
250
|
-
});
|
|
251
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTaskDecision", function (name, inputMethod) {
|
|
252
|
-
return function () {
|
|
253
|
-
var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
|
|
254
|
-
var _this$props7 = _this.props,
|
|
255
|
-
_this$props7$editorVi = _this$props7.editorView,
|
|
256
|
-
state = _this$props7$editorVi.state,
|
|
257
|
-
dispatch = _this$props7$editorVi.dispatch,
|
|
258
|
-
pluginInjectionApi = _this$props7.pluginInjectionApi;
|
|
259
|
-
var listType = name === 'action' ? 'taskList' : 'decisionList';
|
|
260
|
-
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;
|
|
261
|
-
};
|
|
262
|
-
});
|
|
263
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
|
|
264
|
-
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
265
|
-
var _this$props8 = _this.props,
|
|
266
|
-
_this$props8$editorVi = _this$props8.editorView,
|
|
267
|
-
state = _this$props8$editorVi.state,
|
|
268
|
-
dispatch = _this$props8$editorVi.dispatch,
|
|
269
|
-
pluginInjectionApi = _this$props8.pluginInjectionApi;
|
|
270
|
-
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;
|
|
271
|
-
});
|
|
272
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
273
|
-
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
274
|
-
var _this$props9 = _this.props,
|
|
275
|
-
_this$props9$editorVi = _this$props9.editorView,
|
|
276
|
-
state = _this$props9$editorVi.state,
|
|
277
|
-
dispatch = _this$props9$editorVi.dispatch,
|
|
278
|
-
pluginInjectionApi = _this$props9.pluginInjectionApi;
|
|
279
|
-
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;
|
|
280
|
-
});
|
|
281
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertBlockType", function (itemName) {
|
|
282
|
-
return function () {
|
|
283
|
-
var _this$props10 = _this.props,
|
|
284
|
-
editorView = _this$props10.editorView,
|
|
285
|
-
onInsertBlockType = _this$props10.onInsertBlockType;
|
|
286
|
-
var state = editorView.state,
|
|
287
|
-
dispatch = editorView.dispatch;
|
|
288
|
-
onInsertBlockType(itemName)(state, dispatch);
|
|
289
|
-
return true;
|
|
290
|
-
};
|
|
291
|
-
});
|
|
292
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSelectedEmoji", function (emojiId) {
|
|
293
|
-
var _pluginInjectionApi$e3;
|
|
294
|
-
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
295
|
-
_this.props.editorView.focus();
|
|
296
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute((_pluginInjectionApi$e3 = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.commands.insertEmoji(emojiId, _analytics.INPUT_METHOD.PICKER));
|
|
297
|
-
_this.toggleEmojiPicker();
|
|
298
|
-
return true;
|
|
299
|
-
});
|
|
300
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openElementBrowser", function () {
|
|
301
|
-
var _pluginInjectionApi$q;
|
|
302
|
-
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
303
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
304
|
-
});
|
|
305
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref2) {
|
|
306
|
-
var item = _ref2.item,
|
|
307
|
-
inputMethod = _ref2.inputMethod;
|
|
308
|
-
var _this$props11 = _this.props,
|
|
309
|
-
editorView = _this$props11.editorView,
|
|
310
|
-
editorActions = _this$props11.editorActions,
|
|
311
|
-
handleImageUpload = _this$props11.handleImageUpload,
|
|
312
|
-
expandEnabled = _this$props11.expandEnabled;
|
|
313
|
-
|
|
314
|
-
// need to do this before inserting nodes so scrollIntoView works properly
|
|
315
|
-
if (!editorView.hasFocus()) {
|
|
316
|
-
editorView.focus();
|
|
317
|
-
}
|
|
318
|
-
switch (item.value.name) {
|
|
319
|
-
case 'link':
|
|
320
|
-
_this.toggleLinkPanel(inputMethod);
|
|
321
|
-
break;
|
|
322
|
-
case 'table':
|
|
323
|
-
_this.insertTable(inputMethod);
|
|
324
|
-
break;
|
|
325
|
-
case 'image upload':
|
|
326
|
-
if (handleImageUpload) {
|
|
327
|
-
var state = editorView.state,
|
|
328
|
-
dispatch = editorView.dispatch;
|
|
329
|
-
handleImageUpload()(state, dispatch);
|
|
330
|
-
}
|
|
331
|
-
break;
|
|
332
|
-
case 'media':
|
|
333
|
-
_this.openMediaPicker(inputMethod);
|
|
334
|
-
break;
|
|
335
|
-
case 'mention':
|
|
336
|
-
_this.insertMention(inputMethod);
|
|
337
|
-
break;
|
|
338
|
-
case 'emoji':
|
|
339
|
-
_this.toggleEmojiPicker(inputMethod);
|
|
340
|
-
break;
|
|
341
|
-
case 'codeblock':
|
|
342
|
-
case 'blockquote':
|
|
343
|
-
case 'panel':
|
|
344
|
-
_this.insertBlockType(item.value.name)();
|
|
345
|
-
break;
|
|
346
|
-
case 'action':
|
|
347
|
-
case 'decision':
|
|
348
|
-
_this.insertTaskDecision(item.value.name, inputMethod)();
|
|
349
|
-
break;
|
|
350
|
-
case 'horizontalrule':
|
|
351
|
-
_this.insertHorizontalRule(inputMethod);
|
|
352
|
-
break;
|
|
353
|
-
case 'macro':
|
|
354
|
-
_this.openElementBrowser();
|
|
355
|
-
break;
|
|
356
|
-
case 'date':
|
|
357
|
-
_this.createDate(inputMethod);
|
|
358
|
-
break;
|
|
359
|
-
case 'placeholder text':
|
|
360
|
-
_this.createPlaceholderText();
|
|
361
|
-
break;
|
|
362
|
-
case 'layout':
|
|
363
|
-
_this.insertLayoutColumns(inputMethod);
|
|
364
|
-
break;
|
|
365
|
-
case 'status':
|
|
366
|
-
_this.createStatus(inputMethod);
|
|
367
|
-
break;
|
|
368
|
-
|
|
369
|
-
// https://product-fabric.atlassian.net/browse/ED-8053
|
|
370
|
-
// @ts-ignore: OK to fallthrough to default
|
|
371
|
-
case 'expand':
|
|
372
|
-
if (expandEnabled) {
|
|
373
|
-
_this.insertExpand();
|
|
374
|
-
break;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// eslint-disable-next-line no-fallthrough
|
|
378
|
-
default:
|
|
379
|
-
if (item && item.onClick) {
|
|
380
|
-
item.onClick(editorActions);
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
_this.setState({
|
|
385
|
-
isPlusMenuOpen: false
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertToolbarMenuItem", function (btn) {
|
|
389
|
-
return _this.onItemActivated({
|
|
390
|
-
item: btn,
|
|
391
|
-
inputMethod: _analytics.INPUT_METHOD.TOOLBAR
|
|
392
|
-
});
|
|
393
|
-
});
|
|
394
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertInsertMenuItem", function (_ref3) {
|
|
395
|
-
var item = _ref3.item;
|
|
396
|
-
return _this.onItemActivated({
|
|
397
|
-
item: item,
|
|
398
|
-
inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
|
|
399
|
-
});
|
|
400
|
-
});
|
|
401
|
-
return _this;
|
|
402
|
-
}
|
|
403
|
-
(0, _createClass2.default)(ToolbarInsertBlock, [{
|
|
404
|
-
key: "componentDidUpdate",
|
|
405
|
-
value: function componentDidUpdate(prevProps) {
|
|
406
|
-
// If number of visible buttons changed, close emoji picker
|
|
407
|
-
if (prevProps.buttons !== this.props.buttons) {
|
|
408
|
-
this.setState({
|
|
409
|
-
emojiPickerOpen: false
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
if (this.state.isOpenedByKeyboard) {
|
|
413
|
-
var _this$dropdownButtonR;
|
|
414
|
-
var downArrowEvent = new KeyboardEvent('keydown', {
|
|
415
|
-
bubbles: true,
|
|
416
|
-
key: 'ArrowDown'
|
|
417
|
-
});
|
|
418
|
-
(_this$dropdownButtonR = this.dropdownButtonRef) === null || _this$dropdownButtonR === void 0 || _this$dropdownButtonR.dispatchEvent(downArrowEvent);
|
|
419
|
-
this.setState(_objectSpread(_objectSpread({}, this.state), {}, {
|
|
420
|
-
isOpenedByKeyboard: false
|
|
421
|
-
}));
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}, {
|
|
425
|
-
key: "renderPopup",
|
|
426
|
-
value: function renderPopup() {
|
|
427
|
-
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
428
|
-
var _this$props12 = this.props,
|
|
429
|
-
popupsMountPoint = _this$props12.popupsMountPoint,
|
|
430
|
-
popupsBoundariesElement = _this$props12.popupsBoundariesElement,
|
|
431
|
-
popupsScrollableElement = _this$props12.popupsScrollableElement,
|
|
432
|
-
emojiProvider = _this$props12.emojiProvider,
|
|
433
|
-
replacePlusMenuWithElementBrowser = _this$props12.replacePlusMenuWithElementBrowser;
|
|
434
|
-
var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
|
|
435
|
-
var name = _ref4.value.name;
|
|
436
|
-
return name === 'emoji';
|
|
437
|
-
});
|
|
438
|
-
var dropDownButtonRef = replacePlusMenuWithElementBrowser ? this.plusButtonRef : this.dropdownButtonRef;
|
|
439
|
-
var ref = dropdownEmoji ? dropDownButtonRef : this.emojiButtonRef;
|
|
440
|
-
if (!emojiPickerOpen || !ref || !emojiProvider) {
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
|
-
return (0, _react2.jsx)(_ui.Popup, {
|
|
444
|
-
target: ref,
|
|
445
|
-
fitHeight: 350,
|
|
446
|
-
fitWidth: 350,
|
|
447
|
-
offset: [0, 3],
|
|
448
|
-
mountTo: popupsMountPoint,
|
|
449
|
-
boundariesElement: popupsBoundariesElement,
|
|
450
|
-
scrollableElement: popupsScrollableElement,
|
|
451
|
-
focusTrap: true,
|
|
452
|
-
zIndex: _editorSharedStyles.akEditorMenuZIndex
|
|
453
|
-
}, (0, _react2.jsx)(EmojiPickerWithListeners, {
|
|
454
|
-
emojiProvider: emojiProvider,
|
|
455
|
-
onSelection: this.handleSelectedEmoji,
|
|
456
|
-
handleClickOutside: this.handleEmojiClickOutside,
|
|
457
|
-
handleEscapeKeydown: this.handleEmojiPressEscape
|
|
458
|
-
}));
|
|
459
|
-
}
|
|
460
|
-
}, {
|
|
461
|
-
key: "render",
|
|
462
|
-
value: function render() {
|
|
463
|
-
var _this2 = this,
|
|
464
|
-
_this$props$isDisable,
|
|
465
|
-
_this$props$replacePl;
|
|
466
|
-
var _this$state = this.state,
|
|
467
|
-
buttons = _this$state.buttons,
|
|
468
|
-
dropdownItems = _this$state.dropdownItems,
|
|
469
|
-
emojiPickerOpen = _this$state.emojiPickerOpen;
|
|
470
|
-
var _this$props13 = this.props,
|
|
471
|
-
isDisabled = _this$props13.isDisabled,
|
|
472
|
-
isReducedSpacing = _this$props13.isReducedSpacing;
|
|
473
|
-
if (buttons.length === 0 && dropdownItems.length === 0) {
|
|
474
|
-
return null;
|
|
475
|
-
}
|
|
476
|
-
return (0, _react2.jsx)("span", {
|
|
477
|
-
css: _styles.buttonGroupStyle
|
|
478
|
-
}, buttons.map(function (btn) {
|
|
479
|
-
return (0, _react2.jsx)(_uiMenu.ToolbarButton, {
|
|
480
|
-
item: btn,
|
|
481
|
-
testId: String(btn.content),
|
|
482
|
-
ref: btn.value.name === 'emoji' ? _this2.handleEmojiButtonRef : noop,
|
|
483
|
-
key: btn.value.name,
|
|
484
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
485
|
-
disabled: isDisabled || btn.isDisabled,
|
|
486
|
-
iconBefore: btn.elemBefore,
|
|
487
|
-
selected: btn.value.name === 'emoji' && emojiPickerOpen || btn.isActive,
|
|
488
|
-
title: btn.title,
|
|
489
|
-
"aria-label": btn['aria-label'],
|
|
490
|
-
"aria-haspopup": btn['aria-haspopup'],
|
|
491
|
-
"aria-keyshortcuts": btn['aria-keyshortcuts'],
|
|
492
|
-
onItemClick: _this2.insertToolbarMenuItem
|
|
493
|
-
});
|
|
494
|
-
}), (0, _react2.jsx)("span", {
|
|
495
|
-
css: _styles.wrapperStyle
|
|
496
|
-
}, this.renderPopup(), (0, _react2.jsx)(_blockInsertMenu.BlockInsertMenu, {
|
|
497
|
-
popupsMountPoint: this.props.popupsMountPoint,
|
|
498
|
-
popupsBoundariesElement: this.props.popupsBoundariesElement,
|
|
499
|
-
popupsScrollableElement: this.props.popupsScrollableElement,
|
|
500
|
-
disabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
|
|
501
|
-
editorView: this.props.editorView,
|
|
502
|
-
spacing: this.props.isReducedSpacing ? 'none' : 'default',
|
|
503
|
-
label: this.props.intl.formatMessage(_messages.messages.insertMenu),
|
|
504
|
-
open: this.state.isPlusMenuOpen,
|
|
505
|
-
plusButtonRef: this.plusButtonRef,
|
|
506
|
-
items: this.state.dropdownItems,
|
|
507
|
-
onRef: this.handleDropDownButtonRef,
|
|
508
|
-
onPlusButtonRef: this.handlePlusButtonRef,
|
|
509
|
-
onClick: this.handleClick,
|
|
510
|
-
onKeyDown: this.handleOpenByKeyboard,
|
|
511
|
-
onItemActivated: this.insertInsertMenuItem,
|
|
512
|
-
onInsert: this.insertInsertMenuItem,
|
|
513
|
-
onOpenChange: this.onOpenChange,
|
|
514
|
-
togglePlusMenuVisibility: this.togglePlusMenuVisibility,
|
|
515
|
-
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
|
|
516
|
-
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
517
|
-
pluginInjectionApi: this.props.pluginInjectionApi
|
|
518
|
-
})), this.props.showSeparator && (0, _react2.jsx)("span", {
|
|
519
|
-
css: _styles.separatorStyles
|
|
520
|
-
}));
|
|
521
|
-
}
|
|
522
|
-
}], [{
|
|
523
|
-
key: "getDerivedStateFromProps",
|
|
524
|
-
value: function getDerivedStateFromProps(props, state) {
|
|
525
|
-
var _createItems = (0, _createItems3.createItems)({
|
|
526
|
-
isTypeAheadAllowed: props.isTypeAheadAllowed,
|
|
527
|
-
tableSupported: props.tableSupported,
|
|
528
|
-
mediaUploadsEnabled: props.mediaUploadsEnabled,
|
|
529
|
-
mediaSupported: props.mediaSupported,
|
|
530
|
-
imageUploadSupported: props.imageUploadSupported,
|
|
531
|
-
imageUploadEnabled: props.imageUploadEnabled,
|
|
532
|
-
mentionsSupported: props.mentionsSupported,
|
|
533
|
-
mentionsDisabled: props.mentionsDisabled,
|
|
534
|
-
actionSupported: props.actionSupported,
|
|
535
|
-
decisionSupported: props.decisionSupported,
|
|
536
|
-
linkSupported: props.linkSupported,
|
|
537
|
-
linkDisabled: props.linkDisabled,
|
|
538
|
-
emojiDisabled: props.emojiDisabled,
|
|
539
|
-
nativeStatusSupported: props.nativeStatusSupported,
|
|
540
|
-
dateEnabled: props.dateEnabled,
|
|
541
|
-
placeholderTextEnabled: props.placeholderTextEnabled,
|
|
542
|
-
horizontalRuleEnabled: props.horizontalRuleEnabled,
|
|
543
|
-
layoutSectionEnabled: props.layoutSectionEnabled,
|
|
544
|
-
expandEnabled: props.expandEnabled,
|
|
545
|
-
showElementBrowserLink: props.showElementBrowserLink,
|
|
546
|
-
emojiProvider: props.emojiProvider,
|
|
547
|
-
availableWrapperBlockTypes: props.availableWrapperBlockTypes,
|
|
548
|
-
insertMenuItems: props.insertMenuItems,
|
|
549
|
-
schema: props.editorView.state.schema,
|
|
550
|
-
numberOfButtons: props.buttons,
|
|
551
|
-
formatMessage: props.intl.formatMessage,
|
|
552
|
-
isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
|
|
553
|
-
}),
|
|
554
|
-
_createItems2 = (0, _slicedToArray2.default)(_createItems, 2),
|
|
555
|
-
buttons = _createItems2[0],
|
|
556
|
-
dropdownItems = _createItems2[1];
|
|
557
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
558
|
-
buttons: buttons,
|
|
559
|
-
dropdownItems: dropdownItems
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
}]);
|
|
563
|
-
return ToolbarInsertBlock;
|
|
564
|
-
}(_react.default.PureComponent);
|
|
565
|
-
var _default = exports.default = (0, _reactIntlNext.injectIntl)(ToolbarInsertBlock);
|