@atlaskit/editor-plugin-insert-block 2.4.22 → 2.4.24
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/index.js +2 -2
- package/dist/cjs/{plugin.js → insertBlockPlugin.js} +38 -5
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +41 -44
- package/dist/es2019/index.js +4 -1
- package/dist/es2019/{plugin.js → insertBlockPlugin.js} +27 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/{plugin.js → insertBlockPlugin.js} +31 -1
- package/dist/esm/ui/ToolbarInsertBlock/index.js +41 -44
- package/dist/types/index.d.ts +3 -3
- package/dist/types/{plugin.d.ts → insertBlockPlugin.d.ts} +1 -1
- package/dist/types/ui/ElementRail/index.d.ts +2 -2
- package/dist/types/ui/ElementRail/useInsertMenuRailItems.d.ts +1 -1
- package/dist/types/ui/templateOptions.d.ts +1 -1
- package/dist/types/ui/transformOptions.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +3 -3
- package/dist/types-ts4.5/{plugin.d.ts → insertBlockPlugin.d.ts} +1 -1
- package/dist/types-ts4.5/ui/ElementRail/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ElementRail/useInsertMenuRailItems.d.ts +1 -1
- package/dist/types-ts4.5/ui/templateOptions.d.ts +1 -1
- package/dist/types-ts4.5/ui/transformOptions.d.ts +1 -1
- package/package.json +9 -6
- /package/dist/cjs/{types.js → insertBlockPluginType.js} +0 -0
- /package/dist/es2019/{types.js → insertBlockPluginType.js} +0 -0
- /package/dist/esm/{types.js → insertBlockPluginType.js} +0 -0
- /package/dist/types/{types.d.ts → insertBlockPluginType.d.ts} +0 -0
- /package/dist/types-ts4.5/{types.d.ts → insertBlockPluginType.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 2.4.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#179859](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179859)
|
|
8
|
+
[`1a90382aae1c6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1a90382aae1c6) -
|
|
9
|
+
Optimise the insert menu dropdown by preloading it.
|
|
10
|
+
|
|
11
|
+
## 2.4.23
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#177216](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177216)
|
|
16
|
+
[`92df986420bc1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/92df986420bc1) -
|
|
17
|
+
updated insert block plugin to EES 003
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 2.4.22
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "insertBlockPlugin", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _insertBlockPlugin.insertBlockPlugin;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _insertBlockPlugin = require("./insertBlockPlugin");
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.toolbarSizeToButtons = exports.insertBlockPlugin = void 0;
|
|
8
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
+
var _elementBrowser = require("@atlaskit/editor-common/element-browser");
|
|
10
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
13
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
12
14
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
@@ -18,12 +20,14 @@ var _consts = require("@atlaskit/editor-plugin-block-type/consts");
|
|
|
18
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
21
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
20
22
|
var _switch = _interopRequireDefault(require("./assets/switch"));
|
|
21
|
-
var
|
|
23
|
+
var _elementBrowser2 = require("./pm-plugins/elementBrowser");
|
|
22
24
|
var _toggleInsertBlock = require("./pm-plugins/toggleInsertBlock");
|
|
23
25
|
var _ElementRail = require("./ui/ElementRail");
|
|
24
26
|
var _templateOptions = require("./ui/templateOptions");
|
|
25
27
|
var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
|
|
26
28
|
var _transformOptions = require("./ui/transformOptions");
|
|
29
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
30
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
31
|
var toolbarSizeToButtons = exports.toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize, appearance) {
|
|
28
32
|
// Different button numbers for full-page to better match full page toolbar breakpoints
|
|
29
33
|
if (appearance === 'full-page' && (0, _platformFeatureFlags.fg)('platform_editor_toolbar_responsive_fixes')) {
|
|
@@ -85,6 +89,23 @@ function handleInsertBlockType(insertCodeBlock, insertPanel, insertBlockQuote) {
|
|
|
85
89
|
};
|
|
86
90
|
};
|
|
87
91
|
}
|
|
92
|
+
function delayUntilIdle(cb) {
|
|
93
|
+
if (typeof window === 'undefined') {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
// eslint-disable-next-line compat/compat
|
|
97
|
+
if (window.requestIdleCallback !== undefined) {
|
|
98
|
+
// eslint-disable-next-line compat/compat
|
|
99
|
+
return window.requestIdleCallback(function () {
|
|
100
|
+
return cb();
|
|
101
|
+
}, {
|
|
102
|
+
timeout: 500
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return window.requestAnimationFrame(function () {
|
|
106
|
+
return cb();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
88
109
|
var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
89
110
|
var _api$primaryToolbar, _options$appearance4;
|
|
90
111
|
var _ref$config = _ref.config,
|
|
@@ -151,7 +172,7 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
151
172
|
return;
|
|
152
173
|
}
|
|
153
174
|
var toggleInsertBlockPluginState = _toggleInsertBlock.toggleInsertBlockPmKey.getState(editorState);
|
|
154
|
-
var elementBrowserPluginState =
|
|
175
|
+
var elementBrowserPluginState = _elementBrowser2.elementBrowserPmKey.getState(editorState);
|
|
155
176
|
return {
|
|
156
177
|
showElementBrowser: (toggleInsertBlockPluginState === null || toggleInsertBlockPluginState === void 0 ? void 0 : toggleInsertBlockPluginState.showElementBrowser) || false,
|
|
157
178
|
/**
|
|
@@ -162,6 +183,18 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
162
183
|
menuBrowserOpen: (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true) ? elementBrowserPluginState === null || elementBrowserPluginState === void 0 ? void 0 : elementBrowserPluginState.menuBrowserOpen : false
|
|
163
184
|
};
|
|
164
185
|
},
|
|
186
|
+
usePluginHook: function usePluginHook() {
|
|
187
|
+
(0, _react.useEffect)(function () {
|
|
188
|
+
// This is to optimise the UI so that when the user first clicks on the insert
|
|
189
|
+
// menu it opens instantly. As we're delaying the loading this won't affect the
|
|
190
|
+
// initial editor rendering metrics.
|
|
191
|
+
delayUntilIdle(function () {
|
|
192
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_preload_insert_menu')) {
|
|
193
|
+
_elementBrowser.ElementBrowser.preload();
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}, []);
|
|
197
|
+
},
|
|
165
198
|
pmPlugins: function pmPlugins() {
|
|
166
199
|
var _options$appearance2;
|
|
167
200
|
if (!['full-page', 'full-width'].includes((_options$appearance2 = options.appearance) !== null && _options$appearance2 !== void 0 ? _options$appearance2 : '')) {
|
|
@@ -172,7 +205,7 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
172
205
|
plugins.push({
|
|
173
206
|
name: 'elementBrowserPmPlugin',
|
|
174
207
|
plugin: function plugin() {
|
|
175
|
-
return (0,
|
|
208
|
+
return (0, _elementBrowser2.elementBrowserPmPlugin)();
|
|
176
209
|
}
|
|
177
210
|
}, {
|
|
178
211
|
name: 'elementBrowserEditorViewRef',
|
|
@@ -279,7 +312,7 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
279
312
|
plugin.pluginsOptions.contextPanel = function (state) {
|
|
280
313
|
// api.getSharedState() will have an outdated reference to editorState on first mount of this component
|
|
281
314
|
// so instead just rely on plugin key as we don't need to be reactive to changes here
|
|
282
|
-
var pluginState =
|
|
315
|
+
var pluginState = _elementBrowser2.elementBrowserPmKey.getState(state);
|
|
283
316
|
if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen && editorViewRef.current) {
|
|
284
317
|
return /*#__PURE__*/_react.default.createElement(_ElementRail.InsertMenuRail, {
|
|
285
318
|
editorView: editorViewRef.current,
|
|
@@ -9,10 +9,9 @@ exports.tableButtonWrapper = exports.default = exports.ToolbarInsertBlock = void
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
16
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
18
17
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -46,7 +45,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
46
45
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
47
46
|
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; }
|
|
48
47
|
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; }
|
|
49
|
-
function
|
|
48
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
50
49
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
51
50
|
/**
|
|
52
51
|
* Checks if an element is detached (i.e. not in the current document)
|
|
@@ -77,18 +76,16 @@ var tableButtonWrapper = exports.tableButtonWrapper = function tableButtonWrappe
|
|
|
77
76
|
|
|
78
77
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
79
78
|
var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
80
|
-
(0, _inherits2.default)(ToolbarInsertBlock, _React$PureComponent);
|
|
81
|
-
var _super = _createSuper(ToolbarInsertBlock);
|
|
82
79
|
function ToolbarInsertBlock() {
|
|
83
80
|
var _this;
|
|
84
81
|
(0, _classCallCheck2.default)(this, ToolbarInsertBlock);
|
|
85
82
|
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
86
83
|
_args[_key] = arguments[_key];
|
|
87
84
|
}
|
|
88
|
-
_this =
|
|
89
|
-
(0, _defineProperty2.default)(
|
|
90
|
-
(0, _defineProperty2.default)(
|
|
91
|
-
(0, _defineProperty2.default)(
|
|
85
|
+
_this = _callSuper(this, ToolbarInsertBlock, [].concat(_args));
|
|
86
|
+
(0, _defineProperty2.default)(_this, "tableButtonRef", /*#__PURE__*/_react.default.createRef());
|
|
87
|
+
(0, _defineProperty2.default)(_this, "tableSelectorButtonRef", /*#__PURE__*/_react.default.createRef());
|
|
88
|
+
(0, _defineProperty2.default)(_this, "state", {
|
|
92
89
|
isPlusMenuOpen: false,
|
|
93
90
|
emojiPickerOpen: false,
|
|
94
91
|
isOpenedByKeyboard: false,
|
|
@@ -97,7 +94,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
97
94
|
isTableSelectorOpen: false,
|
|
98
95
|
isTableSelectorOpenedByKeyboard: false
|
|
99
96
|
});
|
|
100
|
-
(0, _defineProperty2.default)(
|
|
97
|
+
(0, _defineProperty2.default)(_this, "onOpenChange", function (attrs) {
|
|
101
98
|
var state = {
|
|
102
99
|
isPlusMenuOpen: attrs.isPlusMenuOpen,
|
|
103
100
|
emojiPickerOpen: _this.state.emojiPickerOpen
|
|
@@ -125,7 +122,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
125
122
|
});
|
|
126
123
|
});
|
|
127
124
|
});
|
|
128
|
-
(0, _defineProperty2.default)(
|
|
125
|
+
(0, _defineProperty2.default)(_this, "togglePlusMenuVisibility", function (event) {
|
|
129
126
|
var isPlusMenuOpen = _this.state.isPlusMenuOpen;
|
|
130
127
|
_this.onOpenChange({
|
|
131
128
|
isPlusMenuOpen: !isPlusMenuOpen
|
|
@@ -135,7 +132,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
135
132
|
(_ref2 = _this.plusButtonRef || _this.dropdownButtonRef) === null || _ref2 === void 0 || (_ref2 = _ref2.deref()) === null || _ref2 === void 0 || _ref2.focus();
|
|
136
133
|
}
|
|
137
134
|
});
|
|
138
|
-
(0, _defineProperty2.default)(
|
|
135
|
+
(0, _defineProperty2.default)(_this, "toggleEmojiPicker", function () {
|
|
139
136
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
140
137
|
_this.setState(function (prevState) {
|
|
141
138
|
return {
|
|
@@ -158,12 +155,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
158
155
|
}
|
|
159
156
|
});
|
|
160
157
|
});
|
|
161
|
-
(0, _defineProperty2.default)(
|
|
158
|
+
(0, _defineProperty2.default)(_this, "handleEmojiPressEscape", function () {
|
|
162
159
|
var _this$emojiButtonRef;
|
|
163
160
|
_this.toggleEmojiPicker(_analytics.INPUT_METHOD.KEYBOARD);
|
|
164
161
|
(_this$emojiButtonRef = _this.emojiButtonRef) === null || _this$emojiButtonRef === void 0 || (_this$emojiButtonRef = _this$emojiButtonRef.deref()) === null || _this$emojiButtonRef === void 0 || _this$emojiButtonRef.focus();
|
|
165
162
|
});
|
|
166
|
-
(0, _defineProperty2.default)(
|
|
163
|
+
(0, _defineProperty2.default)(_this, "handleEmojiClickOutside", function (e) {
|
|
167
164
|
// Ignore click events for detached elements.
|
|
168
165
|
// Workaround for FS-1322 - where two onClicks fire - one when the upload button is
|
|
169
166
|
// still in the document, and one once it's detached. Does not always occur, and
|
|
@@ -172,7 +169,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
172
169
|
_this.toggleEmojiPicker(_analytics.INPUT_METHOD.TOOLBAR);
|
|
173
170
|
}
|
|
174
171
|
});
|
|
175
|
-
(0, _defineProperty2.default)(
|
|
172
|
+
(0, _defineProperty2.default)(_this, "handleToolbarRef", function (buttonName) {
|
|
176
173
|
return function (ref) {
|
|
177
174
|
if (!ref) {
|
|
178
175
|
return;
|
|
@@ -187,17 +184,17 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
187
184
|
}
|
|
188
185
|
};
|
|
189
186
|
});
|
|
190
|
-
(0, _defineProperty2.default)(
|
|
187
|
+
(0, _defineProperty2.default)(_this, "handlePlusButtonRef", function (ref) {
|
|
191
188
|
if (ref) {
|
|
192
189
|
_this.plusButtonRef = new WeakRef(ref);
|
|
193
190
|
}
|
|
194
191
|
});
|
|
195
|
-
(0, _defineProperty2.default)(
|
|
192
|
+
(0, _defineProperty2.default)(_this, "handleDropDownButtonRef", function (ref) {
|
|
196
193
|
if (ref) {
|
|
197
194
|
_this.dropdownButtonRef = new WeakRef(ref);
|
|
198
195
|
}
|
|
199
196
|
});
|
|
200
|
-
(0, _defineProperty2.default)(
|
|
197
|
+
(0, _defineProperty2.default)(_this, "toggleTableSelector", function () {
|
|
201
198
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
202
199
|
_this.setState(function (prevState) {
|
|
203
200
|
return {
|
|
@@ -205,22 +202,22 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
205
202
|
};
|
|
206
203
|
});
|
|
207
204
|
});
|
|
208
|
-
(0, _defineProperty2.default)(
|
|
205
|
+
(0, _defineProperty2.default)(_this, "handleSelectedTableSize", function (rowsCount, colsCount) {
|
|
209
206
|
_this.insertTableWithSize(_analytics.INPUT_METHOD.TOOLBAR, rowsCount, colsCount)();
|
|
210
207
|
_this.toggleTableSelector();
|
|
211
208
|
});
|
|
212
|
-
(0, _defineProperty2.default)(
|
|
209
|
+
(0, _defineProperty2.default)(_this, "handleTableSelectorPressEscape", function () {
|
|
213
210
|
var _this$tableSelectorBu;
|
|
214
211
|
_this.toggleTableSelector(_analytics.INPUT_METHOD.KEYBOARD);
|
|
215
212
|
(_this$tableSelectorBu = _this.tableSelectorButtonRef.current) === null || _this$tableSelectorBu === void 0 || _this$tableSelectorBu.focus();
|
|
216
213
|
});
|
|
217
|
-
(0, _defineProperty2.default)(
|
|
214
|
+
(0, _defineProperty2.default)(_this, "handleTableSelectorClickOutside", function (e) {
|
|
218
215
|
// Ignore click events for detached elements.
|
|
219
216
|
if (e.target && !isDetachedElement(e.target)) {
|
|
220
217
|
_this.toggleTableSelector(_analytics.INPUT_METHOD.TOOLBAR);
|
|
221
218
|
}
|
|
222
219
|
});
|
|
223
|
-
(0, _defineProperty2.default)(
|
|
220
|
+
(0, _defineProperty2.default)(_this, "handleClick", function () {
|
|
224
221
|
var _this$props$editorApp;
|
|
225
222
|
/**
|
|
226
223
|
* For insert menu in right rail experiment
|
|
@@ -252,7 +249,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
252
249
|
}
|
|
253
250
|
_this.togglePlusMenuVisibility();
|
|
254
251
|
});
|
|
255
|
-
(0, _defineProperty2.default)(
|
|
252
|
+
(0, _defineProperty2.default)(_this, "handleOpenByKeyboard", function (event) {
|
|
256
253
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
257
254
|
var _this$props$editorApp2;
|
|
258
255
|
/**
|
|
@@ -279,19 +276,19 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
279
276
|
_this.togglePlusMenuVisibility();
|
|
280
277
|
}
|
|
281
278
|
});
|
|
282
|
-
(0, _defineProperty2.default)(
|
|
279
|
+
(0, _defineProperty2.default)(_this, "handleTableSelectorOpenByKeyboard", function (event) {
|
|
283
280
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
284
281
|
_this.setState({
|
|
285
282
|
isTableSelectorOpenedByKeyboard: true
|
|
286
283
|
});
|
|
287
284
|
}
|
|
288
285
|
});
|
|
289
|
-
(0, _defineProperty2.default)(
|
|
286
|
+
(0, _defineProperty2.default)(_this, "toggleLinkPanel", function (inputMethod) {
|
|
290
287
|
var _pluginInjectionApi$c2, _pluginInjectionApi$c3, _pluginInjectionApi$h;
|
|
291
288
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
292
289
|
return (_pluginInjectionApi$c2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.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$c2 !== void 0 ? _pluginInjectionApi$c2 : false;
|
|
293
290
|
});
|
|
294
|
-
(0, _defineProperty2.default)(
|
|
291
|
+
(0, _defineProperty2.default)(_this, "insertMention", function (inputMethod) {
|
|
295
292
|
var _pluginInjectionApi$m, _pluginInjectionApi$m2;
|
|
296
293
|
var _this$props = _this.props,
|
|
297
294
|
editorView = _this$props.editorView,
|
|
@@ -305,7 +302,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
305
302
|
}
|
|
306
303
|
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));
|
|
307
304
|
});
|
|
308
|
-
(0, _defineProperty2.default)(
|
|
305
|
+
(0, _defineProperty2.default)(_this, "insertTable", function (inputMethod) {
|
|
309
306
|
var _this$props2 = _this.props,
|
|
310
307
|
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
311
308
|
editorView = _this$props2.editorView;
|
|
@@ -326,7 +323,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
326
323
|
})(state, dispatch);
|
|
327
324
|
});
|
|
328
325
|
});
|
|
329
|
-
(0, _defineProperty2.default)(
|
|
326
|
+
(0, _defineProperty2.default)(_this, "insertTableWithSize", function (inputMethod, rowsCount, colsCount) {
|
|
330
327
|
return function () {
|
|
331
328
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
332
329
|
|
|
@@ -337,7 +334,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
337
334
|
});
|
|
338
335
|
};
|
|
339
336
|
});
|
|
340
|
-
(0, _defineProperty2.default)(
|
|
337
|
+
(0, _defineProperty2.default)(_this, "createDate", function (inputMethod) {
|
|
341
338
|
var _pluginInjectionApi$c5, _pluginInjectionApi$d;
|
|
342
339
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
343
340
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 || _pluginInjectionApi$c5.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({
|
|
@@ -345,7 +342,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
345
342
|
}));
|
|
346
343
|
return true;
|
|
347
344
|
});
|
|
348
|
-
(0, _defineProperty2.default)(
|
|
345
|
+
(0, _defineProperty2.default)(_this, "createPlaceholderText", function () {
|
|
349
346
|
var _pluginInjectionApi$p;
|
|
350
347
|
var _this$props3 = _this.props,
|
|
351
348
|
editorView = _this$props3.editorView,
|
|
@@ -353,7 +350,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
353
350
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$p = pluginInjectionApi.placeholderText) === null || _pluginInjectionApi$p === void 0 || _pluginInjectionApi$p.actions.showPlaceholderFloatingToolbar(editorView.state, editorView.dispatch);
|
|
354
351
|
return true;
|
|
355
352
|
});
|
|
356
|
-
(0, _defineProperty2.default)(
|
|
353
|
+
(0, _defineProperty2.default)(_this, "insertLayoutColumns", function (inputMethod) {
|
|
357
354
|
var _pluginInjectionApi$l;
|
|
358
355
|
var _this$props4 = _this.props,
|
|
359
356
|
editorView = _this$props4.editorView,
|
|
@@ -361,12 +358,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
361
358
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
362
359
|
return true;
|
|
363
360
|
});
|
|
364
|
-
(0, _defineProperty2.default)(
|
|
361
|
+
(0, _defineProperty2.default)(_this, "createStatus", function (inputMethod) {
|
|
365
362
|
var _pluginInjectionApi$c6, _pluginInjectionApi$s;
|
|
366
363
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
367
364
|
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.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)));
|
|
368
365
|
});
|
|
369
|
-
(0, _defineProperty2.default)(
|
|
366
|
+
(0, _defineProperty2.default)(_this, "openMediaPicker", function (inputMethod) {
|
|
370
367
|
var _this$props5 = _this.props,
|
|
371
368
|
onShowMediaPicker = _this$props5.onShowMediaPicker,
|
|
372
369
|
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
|
|
@@ -392,7 +389,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
392
389
|
}
|
|
393
390
|
return true;
|
|
394
391
|
});
|
|
395
|
-
(0, _defineProperty2.default)(
|
|
392
|
+
(0, _defineProperty2.default)(_this, "insertTaskDecision", function (name, inputMethod) {
|
|
396
393
|
return function () {
|
|
397
394
|
var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
|
|
398
395
|
var _this$props6 = _this.props,
|
|
@@ -404,7 +401,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
404
401
|
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;
|
|
405
402
|
};
|
|
406
403
|
});
|
|
407
|
-
(0, _defineProperty2.default)(
|
|
404
|
+
(0, _defineProperty2.default)(_this, "insertHorizontalRule", function (inputMethod) {
|
|
408
405
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
409
406
|
var _this$props7 = _this.props,
|
|
410
407
|
_this$props7$editorVi = _this$props7.editorView,
|
|
@@ -413,7 +410,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
413
410
|
pluginInjectionApi = _this$props7.pluginInjectionApi;
|
|
414
411
|
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;
|
|
415
412
|
});
|
|
416
|
-
(0, _defineProperty2.default)(
|
|
413
|
+
(0, _defineProperty2.default)(_this, "insertExpand", function () {
|
|
417
414
|
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
418
415
|
var _this$props8 = _this.props,
|
|
419
416
|
_this$props8$editorVi = _this$props8.editorView,
|
|
@@ -422,7 +419,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
422
419
|
pluginInjectionApi = _this$props8.pluginInjectionApi;
|
|
423
420
|
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;
|
|
424
421
|
});
|
|
425
|
-
(0, _defineProperty2.default)(
|
|
422
|
+
(0, _defineProperty2.default)(_this, "insertBlockType", function (itemName) {
|
|
426
423
|
return function () {
|
|
427
424
|
var _this$props9 = _this.props,
|
|
428
425
|
editorView = _this$props9.editorView,
|
|
@@ -433,7 +430,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
433
430
|
return true;
|
|
434
431
|
};
|
|
435
432
|
});
|
|
436
|
-
(0, _defineProperty2.default)(
|
|
433
|
+
(0, _defineProperty2.default)(_this, "handleSelectedEmoji", function (emojiId) {
|
|
437
434
|
var _pluginInjectionApi$c7, _pluginInjectionApi$e3;
|
|
438
435
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
439
436
|
_this.props.editorView.focus();
|
|
@@ -441,12 +438,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
441
438
|
_this.toggleEmojiPicker();
|
|
442
439
|
return true;
|
|
443
440
|
});
|
|
444
|
-
(0, _defineProperty2.default)(
|
|
441
|
+
(0, _defineProperty2.default)(_this, "openElementBrowser", function () {
|
|
445
442
|
var _pluginInjectionApi$c8, _pluginInjectionApi$q;
|
|
446
443
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
447
444
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 || _pluginInjectionApi$c8.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
448
445
|
});
|
|
449
|
-
(0, _defineProperty2.default)(
|
|
446
|
+
(0, _defineProperty2.default)(_this, "onItemActivated", function (_ref5) {
|
|
450
447
|
var item = _ref5.item,
|
|
451
448
|
inputMethod = _ref5.inputMethod;
|
|
452
449
|
var _this$props10 = _this.props,
|
|
@@ -531,13 +528,13 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
531
528
|
isPlusMenuOpen: false
|
|
532
529
|
});
|
|
533
530
|
});
|
|
534
|
-
(0, _defineProperty2.default)(
|
|
531
|
+
(0, _defineProperty2.default)(_this, "insertToolbarMenuItem", function (btn) {
|
|
535
532
|
return _this.onItemActivated({
|
|
536
533
|
item: btn,
|
|
537
534
|
inputMethod: _analytics.INPUT_METHOD.TOOLBAR
|
|
538
535
|
});
|
|
539
536
|
});
|
|
540
|
-
(0, _defineProperty2.default)(
|
|
537
|
+
(0, _defineProperty2.default)(_this, "insertInsertMenuItem", function (_ref6) {
|
|
541
538
|
var item = _ref6.item;
|
|
542
539
|
return _this.onItemActivated({
|
|
543
540
|
item: item,
|
|
@@ -546,7 +543,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
546
543
|
});
|
|
547
544
|
return _this;
|
|
548
545
|
}
|
|
549
|
-
(0,
|
|
546
|
+
(0, _inherits2.default)(ToolbarInsertBlock, _React$PureComponent);
|
|
547
|
+
return (0, _createClass2.default)(ToolbarInsertBlock, [{
|
|
550
548
|
key: "componentDidUpdate",
|
|
551
549
|
value: function componentDidUpdate(prevProps) {
|
|
552
550
|
// If number of visible buttons changed, close emoji picker and table selector
|
|
@@ -858,6 +856,5 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
858
856
|
});
|
|
859
857
|
}
|
|
860
858
|
}]);
|
|
861
|
-
return ToolbarInsertBlock;
|
|
862
859
|
}(_react.default.PureComponent);
|
|
863
860
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(ToolbarInsertBlock);
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
3
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
5
|
import { contentAllowedInCodeBlock, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
5
6
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -76,6 +77,19 @@ function handleInsertBlockType(insertCodeBlock, insertPanel, insertBlockQuote) {
|
|
|
76
77
|
return () => false;
|
|
77
78
|
};
|
|
78
79
|
}
|
|
80
|
+
function delayUntilIdle(cb) {
|
|
81
|
+
if (typeof window === 'undefined') {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// eslint-disable-next-line compat/compat
|
|
85
|
+
if (window.requestIdleCallback !== undefined) {
|
|
86
|
+
// eslint-disable-next-line compat/compat
|
|
87
|
+
return window.requestIdleCallback(() => cb(), {
|
|
88
|
+
timeout: 500
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return window.requestAnimationFrame(() => cb());
|
|
92
|
+
}
|
|
79
93
|
export const insertBlockPlugin = ({
|
|
80
94
|
config: options = {},
|
|
81
95
|
api
|
|
@@ -155,6 +169,18 @@ export const insertBlockPlugin = ({
|
|
|
155
169
|
menuBrowserOpen: editorExperiment('insert-menu-in-right-rail', true) ? elementBrowserPluginState === null || elementBrowserPluginState === void 0 ? void 0 : elementBrowserPluginState.menuBrowserOpen : false
|
|
156
170
|
};
|
|
157
171
|
},
|
|
172
|
+
usePluginHook() {
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
// This is to optimise the UI so that when the user first clicks on the insert
|
|
175
|
+
// menu it opens instantly. As we're delaying the loading this won't affect the
|
|
176
|
+
// initial editor rendering metrics.
|
|
177
|
+
delayUntilIdle(() => {
|
|
178
|
+
if (fg('platform_editor_preload_insert_menu')) {
|
|
179
|
+
ElementBrowser.preload();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}, []);
|
|
183
|
+
},
|
|
158
184
|
pmPlugins: () => {
|
|
159
185
|
var _options$appearance2;
|
|
160
186
|
if (!['full-page', 'full-width'].includes((_options$appearance2 = options.appearance) !== null && _options$appearance2 !== void 0 ? _options$appearance2 : '')) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
3
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
5
|
import { contentAllowedInCodeBlock, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
5
6
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -78,6 +79,23 @@ function handleInsertBlockType(insertCodeBlock, insertPanel, insertBlockQuote) {
|
|
|
78
79
|
};
|
|
79
80
|
};
|
|
80
81
|
}
|
|
82
|
+
function delayUntilIdle(cb) {
|
|
83
|
+
if (typeof window === 'undefined') {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// eslint-disable-next-line compat/compat
|
|
87
|
+
if (window.requestIdleCallback !== undefined) {
|
|
88
|
+
// eslint-disable-next-line compat/compat
|
|
89
|
+
return window.requestIdleCallback(function () {
|
|
90
|
+
return cb();
|
|
91
|
+
}, {
|
|
92
|
+
timeout: 500
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return window.requestAnimationFrame(function () {
|
|
96
|
+
return cb();
|
|
97
|
+
});
|
|
98
|
+
}
|
|
81
99
|
export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
82
100
|
var _api$primaryToolbar, _options$appearance4;
|
|
83
101
|
var _ref$config = _ref.config,
|
|
@@ -155,6 +173,18 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
155
173
|
menuBrowserOpen: editorExperiment('insert-menu-in-right-rail', true) ? elementBrowserPluginState === null || elementBrowserPluginState === void 0 ? void 0 : elementBrowserPluginState.menuBrowserOpen : false
|
|
156
174
|
};
|
|
157
175
|
},
|
|
176
|
+
usePluginHook: function usePluginHook() {
|
|
177
|
+
useEffect(function () {
|
|
178
|
+
// This is to optimise the UI so that when the user first clicks on the insert
|
|
179
|
+
// menu it opens instantly. As we're delaying the loading this won't affect the
|
|
180
|
+
// initial editor rendering metrics.
|
|
181
|
+
delayUntilIdle(function () {
|
|
182
|
+
if (fg('platform_editor_preload_insert_menu')) {
|
|
183
|
+
ElementBrowser.preload();
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}, []);
|
|
187
|
+
},
|
|
158
188
|
pmPlugins: function pmPlugins() {
|
|
159
189
|
var _options$appearance2;
|
|
160
190
|
if (!['full-page', 'full-width'].includes((_options$appearance2 = options.appearance) !== null && _options$appearance2 !== void 0 ? _options$appearance2 : '')) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
8
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
10
9
|
import _extends from "@babel/runtime/helpers/extends";
|
|
@@ -14,7 +13,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
14
13
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
14
|
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; }
|
|
16
15
|
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) { _defineProperty(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; }
|
|
17
|
-
function
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
17
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
18
|
/**
|
|
20
19
|
* @jsxRuntime classic
|
|
@@ -68,18 +67,16 @@ export var tableButtonWrapper = function tableButtonWrapper(_ref) {
|
|
|
68
67
|
|
|
69
68
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
70
69
|
export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
71
|
-
_inherits(ToolbarInsertBlock, _React$PureComponent);
|
|
72
|
-
var _super = _createSuper(ToolbarInsertBlock);
|
|
73
70
|
function ToolbarInsertBlock() {
|
|
74
71
|
var _this;
|
|
75
72
|
_classCallCheck(this, ToolbarInsertBlock);
|
|
76
73
|
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
77
74
|
_args[_key] = arguments[_key];
|
|
78
75
|
}
|
|
79
|
-
_this =
|
|
80
|
-
_defineProperty(
|
|
81
|
-
_defineProperty(
|
|
82
|
-
_defineProperty(
|
|
76
|
+
_this = _callSuper(this, ToolbarInsertBlock, [].concat(_args));
|
|
77
|
+
_defineProperty(_this, "tableButtonRef", /*#__PURE__*/React.createRef());
|
|
78
|
+
_defineProperty(_this, "tableSelectorButtonRef", /*#__PURE__*/React.createRef());
|
|
79
|
+
_defineProperty(_this, "state", {
|
|
83
80
|
isPlusMenuOpen: false,
|
|
84
81
|
emojiPickerOpen: false,
|
|
85
82
|
isOpenedByKeyboard: false,
|
|
@@ -88,7 +85,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
88
85
|
isTableSelectorOpen: false,
|
|
89
86
|
isTableSelectorOpenedByKeyboard: false
|
|
90
87
|
});
|
|
91
|
-
_defineProperty(
|
|
88
|
+
_defineProperty(_this, "onOpenChange", function (attrs) {
|
|
92
89
|
var state = {
|
|
93
90
|
isPlusMenuOpen: attrs.isPlusMenuOpen,
|
|
94
91
|
emojiPickerOpen: _this.state.emojiPickerOpen
|
|
@@ -116,7 +113,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
116
113
|
});
|
|
117
114
|
});
|
|
118
115
|
});
|
|
119
|
-
_defineProperty(
|
|
116
|
+
_defineProperty(_this, "togglePlusMenuVisibility", function (event) {
|
|
120
117
|
var isPlusMenuOpen = _this.state.isPlusMenuOpen;
|
|
121
118
|
_this.onOpenChange({
|
|
122
119
|
isPlusMenuOpen: !isPlusMenuOpen
|
|
@@ -126,7 +123,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
126
123
|
(_ref2 = _this.plusButtonRef || _this.dropdownButtonRef) === null || _ref2 === void 0 || (_ref2 = _ref2.deref()) === null || _ref2 === void 0 || _ref2.focus();
|
|
127
124
|
}
|
|
128
125
|
});
|
|
129
|
-
_defineProperty(
|
|
126
|
+
_defineProperty(_this, "toggleEmojiPicker", function () {
|
|
130
127
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.TOOLBAR;
|
|
131
128
|
_this.setState(function (prevState) {
|
|
132
129
|
return {
|
|
@@ -149,12 +146,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
149
146
|
}
|
|
150
147
|
});
|
|
151
148
|
});
|
|
152
|
-
_defineProperty(
|
|
149
|
+
_defineProperty(_this, "handleEmojiPressEscape", function () {
|
|
153
150
|
var _this$emojiButtonRef;
|
|
154
151
|
_this.toggleEmojiPicker(INPUT_METHOD.KEYBOARD);
|
|
155
152
|
(_this$emojiButtonRef = _this.emojiButtonRef) === null || _this$emojiButtonRef === void 0 || (_this$emojiButtonRef = _this$emojiButtonRef.deref()) === null || _this$emojiButtonRef === void 0 || _this$emojiButtonRef.focus();
|
|
156
153
|
});
|
|
157
|
-
_defineProperty(
|
|
154
|
+
_defineProperty(_this, "handleEmojiClickOutside", function (e) {
|
|
158
155
|
// Ignore click events for detached elements.
|
|
159
156
|
// Workaround for FS-1322 - where two onClicks fire - one when the upload button is
|
|
160
157
|
// still in the document, and one once it's detached. Does not always occur, and
|
|
@@ -163,7 +160,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
163
160
|
_this.toggleEmojiPicker(INPUT_METHOD.TOOLBAR);
|
|
164
161
|
}
|
|
165
162
|
});
|
|
166
|
-
_defineProperty(
|
|
163
|
+
_defineProperty(_this, "handleToolbarRef", function (buttonName) {
|
|
167
164
|
return function (ref) {
|
|
168
165
|
if (!ref) {
|
|
169
166
|
return;
|
|
@@ -178,17 +175,17 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
178
175
|
}
|
|
179
176
|
};
|
|
180
177
|
});
|
|
181
|
-
_defineProperty(
|
|
178
|
+
_defineProperty(_this, "handlePlusButtonRef", function (ref) {
|
|
182
179
|
if (ref) {
|
|
183
180
|
_this.plusButtonRef = new WeakRef(ref);
|
|
184
181
|
}
|
|
185
182
|
});
|
|
186
|
-
_defineProperty(
|
|
183
|
+
_defineProperty(_this, "handleDropDownButtonRef", function (ref) {
|
|
187
184
|
if (ref) {
|
|
188
185
|
_this.dropdownButtonRef = new WeakRef(ref);
|
|
189
186
|
}
|
|
190
187
|
});
|
|
191
|
-
_defineProperty(
|
|
188
|
+
_defineProperty(_this, "toggleTableSelector", function () {
|
|
192
189
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.TOOLBAR;
|
|
193
190
|
_this.setState(function (prevState) {
|
|
194
191
|
return {
|
|
@@ -196,22 +193,22 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
196
193
|
};
|
|
197
194
|
});
|
|
198
195
|
});
|
|
199
|
-
_defineProperty(
|
|
196
|
+
_defineProperty(_this, "handleSelectedTableSize", function (rowsCount, colsCount) {
|
|
200
197
|
_this.insertTableWithSize(INPUT_METHOD.TOOLBAR, rowsCount, colsCount)();
|
|
201
198
|
_this.toggleTableSelector();
|
|
202
199
|
});
|
|
203
|
-
_defineProperty(
|
|
200
|
+
_defineProperty(_this, "handleTableSelectorPressEscape", function () {
|
|
204
201
|
var _this$tableSelectorBu;
|
|
205
202
|
_this.toggleTableSelector(INPUT_METHOD.KEYBOARD);
|
|
206
203
|
(_this$tableSelectorBu = _this.tableSelectorButtonRef.current) === null || _this$tableSelectorBu === void 0 || _this$tableSelectorBu.focus();
|
|
207
204
|
});
|
|
208
|
-
_defineProperty(
|
|
205
|
+
_defineProperty(_this, "handleTableSelectorClickOutside", function (e) {
|
|
209
206
|
// Ignore click events for detached elements.
|
|
210
207
|
if (e.target && !isDetachedElement(e.target)) {
|
|
211
208
|
_this.toggleTableSelector(INPUT_METHOD.TOOLBAR);
|
|
212
209
|
}
|
|
213
210
|
});
|
|
214
|
-
_defineProperty(
|
|
211
|
+
_defineProperty(_this, "handleClick", function () {
|
|
215
212
|
var _this$props$editorApp;
|
|
216
213
|
/**
|
|
217
214
|
* For insert menu in right rail experiment
|
|
@@ -243,7 +240,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
243
240
|
}
|
|
244
241
|
_this.togglePlusMenuVisibility();
|
|
245
242
|
});
|
|
246
|
-
_defineProperty(
|
|
243
|
+
_defineProperty(_this, "handleOpenByKeyboard", function (event) {
|
|
247
244
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
248
245
|
var _this$props$editorApp2;
|
|
249
246
|
/**
|
|
@@ -270,19 +267,19 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
270
267
|
_this.togglePlusMenuVisibility();
|
|
271
268
|
}
|
|
272
269
|
});
|
|
273
|
-
_defineProperty(
|
|
270
|
+
_defineProperty(_this, "handleTableSelectorOpenByKeyboard", function (event) {
|
|
274
271
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
275
272
|
_this.setState({
|
|
276
273
|
isTableSelectorOpenedByKeyboard: true
|
|
277
274
|
});
|
|
278
275
|
}
|
|
279
276
|
});
|
|
280
|
-
_defineProperty(
|
|
277
|
+
_defineProperty(_this, "toggleLinkPanel", function (inputMethod) {
|
|
281
278
|
var _pluginInjectionApi$c2, _pluginInjectionApi$c3, _pluginInjectionApi$h;
|
|
282
279
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
283
280
|
return (_pluginInjectionApi$c2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.core) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.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$c2 !== void 0 ? _pluginInjectionApi$c2 : false;
|
|
284
281
|
});
|
|
285
|
-
_defineProperty(
|
|
282
|
+
_defineProperty(_this, "insertMention", function (inputMethod) {
|
|
286
283
|
var _pluginInjectionApi$m, _pluginInjectionApi$m2;
|
|
287
284
|
var _this$props = _this.props,
|
|
288
285
|
editorView = _this$props.editorView,
|
|
@@ -296,7 +293,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
296
293
|
}
|
|
297
294
|
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));
|
|
298
295
|
});
|
|
299
|
-
_defineProperty(
|
|
296
|
+
_defineProperty(_this, "insertTable", function (inputMethod) {
|
|
300
297
|
var _this$props2 = _this.props,
|
|
301
298
|
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
302
299
|
editorView = _this$props2.editorView;
|
|
@@ -317,7 +314,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
317
314
|
})(state, dispatch);
|
|
318
315
|
});
|
|
319
316
|
});
|
|
320
|
-
_defineProperty(
|
|
317
|
+
_defineProperty(_this, "insertTableWithSize", function (inputMethod, rowsCount, colsCount) {
|
|
321
318
|
return function () {
|
|
322
319
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
323
320
|
|
|
@@ -328,7 +325,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
328
325
|
});
|
|
329
326
|
};
|
|
330
327
|
});
|
|
331
|
-
_defineProperty(
|
|
328
|
+
_defineProperty(_this, "createDate", function (inputMethod) {
|
|
332
329
|
var _pluginInjectionApi$c5, _pluginInjectionApi$d;
|
|
333
330
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
334
331
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c5 = pluginInjectionApi.core) === null || _pluginInjectionApi$c5 === void 0 || _pluginInjectionApi$c5.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({
|
|
@@ -336,7 +333,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
336
333
|
}));
|
|
337
334
|
return true;
|
|
338
335
|
});
|
|
339
|
-
_defineProperty(
|
|
336
|
+
_defineProperty(_this, "createPlaceholderText", function () {
|
|
340
337
|
var _pluginInjectionApi$p;
|
|
341
338
|
var _this$props3 = _this.props,
|
|
342
339
|
editorView = _this$props3.editorView,
|
|
@@ -344,7 +341,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
344
341
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$p = pluginInjectionApi.placeholderText) === null || _pluginInjectionApi$p === void 0 || _pluginInjectionApi$p.actions.showPlaceholderFloatingToolbar(editorView.state, editorView.dispatch);
|
|
345
342
|
return true;
|
|
346
343
|
});
|
|
347
|
-
_defineProperty(
|
|
344
|
+
_defineProperty(_this, "insertLayoutColumns", function (inputMethod) {
|
|
348
345
|
var _pluginInjectionApi$l;
|
|
349
346
|
var _this$props4 = _this.props,
|
|
350
347
|
editorView = _this$props4.editorView,
|
|
@@ -352,12 +349,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
352
349
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
353
350
|
return true;
|
|
354
351
|
});
|
|
355
|
-
_defineProperty(
|
|
352
|
+
_defineProperty(_this, "createStatus", function (inputMethod) {
|
|
356
353
|
var _pluginInjectionApi$c6, _pluginInjectionApi$s;
|
|
357
354
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
358
355
|
return Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c6 = pluginInjectionApi.core) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.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)));
|
|
359
356
|
});
|
|
360
|
-
_defineProperty(
|
|
357
|
+
_defineProperty(_this, "openMediaPicker", function (inputMethod) {
|
|
361
358
|
var _this$props5 = _this.props,
|
|
362
359
|
onShowMediaPicker = _this$props5.onShowMediaPicker,
|
|
363
360
|
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
|
|
@@ -383,7 +380,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
383
380
|
}
|
|
384
381
|
return true;
|
|
385
382
|
});
|
|
386
|
-
_defineProperty(
|
|
383
|
+
_defineProperty(_this, "insertTaskDecision", function (name, inputMethod) {
|
|
387
384
|
return function () {
|
|
388
385
|
var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
|
|
389
386
|
var _this$props6 = _this.props,
|
|
@@ -395,7 +392,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
395
392
|
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;
|
|
396
393
|
};
|
|
397
394
|
});
|
|
398
|
-
_defineProperty(
|
|
395
|
+
_defineProperty(_this, "insertHorizontalRule", function (inputMethod) {
|
|
399
396
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
400
397
|
var _this$props7 = _this.props,
|
|
401
398
|
_this$props7$editorVi = _this$props7.editorView,
|
|
@@ -404,7 +401,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
404
401
|
pluginInjectionApi = _this$props7.pluginInjectionApi;
|
|
405
402
|
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;
|
|
406
403
|
});
|
|
407
|
-
_defineProperty(
|
|
404
|
+
_defineProperty(_this, "insertExpand", function () {
|
|
408
405
|
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
409
406
|
var _this$props8 = _this.props,
|
|
410
407
|
_this$props8$editorVi = _this$props8.editorView,
|
|
@@ -413,7 +410,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
413
410
|
pluginInjectionApi = _this$props8.pluginInjectionApi;
|
|
414
411
|
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;
|
|
415
412
|
});
|
|
416
|
-
_defineProperty(
|
|
413
|
+
_defineProperty(_this, "insertBlockType", function (itemName) {
|
|
417
414
|
return function () {
|
|
418
415
|
var _this$props9 = _this.props,
|
|
419
416
|
editorView = _this$props9.editorView,
|
|
@@ -424,7 +421,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
424
421
|
return true;
|
|
425
422
|
};
|
|
426
423
|
});
|
|
427
|
-
_defineProperty(
|
|
424
|
+
_defineProperty(_this, "handleSelectedEmoji", function (emojiId) {
|
|
428
425
|
var _pluginInjectionApi$c7, _pluginInjectionApi$e3;
|
|
429
426
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
430
427
|
_this.props.editorView.focus();
|
|
@@ -432,12 +429,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
432
429
|
_this.toggleEmojiPicker();
|
|
433
430
|
return true;
|
|
434
431
|
});
|
|
435
|
-
_defineProperty(
|
|
432
|
+
_defineProperty(_this, "openElementBrowser", function () {
|
|
436
433
|
var _pluginInjectionApi$c8, _pluginInjectionApi$q;
|
|
437
434
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
438
435
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c8 = pluginInjectionApi.core) === null || _pluginInjectionApi$c8 === void 0 || _pluginInjectionApi$c8.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
439
436
|
});
|
|
440
|
-
_defineProperty(
|
|
437
|
+
_defineProperty(_this, "onItemActivated", function (_ref5) {
|
|
441
438
|
var item = _ref5.item,
|
|
442
439
|
inputMethod = _ref5.inputMethod;
|
|
443
440
|
var _this$props10 = _this.props,
|
|
@@ -522,13 +519,13 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
522
519
|
isPlusMenuOpen: false
|
|
523
520
|
});
|
|
524
521
|
});
|
|
525
|
-
_defineProperty(
|
|
522
|
+
_defineProperty(_this, "insertToolbarMenuItem", function (btn) {
|
|
526
523
|
return _this.onItemActivated({
|
|
527
524
|
item: btn,
|
|
528
525
|
inputMethod: INPUT_METHOD.TOOLBAR
|
|
529
526
|
});
|
|
530
527
|
});
|
|
531
|
-
_defineProperty(
|
|
528
|
+
_defineProperty(_this, "insertInsertMenuItem", function (_ref6) {
|
|
532
529
|
var item = _ref6.item;
|
|
533
530
|
return _this.onItemActivated({
|
|
534
531
|
item: item,
|
|
@@ -537,7 +534,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
537
534
|
});
|
|
538
535
|
return _this;
|
|
539
536
|
}
|
|
540
|
-
|
|
537
|
+
_inherits(ToolbarInsertBlock, _React$PureComponent);
|
|
538
|
+
return _createClass(ToolbarInsertBlock, [{
|
|
541
539
|
key: "componentDidUpdate",
|
|
542
540
|
value: function componentDidUpdate(prevProps) {
|
|
543
541
|
// If number of visible buttons changed, close emoji picker and table selector
|
|
@@ -849,6 +847,5 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
849
847
|
});
|
|
850
848
|
}
|
|
851
849
|
}]);
|
|
852
|
-
return ToolbarInsertBlock;
|
|
853
850
|
}(React.PureComponent);
|
|
854
851
|
export default injectIntl(ToolbarInsertBlock);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { insertBlockPlugin } from './
|
|
2
|
-
export type { InsertBlockPlugin, InsertBlockOptions, InsertBlockPluginState } from './
|
|
3
|
-
export type { InsertBlockPluginDependencies } from './
|
|
1
|
+
export { insertBlockPlugin } from './insertBlockPlugin';
|
|
2
|
+
export type { InsertBlockPlugin, InsertBlockOptions, InsertBlockPluginState, } from './insertBlockPlugin';
|
|
3
|
+
export type { InsertBlockPluginDependencies } from './insertBlockPluginType';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorAppearance, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { InsertBlockPluginDependencies } from './
|
|
3
|
+
import type { InsertBlockPluginDependencies } from './insertBlockPluginType';
|
|
4
4
|
export declare const toolbarSizeToButtons: (toolbarSize: ToolbarSize, appearance?: EditorAppearance) => 0 | 2 | 3 | 5 | 7;
|
|
5
5
|
export interface InsertBlockOptions {
|
|
6
6
|
allowTables?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { type InsertBlockOptions, type InsertBlockPlugin } from '../../
|
|
4
|
+
import { type InsertBlockOptions, type InsertBlockPlugin } from '../../insertBlockPlugin';
|
|
5
5
|
/**
|
|
6
6
|
* For insert menu in right rail experiment
|
|
7
7
|
* - Clean up ticket ED-24801
|
|
@@ -15,6 +15,6 @@ export declare const InsertMenuRail: ({ editorView, options, api, }: {
|
|
|
15
15
|
actions: {
|
|
16
16
|
toggleAdditionalMenu: () => void;
|
|
17
17
|
};
|
|
18
|
-
sharedState: import("../../
|
|
18
|
+
sharedState: import("../../insertBlockPlugin").InsertBlockPluginState | undefined;
|
|
19
19
|
}> | undefined;
|
|
20
20
|
}) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { InsertBlockOptions, insertBlockPlugin } from '../../
|
|
3
|
+
import type { InsertBlockOptions, insertBlockPlugin } from '../../insertBlockPlugin';
|
|
4
4
|
export declare const useInsertMenuRailItems: (editorView: EditorView, options: InsertBlockOptions, api?: ExtractInjectionAPI<typeof insertBlockPlugin>) => import("../ToolbarInsertBlock/create-items").BlockMenuItem[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
2
2
|
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { type InsertBlockPlugin } from '../
|
|
3
|
+
import { type InsertBlockPlugin } from '../insertBlockPlugin';
|
|
4
4
|
export declare const templateOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined) => QuickInsertItem[];
|
|
@@ -2,7 +2,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
2
2
|
import { type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import QuoteIcon from '@atlaskit/icon/glyph/quote';
|
|
4
4
|
import ExpandIcon from '../assets/expand';
|
|
5
|
-
import type { InsertBlockPlugin } from '../
|
|
5
|
+
import type { InsertBlockPlugin } from '../insertBlockPlugin';
|
|
6
6
|
export declare const transformationOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined, schema: Schema) => ({
|
|
7
7
|
type: import("prosemirror-model").NodeType;
|
|
8
8
|
title: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { insertBlockPlugin } from './
|
|
2
|
-
export type { InsertBlockPlugin, InsertBlockOptions, InsertBlockPluginState } from './
|
|
3
|
-
export type { InsertBlockPluginDependencies } from './
|
|
1
|
+
export { insertBlockPlugin } from './insertBlockPlugin';
|
|
2
|
+
export type { InsertBlockPlugin, InsertBlockOptions, InsertBlockPluginState, } from './insertBlockPlugin';
|
|
3
|
+
export type { InsertBlockPluginDependencies } from './insertBlockPluginType';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorAppearance, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { InsertBlockPluginDependencies } from './
|
|
3
|
+
import type { InsertBlockPluginDependencies } from './insertBlockPluginType';
|
|
4
4
|
export declare const toolbarSizeToButtons: (toolbarSize: ToolbarSize, appearance?: EditorAppearance) => 0 | 2 | 3 | 5 | 7;
|
|
5
5
|
export interface InsertBlockOptions {
|
|
6
6
|
allowTables?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { type InsertBlockOptions, type InsertBlockPlugin } from '../../
|
|
4
|
+
import { type InsertBlockOptions, type InsertBlockPlugin } from '../../insertBlockPlugin';
|
|
5
5
|
/**
|
|
6
6
|
* For insert menu in right rail experiment
|
|
7
7
|
* - Clean up ticket ED-24801
|
|
@@ -15,6 +15,6 @@ export declare const InsertMenuRail: ({ editorView, options, api, }: {
|
|
|
15
15
|
actions: {
|
|
16
16
|
toggleAdditionalMenu: () => void;
|
|
17
17
|
};
|
|
18
|
-
sharedState: import("../../
|
|
18
|
+
sharedState: import("../../insertBlockPlugin").InsertBlockPluginState | undefined;
|
|
19
19
|
}> | undefined;
|
|
20
20
|
}) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { InsertBlockOptions, insertBlockPlugin } from '../../
|
|
3
|
+
import type { InsertBlockOptions, insertBlockPlugin } from '../../insertBlockPlugin';
|
|
4
4
|
export declare const useInsertMenuRailItems: (editorView: EditorView, options: InsertBlockOptions, api?: ExtractInjectionAPI<typeof insertBlockPlugin>) => import("../ToolbarInsertBlock/create-items").BlockMenuItem[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
2
2
|
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { type InsertBlockPlugin } from '../
|
|
3
|
+
import { type InsertBlockPlugin } from '../insertBlockPlugin';
|
|
4
4
|
export declare const templateOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined) => QuickInsertItem[];
|
|
@@ -2,7 +2,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
2
2
|
import { type Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import QuoteIcon from '@atlaskit/icon/glyph/quote';
|
|
4
4
|
import ExpandIcon from '../assets/expand';
|
|
5
|
-
import type { InsertBlockPlugin } from '../
|
|
5
|
+
import type { InsertBlockPlugin } from '../insertBlockPlugin';
|
|
6
6
|
export declare const transformationOptions: (api: ExtractInjectionAPI<InsertBlockPlugin> | undefined, schema: Schema) => ({
|
|
7
7
|
type: import("prosemirror-model").NodeType;
|
|
8
8
|
title: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.24",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/button": "^20.3.0",
|
|
35
|
-
"@atlaskit/editor-common": "^96.
|
|
35
|
+
"@atlaskit/editor-common": "^96.5.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-block-type": "^4.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-code-block": "^3.5.0",
|
|
39
|
-
"@atlaskit/editor-plugin-connectivity": "^1.
|
|
39
|
+
"@atlaskit/editor-plugin-connectivity": "^1.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-date": "^2.4.0",
|
|
41
41
|
"@atlaskit/editor-plugin-emoji": "^2.7.0",
|
|
42
42
|
"@atlaskit/editor-plugin-expand": "^2.10.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@atlaskit/editor-plugin-hyperlink": "^3.2.0",
|
|
46
46
|
"@atlaskit/editor-plugin-image-upload": "^1.2.0",
|
|
47
47
|
"@atlaskit/editor-plugin-layout": "^1.12.0",
|
|
48
|
-
"@atlaskit/editor-plugin-media": "^1.
|
|
48
|
+
"@atlaskit/editor-plugin-media": "^1.43.0",
|
|
49
49
|
"@atlaskit/editor-plugin-media-insert": "^4.0.0",
|
|
50
50
|
"@atlaskit/editor-plugin-mentions": "^2.10.0",
|
|
51
51
|
"@atlaskit/editor-plugin-panel": "^3.1.0",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
67
67
|
"@atlaskit/primitives": "^13.3.0",
|
|
68
68
|
"@atlaskit/theme": "^14.0.0",
|
|
69
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
70
|
-
"@atlaskit/tokens": "^2.
|
|
69
|
+
"@atlaskit/tmp-editor-statsig": "^2.27.0",
|
|
70
|
+
"@atlaskit/tokens": "^2.5.0",
|
|
71
71
|
"@atlaskit/tooltip": "19.0.0",
|
|
72
72
|
"@babel/runtime": "^7.0.0",
|
|
73
73
|
"@emotion/react": "^11.7.1",
|
|
@@ -130,6 +130,9 @@
|
|
|
130
130
|
"platform_editor_consistent_insert_menu": {
|
|
131
131
|
"type": "boolean"
|
|
132
132
|
},
|
|
133
|
+
"platform_editor_preload_insert_menu": {
|
|
134
|
+
"type": "boolean"
|
|
135
|
+
},
|
|
133
136
|
"platform_editor_reduce_element_browser_padding": {
|
|
134
137
|
"type": "boolean"
|
|
135
138
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|