@atlaskit/editor-core 187.30.9 → 187.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/index.js +2 -21
- package/dist/cjs/plugins/help-dialog/index.js +3 -6
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -9
- package/dist/cjs/plugins/quick-insert/commands.js +6 -10
- package/dist/cjs/plugins/quick-insert/index.js +49 -52
- package/dist/cjs/plugins/quick-insert/search.js +17 -61
- package/dist/cjs/plugins/quick-insert/ui/ModalElementBrowser/index.js +12 -5
- package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +2 -1
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +17 -1
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +54 -54
- package/dist/cjs/utils/index.js +0 -32
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/index.js +7 -4
- package/dist/es2019/plugins/help-dialog/index.js +3 -6
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +7 -3
- package/dist/es2019/plugins/quick-insert/commands.js +6 -9
- package/dist/es2019/plugins/quick-insert/index.js +48 -45
- package/dist/es2019/plugins/quick-insert/search.js +15 -42
- package/dist/es2019/plugins/quick-insert/ui/ModalElementBrowser/index.js +11 -4
- package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +3 -2
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +14 -0
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +28 -25
- package/dist/es2019/utils/index.js +0 -25
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/index.js +7 -4
- package/dist/esm/plugins/help-dialog/index.js +3 -6
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +5 -3
- package/dist/esm/plugins/quick-insert/commands.js +6 -10
- package/dist/esm/plugins/quick-insert/index.js +49 -46
- package/dist/esm/plugins/quick-insert/search.js +15 -56
- package/dist/esm/plugins/quick-insert/ui/ModalElementBrowser/index.js +12 -5
- package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +3 -2
- package/dist/esm/plugins/selection/gap-cursor/utils.js +14 -0
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +54 -54
- package/dist/esm/utils/index.js +0 -31
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +6 -3
- package/dist/types/labs/next/presets/default.d.ts +32 -0
- package/dist/types/plugins/expand/ui/ExpandIconButton.d.ts +1 -1
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +4 -4
- package/dist/types/plugins/help-dialog/index.d.ts +5 -1
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +3 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +3 -0
- package/dist/types/plugins/quick-insert/commands.d.ts +2 -2
- package/dist/types/plugins/quick-insert/index.d.ts +12 -9
- package/dist/types/plugins/quick-insert/search.d.ts +3 -5
- package/dist/types/plugins/selection/gap-cursor/utils.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +3 -0
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +6 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +32 -0
- package/dist/types-ts4.5/plugins/expand/ui/ExpandIconButton.d.ts +1 -1
- package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +4 -4
- package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +3 -0
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +3 -0
- package/dist/types-ts4.5/plugins/quick-insert/commands.d.ts +2 -2
- package/dist/types-ts4.5/plugins/quick-insert/index.d.ts +12 -9
- package/dist/types-ts4.5/plugins/quick-insert/search.d.ts +3 -5
- package/dist/types-ts4.5/plugins/selection/gap-cursor/utils.d.ts +1 -0
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +3 -0
- package/dist/types-ts4.5/utils/index.d.ts +0 -1
- package/package.json +3 -6
- package/report.api.md +2 -30
- package/tmp/api-report-tmp.d.ts +2 -21
- package/dist/cjs/plugins/quick-insert/api.js +0 -23
- package/dist/cjs/plugins/quick-insert/types.js +0 -5
- package/dist/es2019/plugins/quick-insert/api.js +0 -14
- package/dist/es2019/plugins/quick-insert/types.js +0 -1
- package/dist/esm/plugins/quick-insert/api.js +0 -16
- package/dist/esm/plugins/quick-insert/types.js +0 -1
- package/dist/types/plugins/quick-insert/api.d.ts +0 -6
- package/dist/types/plugins/quick-insert/types.d.ts +0 -4
- package/dist/types-ts4.5/plugins/quick-insert/api.d.ts +0 -6
- package/dist/types-ts4.5/plugins/quick-insert/types.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c70a6612aba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c70a6612aba) - [ED-19428] Decouple quick-insert plugin from editor-core
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 187.30.10
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`a31ffa191cb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a31ffa191cb) - [ux] ED-19348 Fix gap-cursor position for numbered-table in wide/full-width mode
|
|
18
|
+
|
|
3
19
|
## 187.30.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -209,12 +209,6 @@ Object.defineProperty(exports, "commitStatusPicker", {
|
|
|
209
209
|
return _actions2.commitStatusPicker;
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
|
-
Object.defineProperty(exports, "createQuickInsertTools", {
|
|
213
|
-
enumerable: true,
|
|
214
|
-
get: function get() {
|
|
215
|
-
return _api2.createQuickInsertTools;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
212
|
Object.defineProperty(exports, "createTable", {
|
|
219
213
|
enumerable: true,
|
|
220
214
|
get: function get() {
|
|
@@ -254,7 +248,7 @@ Object.defineProperty(exports, "dateToDateType", {
|
|
|
254
248
|
Object.defineProperty(exports, "dedupe", {
|
|
255
249
|
enumerable: true,
|
|
256
250
|
get: function get() {
|
|
257
|
-
return
|
|
251
|
+
return _utils2.dedupe;
|
|
258
252
|
}
|
|
259
253
|
});
|
|
260
254
|
Object.defineProperty(exports, "deleteDate", {
|
|
@@ -371,18 +365,6 @@ Object.defineProperty(exports, "openDatePicker", {
|
|
|
371
365
|
return _actions.openDatePicker;
|
|
372
366
|
}
|
|
373
367
|
});
|
|
374
|
-
Object.defineProperty(exports, "processQuickInsertItems", {
|
|
375
|
-
enumerable: true,
|
|
376
|
-
get: function get() {
|
|
377
|
-
return _quickInsert.memoProcessItems;
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
Object.defineProperty(exports, "quickInsertPluginKey", {
|
|
381
|
-
enumerable: true,
|
|
382
|
-
get: function get() {
|
|
383
|
-
return _quickInsert.pluginKey;
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
368
|
Object.defineProperty(exports, "removeStatus", {
|
|
387
369
|
enumerable: true,
|
|
388
370
|
get: function get() {
|
|
@@ -524,11 +506,11 @@ var _formatParse = require("./plugins/date/utils/formatParse");
|
|
|
524
506
|
var _pluginKey = require("./plugins/date/pm-plugins/plugin-key");
|
|
525
507
|
var _actions2 = require("./plugins/status/actions");
|
|
526
508
|
var _typeAhead = require("./plugins/type-ahead");
|
|
527
|
-
var _quickInsert = require("./plugins/quick-insert");
|
|
528
509
|
var _history = require("./plugins/history");
|
|
529
510
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
530
511
|
var _commands6 = require("./plugins/mobile-dimensions/commands");
|
|
531
512
|
var _utils = require("./utils");
|
|
513
|
+
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
532
514
|
var _createEditor = require("./create-editor");
|
|
533
515
|
var _actions3 = _interopRequireDefault(require("./actions"));
|
|
534
516
|
var _portalProvider = require("@atlaskit/editor-common/portal-provider");
|
|
@@ -540,6 +522,5 @@ var _statusColorPalette = require("./ui/ColorPalette/Palettes/statusColorPalette
|
|
|
540
522
|
var _common = require("./ui/ColorPalette/Palettes/common");
|
|
541
523
|
var _messages = _interopRequireWildcard(require("./messages"));
|
|
542
524
|
var _api = require("./plugins/type-ahead/api");
|
|
543
|
-
var _api2 = require("./plugins/quick-insert/api");
|
|
544
525
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
545
526
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -13,7 +13,6 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
13
13
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
14
14
|
var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
|
|
15
15
|
var _HelpDialogLoader = require("./ui/HelpDialogLoader");
|
|
16
|
-
var _quickInsert = require("../quick-insert");
|
|
17
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
17
|
var _questionCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/question-circle"));
|
|
19
18
|
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
@@ -103,17 +102,15 @@ var helpDialog = function helpDialog() {
|
|
|
103
102
|
var editorView = _ref3.editorView;
|
|
104
103
|
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
105
104
|
plugins: {
|
|
106
|
-
helpDialog: _pluginKey.pluginKey
|
|
107
|
-
quickInsert: _quickInsert.pluginKey
|
|
105
|
+
helpDialog: _pluginKey.pluginKey
|
|
108
106
|
},
|
|
109
107
|
render: function render(_ref4) {
|
|
110
108
|
var _ref4$helpDialog = _ref4.helpDialog,
|
|
111
|
-
helpDialog = _ref4$helpDialog === void 0 ? {} : _ref4$helpDialog
|
|
112
|
-
quickInsert = _ref4.quickInsert;
|
|
109
|
+
helpDialog = _ref4$helpDialog === void 0 ? {} : _ref4$helpDialog;
|
|
113
110
|
return /*#__PURE__*/_react.default.createElement(_HelpDialogLoader.HelpDialogLoader, {
|
|
114
111
|
editorView: editorView,
|
|
115
112
|
isVisible: helpDialog.isVisible,
|
|
116
|
-
quickInsertEnabled: !!quickInsert,
|
|
113
|
+
quickInsertEnabled: !!(api !== null && api !== void 0 && api.dependencies.quickInsert),
|
|
117
114
|
imageEnabled: helpDialog.imageEnabled
|
|
118
115
|
});
|
|
119
116
|
}
|
|
@@ -25,7 +25,8 @@ var BlockInsertElementBrowser = function BlockInsertElementBrowser(props) {
|
|
|
25
25
|
dropdownItems: props.items,
|
|
26
26
|
onInsert: props.onInsert,
|
|
27
27
|
toggleVisiblity: props.togglePlusMenuVisibility,
|
|
28
|
-
showElementBrowserLink: props.showElementBrowserLink
|
|
28
|
+
showElementBrowserLink: props.showElementBrowserLink,
|
|
29
|
+
pluginInjectionApi: props.pluginInjectionApi
|
|
29
30
|
})), /*#__PURE__*/_react.default.createElement(_dropdownButton.DropDownButton, {
|
|
30
31
|
"aria-expanded": props.open,
|
|
31
32
|
"aria-haspopup": true,
|
|
@@ -44,7 +44,8 @@ var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
|
44
44
|
popupsScrollableElement: props.popupsScrollableElement,
|
|
45
45
|
spacing: props.spacing,
|
|
46
46
|
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
47
|
-
showElementBrowserLink: props.showElementBrowserLink
|
|
47
|
+
showElementBrowserLink: props.showElementBrowserLink,
|
|
48
|
+
pluginInjectionApi: props.pluginInjectionApi
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
return /*#__PURE__*/_react.default.createElement(_blockInsertMenuLegacy.BlockInsertMenuLegacy, {
|
|
@@ -22,18 +22,17 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
22
22
|
var _ToolbarButton = _interopRequireDefault(require("../../../../ui/ToolbarButton"));
|
|
23
23
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
24
24
|
var _actions = require("../../../date/actions");
|
|
25
|
-
var _commands = require("../../../quick-insert/commands");
|
|
26
25
|
var _actions2 = require("../../../placeholder-text/actions");
|
|
27
26
|
var _actions3 = require("../../../layout/actions");
|
|
28
|
-
var
|
|
29
|
-
var
|
|
27
|
+
var _commands = require("../../../tasks-and-decisions/commands");
|
|
28
|
+
var _commands2 = require("../../../expand/commands");
|
|
30
29
|
var _api = require("../../../type-ahead/api");
|
|
31
30
|
var _actions4 = require("../../../status/actions");
|
|
32
31
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
33
32
|
var _messages = require("./messages");
|
|
34
33
|
var _createItems3 = require("./create-items");
|
|
35
34
|
var _blockInsertMenu = require("./block-insert-menu");
|
|
36
|
-
var
|
|
35
|
+
var _commands3 = require("../../../rule/commands");
|
|
37
36
|
var _withOuterListeners = _interopRequireDefault(require("../../../../ui/with-outer-listeners"));
|
|
38
37
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
38
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -252,7 +251,7 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
252
251
|
state = _this$props$editorVie.state,
|
|
253
252
|
dispatch = _this$props$editorVie.dispatch;
|
|
254
253
|
var listType = name === 'action' ? 'taskList' : 'decisionList';
|
|
255
|
-
return (0,
|
|
254
|
+
return (0, _commands.insertTaskDecisionCommand)(listType, inputMethod)(state, dispatch);
|
|
256
255
|
};
|
|
257
256
|
});
|
|
258
257
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
|
|
@@ -261,13 +260,13 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
261
260
|
state = _this$props4$editorVi.state,
|
|
262
261
|
dispatch = _this$props4$editorVi.dispatch,
|
|
263
262
|
featureFlags = _this$props4.featureFlags;
|
|
264
|
-
return (0,
|
|
263
|
+
return (0, _commands3.insertHorizontalRule)(inputMethod, featureFlags)(state, dispatch);
|
|
265
264
|
});
|
|
266
265
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
267
266
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
268
267
|
state = _this$props$editorVie2.state,
|
|
269
268
|
dispatch = _this$props$editorVie2.dispatch;
|
|
270
|
-
return (0,
|
|
269
|
+
return (0, _commands2.insertExpand)(state, dispatch);
|
|
271
270
|
});
|
|
272
271
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertBlockType", function (itemName) {
|
|
273
272
|
return function () {
|
|
@@ -289,7 +288,9 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
289
288
|
return true;
|
|
290
289
|
});
|
|
291
290
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openElementBrowser", function () {
|
|
292
|
-
|
|
291
|
+
var _pluginInjectionApi$d10;
|
|
292
|
+
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
293
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d10 = pluginInjectionApi.dependencies.quickInsert) === null || _pluginInjectionApi$d10 === void 0 ? void 0 : _pluginInjectionApi$d10.commands.openElementBrowserModal);
|
|
293
294
|
});
|
|
294
295
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref2) {
|
|
295
296
|
var item = _ref2.item,
|
|
@@ -501,7 +502,8 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
501
502
|
onOpenChange: this.onOpenChange,
|
|
502
503
|
togglePlusMenuVisibility: this.togglePlusMenuVisibility,
|
|
503
504
|
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
|
|
504
|
-
showElementBrowserLink: this.props.showElementBrowserLink || false
|
|
505
|
+
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
506
|
+
pluginInjectionApi: this.props.pluginInjectionApi
|
|
505
507
|
})), this.props.showSeparator && (0, _react2.jsx)("span", {
|
|
506
508
|
css: _styles.separatorStyles
|
|
507
509
|
}));
|
|
@@ -6,15 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.openElementBrowserModal = exports.insertItem = exports.closeElementBrowserModal = void 0;
|
|
7
7
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
8
8
|
var _pluginKey = require("./plugin-key");
|
|
9
|
-
var openElementBrowserModal = function openElementBrowserModal() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
return true;
|
|
17
|
-
};
|
|
9
|
+
var openElementBrowserModal = function openElementBrowserModal(_ref) {
|
|
10
|
+
var tr = _ref.tr;
|
|
11
|
+
return tr.setMeta(_pluginKey.pluginKey, {
|
|
12
|
+
isElementBrowserModalOpen: true
|
|
13
|
+
});
|
|
18
14
|
};
|
|
19
15
|
exports.openElementBrowserModal = openElementBrowserModal;
|
|
20
16
|
var closeElementBrowserModal = function closeElementBrowserModal() {
|
|
@@ -28,7 +24,7 @@ var closeElementBrowserModal = function closeElementBrowserModal() {
|
|
|
28
24
|
};
|
|
29
25
|
};
|
|
30
26
|
|
|
31
|
-
// this method was adapted from the
|
|
27
|
+
// this method was adapted from the typeahead plugin so we respect the API for quick insert items
|
|
32
28
|
exports.closeElementBrowserModal = closeElementBrowserModal;
|
|
33
29
|
var insertItem = function insertItem(item) {
|
|
34
30
|
return function (state, dispatch) {
|
|
@@ -4,29 +4,24 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
8
|
-
Object.defineProperty(exports, "pluginKey", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _pluginKey.pluginKey;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
7
|
+
exports.default = void 0;
|
|
14
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
15
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
11
|
var _react = _interopRequireDefault(require("react"));
|
|
18
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
19
|
-
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
20
13
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
21
14
|
var _pluginKey = require("./plugin-key");
|
|
22
15
|
var _search = require("./search");
|
|
23
16
|
var _ModalElementBrowser = _interopRequireDefault(require("./ui/ModalElementBrowser"));
|
|
17
|
+
var _commands = require("./commands");
|
|
18
|
+
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
24
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
21
|
var quickInsertPlugin = function quickInsertPlugin(options) {
|
|
27
22
|
return {
|
|
28
23
|
name: 'quickInsert',
|
|
29
|
-
pmPlugins: function pmPlugins(
|
|
24
|
+
pmPlugins: function pmPlugins(defaultItems) {
|
|
30
25
|
return [{
|
|
31
26
|
name: 'quickInsert',
|
|
32
27
|
// It's important that this plugin is above TypeAheadPlugin
|
|
@@ -34,7 +29,7 @@ var quickInsertPlugin = function quickInsertPlugin(options) {
|
|
|
34
29
|
var providerFactory = _ref.providerFactory,
|
|
35
30
|
getIntl = _ref.getIntl,
|
|
36
31
|
dispatch = _ref.dispatch;
|
|
37
|
-
return quickInsertPluginFactory(
|
|
32
|
+
return quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler);
|
|
38
33
|
}
|
|
39
34
|
}];
|
|
40
35
|
},
|
|
@@ -42,12 +37,19 @@ var quickInsertPlugin = function quickInsertPlugin(options) {
|
|
|
42
37
|
typeAhead: {
|
|
43
38
|
id: _typeAhead.TypeAheadAvailableNodes.QUICK_INSERT,
|
|
44
39
|
trigger: '/',
|
|
45
|
-
headless: options ? options.headless
|
|
40
|
+
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
46
41
|
getItems: function getItems(_ref2) {
|
|
47
42
|
var query = _ref2.query,
|
|
48
43
|
editorState = _ref2.editorState;
|
|
49
44
|
var quickInsertState = _pluginKey.pluginKey.getState(editorState);
|
|
50
|
-
return Promise.resolve((0,
|
|
45
|
+
return Promise.resolve((0, _quickInsert.getQuickInsertSuggestions)({
|
|
46
|
+
searchOptions: {
|
|
47
|
+
query: query,
|
|
48
|
+
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems
|
|
49
|
+
},
|
|
50
|
+
lazyDefaultItems: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems,
|
|
51
|
+
providedItems: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems
|
|
52
|
+
}));
|
|
51
53
|
},
|
|
52
54
|
selectItem: function selectItem(state, item, insert) {
|
|
53
55
|
return item.action(insert, state);
|
|
@@ -56,53 +58,40 @@ var quickInsertPlugin = function quickInsertPlugin(options) {
|
|
|
56
58
|
},
|
|
57
59
|
contentComponent: function contentComponent(_ref3) {
|
|
58
60
|
var editorView = _ref3.editorView;
|
|
59
|
-
if (options && options.enableElementBrowser) {
|
|
61
|
+
if (options !== null && options !== void 0 && options.enableElementBrowser) {
|
|
60
62
|
return /*#__PURE__*/_react.default.createElement(_ModalElementBrowser.default, {
|
|
61
63
|
editorView: editorView,
|
|
62
|
-
helpUrl: options.elementBrowserHelpUrl
|
|
64
|
+
helpUrl: options === null || options === void 0 ? void 0 : options.elementBrowserHelpUrl
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
67
|
return null;
|
|
68
|
+
},
|
|
69
|
+
getSharedState: function getSharedState(editorState) {
|
|
70
|
+
var _quickInsertState$sug;
|
|
71
|
+
if (!editorState) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
var quickInsertState = _pluginKey.pluginKey.getState(editorState);
|
|
75
|
+
if (!quickInsertState) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
suggestions: (_quickInsertState$sug = quickInsertState.suggestions) !== null && _quickInsertState$sug !== void 0 ? _quickInsertState$sug : [],
|
|
80
|
+
lazyDefaultItems: quickInsertState.lazyDefaultItems,
|
|
81
|
+
emptyStateHandler: quickInsertState.emptyStateHandler
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
actions: {
|
|
85
|
+
insertItem: _commands.insertItem
|
|
86
|
+
},
|
|
87
|
+
commands: {
|
|
88
|
+
search: _search.search,
|
|
89
|
+
openElementBrowserModal: _commands.openElementBrowserModal
|
|
66
90
|
}
|
|
67
91
|
};
|
|
68
92
|
};
|
|
69
93
|
var _default = quickInsertPlugin;
|
|
70
94
|
exports.default = _default;
|
|
71
|
-
var processItems = function processItems(items, intl, extendedActions) {
|
|
72
|
-
var reducedItems = items.reduce(function (acc, item) {
|
|
73
|
-
if (typeof item === 'function') {
|
|
74
|
-
var quickInsertItems = item(intl);
|
|
75
|
-
return acc.concat(quickInsertItems);
|
|
76
|
-
}
|
|
77
|
-
return acc.concat(item);
|
|
78
|
-
}, []);
|
|
79
|
-
return extendQuickInsertAction(reducedItems, extendedActions);
|
|
80
|
-
};
|
|
81
|
-
var memoProcessItems = (0, _memoizeOne.default)(processItems);
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Allows for extending the quickInsertItems actions with the provided extendedActions.
|
|
85
|
-
* The provided extended action will then be called after the original action is executed.
|
|
86
|
-
* This is useful for mobile communications where we need to talk to the mobile bridge.
|
|
87
|
-
*/
|
|
88
|
-
exports.memoProcessItems = memoProcessItems;
|
|
89
|
-
var extendQuickInsertAction = function extendQuickInsertAction(quickInsertItems, extendedActions) {
|
|
90
|
-
if (!extendedActions) {
|
|
91
|
-
return quickInsertItems;
|
|
92
|
-
}
|
|
93
|
-
return quickInsertItems.map(function (quickInsertItem) {
|
|
94
|
-
var quickInsertId = quickInsertItem.id;
|
|
95
|
-
if (quickInsertId && extendedActions[quickInsertId]) {
|
|
96
|
-
var originalAction = quickInsertItem.action;
|
|
97
|
-
quickInsertItem.action = function (insert, state) {
|
|
98
|
-
var result = originalAction(insert, state);
|
|
99
|
-
extendedActions[quickInsertId](quickInsertItem);
|
|
100
|
-
return result;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
return quickInsertItem;
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
95
|
var setProviderState = function setProviderState(providerState) {
|
|
107
96
|
return function (state, dispatch) {
|
|
108
97
|
if (dispatch) {
|
|
@@ -111,7 +100,7 @@ var setProviderState = function setProviderState(providerState) {
|
|
|
111
100
|
return true;
|
|
112
101
|
};
|
|
113
102
|
};
|
|
114
|
-
function quickInsertPluginFactory(
|
|
103
|
+
function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, emptyStateHandler) {
|
|
115
104
|
return new _safePlugin.SafePlugin({
|
|
116
105
|
key: _pluginKey.pluginKey,
|
|
117
106
|
state: {
|
|
@@ -123,13 +112,21 @@ function quickInsertPluginFactory(quickInsertItems, providerFactory, getIntl, di
|
|
|
123
112
|
// memo here to avoid using a singleton cache, avoids editor
|
|
124
113
|
// getting confused when two editors exist within the same page.
|
|
125
114
|
lazyDefaultItems: function lazyDefaultItems() {
|
|
126
|
-
return
|
|
127
|
-
}
|
|
115
|
+
return (0, _quickInsert.memoProcessQuickInsertItems)(defaultItems || [], getIntl());
|
|
116
|
+
},
|
|
117
|
+
suggestions: []
|
|
128
118
|
};
|
|
129
119
|
},
|
|
130
120
|
apply: function apply(tr, pluginState) {
|
|
131
121
|
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
132
122
|
if (meta) {
|
|
123
|
+
if ('searchOptions' in meta) {
|
|
124
|
+
meta.suggestions = (0, _quickInsert.getQuickInsertSuggestions)({
|
|
125
|
+
searchOptions: meta.searchOptions,
|
|
126
|
+
lazyDefaultItems: pluginState.lazyDefaultItems,
|
|
127
|
+
providedItems: pluginState.providedItems
|
|
128
|
+
});
|
|
129
|
+
}
|
|
133
130
|
var keys = Object.keys(meta);
|
|
134
131
|
var changed = keys.some(function (key) {
|
|
135
132
|
return pluginState[key] !== meta[key];
|
|
@@ -1,69 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, {
|
|
24
|
-
name: 'description',
|
|
25
|
-
weight: 0.04
|
|
26
|
-
}, {
|
|
27
|
-
name: 'keyshortcut',
|
|
28
|
-
weight: 0.01
|
|
29
|
-
}]
|
|
30
|
-
};
|
|
31
|
-
function find(query, items) {
|
|
32
|
-
var fuse = new _fuse.default(items, options);
|
|
33
|
-
if (query === '') {
|
|
34
|
-
// Copy and sort list by priority
|
|
35
|
-
return items.slice(0).sort(function (a, b) {
|
|
36
|
-
return (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return fuse.search(query).map(function (result) {
|
|
40
|
-
return result.item;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
var searchQuickInsertItems = function searchQuickInsertItems(quickInsertState, options) {
|
|
44
|
-
return function (query, category) {
|
|
45
|
-
var defaultItems = !quickInsertState || options && options.disableDefaultItems ? [] : quickInsertState.lazyDefaultItems();
|
|
46
|
-
var providedItems = quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems;
|
|
47
|
-
var items = providedItems ? (0, _utils.dedupe)([].concat((0, _toConsumableArray2.default)(defaultItems), (0, _toConsumableArray2.default)(providedItems)), function (item) {
|
|
48
|
-
return item.title;
|
|
49
|
-
}) : defaultItems;
|
|
50
|
-
return find(query || '', category === 'all' || !category ? items : items.filter(function (item) {
|
|
51
|
-
return item.categories && item.categories.includes(category);
|
|
52
|
-
}));
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
exports.searchQuickInsertItems = searchQuickInsertItems;
|
|
56
|
-
var getFeaturedQuickInsertItems = function getFeaturedQuickInsertItems(_ref, options) {
|
|
57
|
-
var providedItems = _ref.providedItems,
|
|
58
|
-
lazyDefaultItems = _ref.lazyDefaultItems;
|
|
59
|
-
return function () {
|
|
60
|
-
var defaultItems = options && options.disableDefaultItems ? [] : lazyDefaultItems();
|
|
61
|
-
var items = providedItems ? (0, _utils.dedupe)([].concat((0, _toConsumableArray2.default)(defaultItems), (0, _toConsumableArray2.default)(providedItems)), function (item) {
|
|
62
|
-
return item.title;
|
|
63
|
-
}) : defaultItems;
|
|
64
|
-
return items.filter(function (item) {
|
|
65
|
-
return item.featured;
|
|
6
|
+
exports.search = void 0;
|
|
7
|
+
var _pluginKey = require("./plugin-key");
|
|
8
|
+
var search = function search(_ref) {
|
|
9
|
+
var query = _ref.query,
|
|
10
|
+
category = _ref.category,
|
|
11
|
+
disableDefaultItems = _ref.disableDefaultItems,
|
|
12
|
+
featuredItems = _ref.featuredItems;
|
|
13
|
+
return function (_ref2) {
|
|
14
|
+
var tr = _ref2.tr;
|
|
15
|
+
return tr.setMeta(_pluginKey.pluginKey, {
|
|
16
|
+
searchOptions: {
|
|
17
|
+
query: query,
|
|
18
|
+
category: category,
|
|
19
|
+
disableDefaultItems: disableDefaultItems,
|
|
20
|
+
featuredItems: featuredItems
|
|
21
|
+
}
|
|
66
22
|
});
|
|
67
23
|
};
|
|
68
24
|
};
|
|
69
|
-
exports.
|
|
25
|
+
exports.search = search;
|
|
@@ -9,9 +9,9 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _WithPluginState = _interopRequireDefault(require("../../../../ui/WithPluginState"));
|
|
11
11
|
var _pluginKey = require("../../plugin-key");
|
|
12
|
-
var _search = require("../../search");
|
|
13
12
|
var _ModalElementBrowser = _interopRequireDefault(require("../../../../ui/ElementBrowser/ModalElementBrowser"));
|
|
14
13
|
var _commands = require("../../commands");
|
|
14
|
+
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
var Modal = function Modal(_ref) {
|
|
@@ -19,8 +19,15 @@ var Modal = function Modal(_ref) {
|
|
|
19
19
|
editorView = _ref.editorView,
|
|
20
20
|
helpUrl = _ref.helpUrl;
|
|
21
21
|
var getItems = (0, _react.useCallback)(function (query, category) {
|
|
22
|
-
return (0,
|
|
23
|
-
|
|
22
|
+
return (0, _quickInsert.getQuickInsertSuggestions)({
|
|
23
|
+
searchOptions: {
|
|
24
|
+
query: query,
|
|
25
|
+
category: category
|
|
26
|
+
},
|
|
27
|
+
lazyDefaultItems: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems,
|
|
28
|
+
providedItems: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems
|
|
29
|
+
});
|
|
30
|
+
}, [quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems]);
|
|
24
31
|
var focusInEditor = (0, _react.useCallback)(function () {
|
|
25
32
|
if (!editorView.hasFocus()) {
|
|
26
33
|
editorView.focus();
|
|
@@ -39,8 +46,8 @@ var Modal = function Modal(_ref) {
|
|
|
39
46
|
getItems: getItems,
|
|
40
47
|
onInsertItem: onInsertItem,
|
|
41
48
|
helpUrl: helpUrl,
|
|
42
|
-
isOpen: quickInsertState
|
|
43
|
-
emptyStateHandler: quickInsertState
|
|
49
|
+
isOpen: (quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.isElementBrowserModalOpen) || false,
|
|
50
|
+
emptyStateHandler: quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.emptyStateHandler,
|
|
44
51
|
onClose: onClose
|
|
45
52
|
});
|
|
46
53
|
};
|
|
@@ -91,7 +91,8 @@ var toDOM = function toDOM(view, getPos) {
|
|
|
91
91
|
}
|
|
92
92
|
if (layoutMode) {
|
|
93
93
|
gapCursor.setAttribute('layout', layoutMode);
|
|
94
|
-
|
|
94
|
+
var breakoutModeStyle = (0, _utils.getComputedStyleForLayoutMode)(dom, node, style);
|
|
95
|
+
gapCursor.style.width = "".concat(measureWidth(breakoutModeStyle), "px");
|
|
95
96
|
} else {
|
|
96
97
|
mutateElementStyle(gapCursor, style, selection.side);
|
|
97
98
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getComputedStyleForLayoutMode = void 0;
|
|
6
7
|
exports.getLayoutModeFromTargetNode = getLayoutModeFromTargetNode;
|
|
7
8
|
exports.getMediaNearPos = getMediaNearPos;
|
|
8
9
|
exports.isTextBlockNearPos = exports.isLeftCursor = exports.isIgnoredClick = void 0;
|
|
@@ -123,4 +124,19 @@ var isIgnoredClick = function isIgnoredClick(elem) {
|
|
|
123
124
|
}
|
|
124
125
|
return false;
|
|
125
126
|
};
|
|
126
|
-
|
|
127
|
+
|
|
128
|
+
/*
|
|
129
|
+
Calculates custom style for breakout mode
|
|
130
|
+
Mainly to handle table width to include the numbered column width as well
|
|
131
|
+
*/
|
|
132
|
+
exports.isIgnoredClick = isIgnoredClick;
|
|
133
|
+
var getComputedStyleForLayoutMode = function getComputedStyleForLayoutMode(dom, node, style) {
|
|
134
|
+
if (node && node.type.name === 'table') {
|
|
135
|
+
var tableContainer = dom.querySelector('.pm-table-container');
|
|
136
|
+
if (tableContainer) {
|
|
137
|
+
return window.getComputedStyle(tableContainer);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return style;
|
|
141
|
+
};
|
|
142
|
+
exports.getComputedStyleForLayoutMode = getComputedStyleForLayoutMode;
|