@atlaskit/editor-plugin-floating-toolbar 1.14.18 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/floatingToolbarPlugin.js +37 -3
- package/dist/cjs/ui/ExpandButton.js +17 -0
- package/dist/cjs/ui/Toolbar.js +3 -0
- package/dist/es2019/floatingToolbarPlugin.js +33 -3
- package/dist/es2019/ui/ExpandButton.js +10 -0
- package/dist/es2019/ui/Toolbar.js +3 -0
- package/dist/esm/floatingToolbarPlugin.js +37 -3
- package/dist/esm/ui/ExpandButton.js +10 -0
- package/dist/esm/ui/Toolbar.js +3 -0
- package/dist/types/ui/ExpandButton.d.ts +2 -0
- package/dist/types-ts4.5/ui/ExpandButton.d.ts +2 -0
- package/package.json +25 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 1.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
|
|
8
|
+
[`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
|
|
9
|
+
Update `React` from v16 to v18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 1.15.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#107473](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107473)
|
|
20
|
+
[`962b3297548df`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/962b3297548df) -
|
|
21
|
+
[ux] Implement variation 2 for editor contextual toolbar formatting experiment
|
|
22
|
+
|
|
3
23
|
## 1.14.18
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -20,12 +20,14 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
20
20
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
21
21
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
22
22
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
23
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
24
|
var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
|
|
24
25
|
var _commands = require("./pm-plugins/toolbar-data/commands");
|
|
25
26
|
var _plugin = require("./pm-plugins/toolbar-data/plugin");
|
|
26
27
|
var _pluginKey = require("./pm-plugins/toolbar-data/plugin-key");
|
|
27
28
|
var _utils2 = require("./pm-plugins/utils");
|
|
28
29
|
var _ConfirmationModal = require("./ui/ConfirmationModal");
|
|
30
|
+
var _ExpandButton = require("./ui/ExpandButton");
|
|
29
31
|
var _ToolbarLoader = require("./ui/ToolbarLoader");
|
|
30
32
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
31
33
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -200,11 +202,10 @@ function ContentComponent(_ref5) {
|
|
|
200
202
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
201
203
|
providerFactory = _ref5.providerFactory,
|
|
202
204
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
203
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', '
|
|
205
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'blockControls']),
|
|
204
206
|
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
205
207
|
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
206
208
|
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
207
|
-
featureFlagsState = _useSharedPluginState.featureFlagsState,
|
|
208
209
|
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
209
210
|
var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
210
211
|
configWithNodeInfo = _ref6.configWithNodeInfo,
|
|
@@ -212,7 +213,7 @@ function ContentComponent(_ref5) {
|
|
|
212
213
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
213
214
|
return null;
|
|
214
215
|
}
|
|
215
|
-
if (
|
|
216
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
216
217
|
return null;
|
|
217
218
|
}
|
|
218
219
|
var config = configWithNodeInfo.config,
|
|
@@ -266,6 +267,39 @@ function ContentComponent(_ref5) {
|
|
|
266
267
|
}
|
|
267
268
|
var customPositionCalculation;
|
|
268
269
|
var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
|
|
270
|
+
var viewModeToolbarEntry = (0, _experiments.unstable_editorExperimentParam)('live_pages_graceful_edit', 'toolbar-entry', {
|
|
271
|
+
defaultValue: 'none',
|
|
272
|
+
typeGuard: function typeGuard(value) {
|
|
273
|
+
return typeof value === 'string' && ['text', 'nodes'].includes(value);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
if (!(0, _experiments.editorExperiment)('live_pages_graceful_edit', 'control') && viewModeToolbarEntry !== 'none') {
|
|
277
|
+
if ((editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.contentMode) === 'live-edit' && editorViewModeState !== null && editorViewModeState !== void 0 && editorViewModeState.isConsumption) {
|
|
278
|
+
var hasOtherToolbarItems = toolbarItems && toolbarItems.length !== 0;
|
|
279
|
+
var shouldAddToolbarItems = viewModeToolbarEntry === 'expand-existing-only' ? hasOtherToolbarItems : true;
|
|
280
|
+
if (shouldAddToolbarItems) {
|
|
281
|
+
if (toolbarItems && toolbarItems.length > 0) {
|
|
282
|
+
toolbarItems.unshift({
|
|
283
|
+
type: 'separator'
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
toolbarItems === null || toolbarItems === void 0 || toolbarItems.unshift({
|
|
287
|
+
type: 'button',
|
|
288
|
+
title: 'Edit',
|
|
289
|
+
onClick: function onClick() {
|
|
290
|
+
var _pluginInjectionApi$c2, _pluginInjectionApi$e;
|
|
291
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.actions) === null || _pluginInjectionApi$c2 === void 0 || _pluginInjectionApi$c2.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.updateContentMode({
|
|
292
|
+
type: 'intent-to-edit'
|
|
293
|
+
}));
|
|
294
|
+
return false;
|
|
295
|
+
},
|
|
296
|
+
icon: function icon() {
|
|
297
|
+
return /*#__PURE__*/_react.default.createElement(_ExpandButton.ExpandButton, null);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
269
303
|
if (onPositionCalculated) {
|
|
270
304
|
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
271
305
|
return onPositionCalculated(editorView, nextPos);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ExpandButton = ExpandButton;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/utility/chevron-right"));
|
|
10
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
|
+
function ExpandButton() {
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
13
|
+
paddingInline: "space.075"
|
|
14
|
+
}, /*#__PURE__*/_react.default.createElement(_chevronRight.default, {
|
|
15
|
+
label: 'Edit'
|
|
16
|
+
}));
|
|
17
|
+
}
|
package/dist/cjs/ui/Toolbar.js
CHANGED
|
@@ -130,6 +130,9 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
130
130
|
label: item.title,
|
|
131
131
|
spacing: "spacious"
|
|
132
132
|
}) : undefined,
|
|
133
|
+
iconAfter: item.iconAfter ? (0, _react2.jsx)(item.iconAfter, {
|
|
134
|
+
label: ""
|
|
135
|
+
}) : undefined,
|
|
133
136
|
appearance: item.appearance,
|
|
134
137
|
target: item.target,
|
|
135
138
|
onClick: onClickHandler,
|
|
@@ -8,12 +8,14 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
8
8
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import { editorExperiment, unstable_editorExperimentParam } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
|
|
12
13
|
import { hideConfirmDialog } from './pm-plugins/toolbar-data/commands';
|
|
13
14
|
import { createPlugin as floatingToolbarDataPluginFactory } from './pm-plugins/toolbar-data/plugin';
|
|
14
15
|
import { pluginKey as dataPluginKey } from './pm-plugins/toolbar-data/plugin-key';
|
|
15
16
|
import { findNode } from './pm-plugins/utils';
|
|
16
17
|
import { ConfirmationModal } from './ui/ConfirmationModal';
|
|
18
|
+
import { ExpandButton } from './ui/ExpandButton';
|
|
17
19
|
import { ToolbarLoader } from './ui/ToolbarLoader';
|
|
18
20
|
|
|
19
21
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
@@ -189,9 +191,8 @@ export function ContentComponent({
|
|
|
189
191
|
floatingToolbarState,
|
|
190
192
|
editorDisabledState,
|
|
191
193
|
editorViewModeState,
|
|
192
|
-
featureFlagsState,
|
|
193
194
|
blockControlsState
|
|
194
|
-
} = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', '
|
|
195
|
+
} = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'blockControls']);
|
|
195
196
|
const {
|
|
196
197
|
configWithNodeInfo,
|
|
197
198
|
floatingToolbarData
|
|
@@ -199,7 +200,7 @@ export function ContentComponent({
|
|
|
199
200
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
200
201
|
return null;
|
|
201
202
|
}
|
|
202
|
-
if (
|
|
203
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
203
204
|
return null;
|
|
204
205
|
}
|
|
205
206
|
const {
|
|
@@ -252,6 +253,35 @@ export function ContentComponent({
|
|
|
252
253
|
}
|
|
253
254
|
let customPositionCalculation;
|
|
254
255
|
const toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
|
|
256
|
+
const viewModeToolbarEntry = unstable_editorExperimentParam('live_pages_graceful_edit', 'toolbar-entry', {
|
|
257
|
+
defaultValue: 'none',
|
|
258
|
+
typeGuard: value => typeof value === 'string' && ['text', 'nodes'].includes(value)
|
|
259
|
+
});
|
|
260
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control') && viewModeToolbarEntry !== 'none') {
|
|
261
|
+
if ((editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.contentMode) === 'live-edit' && editorViewModeState !== null && editorViewModeState !== void 0 && editorViewModeState.isConsumption) {
|
|
262
|
+
const hasOtherToolbarItems = toolbarItems && toolbarItems.length !== 0;
|
|
263
|
+
const shouldAddToolbarItems = viewModeToolbarEntry === 'expand-existing-only' ? hasOtherToolbarItems : true;
|
|
264
|
+
if (shouldAddToolbarItems) {
|
|
265
|
+
if (toolbarItems && toolbarItems.length > 0) {
|
|
266
|
+
toolbarItems.unshift({
|
|
267
|
+
type: 'separator'
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
toolbarItems === null || toolbarItems === void 0 ? void 0 : toolbarItems.unshift({
|
|
271
|
+
type: 'button',
|
|
272
|
+
title: 'Edit',
|
|
273
|
+
onClick: () => {
|
|
274
|
+
var _pluginInjectionApi$c2, _pluginInjectionApi$c3, _pluginInjectionApi$e;
|
|
275
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.actions) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.updateContentMode({
|
|
276
|
+
type: 'intent-to-edit'
|
|
277
|
+
}));
|
|
278
|
+
return false;
|
|
279
|
+
},
|
|
280
|
+
icon: () => /*#__PURE__*/React.createElement(ExpandButton, null)
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
255
285
|
if (onPositionCalculated) {
|
|
256
286
|
customPositionCalculation = nextPos => {
|
|
257
287
|
return onPositionCalculated(editorView, nextPos);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Icon from '@atlaskit/icon/utility/chevron-right';
|
|
3
|
+
import { Box } from '@atlaskit/primitives';
|
|
4
|
+
export function ExpandButton() {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
6
|
+
paddingInline: "space.075"
|
|
7
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
8
|
+
label: 'Edit'
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
@@ -119,6 +119,9 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
119
119
|
label: item.title,
|
|
120
120
|
spacing: "spacious"
|
|
121
121
|
}) : undefined,
|
|
122
|
+
iconAfter: item.iconAfter ? jsx(item.iconAfter, {
|
|
123
|
+
label: ""
|
|
124
|
+
}) : undefined,
|
|
122
125
|
appearance: item.appearance,
|
|
123
126
|
target: item.target,
|
|
124
127
|
onClick: onClickHandler,
|
|
@@ -11,12 +11,14 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
11
11
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
14
|
+
import { editorExperiment, unstable_editorExperimentParam } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
15
|
import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
|
|
15
16
|
import { hideConfirmDialog } from './pm-plugins/toolbar-data/commands';
|
|
16
17
|
import { createPlugin as floatingToolbarDataPluginFactory } from './pm-plugins/toolbar-data/plugin';
|
|
17
18
|
import { pluginKey as dataPluginKey } from './pm-plugins/toolbar-data/plugin-key';
|
|
18
19
|
import { findNode } from './pm-plugins/utils';
|
|
19
20
|
import { ConfirmationModal } from './ui/ConfirmationModal';
|
|
21
|
+
import { ExpandButton } from './ui/ExpandButton';
|
|
20
22
|
import { ToolbarLoader } from './ui/ToolbarLoader';
|
|
21
23
|
|
|
22
24
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
@@ -188,11 +190,10 @@ export function ContentComponent(_ref5) {
|
|
|
188
190
|
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
189
191
|
providerFactory = _ref5.providerFactory,
|
|
190
192
|
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
191
|
-
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', '
|
|
193
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled', 'editorViewMode', 'blockControls']),
|
|
192
194
|
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
193
195
|
editorDisabledState = _useSharedPluginState.editorDisabledState,
|
|
194
196
|
editorViewModeState = _useSharedPluginState.editorViewModeState,
|
|
195
|
-
featureFlagsState = _useSharedPluginState.featureFlagsState,
|
|
196
197
|
blockControlsState = _useSharedPluginState.blockControlsState;
|
|
197
198
|
var _ref6 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
198
199
|
configWithNodeInfo = _ref6.configWithNodeInfo,
|
|
@@ -200,7 +201,7 @@ export function ContentComponent(_ref5) {
|
|
|
200
201
|
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
201
202
|
return null;
|
|
202
203
|
}
|
|
203
|
-
if (
|
|
204
|
+
if (blockControlsState !== null && blockControlsState !== void 0 && blockControlsState.isDragging) {
|
|
204
205
|
return null;
|
|
205
206
|
}
|
|
206
207
|
var config = configWithNodeInfo.config,
|
|
@@ -254,6 +255,39 @@ export function ContentComponent(_ref5) {
|
|
|
254
255
|
}
|
|
255
256
|
var customPositionCalculation;
|
|
256
257
|
var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
|
|
258
|
+
var viewModeToolbarEntry = unstable_editorExperimentParam('live_pages_graceful_edit', 'toolbar-entry', {
|
|
259
|
+
defaultValue: 'none',
|
|
260
|
+
typeGuard: function typeGuard(value) {
|
|
261
|
+
return typeof value === 'string' && ['text', 'nodes'].includes(value);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
if (!editorExperiment('live_pages_graceful_edit', 'control') && viewModeToolbarEntry !== 'none') {
|
|
265
|
+
if ((editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.contentMode) === 'live-edit' && editorViewModeState !== null && editorViewModeState !== void 0 && editorViewModeState.isConsumption) {
|
|
266
|
+
var hasOtherToolbarItems = toolbarItems && toolbarItems.length !== 0;
|
|
267
|
+
var shouldAddToolbarItems = viewModeToolbarEntry === 'expand-existing-only' ? hasOtherToolbarItems : true;
|
|
268
|
+
if (shouldAddToolbarItems) {
|
|
269
|
+
if (toolbarItems && toolbarItems.length > 0) {
|
|
270
|
+
toolbarItems.unshift({
|
|
271
|
+
type: 'separator'
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
toolbarItems === null || toolbarItems === void 0 || toolbarItems.unshift({
|
|
275
|
+
type: 'button',
|
|
276
|
+
title: 'Edit',
|
|
277
|
+
onClick: function onClick() {
|
|
278
|
+
var _pluginInjectionApi$c2, _pluginInjectionApi$e;
|
|
279
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.actions) === null || _pluginInjectionApi$c2 === void 0 || _pluginInjectionApi$c2.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.updateContentMode({
|
|
280
|
+
type: 'intent-to-edit'
|
|
281
|
+
}));
|
|
282
|
+
return false;
|
|
283
|
+
},
|
|
284
|
+
icon: function icon() {
|
|
285
|
+
return /*#__PURE__*/React.createElement(ExpandButton, null);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
257
291
|
if (onPositionCalculated) {
|
|
258
292
|
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
259
293
|
return onPositionCalculated(editorView, nextPos);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Icon from '@atlaskit/icon/utility/chevron-right';
|
|
3
|
+
import { Box } from '@atlaskit/primitives';
|
|
4
|
+
export function ExpandButton() {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
6
|
+
paddingInline: "space.075"
|
|
7
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
8
|
+
label: 'Edit'
|
|
9
|
+
}));
|
|
10
|
+
}
|
package/dist/esm/ui/Toolbar.js
CHANGED
|
@@ -123,6 +123,9 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
123
123
|
label: item.title,
|
|
124
124
|
spacing: "spacious"
|
|
125
125
|
}) : undefined,
|
|
126
|
+
iconAfter: item.iconAfter ? jsx(item.iconAfter, {
|
|
127
|
+
label: ""
|
|
128
|
+
}) : undefined,
|
|
126
129
|
appearance: item.appearance,
|
|
127
130
|
target: item.target,
|
|
128
131
|
onClick: onClickHandler,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
".": "./src/index.ts"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaskit/adf-utils": "^19.
|
|
27
|
-
"@atlaskit/button": "^20.
|
|
28
|
-
"@atlaskit/checkbox": "^15.
|
|
29
|
-
"@atlaskit/editor-common": "^99.
|
|
30
|
-
"@atlaskit/editor-palette": "1.
|
|
31
|
-
"@atlaskit/editor-plugin-block-controls": "^2.
|
|
32
|
-
"@atlaskit/editor-plugin-context-panel": "^1.
|
|
33
|
-
"@atlaskit/editor-plugin-copy-button": "^1.
|
|
34
|
-
"@atlaskit/editor-plugin-decorations": "^1.
|
|
35
|
-
"@atlaskit/editor-plugin-editor-disabled": "^1.
|
|
26
|
+
"@atlaskit/adf-utils": "^19.18.0",
|
|
27
|
+
"@atlaskit/button": "^20.4.0",
|
|
28
|
+
"@atlaskit/checkbox": "^15.3.0",
|
|
29
|
+
"@atlaskit/editor-common": "^99.6.0",
|
|
30
|
+
"@atlaskit/editor-palette": "1.7.0",
|
|
31
|
+
"@atlaskit/editor-plugin-block-controls": "^2.21.0",
|
|
32
|
+
"@atlaskit/editor-plugin-context-panel": "^1.5.0",
|
|
33
|
+
"@atlaskit/editor-plugin-copy-button": "^1.4.0",
|
|
34
|
+
"@atlaskit/editor-plugin-decorations": "^1.4.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-disabled": "^1.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
37
|
-
"@atlaskit/editor-plugin-emoji": "^2.
|
|
38
|
-
"@atlaskit/editor-plugin-extension": "^3.
|
|
39
|
-
"@atlaskit/editor-plugin-table": "^9.
|
|
37
|
+
"@atlaskit/editor-plugin-emoji": "^2.8.0",
|
|
38
|
+
"@atlaskit/editor-plugin-extension": "^3.1.0",
|
|
39
|
+
"@atlaskit/editor-plugin-table": "^9.3.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
41
|
-
"@atlaskit/emoji": "^67.
|
|
42
|
-
"@atlaskit/icon": "^23.
|
|
43
|
-
"@atlaskit/menu": "^2.
|
|
44
|
-
"@atlaskit/modal-dialog": "^12.
|
|
41
|
+
"@atlaskit/emoji": "^67.13.0",
|
|
42
|
+
"@atlaskit/icon": "^23.5.0",
|
|
43
|
+
"@atlaskit/menu": "^2.14.0",
|
|
44
|
+
"@atlaskit/modal-dialog": "^12.20.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
|
-
"@atlaskit/primitives": "^13.
|
|
47
|
-
"@atlaskit/select": "^18.
|
|
48
|
-
"@atlaskit/theme": "^14.
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
50
|
-
"@atlaskit/tokens": "^3.
|
|
51
|
-
"@atlaskit/tooltip": "^19.
|
|
46
|
+
"@atlaskit/primitives": "^13.4.0",
|
|
47
|
+
"@atlaskit/select": "^18.10.0",
|
|
48
|
+
"@atlaskit/theme": "^14.1.0",
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^2.41.0",
|
|
50
|
+
"@atlaskit/tokens": "^3.3.0",
|
|
51
|
+
"@atlaskit/tooltip": "^19.1.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@atlaskit/visual-regression": "*",
|
|
65
65
|
"@testing-library/dom": "^10.1.0",
|
|
66
|
-
"@testing-library/react": "^
|
|
66
|
+
"@testing-library/react": "^13.4.0",
|
|
67
67
|
"@testing-library/user-event": "^14.4.3",
|
|
68
68
|
"enzyme": "^3.10.0",
|
|
69
69
|
"typescript": "~5.4.2",
|