@atlaskit/editor-plugin-floating-toolbar 8.2.0 → 8.2.2
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/floatingToolbarPlugin.js +59 -8
- package/dist/cjs/pm-plugins/toolbar-data/commands.js +3 -2
- package/dist/cjs/pm-plugins/toolbar-data/reducer.js +2 -1
- package/dist/cjs/ui/Toolbar.js +25 -2
- package/dist/es2019/floatingToolbarPlugin.js +61 -9
- package/dist/es2019/pm-plugins/toolbar-data/commands.js +3 -2
- package/dist/es2019/pm-plugins/toolbar-data/reducer.js +2 -1
- package/dist/es2019/ui/Toolbar.js +23 -1
- package/dist/esm/floatingToolbarPlugin.js +59 -8
- package/dist/esm/pm-plugins/toolbar-data/commands.js +3 -2
- package/dist/esm/pm-plugins/toolbar-data/reducer.js +2 -1
- package/dist/esm/ui/Toolbar.js +24 -1
- package/dist/types/floatingToolbarPlugin.d.ts +30 -0
- package/dist/types/floatingToolbarPluginType.d.ts +1 -0
- package/dist/types/pm-plugins/toolbar-data/commands.d.ts +1 -1
- package/dist/types/pm-plugins/toolbar-data/types.d.ts +1 -0
- package/dist/types-ts4.5/floatingToolbarPlugin.d.ts +30 -0
- package/dist/types-ts4.5/floatingToolbarPluginType.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-data/commands.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/toolbar-data/types.d.ts +1 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 8.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`94b21013815ad`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/94b21013815ad) -
|
|
8
|
+
[ux] ensure confirmation is required when removing a table with an associated chart (fixes bug
|
|
9
|
+
when platform_editor_controls is set to variant1)
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 8.2.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`5292689cffab1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5292689cffab1) -
|
|
17
|
+
fix/ignore minor eslint issues ahead of bug fix for confirming the removal of tables
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 8.2.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -209,8 +209,26 @@ var floatingToolbarPlugin = exports.floatingToolbarPlugin = function floatingToo
|
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* React component that renders the floating toolbar UI for the editor.
|
|
215
|
+
*
|
|
216
|
+
* This component manages the display of floating toolbars based on the current editor state,
|
|
217
|
+
* selection, and configuration. It handles visibility conditions, positioning, toolbar items
|
|
218
|
+
* consolidation, and confirmation dialogs.
|
|
219
|
+
*
|
|
220
|
+
* @param props - Component properties
|
|
221
|
+
* @param props.pluginInjectionApi - Plugin injection API for accessing other plugin states
|
|
222
|
+
* @param props.editorView - ProseMirror EditorView instance
|
|
223
|
+
* @param props.popupsMountPoint - DOM element where popups should be mounted
|
|
224
|
+
* @param props.popupsBoundariesElement - Element that defines popup boundaries
|
|
225
|
+
* @param props.popupsScrollableElement - Scrollable container element for popups
|
|
226
|
+
* @param props.providerFactory - Factory for creating various providers
|
|
227
|
+
* @param props.dispatchAnalyticsEvent - Function to dispatch analytics events
|
|
228
|
+
* @returns JSX element representing the floating toolbar or null if not visible
|
|
229
|
+
*/
|
|
212
230
|
function ContentComponent(_ref5) {
|
|
213
|
-
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d;
|
|
231
|
+
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d, _confirmButtonItem, _confirmButtonItem2, _confirmButtonItem3;
|
|
214
232
|
var pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
215
233
|
editorView = _ref5.editorView,
|
|
216
234
|
popupsMountPoint = _ref5.popupsMountPoint,
|
|
@@ -371,14 +389,33 @@ function ContentComponent(_ref5) {
|
|
|
371
389
|
};
|
|
372
390
|
|
|
373
391
|
// Confirm dialog
|
|
374
|
-
var
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
392
|
+
var confirmButtonItem;
|
|
393
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_confirm_table_removal')) {
|
|
394
|
+
var _ref7 = floatingToolbarData || {},
|
|
395
|
+
confirmDialogForItem = _ref7.confirmDialogForItem,
|
|
396
|
+
confirmDialogForItemOption = _ref7.confirmDialogForItemOption;
|
|
397
|
+
var matchingItem = confirmDialogForItem ? toolbarItems === null || toolbarItems === void 0 ? void 0 : toolbarItems[confirmDialogForItem] : undefined;
|
|
398
|
+
if ((matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.type) === 'button') {
|
|
399
|
+
confirmButtonItem = matchingItem;
|
|
400
|
+
}
|
|
401
|
+
if ((matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.type) === 'overflow-dropdown' && confirmDialogForItemOption !== undefined) {
|
|
402
|
+
var matchingItemOption = matchingItem.options[confirmDialogForItemOption];
|
|
403
|
+
|
|
404
|
+
// OverflowDropdownOption is the only member of the union that does not have a 'type' property
|
|
405
|
+
if (!('type' in matchingItemOption)) {
|
|
406
|
+
confirmButtonItem = matchingItemOption;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
} else {
|
|
410
|
+
var _ref8 = floatingToolbarData || {},
|
|
411
|
+
_confirmDialogForItem = _ref8.confirmDialogForItem;
|
|
412
|
+
confirmButtonItem = _confirmDialogForItem ?
|
|
413
|
+
// Ignored via go/ees005
|
|
414
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
415
|
+
toolbarItems[_confirmDialogForItem] : undefined;
|
|
416
|
+
}
|
|
380
417
|
var scrollable = config.scrollable;
|
|
381
|
-
var confirmDialogOptions = typeof (confirmButtonItem === null ||
|
|
418
|
+
var confirmDialogOptions = typeof ((_confirmButtonItem = confirmButtonItem) === null || _confirmButtonItem === void 0 ? void 0 : _confirmButtonItem.confirmDialog) === 'function' ? (_confirmButtonItem2 = confirmButtonItem) === null || _confirmButtonItem2 === void 0 ? void 0 : _confirmButtonItem2.confirmDialog() : (_confirmButtonItem3 = confirmButtonItem) === null || _confirmButtonItem3 === void 0 ? void 0 : _confirmButtonItem3.confirmDialog;
|
|
382
419
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
383
420
|
component: _analytics.ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
|
|
384
421
|
componentId: (0, _camelCase.default)(title),
|
|
@@ -489,6 +526,20 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
489
526
|
}
|
|
490
527
|
return config;
|
|
491
528
|
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Creates a floating toolbar plugin for the ProseMirror editor.
|
|
532
|
+
*
|
|
533
|
+
* This factory function creates a SafePlugin that manages floating toolbars in the editor.
|
|
534
|
+
* It processes an array of floating toolbar handlers and determines which toolbar configuration
|
|
535
|
+
* should be active based on the current editor state and selection.
|
|
536
|
+
*
|
|
537
|
+
* @param options - Configuration object for the floating toolbar plugin
|
|
538
|
+
* @param options.floatingToolbarHandlers - Array of handlers that return toolbar configurations
|
|
539
|
+
* @param options.getIntl - Function that returns the IntlShape instance for internationalization
|
|
540
|
+
* @param options.providerFactory - Factory for creating various providers used by the editor
|
|
541
|
+
* @returns A SafePlugin instance that manages floating toolbar state and behavior
|
|
542
|
+
*/
|
|
492
543
|
function floatingToolbarPluginFactory(options) {
|
|
493
544
|
var floatingToolbarHandlers = options.floatingToolbarHandlers,
|
|
494
545
|
providerFactory = options.providerFactory,
|
|
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.showConfirmDialog = exports.hideConfirmDialog = void 0;
|
|
7
7
|
var _pluginFactory = require("./plugin-factory");
|
|
8
|
-
var showConfirmDialog = exports.showConfirmDialog = function showConfirmDialog(buttonIndex) {
|
|
8
|
+
var showConfirmDialog = exports.showConfirmDialog = function showConfirmDialog(buttonIndex, optionIndex) {
|
|
9
9
|
return (0, _pluginFactory.createCommand)({
|
|
10
10
|
type: 'SHOW_CONFIRM_DIALOG',
|
|
11
11
|
data: {
|
|
12
|
-
buttonIndex: buttonIndex
|
|
12
|
+
buttonIndex: buttonIndex,
|
|
13
|
+
optionIndex: optionIndex
|
|
13
14
|
}
|
|
14
15
|
}, function (tr) {
|
|
15
16
|
return tr.setMeta('addToHistory', false);
|
|
@@ -12,7 +12,8 @@ var reducer = exports.reducer = function reducer(pluginState, action) {
|
|
|
12
12
|
switch (action.type) {
|
|
13
13
|
case 'SHOW_CONFIRM_DIALOG':
|
|
14
14
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
15
|
-
confirmDialogForItem: action.data.buttonIndex
|
|
15
|
+
confirmDialogForItem: action.data.buttonIndex,
|
|
16
|
+
confirmDialogForItemOption: action.data.optionIndex
|
|
16
17
|
});
|
|
17
18
|
case 'HIDE_CONFIRM_DIALOG':
|
|
18
19
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
package/dist/cjs/ui/Toolbar.js
CHANGED
|
@@ -26,6 +26,7 @@ var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
|
26
26
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
27
27
|
var _editorPalette = require("@atlaskit/editor-palette");
|
|
28
28
|
var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
|
|
29
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
29
30
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
30
31
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
31
32
|
var _forceFocus = require("../pm-plugins/force-focus");
|
|
@@ -39,10 +40,13 @@ var _ScrollButtons = require("./ScrollButtons");
|
|
|
39
40
|
var _Select = _interopRequireDefault(require("./Select"));
|
|
40
41
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
41
42
|
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)); }
|
|
42
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
43
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
44
|
+
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; }
|
|
45
|
+
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; } /* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation */ /**
|
|
43
46
|
* @jsxRuntime classic
|
|
44
47
|
* @jsx jsx
|
|
45
48
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
49
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
46
50
|
function groupItems(items, areAnyNewToolbarFlagsEnabled) {
|
|
47
51
|
var groupItems = items.reduce(function (accumulator, item, i) {
|
|
48
52
|
var finalOutput = accumulator.finalOutput,
|
|
@@ -199,6 +203,25 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
199
203
|
return item.render(editorView, idx, dispatchAnalyticsEvent);
|
|
200
204
|
}
|
|
201
205
|
case 'overflow-dropdown':
|
|
206
|
+
var options;
|
|
207
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_confirm_table_removal')) {
|
|
208
|
+
// if an option has a confirmDialog, we need to replace its onClick handler
|
|
209
|
+
// to set the state to show the confirm dialog
|
|
210
|
+
|
|
211
|
+
// crudely done here to avoid greater coupling with DropdownMenuItem from `floating-toolbar`
|
|
212
|
+
// which would need knowledge of indexes, showConfirmDialog etc.
|
|
213
|
+
options = item.options.map(function (option, optionIndex) {
|
|
214
|
+
if (!('type' in option) && option.confirmDialog) {
|
|
215
|
+
var onClick = option.confirmDialog ? (0, _commands.showConfirmDialog)(idx, optionIndex) : option.onClick;
|
|
216
|
+
return _objectSpread(_objectSpread({}, option), {}, {
|
|
217
|
+
onClick: onClick
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return option;
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
options = item.options;
|
|
224
|
+
}
|
|
202
225
|
return (0, _react2.jsx)(_Dropdown.default, {
|
|
203
226
|
alignX: areAnyNewToolbarFlagsEnabled ? 'right' : undefined,
|
|
204
227
|
key: idx,
|
|
@@ -208,7 +231,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
208
231
|
spacing: "spacious"
|
|
209
232
|
}),
|
|
210
233
|
dispatchCommand: dispatchCommand,
|
|
211
|
-
options:
|
|
234
|
+
options: options,
|
|
212
235
|
disabled: item.disabled,
|
|
213
236
|
tooltip: item.tooltip,
|
|
214
237
|
hideExpandIcon: true,
|
|
@@ -195,6 +195,24 @@ export const floatingToolbarPlugin = ({
|
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* React component that renders the floating toolbar UI for the editor.
|
|
201
|
+
*
|
|
202
|
+
* This component manages the display of floating toolbars based on the current editor state,
|
|
203
|
+
* selection, and configuration. It handles visibility conditions, positioning, toolbar items
|
|
204
|
+
* consolidation, and confirmation dialogs.
|
|
205
|
+
*
|
|
206
|
+
* @param props - Component properties
|
|
207
|
+
* @param props.pluginInjectionApi - Plugin injection API for accessing other plugin states
|
|
208
|
+
* @param props.editorView - ProseMirror EditorView instance
|
|
209
|
+
* @param props.popupsMountPoint - DOM element where popups should be mounted
|
|
210
|
+
* @param props.popupsBoundariesElement - Element that defines popup boundaries
|
|
211
|
+
* @param props.popupsScrollableElement - Scrollable container element for popups
|
|
212
|
+
* @param props.providerFactory - Factory for creating various providers
|
|
213
|
+
* @param props.dispatchAnalyticsEvent - Function to dispatch analytics events
|
|
214
|
+
* @returns JSX element representing the floating toolbar or null if not visible
|
|
215
|
+
*/
|
|
198
216
|
export function ContentComponent({
|
|
199
217
|
pluginInjectionApi,
|
|
200
218
|
editorView,
|
|
@@ -204,7 +222,7 @@ export function ContentComponent({
|
|
|
204
222
|
providerFactory,
|
|
205
223
|
dispatchAnalyticsEvent
|
|
206
224
|
}) {
|
|
207
|
-
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d;
|
|
225
|
+
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d, _confirmButtonItem, _confirmButtonItem2, _confirmButtonItem3;
|
|
208
226
|
const {
|
|
209
227
|
floatingToolbarState,
|
|
210
228
|
editorDisabledState,
|
|
@@ -355,15 +373,35 @@ export function ContentComponent({
|
|
|
355
373
|
const dispatchCommand = fn => fn && fn(editorView.state, editorView.dispatch, editorView);
|
|
356
374
|
|
|
357
375
|
// Confirm dialog
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
376
|
+
let confirmButtonItem;
|
|
377
|
+
if (fg('platform_editor_fix_confirm_table_removal')) {
|
|
378
|
+
const {
|
|
379
|
+
confirmDialogForItem,
|
|
380
|
+
confirmDialogForItemOption
|
|
381
|
+
} = floatingToolbarData || {};
|
|
382
|
+
const matchingItem = confirmDialogForItem ? toolbarItems === null || toolbarItems === void 0 ? void 0 : toolbarItems[confirmDialogForItem] : undefined;
|
|
383
|
+
if ((matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.type) === 'button') {
|
|
384
|
+
confirmButtonItem = matchingItem;
|
|
385
|
+
}
|
|
386
|
+
if ((matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.type) === 'overflow-dropdown' && confirmDialogForItemOption !== undefined) {
|
|
387
|
+
const matchingItemOption = matchingItem.options[confirmDialogForItemOption];
|
|
388
|
+
|
|
389
|
+
// OverflowDropdownOption is the only member of the union that does not have a 'type' property
|
|
390
|
+
if (!('type' in matchingItemOption)) {
|
|
391
|
+
confirmButtonItem = matchingItemOption;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
const {
|
|
396
|
+
confirmDialogForItem
|
|
397
|
+
} = floatingToolbarData || {};
|
|
398
|
+
confirmButtonItem = confirmDialogForItem ?
|
|
399
|
+
// Ignored via go/ees005
|
|
400
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
401
|
+
toolbarItems[confirmDialogForItem] : undefined;
|
|
402
|
+
}
|
|
365
403
|
const scrollable = config.scrollable;
|
|
366
|
-
const confirmDialogOptions = typeof (confirmButtonItem === null ||
|
|
404
|
+
const confirmDialogOptions = typeof ((_confirmButtonItem = confirmButtonItem) === null || _confirmButtonItem === void 0 ? void 0 : _confirmButtonItem.confirmDialog) === 'function' ? (_confirmButtonItem2 = confirmButtonItem) === null || _confirmButtonItem2 === void 0 ? void 0 : _confirmButtonItem2.confirmDialog() : (_confirmButtonItem3 = confirmButtonItem) === null || _confirmButtonItem3 === void 0 ? void 0 : _confirmButtonItem3.confirmDialog;
|
|
367
405
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
368
406
|
component: ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
|
|
369
407
|
componentId: camelCase(title),
|
|
@@ -472,6 +510,20 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
472
510
|
}
|
|
473
511
|
return config;
|
|
474
512
|
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Creates a floating toolbar plugin for the ProseMirror editor.
|
|
516
|
+
*
|
|
517
|
+
* This factory function creates a SafePlugin that manages floating toolbars in the editor.
|
|
518
|
+
* It processes an array of floating toolbar handlers and determines which toolbar configuration
|
|
519
|
+
* should be active based on the current editor state and selection.
|
|
520
|
+
*
|
|
521
|
+
* @param options - Configuration object for the floating toolbar plugin
|
|
522
|
+
* @param options.floatingToolbarHandlers - Array of handlers that return toolbar configurations
|
|
523
|
+
* @param options.getIntl - Function that returns the IntlShape instance for internationalization
|
|
524
|
+
* @param options.providerFactory - Factory for creating various providers used by the editor
|
|
525
|
+
* @returns A SafePlugin instance that manages floating toolbar state and behavior
|
|
526
|
+
*/
|
|
475
527
|
export function floatingToolbarPluginFactory(options) {
|
|
476
528
|
const {
|
|
477
529
|
floatingToolbarHandlers,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createCommand } from './plugin-factory';
|
|
2
|
-
export const showConfirmDialog = buttonIndex => createCommand({
|
|
2
|
+
export const showConfirmDialog = (buttonIndex, optionIndex) => createCommand({
|
|
3
3
|
type: 'SHOW_CONFIRM_DIALOG',
|
|
4
4
|
data: {
|
|
5
|
-
buttonIndex
|
|
5
|
+
buttonIndex,
|
|
6
|
+
optionIndex
|
|
6
7
|
}
|
|
7
8
|
}, tr => tr.setMeta('addToHistory', false));
|
|
8
9
|
export const hideConfirmDialog = () => createCommand({
|
|
@@ -3,7 +3,8 @@ export const reducer = (pluginState, action) => {
|
|
|
3
3
|
case 'SHOW_CONFIRM_DIALOG':
|
|
4
4
|
return {
|
|
5
5
|
...pluginState,
|
|
6
|
-
confirmDialogForItem: action.data.buttonIndex
|
|
6
|
+
confirmDialogForItem: action.data.buttonIndex,
|
|
7
|
+
confirmDialogForItemOption: action.data.optionIndex
|
|
7
8
|
};
|
|
8
9
|
case 'HIDE_CONFIRM_DIALOG':
|
|
9
10
|
return {
|
|
@@ -19,6 +19,7 @@ import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-col
|
|
|
19
19
|
import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
20
20
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
21
21
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
22
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
23
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
23
24
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
24
25
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
@@ -30,6 +31,7 @@ import { Input } from './Input';
|
|
|
30
31
|
import { ScrollButton } from './ScrollButton';
|
|
31
32
|
import { ScrollButtons } from './ScrollButtons';
|
|
32
33
|
import Select from './Select';
|
|
34
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
33
35
|
export function groupItems(items, areAnyNewToolbarFlagsEnabled) {
|
|
34
36
|
const groupItems = items.reduce((accumulator, item, i) => {
|
|
35
37
|
const {
|
|
@@ -177,6 +179,26 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
177
179
|
return item.render(editorView, idx, dispatchAnalyticsEvent);
|
|
178
180
|
}
|
|
179
181
|
case 'overflow-dropdown':
|
|
182
|
+
let options;
|
|
183
|
+
if (fg('platform_editor_fix_confirm_table_removal')) {
|
|
184
|
+
// if an option has a confirmDialog, we need to replace its onClick handler
|
|
185
|
+
// to set the state to show the confirm dialog
|
|
186
|
+
|
|
187
|
+
// crudely done here to avoid greater coupling with DropdownMenuItem from `floating-toolbar`
|
|
188
|
+
// which would need knowledge of indexes, showConfirmDialog etc.
|
|
189
|
+
options = item.options.map((option, optionIndex) => {
|
|
190
|
+
if (!('type' in option) && option.confirmDialog) {
|
|
191
|
+
const onClick = option.confirmDialog ? showConfirmDialog(idx, optionIndex) : option.onClick;
|
|
192
|
+
return {
|
|
193
|
+
...option,
|
|
194
|
+
onClick
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
return option;
|
|
198
|
+
});
|
|
199
|
+
} else {
|
|
200
|
+
options = item.options;
|
|
201
|
+
}
|
|
180
202
|
return jsx(Dropdown, {
|
|
181
203
|
alignX: areAnyNewToolbarFlagsEnabled ? 'right' : undefined,
|
|
182
204
|
key: idx,
|
|
@@ -186,7 +208,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
186
208
|
spacing: "spacious"
|
|
187
209
|
}),
|
|
188
210
|
dispatchCommand: dispatchCommand,
|
|
189
|
-
options:
|
|
211
|
+
options: options,
|
|
190
212
|
disabled: item.disabled,
|
|
191
213
|
tooltip: item.tooltip,
|
|
192
214
|
hideExpandIcon: true,
|
|
@@ -200,8 +200,26 @@ export var floatingToolbarPlugin = function floatingToolbarPlugin(_ref) {
|
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* React component that renders the floating toolbar UI for the editor.
|
|
206
|
+
*
|
|
207
|
+
* This component manages the display of floating toolbars based on the current editor state,
|
|
208
|
+
* selection, and configuration. It handles visibility conditions, positioning, toolbar items
|
|
209
|
+
* consolidation, and confirmation dialogs.
|
|
210
|
+
*
|
|
211
|
+
* @param props - Component properties
|
|
212
|
+
* @param props.pluginInjectionApi - Plugin injection API for accessing other plugin states
|
|
213
|
+
* @param props.editorView - ProseMirror EditorView instance
|
|
214
|
+
* @param props.popupsMountPoint - DOM element where popups should be mounted
|
|
215
|
+
* @param props.popupsBoundariesElement - Element that defines popup boundaries
|
|
216
|
+
* @param props.popupsScrollableElement - Scrollable container element for popups
|
|
217
|
+
* @param props.providerFactory - Factory for creating various providers
|
|
218
|
+
* @param props.dispatchAnalyticsEvent - Function to dispatch analytics events
|
|
219
|
+
* @returns JSX element representing the floating toolbar or null if not visible
|
|
220
|
+
*/
|
|
203
221
|
export function ContentComponent(_ref5) {
|
|
204
|
-
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d;
|
|
222
|
+
var _configWithNodeInfo$c, _configWithNodeInfo$c2, _items, _pluginInjectionApi$c, _pluginInjectionApi$d, _confirmButtonItem, _confirmButtonItem2, _confirmButtonItem3;
|
|
205
223
|
var pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
206
224
|
editorView = _ref5.editorView,
|
|
207
225
|
popupsMountPoint = _ref5.popupsMountPoint,
|
|
@@ -362,14 +380,33 @@ export function ContentComponent(_ref5) {
|
|
|
362
380
|
};
|
|
363
381
|
|
|
364
382
|
// Confirm dialog
|
|
365
|
-
var
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
383
|
+
var confirmButtonItem;
|
|
384
|
+
if (fg('platform_editor_fix_confirm_table_removal')) {
|
|
385
|
+
var _ref7 = floatingToolbarData || {},
|
|
386
|
+
confirmDialogForItem = _ref7.confirmDialogForItem,
|
|
387
|
+
confirmDialogForItemOption = _ref7.confirmDialogForItemOption;
|
|
388
|
+
var matchingItem = confirmDialogForItem ? toolbarItems === null || toolbarItems === void 0 ? void 0 : toolbarItems[confirmDialogForItem] : undefined;
|
|
389
|
+
if ((matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.type) === 'button') {
|
|
390
|
+
confirmButtonItem = matchingItem;
|
|
391
|
+
}
|
|
392
|
+
if ((matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.type) === 'overflow-dropdown' && confirmDialogForItemOption !== undefined) {
|
|
393
|
+
var matchingItemOption = matchingItem.options[confirmDialogForItemOption];
|
|
394
|
+
|
|
395
|
+
// OverflowDropdownOption is the only member of the union that does not have a 'type' property
|
|
396
|
+
if (!('type' in matchingItemOption)) {
|
|
397
|
+
confirmButtonItem = matchingItemOption;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
} else {
|
|
401
|
+
var _ref8 = floatingToolbarData || {},
|
|
402
|
+
_confirmDialogForItem = _ref8.confirmDialogForItem;
|
|
403
|
+
confirmButtonItem = _confirmDialogForItem ?
|
|
404
|
+
// Ignored via go/ees005
|
|
405
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
406
|
+
toolbarItems[_confirmDialogForItem] : undefined;
|
|
407
|
+
}
|
|
371
408
|
var scrollable = config.scrollable;
|
|
372
|
-
var confirmDialogOptions = typeof (confirmButtonItem === null ||
|
|
409
|
+
var confirmDialogOptions = typeof ((_confirmButtonItem = confirmButtonItem) === null || _confirmButtonItem === void 0 ? void 0 : _confirmButtonItem.confirmDialog) === 'function' ? (_confirmButtonItem2 = confirmButtonItem) === null || _confirmButtonItem2 === void 0 ? void 0 : _confirmButtonItem2.confirmDialog() : (_confirmButtonItem3 = confirmButtonItem) === null || _confirmButtonItem3 === void 0 ? void 0 : _confirmButtonItem3.confirmDialog;
|
|
373
410
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
374
411
|
component: ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
|
|
375
412
|
componentId: camelCase(title),
|
|
@@ -480,6 +517,20 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
480
517
|
}
|
|
481
518
|
return config;
|
|
482
519
|
}
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Creates a floating toolbar plugin for the ProseMirror editor.
|
|
523
|
+
*
|
|
524
|
+
* This factory function creates a SafePlugin that manages floating toolbars in the editor.
|
|
525
|
+
* It processes an array of floating toolbar handlers and determines which toolbar configuration
|
|
526
|
+
* should be active based on the current editor state and selection.
|
|
527
|
+
*
|
|
528
|
+
* @param options - Configuration object for the floating toolbar plugin
|
|
529
|
+
* @param options.floatingToolbarHandlers - Array of handlers that return toolbar configurations
|
|
530
|
+
* @param options.getIntl - Function that returns the IntlShape instance for internationalization
|
|
531
|
+
* @param options.providerFactory - Factory for creating various providers used by the editor
|
|
532
|
+
* @returns A SafePlugin instance that manages floating toolbar state and behavior
|
|
533
|
+
*/
|
|
483
534
|
export function floatingToolbarPluginFactory(options) {
|
|
484
535
|
var floatingToolbarHandlers = options.floatingToolbarHandlers,
|
|
485
536
|
providerFactory = options.providerFactory,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createCommand } from './plugin-factory';
|
|
2
|
-
export var showConfirmDialog = function showConfirmDialog(buttonIndex) {
|
|
2
|
+
export var showConfirmDialog = function showConfirmDialog(buttonIndex, optionIndex) {
|
|
3
3
|
return createCommand({
|
|
4
4
|
type: 'SHOW_CONFIRM_DIALOG',
|
|
5
5
|
data: {
|
|
6
|
-
buttonIndex: buttonIndex
|
|
6
|
+
buttonIndex: buttonIndex,
|
|
7
|
+
optionIndex: optionIndex
|
|
7
8
|
}
|
|
8
9
|
}, function (tr) {
|
|
9
10
|
return tr.setMeta('addToHistory', false);
|
|
@@ -5,7 +5,8 @@ export var reducer = function reducer(pluginState, action) {
|
|
|
5
5
|
switch (action.type) {
|
|
6
6
|
case 'SHOW_CONFIRM_DIALOG':
|
|
7
7
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
8
|
-
confirmDialogForItem: action.data.buttonIndex
|
|
8
|
+
confirmDialogForItem: action.data.buttonIndex,
|
|
9
|
+
confirmDialogForItemOption: action.data.optionIndex
|
|
9
10
|
});
|
|
10
11
|
case 'HIDE_CONFIRM_DIALOG':
|
|
11
12
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
package/dist/esm/ui/Toolbar.js
CHANGED
|
@@ -7,6 +7,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
10
12
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation */
|
|
11
13
|
/**
|
|
12
14
|
* @jsxRuntime classic
|
|
@@ -26,6 +28,7 @@ import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-col
|
|
|
26
28
|
import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
27
29
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
28
30
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
31
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
32
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
30
33
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
31
34
|
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
@@ -37,6 +40,7 @@ import { Input } from './Input';
|
|
|
37
40
|
import { ScrollButton } from './ScrollButton';
|
|
38
41
|
import { ScrollButtons } from './ScrollButtons';
|
|
39
42
|
import Select from './Select';
|
|
43
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
40
44
|
export function groupItems(items, areAnyNewToolbarFlagsEnabled) {
|
|
41
45
|
var groupItems = items.reduce(function (accumulator, item, i) {
|
|
42
46
|
var finalOutput = accumulator.finalOutput,
|
|
@@ -193,6 +197,25 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
193
197
|
return item.render(editorView, idx, dispatchAnalyticsEvent);
|
|
194
198
|
}
|
|
195
199
|
case 'overflow-dropdown':
|
|
200
|
+
var options;
|
|
201
|
+
if (fg('platform_editor_fix_confirm_table_removal')) {
|
|
202
|
+
// if an option has a confirmDialog, we need to replace its onClick handler
|
|
203
|
+
// to set the state to show the confirm dialog
|
|
204
|
+
|
|
205
|
+
// crudely done here to avoid greater coupling with DropdownMenuItem from `floating-toolbar`
|
|
206
|
+
// which would need knowledge of indexes, showConfirmDialog etc.
|
|
207
|
+
options = item.options.map(function (option, optionIndex) {
|
|
208
|
+
if (!('type' in option) && option.confirmDialog) {
|
|
209
|
+
var onClick = option.confirmDialog ? showConfirmDialog(idx, optionIndex) : option.onClick;
|
|
210
|
+
return _objectSpread(_objectSpread({}, option), {}, {
|
|
211
|
+
onClick: onClick
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return option;
|
|
215
|
+
});
|
|
216
|
+
} else {
|
|
217
|
+
options = item.options;
|
|
218
|
+
}
|
|
196
219
|
return jsx(Dropdown, {
|
|
197
220
|
alignX: areAnyNewToolbarFlagsEnabled ? 'right' : undefined,
|
|
198
221
|
key: idx,
|
|
@@ -202,7 +225,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
202
225
|
spacing: "spacious"
|
|
203
226
|
}),
|
|
204
227
|
dispatchCommand: dispatchCommand,
|
|
205
|
-
options:
|
|
228
|
+
options: options,
|
|
206
229
|
disabled: item.disabled,
|
|
207
230
|
tooltip: item.tooltip,
|
|
208
231
|
hideExpandIcon: true,
|
|
@@ -9,6 +9,23 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
9
9
|
import type { ConfigWithNodeInfo, FloatingToolbarPlugin, FloatingToolbarPluginState } from './floatingToolbarPluginType';
|
|
10
10
|
export declare const getRelevantConfig: (selection: Selection, configs: Array<FloatingToolbarConfig>) => ConfigWithNodeInfo | undefined;
|
|
11
11
|
export declare const floatingToolbarPlugin: FloatingToolbarPlugin;
|
|
12
|
+
/**
|
|
13
|
+
* React component that renders the floating toolbar UI for the editor.
|
|
14
|
+
*
|
|
15
|
+
* This component manages the display of floating toolbars based on the current editor state,
|
|
16
|
+
* selection, and configuration. It handles visibility conditions, positioning, toolbar items
|
|
17
|
+
* consolidation, and confirmation dialogs.
|
|
18
|
+
*
|
|
19
|
+
* @param props - Component properties
|
|
20
|
+
* @param props.pluginInjectionApi - Plugin injection API for accessing other plugin states
|
|
21
|
+
* @param props.editorView - ProseMirror EditorView instance
|
|
22
|
+
* @param props.popupsMountPoint - DOM element where popups should be mounted
|
|
23
|
+
* @param props.popupsBoundariesElement - Element that defines popup boundaries
|
|
24
|
+
* @param props.popupsScrollableElement - Scrollable container element for popups
|
|
25
|
+
* @param props.providerFactory - Factory for creating various providers
|
|
26
|
+
* @param props.dispatchAnalyticsEvent - Function to dispatch analytics events
|
|
27
|
+
* @returns JSX element representing the floating toolbar or null if not visible
|
|
28
|
+
*/
|
|
12
29
|
export declare function ContentComponent({ pluginInjectionApi, editorView, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, providerFactory, dispatchAnalyticsEvent, }: Pick<UiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'providerFactory' | 'dispatchAnalyticsEvent' | 'popupsScrollableElement'> & {
|
|
13
30
|
pluginInjectionApi: ExtractInjectionAPI<FloatingToolbarPlugin> | undefined;
|
|
14
31
|
} & {
|
|
@@ -20,6 +37,19 @@ export declare function ContentComponent({ pluginInjectionApi, editorView, popup
|
|
|
20
37
|
*
|
|
21
38
|
*/
|
|
22
39
|
export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a floating toolbar plugin for the ProseMirror editor.
|
|
42
|
+
*
|
|
43
|
+
* This factory function creates a SafePlugin that manages floating toolbars in the editor.
|
|
44
|
+
* It processes an array of floating toolbar handlers and determines which toolbar configuration
|
|
45
|
+
* should be active based on the current editor state and selection.
|
|
46
|
+
*
|
|
47
|
+
* @param options - Configuration object for the floating toolbar plugin
|
|
48
|
+
* @param options.floatingToolbarHandlers - Array of handlers that return toolbar configurations
|
|
49
|
+
* @param options.getIntl - Function that returns the IntlShape instance for internationalization
|
|
50
|
+
* @param options.providerFactory - Factory for creating various providers used by the editor
|
|
51
|
+
* @returns A SafePlugin instance that manages floating toolbar state and behavior
|
|
52
|
+
*/
|
|
23
53
|
export declare function floatingToolbarPluginFactory(options: {
|
|
24
54
|
floatingToolbarHandlers: Array<FloatingToolbarHandler>;
|
|
25
55
|
getIntl: () => IntlShape;
|
|
@@ -24,6 +24,7 @@ export type FloatingToolbarPluginState = {
|
|
|
24
24
|
};
|
|
25
25
|
export type FloatingToolbarPluginData = {
|
|
26
26
|
confirmDialogForItem?: number;
|
|
27
|
+
confirmDialogForItemOption?: number;
|
|
27
28
|
};
|
|
28
29
|
export type ForceFocusSelector = (selector: string | null) => (tr: Transaction) => Transaction;
|
|
29
30
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
export declare const showConfirmDialog: (buttonIndex: number) => Command;
|
|
2
|
+
export declare const showConfirmDialog: (buttonIndex: number, optionIndex?: number) => Command;
|
|
3
3
|
export declare const hideConfirmDialog: () => Command;
|
|
@@ -9,6 +9,23 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
9
9
|
import type { ConfigWithNodeInfo, FloatingToolbarPlugin, FloatingToolbarPluginState } from './floatingToolbarPluginType';
|
|
10
10
|
export declare const getRelevantConfig: (selection: Selection, configs: Array<FloatingToolbarConfig>) => ConfigWithNodeInfo | undefined;
|
|
11
11
|
export declare const floatingToolbarPlugin: FloatingToolbarPlugin;
|
|
12
|
+
/**
|
|
13
|
+
* React component that renders the floating toolbar UI for the editor.
|
|
14
|
+
*
|
|
15
|
+
* This component manages the display of floating toolbars based on the current editor state,
|
|
16
|
+
* selection, and configuration. It handles visibility conditions, positioning, toolbar items
|
|
17
|
+
* consolidation, and confirmation dialogs.
|
|
18
|
+
*
|
|
19
|
+
* @param props - Component properties
|
|
20
|
+
* @param props.pluginInjectionApi - Plugin injection API for accessing other plugin states
|
|
21
|
+
* @param props.editorView - ProseMirror EditorView instance
|
|
22
|
+
* @param props.popupsMountPoint - DOM element where popups should be mounted
|
|
23
|
+
* @param props.popupsBoundariesElement - Element that defines popup boundaries
|
|
24
|
+
* @param props.popupsScrollableElement - Scrollable container element for popups
|
|
25
|
+
* @param props.providerFactory - Factory for creating various providers
|
|
26
|
+
* @param props.dispatchAnalyticsEvent - Function to dispatch analytics events
|
|
27
|
+
* @returns JSX element representing the floating toolbar or null if not visible
|
|
28
|
+
*/
|
|
12
29
|
export declare function ContentComponent({ pluginInjectionApi, editorView, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, providerFactory, dispatchAnalyticsEvent, }: Pick<UiComponentFactoryParams, 'editorView' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'providerFactory' | 'dispatchAnalyticsEvent' | 'popupsScrollableElement'> & {
|
|
13
30
|
pluginInjectionApi: ExtractInjectionAPI<FloatingToolbarPlugin> | undefined;
|
|
14
31
|
} & {
|
|
@@ -20,6 +37,19 @@ export declare function ContentComponent({ pluginInjectionApi, editorView, popup
|
|
|
20
37
|
*
|
|
21
38
|
*/
|
|
22
39
|
export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a floating toolbar plugin for the ProseMirror editor.
|
|
42
|
+
*
|
|
43
|
+
* This factory function creates a SafePlugin that manages floating toolbars in the editor.
|
|
44
|
+
* It processes an array of floating toolbar handlers and determines which toolbar configuration
|
|
45
|
+
* should be active based on the current editor state and selection.
|
|
46
|
+
*
|
|
47
|
+
* @param options - Configuration object for the floating toolbar plugin
|
|
48
|
+
* @param options.floatingToolbarHandlers - Array of handlers that return toolbar configurations
|
|
49
|
+
* @param options.getIntl - Function that returns the IntlShape instance for internationalization
|
|
50
|
+
* @param options.providerFactory - Factory for creating various providers used by the editor
|
|
51
|
+
* @returns A SafePlugin instance that manages floating toolbar state and behavior
|
|
52
|
+
*/
|
|
23
53
|
export declare function floatingToolbarPluginFactory(options: {
|
|
24
54
|
floatingToolbarHandlers: Array<FloatingToolbarHandler>;
|
|
25
55
|
getIntl: () => IntlShape;
|
|
@@ -24,6 +24,7 @@ export type FloatingToolbarPluginState = {
|
|
|
24
24
|
};
|
|
25
25
|
export type FloatingToolbarPluginData = {
|
|
26
26
|
confirmDialogForItem?: number;
|
|
27
|
+
confirmDialogForItemOption?: number;
|
|
27
28
|
};
|
|
28
29
|
export type ForceFocusSelector = (selector: string | null) => (tr: Transaction) => Transaction;
|
|
29
30
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
export declare const showConfirmDialog: (buttonIndex: number) => Command;
|
|
2
|
+
export declare const showConfirmDialog: (buttonIndex: number, optionIndex?: number) => Command;
|
|
3
3
|
export declare const hideConfirmDialog: () => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"@atlaskit/editor-plugin-user-intent": "^4.0.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/emoji": "^69.5.0",
|
|
41
|
-
"@atlaskit/icon": "^28.
|
|
41
|
+
"@atlaskit/icon": "^28.4.0",
|
|
42
42
|
"@atlaskit/menu": "^8.4.0",
|
|
43
43
|
"@atlaskit/modal-dialog": "^14.4.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/primitives": "^14.15.0",
|
|
46
46
|
"@atlaskit/select": "^21.3.0",
|
|
47
47
|
"@atlaskit/theme": "^21.0.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^13.2.0",
|
|
49
49
|
"@atlaskit/tokens": "^6.4.0",
|
|
50
50
|
"@atlaskit/tooltip": "^20.5.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
@@ -121,6 +121,9 @@
|
|
|
121
121
|
},
|
|
122
122
|
"platform_editor_block_menu_hide_floating_toolbar": {
|
|
123
123
|
"type": "boolean"
|
|
124
|
+
},
|
|
125
|
+
"platform_editor_fix_confirm_table_removal": {
|
|
126
|
+
"type": "boolean"
|
|
124
127
|
}
|
|
125
128
|
}
|
|
126
129
|
}
|