@atlaskit/editor-plugin-selection-toolbar 27.0.3 → 27.0.5
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 +15 -0
- package/dist/cjs/pm-plugins/get-selection-node-types.js +26 -0
- package/dist/cjs/selectionToolbarPlugin.js +5 -13
- package/dist/cjs/ui/MenuSection.js +4 -4
- package/dist/cjs/ui/PinButton.js +12 -10
- package/dist/cjs/ui/PinMenuItem.js +12 -10
- package/dist/cjs/ui/PrimaryToolbarComponent.js +11 -11
- package/dist/cjs/ui/overflow-toolbar-config.js +4 -4
- package/dist/cjs/ui/pin-toolbar-config.js +5 -5
- package/dist/cjs/ui/toolbar-components.js +22 -21
- package/dist/es2019/pm-plugins/get-selection-node-types.js +21 -0
- package/dist/es2019/selectionToolbarPlugin.js +2 -10
- package/dist/es2019/ui/MenuSection.js +2 -2
- package/dist/es2019/ui/PinButton.js +6 -4
- package/dist/es2019/ui/PinMenuItem.js +6 -4
- package/dist/es2019/ui/PrimaryToolbarComponent.js +4 -4
- package/dist/es2019/ui/overflow-toolbar-config.js +1 -1
- package/dist/es2019/ui/pin-toolbar-config.js +3 -2
- package/dist/es2019/ui/toolbar-components.js +2 -1
- package/dist/esm/pm-plugins/get-selection-node-types.js +20 -0
- package/dist/esm/selectionToolbarPlugin.js +2 -10
- package/dist/esm/ui/MenuSection.js +2 -2
- package/dist/esm/ui/PinButton.js +6 -4
- package/dist/esm/ui/PinMenuItem.js +6 -4
- package/dist/esm/ui/PrimaryToolbarComponent.js +4 -4
- package/dist/esm/ui/overflow-toolbar-config.js +1 -1
- package/dist/esm/ui/pin-toolbar-config.js +3 -2
- package/dist/esm/ui/toolbar-components.js +2 -1
- package/dist/types/pm-plugins/calculate-toolbar-position.d.ts +1 -1
- package/dist/types/pm-plugins/commands.d.ts +1 -1
- package/dist/types/pm-plugins/get-selection-node-types.d.ts +3 -0
- package/dist/types/selectionToolbarPluginType.d.ts +10 -9
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/MenuSection.d.ts +1 -1
- package/dist/types/ui/PinButton.d.ts +1 -1
- package/dist/types/ui/PinMenuItem.d.ts +1 -1
- package/dist/types/ui/PrimaryToolbarComponent.d.ts +1 -1
- package/dist/types/ui/overflow-toolbar-config.d.ts +2 -2
- package/dist/types/ui/pin-toolbar-config.d.ts +3 -2
- package/dist/types/ui/toolbar-components.d.ts +2 -2
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-toolbar
|
|
2
2
|
|
|
3
|
+
## 27.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`dbf4584638609`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dbf4584638609) -
|
|
8
|
+
Deduplicate the node types collected for the selection toolbar so large selections no longer build
|
|
9
|
+
an entry per node, behind the `platform_editor_reduce_memory_leaks` experiment.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 27.0.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 27.0.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSelectionNodeTypes = getSelectionNodeTypes;
|
|
7
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
8
|
+
function getSelectionNodeTypes(state) {
|
|
9
|
+
var _state$selection = state.selection,
|
|
10
|
+
from = _state$selection.from,
|
|
11
|
+
to = _state$selection.to;
|
|
12
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
|
|
13
|
+
var _selectionNodeTypes = new Set();
|
|
14
|
+
state.doc.nodesBetween(from, to, function (node) {
|
|
15
|
+
_selectionNodeTypes.add(node.type);
|
|
16
|
+
});
|
|
17
|
+
return Array.from(_selectionNodeTypes);
|
|
18
|
+
}
|
|
19
|
+
var selectionNodeTypes = [];
|
|
20
|
+
state.doc.nodesBetween(from, to, function (node) {
|
|
21
|
+
if (selectionNodeTypes.indexOf(node.type) !== 0) {
|
|
22
|
+
selectionNodeTypes.push(node.type);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return selectionNodeTypes;
|
|
26
|
+
}
|
|
@@ -10,10 +10,11 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _bindEventListener = require("bind-event-listener");
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
|
-
var
|
|
13
|
+
var _calculateToolbarPosition = require("@atlaskit/editor-common/utils/calculate-toolbar-position");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
16
16
|
var _commands = require("./pm-plugins/commands");
|
|
17
|
+
var _getSelectionNodeTypes = require("./pm-plugins/get-selection-node-types");
|
|
17
18
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
18
19
|
var _pinToolbarConfig = require("./ui/pin-toolbar-config");
|
|
19
20
|
var _PrimaryToolbarComponent = require("./ui/PrimaryToolbarComponent");
|
|
@@ -326,12 +327,12 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
326
327
|
var onPositionCalculated;
|
|
327
328
|
var toolbarTitle = 'Selection toolbar';
|
|
328
329
|
if (isCellSelection && isEditorControlsEnabled) {
|
|
329
|
-
onPositionCalculated = (0,
|
|
330
|
+
onPositionCalculated = (0, _calculateToolbarPosition.calculateToolbarPositionOnCellSelection)(toolbarTitle);
|
|
330
331
|
} else {
|
|
331
|
-
var calcToolbarPosition = config.preferenceToolbarAboveSelection ?
|
|
332
|
+
var calcToolbarPosition = config.preferenceToolbarAboveSelection ? _calculateToolbarPosition.calculateToolbarPositionAboveSelection : _calculateToolbarPosition.calculateToolbarPositionTrackHead;
|
|
332
333
|
onPositionCalculated = calcToolbarPosition(toolbarTitle);
|
|
333
334
|
}
|
|
334
|
-
var nodeType = getSelectionNodeTypes(state);
|
|
335
|
+
var nodeType = (0, _getSelectionNodeTypes.getSelectionNodeTypes)(state);
|
|
335
336
|
return _objectSpread(_objectSpread({
|
|
336
337
|
title: 'Selection toolbar',
|
|
337
338
|
nodeType: nodeType,
|
|
@@ -348,15 +349,6 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
348
349
|
}) ? primaryToolbarComponent : undefined
|
|
349
350
|
};
|
|
350
351
|
};
|
|
351
|
-
function getSelectionNodeTypes(state) {
|
|
352
|
-
var selectionNodeTypes = [];
|
|
353
|
-
state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
|
|
354
|
-
if (selectionNodeTypes.indexOf(node.type) !== 0) {
|
|
355
|
-
selectionNodeTypes.push(node.type);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
return selectionNodeTypes;
|
|
359
|
-
}
|
|
360
352
|
var _hasNestedSpanWithText = function hasNestedSpanWithText(element, text) {
|
|
361
353
|
if (element.tagName === 'SPAN' && element.innerHTML === text) {
|
|
362
354
|
return true;
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.MenuSection = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
10
|
+
var _toolbarDropdownItemSection = require("@atlaskit/editor-toolbar/toolbar-dropdown-item-section");
|
|
11
11
|
var usePluginState = function usePluginState(_api) {
|
|
12
|
-
var _useEditorToolbar = (0,
|
|
12
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
13
13
|
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
14
14
|
return {
|
|
15
15
|
editorViewMode: editorViewMode
|
|
@@ -24,7 +24,7 @@ var MenuSection = exports.MenuSection = function MenuSection(_ref) {
|
|
|
24
24
|
if (!isEdit) {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItemSection.ToolbarDropdownItemSection, {
|
|
28
28
|
hasSeparator: isEdit
|
|
29
29
|
}, children);
|
|
30
30
|
};
|
package/dist/cjs/ui/PinButton.js
CHANGED
|
@@ -7,20 +7,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.PinButton = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
10
|
+
var _selectionToolbar = require("@atlaskit/editor-common/messages/selection-toolbar");
|
|
11
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
12
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
13
|
+
var _pinnedIcon = require("@atlaskit/editor-toolbar/pinned-icon");
|
|
14
|
+
var _toolbarButton = require("@atlaskit/editor-toolbar/toolbar-button");
|
|
15
|
+
var _toolbarTooltip = require("@atlaskit/editor-toolbar/toolbar-tooltip");
|
|
14
16
|
var PinButton = exports.PinButton = function PinButton(_ref) {
|
|
15
17
|
var api = _ref.api;
|
|
16
18
|
var intl = (0, _reactIntl.useIntl)();
|
|
17
|
-
var message = intl.formatMessage(
|
|
18
|
-
var _useEditorToolbar = (0,
|
|
19
|
+
var message = intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
20
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
19
21
|
isDisabled = _useEditorToolbar.isOffline;
|
|
20
22
|
// Pin/unpin is meaningless when a runtime override forces `'always-pinned'`
|
|
21
23
|
// (e.g. Markdown Mode source / preview view). Subscribe so we re-render and
|
|
22
24
|
// hide ourselves on flip.
|
|
23
|
-
var runtimeOverride = (0,
|
|
25
|
+
var runtimeOverride = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['toolbar'], function (states) {
|
|
24
26
|
var _states$toolbarState;
|
|
25
27
|
return (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.contextualFormattingModeOverride;
|
|
26
28
|
});
|
|
@@ -34,10 +36,10 @@ var PinButton = exports.PinButton = function PinButton(_ref) {
|
|
|
34
36
|
}
|
|
35
37
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.actions.updateUserPreference('toolbarDockingPosition', 'none'));
|
|
36
38
|
};
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarTooltip.ToolbarTooltip, {
|
|
38
40
|
content: message
|
|
39
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
40
|
-
iconBefore: /*#__PURE__*/_react.default.createElement(
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_toolbarButton.ToolbarButton, {
|
|
42
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_pinnedIcon.PinnedIcon, {
|
|
41
43
|
size: "small",
|
|
42
44
|
label: ""
|
|
43
45
|
}),
|
|
@@ -7,15 +7,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.PinMenuItem = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
10
|
+
var _selectionToolbar = require("@atlaskit/editor-common/messages/selection-toolbar");
|
|
11
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
12
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
13
|
+
var _pinIcon = require("@atlaskit/editor-toolbar/pin-icon");
|
|
14
|
+
var _pinnedIcon = require("@atlaskit/editor-toolbar/pinned-icon");
|
|
15
|
+
var _toolbarDropdownItem = require("@atlaskit/editor-toolbar/toolbar-dropdown-item");
|
|
14
16
|
var shouldShowPinMenuItem = function shouldShowPinMenuItem(editMode) {
|
|
15
17
|
return editMode !== 'view';
|
|
16
18
|
};
|
|
17
19
|
var usePluginState = function usePluginState(_api) {
|
|
18
|
-
var _useEditorToolbar = (0,
|
|
20
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
19
21
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
20
22
|
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
21
23
|
isOffline = _useEditorToolbar.isOffline;
|
|
@@ -33,7 +35,7 @@ var PinMenuItem = exports.PinMenuItem = function PinMenuItem(_ref) {
|
|
|
33
35
|
var api = _ref.api,
|
|
34
36
|
disablePin = _ref.disablePin;
|
|
35
37
|
var intl = (0, _reactIntl.useIntl)();
|
|
36
|
-
var runtimeOverride = (0,
|
|
38
|
+
var runtimeOverride = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['toolbar'], function (states) {
|
|
37
39
|
var _states$toolbarState;
|
|
38
40
|
return (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.contextualFormattingModeOverride;
|
|
39
41
|
});
|
|
@@ -52,14 +54,14 @@ var PinMenuItem = exports.PinMenuItem = function PinMenuItem(_ref) {
|
|
|
52
54
|
}
|
|
53
55
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.actions.updateUserPreference('toolbarDockingPosition', isToolbarDocked ? 'none' : 'top'));
|
|
54
56
|
};
|
|
55
|
-
var message = intl.formatMessage(isToolbarDocked ?
|
|
56
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
57
|
+
var message = intl.formatMessage(isToolbarDocked ? _selectionToolbar.selectionToolbarMessages.toolbarPositionPinedAtTop : _selectionToolbar.selectionToolbarMessages.toolbarPositionUnpinnedConcise);
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
57
59
|
onClick: onClick,
|
|
58
60
|
isDisabled: isDisabled,
|
|
59
|
-
elemBefore: isToolbarDocked ? /*#__PURE__*/_react.default.createElement(
|
|
61
|
+
elemBefore: isToolbarDocked ? /*#__PURE__*/_react.default.createElement(_pinnedIcon.PinnedIcon, {
|
|
60
62
|
size: "small",
|
|
61
63
|
label: ""
|
|
62
|
-
}) : /*#__PURE__*/_react.default.createElement(
|
|
64
|
+
}) : /*#__PURE__*/_react.default.createElement(_pinIcon.PinIcon, {
|
|
63
65
|
size: "small",
|
|
64
66
|
label: ""
|
|
65
67
|
})
|
|
@@ -11,10 +11,10 @@ require("./PrimaryToolbarComponent.compiled.css");
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
13
|
var _reactIntl = require("react-intl");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
14
|
+
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
15
|
+
var _selectionToolbar = require("@atlaskit/editor-common/messages/selection-toolbar");
|
|
16
|
+
var _ToolbarButton = _interopRequireDefault(require("@atlaskit/editor-common/ui-menu/ToolbarButton"));
|
|
17
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/useSharedPluginStateSelector");
|
|
18
18
|
var _pin = _interopRequireDefault(require("@atlaskit/icon/core/pin"));
|
|
19
19
|
var _pinFilled = _interopRequireDefault(require("@atlaskit/icon/core/pin-filled"));
|
|
20
20
|
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); }
|
|
@@ -29,11 +29,11 @@ var PrimaryToolbarComponent = exports.PrimaryToolbarComponent = function Primary
|
|
|
29
29
|
disabled = _ref.disabled;
|
|
30
30
|
var intl = (0, _reactIntl.useIntl)();
|
|
31
31
|
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
|
|
32
|
-
var isOffline = (0,
|
|
32
|
+
var isOffline = (0, _isOfflineMode.isOfflineMode)(mode);
|
|
33
33
|
var isDockedToTop = (api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.preferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.toolbarDockingPosition) === 'top';
|
|
34
34
|
if (isDockedToTop) {
|
|
35
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
-
"aria-label": intl.formatMessage(
|
|
35
|
+
return /*#__PURE__*/React.createElement(_ToolbarButton.default, {
|
|
36
|
+
"aria-label": intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionPinedAtTop)
|
|
37
37
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides -- Ignored via go/DSP-18766
|
|
38
38
|
,
|
|
39
39
|
|
|
@@ -48,12 +48,12 @@ var PrimaryToolbarComponent = exports.PrimaryToolbarComponent = function Primary
|
|
|
48
48
|
var _api$core$actions$exe, _api$userPreferences2;
|
|
49
49
|
return (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 ? void 0 : _api$userPreferences2.actions.updateUserPreference('toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false;
|
|
50
50
|
},
|
|
51
|
-
title: intl.formatMessage(
|
|
51
|
+
title: intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionPinedAtTop),
|
|
52
52
|
className: (0, _runtime.ax)(["_ca0q12x7 _n3td12x7 _19bv12x7 _u5f312x7"])
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
return /*#__PURE__*/React.createElement(
|
|
56
|
-
"aria-label": intl.formatMessage(
|
|
55
|
+
return /*#__PURE__*/React.createElement(_ToolbarButton.default, {
|
|
56
|
+
"aria-label": intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionUnpined)
|
|
57
57
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides -- Ignored via go/DSP-18766
|
|
58
58
|
,
|
|
59
59
|
|
|
@@ -68,7 +68,7 @@ var PrimaryToolbarComponent = exports.PrimaryToolbarComponent = function Primary
|
|
|
68
68
|
var _api$core$actions$exe2, _api$userPreferences3;
|
|
69
69
|
return (_api$core$actions$exe2 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences3 = api.userPreferences) === null || _api$userPreferences3 === void 0 ? void 0 : _api$userPreferences3.actions.updateUserPreference('toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
|
|
70
70
|
},
|
|
71
|
-
title: intl.formatMessage(
|
|
71
|
+
title: intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionUnpined),
|
|
72
72
|
className: (0, _runtime.ax)(["_ca0q12x7 _n3td12x7 _19bv12x7 _u5f312x7"])
|
|
73
73
|
});
|
|
74
74
|
};
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.getOverflowPrimaryToolbarConfig = void 0;
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
-
var
|
|
12
|
+
var _selectionToolbar = require("@atlaskit/editor-common/messages/selection-toolbar");
|
|
13
13
|
var _dockToolbarTop = _interopRequireDefault(require("@atlaskit/icon-lab/core/dock-toolbar-top"));
|
|
14
14
|
var _checkMark = _interopRequireDefault(require("@atlaskit/icon/core/check-mark"));
|
|
15
15
|
var _minus = _interopRequireDefault(require("@atlaskit/icon/core/minus"));
|
|
@@ -20,13 +20,13 @@ var getOverflowPrimaryToolbarConfig = exports.getOverflowPrimaryToolbarConfig =
|
|
|
20
20
|
intl = _ref.intl;
|
|
21
21
|
return [{
|
|
22
22
|
items: [{
|
|
23
|
-
content: /*#__PURE__*/React.createElement(_headingItem.default, null, intl.formatMessage(
|
|
23
|
+
content: /*#__PURE__*/React.createElement(_headingItem.default, null, intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarAppears)),
|
|
24
24
|
value: {
|
|
25
25
|
name: ''
|
|
26
26
|
},
|
|
27
27
|
isDisabled: true
|
|
28
28
|
}, {
|
|
29
|
-
content: intl.formatMessage(
|
|
29
|
+
content: intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionInline),
|
|
30
30
|
value: {
|
|
31
31
|
name: 'contextual'
|
|
32
32
|
},
|
|
@@ -38,7 +38,7 @@ var getOverflowPrimaryToolbarConfig = exports.getOverflowPrimaryToolbarConfig =
|
|
|
38
38
|
label: ''
|
|
39
39
|
})
|
|
40
40
|
}, {
|
|
41
|
-
content: intl.formatMessage(
|
|
41
|
+
content: intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionFixedAtTop),
|
|
42
42
|
value: {
|
|
43
43
|
name: 'fixed'
|
|
44
44
|
},
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getPinOptionToolbarConfig = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
10
|
+
var _selectionToolbar = require("@atlaskit/editor-common/messages/selection-toolbar");
|
|
11
11
|
var _pin = _interopRequireDefault(require("@atlaskit/icon/core/pin"));
|
|
12
12
|
var _pinFilled = _interopRequireDefault(require("@atlaskit/icon/core/pin-filled"));
|
|
13
13
|
// oxlint-disable-next-line import/no-duplicates
|
|
@@ -17,7 +17,7 @@ var getPinOptionToolbarConfig = exports.getPinOptionToolbarConfig = function get
|
|
|
17
17
|
var api = _ref.api,
|
|
18
18
|
toolbarDocking = _ref.toolbarDocking,
|
|
19
19
|
intl = _ref.intl;
|
|
20
|
-
var isOffline = (0,
|
|
20
|
+
var isOffline = (0, _isOfflineMode.isOfflineMode)(api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode);
|
|
21
21
|
var pinButton = {
|
|
22
22
|
disabled: isOffline,
|
|
23
23
|
id: 'editor.toolbar.unpined',
|
|
@@ -30,7 +30,7 @@ var getPinOptionToolbarConfig = exports.getPinOptionToolbarConfig = function get
|
|
|
30
30
|
var _api$core$actions$exe, _api$userPreferences;
|
|
31
31
|
return (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.actions.updateUserPreference('toolbarDockingPosition', 'top'))) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false;
|
|
32
32
|
},
|
|
33
|
-
title: intl.formatMessage(
|
|
33
|
+
title: intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionUnpined),
|
|
34
34
|
type: 'button'
|
|
35
35
|
};
|
|
36
36
|
var isDockedToTop = toolbarDocking === 'top';
|
|
@@ -48,7 +48,7 @@ var getPinOptionToolbarConfig = exports.getPinOptionToolbarConfig = function get
|
|
|
48
48
|
return (_api$core$actions$exe2 = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$userPreferences2 = api.userPreferences) === null || _api$userPreferences2 === void 0 ? void 0 : _api$userPreferences2.actions.updateUserPreference('toolbarDockingPosition', 'none'))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
|
|
49
49
|
},
|
|
50
50
|
type: 'button',
|
|
51
|
-
title: intl.formatMessage(
|
|
51
|
+
title: intl.formatMessage(_selectionToolbar.selectionToolbarMessages.toolbarPositionPinedAtTop)
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
return [{
|
|
@@ -6,18 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getToolbarComponents = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _keys = require("@atlaskit/editor-common/toolbar/keys");
|
|
10
|
+
var _rank = require("@atlaskit/editor-common/toolbar/rank");
|
|
10
11
|
var _MenuSection = require("./MenuSection");
|
|
11
12
|
var _PinButton = require("./PinButton");
|
|
12
13
|
var _PinMenuItem = require("./PinMenuItem");
|
|
13
14
|
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api, contextualFormattingEnabled, disablePin) {
|
|
14
15
|
var components = [{
|
|
15
|
-
type:
|
|
16
|
-
key:
|
|
16
|
+
type: _keys.PIN_MENU_SECTION.type,
|
|
17
|
+
key: _keys.PIN_MENU_SECTION.key,
|
|
17
18
|
parents: [{
|
|
18
|
-
type:
|
|
19
|
-
key:
|
|
20
|
-
rank:
|
|
19
|
+
type: _keys.OVERFLOW_MENU.type,
|
|
20
|
+
key: _keys.OVERFLOW_MENU.key,
|
|
21
|
+
rank: _rank.OVERFLOW_MENU_RANK[_keys.PIN_MENU_SECTION.key]
|
|
21
22
|
}],
|
|
22
23
|
component: function component(_ref) {
|
|
23
24
|
var children = _ref.children;
|
|
@@ -26,12 +27,12 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
26
27
|
}, children);
|
|
27
28
|
}
|
|
28
29
|
}, {
|
|
29
|
-
type:
|
|
30
|
-
key:
|
|
30
|
+
type: _keys.PIN_MENU_ITEM.type,
|
|
31
|
+
key: _keys.PIN_MENU_ITEM.key,
|
|
31
32
|
parents: [{
|
|
32
|
-
type:
|
|
33
|
-
key:
|
|
34
|
-
rank:
|
|
33
|
+
type: _keys.PIN_MENU_SECTION.type,
|
|
34
|
+
key: _keys.PIN_MENU_SECTION.key,
|
|
35
|
+
rank: _rank.PIN_MENU_SECTION_RANK[_keys.PIN_MENU_ITEM.key]
|
|
35
36
|
}],
|
|
36
37
|
component: function component() {
|
|
37
38
|
return /*#__PURE__*/_react.default.createElement(_PinMenuItem.PinMenuItem, {
|
|
@@ -44,20 +45,20 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
44
45
|
// Add pin button to primary toolbar when contextual formatting is enabled
|
|
45
46
|
if (contextualFormattingEnabled) {
|
|
46
47
|
var pinButtonComponents = [{
|
|
47
|
-
type:
|
|
48
|
-
key:
|
|
48
|
+
type: _keys.PIN_GROUP.type,
|
|
49
|
+
key: _keys.PIN_GROUP.key,
|
|
49
50
|
parents: [{
|
|
50
|
-
type:
|
|
51
|
-
key:
|
|
52
|
-
rank:
|
|
51
|
+
type: _keys.PIN_SECTION.type,
|
|
52
|
+
key: _keys.PIN_SECTION.key,
|
|
53
|
+
rank: _rank.PIN_SECTION_RANK[_keys.PIN_GROUP.key]
|
|
53
54
|
}]
|
|
54
55
|
}, {
|
|
55
|
-
type:
|
|
56
|
-
key:
|
|
56
|
+
type: _keys.PIN_BUTTON.type,
|
|
57
|
+
key: _keys.PIN_BUTTON.key,
|
|
57
58
|
parents: [{
|
|
58
|
-
type:
|
|
59
|
-
key:
|
|
60
|
-
rank:
|
|
59
|
+
type: _keys.PIN_GROUP.type,
|
|
60
|
+
key: _keys.PIN_GROUP.key,
|
|
61
|
+
rank: _rank.PIN_GROUP_RANK[_keys.PIN_BUTTON.key]
|
|
61
62
|
}],
|
|
62
63
|
component: function component() {
|
|
63
64
|
return /*#__PURE__*/_react.default.createElement(_PinButton.PinButton, {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
|
+
export function getSelectionNodeTypes(state) {
|
|
3
|
+
const {
|
|
4
|
+
from,
|
|
5
|
+
to
|
|
6
|
+
} = state.selection;
|
|
7
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
8
|
+
const selectionNodeTypes = new Set();
|
|
9
|
+
state.doc.nodesBetween(from, to, node => {
|
|
10
|
+
selectionNodeTypes.add(node.type);
|
|
11
|
+
});
|
|
12
|
+
return Array.from(selectionNodeTypes);
|
|
13
|
+
}
|
|
14
|
+
const selectionNodeTypes = [];
|
|
15
|
+
state.doc.nodesBetween(from, to, node => {
|
|
16
|
+
if (selectionNodeTypes.indexOf(node.type) !== 0) {
|
|
17
|
+
selectionNodeTypes.push(node.type);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return selectionNodeTypes;
|
|
21
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
4
|
+
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils/calculate-toolbar-position';
|
|
5
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
7
7
|
import { toggleToolbar, updateToolbarDocking } from './pm-plugins/commands';
|
|
8
|
+
import { getSelectionNodeTypes } from './pm-plugins/get-selection-node-types';
|
|
8
9
|
import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
9
10
|
import { getPinOptionToolbarConfig } from './ui/pin-toolbar-config';
|
|
10
11
|
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
@@ -343,15 +344,6 @@ export const selectionToolbarPlugin = ({
|
|
|
343
344
|
}) ? primaryToolbarComponent : undefined
|
|
344
345
|
};
|
|
345
346
|
};
|
|
346
|
-
function getSelectionNodeTypes(state) {
|
|
347
|
-
const selectionNodeTypes = [];
|
|
348
|
-
state.doc.nodesBetween(state.selection.from, state.selection.to, node => {
|
|
349
|
-
if (selectionNodeTypes.indexOf(node.type) !== 0) {
|
|
350
|
-
selectionNodeTypes.push(node.type);
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
return selectionNodeTypes;
|
|
354
|
-
}
|
|
355
347
|
const hasNestedSpanWithText = (element, text) => {
|
|
356
348
|
if (element.tagName === 'SPAN' && element.innerHTML === text) {
|
|
357
349
|
return true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
3
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dropdown-item-section';
|
|
4
4
|
const usePluginState = _api => {
|
|
5
5
|
const {
|
|
6
6
|
editorViewMode
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { PinnedIcon
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
5
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
6
|
+
import { PinnedIcon } from '@atlaskit/editor-toolbar/pinned-icon';
|
|
7
|
+
import { ToolbarButton } from '@atlaskit/editor-toolbar/toolbar-button';
|
|
8
|
+
import { ToolbarTooltip } from '@atlaskit/editor-toolbar/toolbar-tooltip';
|
|
7
9
|
export const PinButton = ({
|
|
8
10
|
api
|
|
9
11
|
}) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { PinIcon
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
5
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
6
|
+
import { PinIcon } from '@atlaskit/editor-toolbar/pin-icon';
|
|
7
|
+
import { PinnedIcon } from '@atlaskit/editor-toolbar/pinned-icon';
|
|
8
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
7
9
|
const shouldShowPinMenuItem = editMode => {
|
|
8
10
|
return editMode !== 'view';
|
|
9
11
|
};
|
|
@@ -3,10 +3,10 @@ import "./PrimaryToolbarComponent.compiled.css";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
6
|
+
import { isOfflineMode } from '@atlaskit/editor-common/connectivity/isOfflineMode';
|
|
7
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
8
|
+
import ToolbarButton from '@atlaskit/editor-common/ui-menu/ToolbarButton';
|
|
9
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/useSharedPluginStateSelector';
|
|
10
10
|
import PinIcon from '@atlaskit/icon/core/pin';
|
|
11
11
|
import PinFilledIcon from '@atlaskit/icon/core/pin-filled';
|
|
12
12
|
const buttonStyles = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* overflow-toolbar-config.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
5
5
|
import DockToolbarTopIcon from '@atlaskit/icon-lab/core/dock-toolbar-top';
|
|
6
6
|
import CheckMarkIcon from '@atlaskit/icon/core/check-mark';
|
|
7
7
|
import MinusIcon from '@atlaskit/icon/core/minus';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { isOfflineMode } from '@atlaskit/editor-common/connectivity/isOfflineMode';
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
4
|
+
|
|
3
5
|
// oxlint-disable-next-line import/no-duplicates
|
|
4
6
|
|
|
5
|
-
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
6
7
|
import PinIcon from '@atlaskit/icon/core/pin';
|
|
7
8
|
import PinFilledIcon from '@atlaskit/icon/core/pin-filled';
|
|
8
9
|
export const getPinOptionToolbarConfig = ({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OVERFLOW_MENU,
|
|
2
|
+
import { OVERFLOW_MENU, PIN_BUTTON, PIN_GROUP, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_SECTION } from '@atlaskit/editor-common/toolbar/keys';
|
|
3
|
+
import { OVERFLOW_MENU_RANK, PIN_MENU_SECTION_RANK, PIN_GROUP_RANK, PIN_SECTION_RANK } from '@atlaskit/editor-common/toolbar/rank';
|
|
3
4
|
import { MenuSection } from './MenuSection';
|
|
4
5
|
import { PinButton } from './PinButton';
|
|
5
6
|
import { PinMenuItem } from './PinMenuItem';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
|
+
export function getSelectionNodeTypes(state) {
|
|
3
|
+
var _state$selection = state.selection,
|
|
4
|
+
from = _state$selection.from,
|
|
5
|
+
to = _state$selection.to;
|
|
6
|
+
if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
|
|
7
|
+
var _selectionNodeTypes = new Set();
|
|
8
|
+
state.doc.nodesBetween(from, to, function (node) {
|
|
9
|
+
_selectionNodeTypes.add(node.type);
|
|
10
|
+
});
|
|
11
|
+
return Array.from(_selectionNodeTypes);
|
|
12
|
+
}
|
|
13
|
+
var selectionNodeTypes = [];
|
|
14
|
+
state.doc.nodesBetween(from, to, function (node) {
|
|
15
|
+
if (selectionNodeTypes.indexOf(node.type) !== 0) {
|
|
16
|
+
selectionNodeTypes.push(node.type);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return selectionNodeTypes;
|
|
20
|
+
}
|
|
@@ -5,10 +5,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { bind } from 'bind-event-listener';
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
|
-
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
8
|
+
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils/calculate-toolbar-position';
|
|
9
9
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
11
|
import { toggleToolbar, updateToolbarDocking } from './pm-plugins/commands';
|
|
12
|
+
import { getSelectionNodeTypes } from './pm-plugins/get-selection-node-types';
|
|
12
13
|
import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
|
|
13
14
|
import { getPinOptionToolbarConfig } from './ui/pin-toolbar-config';
|
|
14
15
|
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
@@ -341,15 +342,6 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
341
342
|
}) ? primaryToolbarComponent : undefined
|
|
342
343
|
};
|
|
343
344
|
};
|
|
344
|
-
function getSelectionNodeTypes(state) {
|
|
345
|
-
var selectionNodeTypes = [];
|
|
346
|
-
state.doc.nodesBetween(state.selection.from, state.selection.to, function (node) {
|
|
347
|
-
if (selectionNodeTypes.indexOf(node.type) !== 0) {
|
|
348
|
-
selectionNodeTypes.push(node.type);
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
return selectionNodeTypes;
|
|
352
|
-
}
|
|
353
345
|
var _hasNestedSpanWithText = function hasNestedSpanWithText(element, text) {
|
|
354
346
|
if (element.tagName === 'SPAN' && element.innerHTML === text) {
|
|
355
347
|
return true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
3
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dropdown-item-section';
|
|
4
4
|
var usePluginState = function usePluginState(_api) {
|
|
5
5
|
var _useEditorToolbar = useEditorToolbar(),
|
|
6
6
|
editorViewMode = _useEditorToolbar.editorViewMode;
|
package/dist/esm/ui/PinButton.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { PinnedIcon
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
5
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
6
|
+
import { PinnedIcon } from '@atlaskit/editor-toolbar/pinned-icon';
|
|
7
|
+
import { ToolbarButton } from '@atlaskit/editor-toolbar/toolbar-button';
|
|
8
|
+
import { ToolbarTooltip } from '@atlaskit/editor-toolbar/toolbar-tooltip';
|
|
7
9
|
export var PinButton = function PinButton(_ref) {
|
|
8
10
|
var api = _ref.api;
|
|
9
11
|
var intl = useIntl();
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { PinIcon
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
5
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
6
|
+
import { PinIcon } from '@atlaskit/editor-toolbar/pin-icon';
|
|
7
|
+
import { PinnedIcon } from '@atlaskit/editor-toolbar/pinned-icon';
|
|
8
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
7
9
|
var shouldShowPinMenuItem = function shouldShowPinMenuItem(editMode) {
|
|
8
10
|
return editMode !== 'view';
|
|
9
11
|
};
|
|
@@ -3,10 +3,10 @@ import "./PrimaryToolbarComponent.compiled.css";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
6
|
+
import { isOfflineMode } from '@atlaskit/editor-common/connectivity/isOfflineMode';
|
|
7
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
8
|
+
import ToolbarButton from '@atlaskit/editor-common/ui-menu/ToolbarButton';
|
|
9
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/useSharedPluginStateSelector';
|
|
10
10
|
import PinIcon from '@atlaskit/icon/core/pin';
|
|
11
11
|
import PinFilledIcon from '@atlaskit/icon/core/pin-filled';
|
|
12
12
|
var buttonStyles = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* overflow-toolbar-config.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
5
5
|
import DockToolbarTopIcon from '@atlaskit/icon-lab/core/dock-toolbar-top';
|
|
6
6
|
import CheckMarkIcon from '@atlaskit/icon/core/check-mark';
|
|
7
7
|
import MinusIcon from '@atlaskit/icon/core/minus';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { isOfflineMode } from '@atlaskit/editor-common/connectivity/isOfflineMode';
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages/selection-toolbar';
|
|
4
|
+
|
|
3
5
|
// oxlint-disable-next-line import/no-duplicates
|
|
4
6
|
|
|
5
|
-
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
6
7
|
import PinIcon from '@atlaskit/icon/core/pin';
|
|
7
8
|
import PinFilledIcon from '@atlaskit/icon/core/pin-filled';
|
|
8
9
|
export var getPinOptionToolbarConfig = function getPinOptionToolbarConfig(_ref) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OVERFLOW_MENU,
|
|
2
|
+
import { OVERFLOW_MENU, PIN_BUTTON, PIN_GROUP, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_SECTION } from '@atlaskit/editor-common/toolbar/keys';
|
|
3
|
+
import { OVERFLOW_MENU_RANK, PIN_MENU_SECTION_RANK, PIN_GROUP_RANK, PIN_SECTION_RANK } from '@atlaskit/editor-common/toolbar/rank';
|
|
3
4
|
import { MenuSection } from './MenuSection';
|
|
4
5
|
import { PinButton } from './PinButton';
|
|
5
6
|
import { PinMenuItem } from './PinMenuItem';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* of the toolbar in different products, i.e confluence comments and annotations.
|
|
4
4
|
* Work to add the toolbar to more products has been paused at the time of writing.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { Position } from '@atlaskit/editor-common/Popup/utils';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
export declare const calculateToolbarPositionTrackHead: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
9
9
|
export type CoordsAtPos = {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
2
|
+
import type { UserPreferencesProvider } from '@atlaskit/editor-common/types/user-preferences';
|
|
3
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics/analyticsPluginType';
|
|
4
|
+
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls/blockControlsPluginType';
|
|
5
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity/connectivityPluginType';
|
|
6
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode/editorViewmodePluginType';
|
|
7
|
+
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar/primary-toolbar-plugin-type';
|
|
8
|
+
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar/toolbar-plugin-type';
|
|
9
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent/user-intent-plugin-type';
|
|
10
|
+
import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences/user-preferences-plugin-type';
|
|
10
11
|
import type { ToolbarDocking } from './types';
|
|
11
12
|
export type SelectionToolbarPluginOptions = {
|
|
12
13
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UserPreferences } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { UserPreferences } from '@atlaskit/editor-common/types/user-preferences';
|
|
2
2
|
export type SelectionToolbarPluginOptions = {
|
|
3
3
|
/**
|
|
4
4
|
* When set to true, placing the toolbar above the selection will be preferenced.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
3
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
4
|
type MenuSectionProps = {
|
|
5
5
|
api: ExtractInjectionAPI<SelectionToolbarPlugin> | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
3
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
4
|
export declare const PinButton: ({ api, }: {
|
|
5
5
|
api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
3
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
4
|
type PinMenuItemProps = {
|
|
5
5
|
api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
2
2
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
3
3
|
type PrimaryToolbarComponentProps = {
|
|
4
4
|
api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @jsxFrag
|
|
5
5
|
*/
|
|
6
6
|
import type { IntlShape } from 'react-intl';
|
|
7
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
7
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
8
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu/DropdownMenu/types';
|
|
9
9
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
10
10
|
type OverflowToobarConfigOptions = {
|
|
11
11
|
api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types/command';
|
|
3
|
+
import type { FloatingToolbarItem } from '@atlaskit/editor-common/types/floating-toolbar';
|
|
4
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
4
5
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
5
6
|
type PinToobarConfig = {
|
|
6
7
|
api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
2
|
+
import type { RegisterComponent } from '@atlaskit/editor-toolbar-model/types';
|
|
3
3
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
4
|
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<SelectionToolbarPlugin>, contextualFormattingEnabled?: boolean, disablePin?: boolean) => RegisterComponent[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "27.0.
|
|
3
|
+
"version": "27.0.5",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
"@atlaskit/icon": "^38.0.0",
|
|
42
42
|
"@atlaskit/icon-lab": "^7.11.0",
|
|
43
43
|
"@atlaskit/menu": "^11.0.0",
|
|
44
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
44
45
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^232.0.0",
|
|
46
47
|
"@atlaskit/tokens": "^20.4.0",
|
|
47
48
|
"@babel/runtime": "^7.0.0",
|
|
48
49
|
"bind-event-listener": "^3.0.0"
|