@atlaskit/editor-plugin-selection-toolbar 7.0.9 → 7.0.11
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/selectionToolbarPlugin.js +1 -3
- package/dist/cjs/ui/PageVisibilityWatcher.js +0 -4
- package/dist/cjs/ui/PinButton.js +8 -2
- package/dist/cjs/ui/PinMenuItem.js +13 -5
- package/dist/es2019/selectionToolbarPlugin.js +1 -3
- package/dist/es2019/ui/PageVisibilityWatcher.js +0 -4
- package/dist/es2019/ui/PinButton.js +9 -2
- package/dist/es2019/ui/PinMenuItem.js +13 -5
- package/dist/esm/selectionToolbarPlugin.js +1 -3
- package/dist/esm/ui/PageVisibilityWatcher.js +0 -4
- package/dist/esm/ui/PinButton.js +8 -2
- package/dist/esm/ui/PinMenuItem.js +13 -5
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-toolbar
|
|
2
2
|
|
|
3
|
+
## 7.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`14b9e966da4dd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14b9e966da4dd) -
|
|
8
|
+
[ux] ED-29517 Toolbar and offline banner is overlapping
|
|
9
|
+
- [`ef001bf65d48f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef001bf65d48f) -
|
|
10
|
+
Remove usage of `platform_editor_toolbar_aifc` inside editor packages - instead rely on checking
|
|
11
|
+
for new toolbar plugin option, make `enableNewToolbarExperience` mandatory for consumers to opt in
|
|
12
|
+
to new toolbar experience
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 7.0.10
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`0b4cd77e72217`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b4cd77e72217) -
|
|
20
|
+
clean up references to platform_editor_controls_performance_fixes
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 7.0.9
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -42,9 +42,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
42
42
|
config = _ref.config;
|
|
43
43
|
var __selectionToolbarHandlers = [];
|
|
44
44
|
var primaryToolbarComponent;
|
|
45
|
-
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar)
|
|
46
|
-
exposure: true
|
|
47
|
-
});
|
|
45
|
+
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
48
46
|
var userPreferencesProvider = config.userPreferencesProvider,
|
|
49
47
|
contextualFormattingEnabled = config.contextualFormattingEnabled;
|
|
50
48
|
if (isToolbarAIFCEnabled) {
|
|
@@ -10,7 +10,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _bindEventListener = require("bind-event-listener");
|
|
12
12
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
13
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
13
|
var PageVisibilityWatcher = exports.PageVisibilityWatcher = function PageVisibilityWatcher(_ref) {
|
|
15
14
|
var api = _ref.api,
|
|
16
15
|
userPreferencesProvider = _ref.userPreferencesProvider;
|
|
@@ -52,9 +51,6 @@ var PageVisibilityWatcher = exports.PageVisibilityWatcher = function PageVisibil
|
|
|
52
51
|
return _ref2.apply(this, arguments);
|
|
53
52
|
};
|
|
54
53
|
}();
|
|
55
|
-
if ((0, _experiments.editorExperiment)('platform_editor_controls_performance_fixes', false)) {
|
|
56
|
-
refreshPrefrerence();
|
|
57
|
-
}
|
|
58
54
|
return (0, _bindEventListener.bind)(document, {
|
|
59
55
|
type: 'visibilitychange',
|
|
60
56
|
listener: refreshPrefrerence
|
package/dist/cjs/ui/PinButton.js
CHANGED
|
@@ -8,14 +8,19 @@ exports.PinButton = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
11
12
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
14
|
var PinButton = exports.PinButton = function PinButton(_ref) {
|
|
13
15
|
var api = _ref.api;
|
|
14
16
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
15
17
|
var message = intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
18
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
19
|
+
isOffline = _useEditorToolbar.isOffline;
|
|
20
|
+
var isDisabled = (0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
16
21
|
var onClick = function onClick() {
|
|
17
22
|
var _api$selectionToolbar, _api$selectionToolbar2;
|
|
18
|
-
if (!api) {
|
|
23
|
+
if (!api || isDisabled) {
|
|
19
24
|
return;
|
|
20
25
|
}
|
|
21
26
|
(_api$selectionToolbar = api.selectionToolbar.actions) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar2 = _api$selectionToolbar.setToolbarDocking) === null || _api$selectionToolbar2 === void 0 || _api$selectionToolbar2.call(_api$selectionToolbar, 'none');
|
|
@@ -28,6 +33,7 @@ var PinButton = exports.PinButton = function PinButton(_ref) {
|
|
|
28
33
|
label: ""
|
|
29
34
|
}),
|
|
30
35
|
label: message,
|
|
31
|
-
onClick: onClick
|
|
36
|
+
onClick: onClick,
|
|
37
|
+
isDisabled: isDisabled
|
|
32
38
|
}));
|
|
33
39
|
};
|
|
@@ -11,6 +11,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
11
11
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
12
12
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
15
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
17
|
var shouldShowPinMenuItem = function shouldShowPinMenuItem(editMode) {
|
|
@@ -21,17 +22,21 @@ var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(fun
|
|
|
21
22
|
}, function (api) {
|
|
22
23
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
23
24
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
24
|
-
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference
|
|
25
|
+
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
26
|
+
isOffline = _useEditorToolbar.isOffline;
|
|
25
27
|
return {
|
|
26
28
|
editorViewMode: editorViewMode,
|
|
27
|
-
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
29
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
30
|
+
isOffline: isOffline
|
|
28
31
|
};
|
|
29
32
|
}, function (api) {
|
|
30
33
|
var editorViewMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
31
34
|
var editorToolbarDockingPreference = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
35
|
+
var isOffline = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode') === 'offline';
|
|
32
36
|
return {
|
|
33
37
|
editorViewMode: editorViewMode,
|
|
34
|
-
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
38
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
39
|
+
isOffline: isOffline
|
|
35
40
|
};
|
|
36
41
|
});
|
|
37
42
|
|
|
@@ -43,13 +48,15 @@ var PinMenuItem = exports.PinMenuItem = function PinMenuItem(_ref) {
|
|
|
43
48
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
44
49
|
var _usePluginState = usePluginState(api),
|
|
45
50
|
editorViewMode = _usePluginState.editorViewMode,
|
|
46
|
-
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference
|
|
51
|
+
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference,
|
|
52
|
+
isOffline = _usePluginState.isOffline;
|
|
47
53
|
var isToolbarDocked = editorToolbarDockingPreference === 'top';
|
|
54
|
+
var isDisabled = (0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
48
55
|
if (!shouldShowPinMenuItem(editorViewMode)) {
|
|
49
56
|
return null;
|
|
50
57
|
}
|
|
51
58
|
var onClick = function onClick() {
|
|
52
|
-
if (!api) {
|
|
59
|
+
if (!api || isDisabled) {
|
|
53
60
|
return;
|
|
54
61
|
}
|
|
55
62
|
if (isToolbarDocked) {
|
|
@@ -63,6 +70,7 @@ var PinMenuItem = exports.PinMenuItem = function PinMenuItem(_ref) {
|
|
|
63
70
|
var message = intl.formatMessage(isToolbarDocked ? _messages.selectionToolbarMessages.toolbarPositionPinedAtTop : _messages.selectionToolbarMessages.toolbarPositionUnpinnedConcise);
|
|
64
71
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
65
72
|
onClick: onClick,
|
|
73
|
+
isDisabled: isDisabled,
|
|
66
74
|
elemBefore: isToolbarDocked ? /*#__PURE__*/_react.default.createElement(_editorToolbar.PinnedIcon, {
|
|
67
75
|
size: "small",
|
|
68
76
|
label: ""
|
|
@@ -32,9 +32,7 @@ export const selectionToolbarPlugin = ({
|
|
|
32
32
|
}) => {
|
|
33
33
|
const __selectionToolbarHandlers = [];
|
|
34
34
|
let primaryToolbarComponent;
|
|
35
|
-
const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar)
|
|
36
|
-
exposure: true
|
|
37
|
-
});
|
|
35
|
+
const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
38
36
|
const {
|
|
39
37
|
userPreferencesProvider,
|
|
40
38
|
contextualFormattingEnabled
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
3
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
4
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
export const PageVisibilityWatcher = ({
|
|
6
5
|
api,
|
|
7
6
|
userPreferencesProvider
|
|
@@ -23,9 +22,6 @@ export const PageVisibilityWatcher = ({
|
|
|
23
22
|
api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.actions) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.refreshToolbarDocking) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.call(_api$selectionToolbar2);
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
|
-
if (editorExperiment('platform_editor_controls_performance_fixes', false)) {
|
|
27
|
-
refreshPrefrerence();
|
|
28
|
-
}
|
|
29
25
|
return bind(document, {
|
|
30
26
|
type: 'visibilitychange',
|
|
31
27
|
listener: refreshPrefrerence
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
4
5
|
import { PinnedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
7
|
export const PinButton = ({
|
|
6
8
|
api
|
|
7
9
|
}) => {
|
|
8
10
|
const intl = useIntl();
|
|
9
11
|
const message = intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
12
|
+
const {
|
|
13
|
+
isOffline
|
|
14
|
+
} = useEditorToolbar();
|
|
15
|
+
const isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
10
16
|
const onClick = () => {
|
|
11
17
|
var _api$selectionToolbar, _api$selectionToolbar2;
|
|
12
|
-
if (!api) {
|
|
18
|
+
if (!api || isDisabled) {
|
|
13
19
|
return;
|
|
14
20
|
}
|
|
15
21
|
(_api$selectionToolbar = api.selectionToolbar.actions) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.setToolbarDocking) === null || _api$selectionToolbar2 === void 0 ? void 0 : _api$selectionToolbar2.call(_api$selectionToolbar, 'none');
|
|
@@ -22,6 +28,7 @@ export const PinButton = ({
|
|
|
22
28
|
label: ""
|
|
23
29
|
}),
|
|
24
30
|
label: message,
|
|
25
|
-
onClick: onClick
|
|
31
|
+
onClick: onClick,
|
|
32
|
+
isDisabled: isDisabled
|
|
26
33
|
}));
|
|
27
34
|
};
|
|
@@ -4,6 +4,7 @@ import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
|
4
4
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
5
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
6
|
import { PinIcon, PinnedIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
8
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
const shouldShowPinMenuItem = editMode => {
|
|
@@ -12,18 +13,22 @@ const shouldShowPinMenuItem = editMode => {
|
|
|
12
13
|
const usePluginState = conditionalHooksFactory(() => expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true), api => {
|
|
13
14
|
const {
|
|
14
15
|
editorViewMode,
|
|
15
|
-
editorToolbarDockingPreference
|
|
16
|
+
editorToolbarDockingPreference,
|
|
17
|
+
isOffline
|
|
16
18
|
} = useEditorToolbar();
|
|
17
19
|
return {
|
|
18
20
|
editorViewMode,
|
|
19
|
-
editorToolbarDockingPreference
|
|
21
|
+
editorToolbarDockingPreference,
|
|
22
|
+
isOffline
|
|
20
23
|
};
|
|
21
24
|
}, api => {
|
|
22
25
|
const editorViewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
23
26
|
const editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
27
|
+
const isOffline = useSharedPluginStateSelector(api, 'connectivity.mode') === 'offline';
|
|
24
28
|
return {
|
|
25
29
|
editorViewMode,
|
|
26
|
-
editorToolbarDockingPreference
|
|
30
|
+
editorToolbarDockingPreference,
|
|
31
|
+
isOffline
|
|
27
32
|
};
|
|
28
33
|
});
|
|
29
34
|
|
|
@@ -36,14 +41,16 @@ export const PinMenuItem = ({
|
|
|
36
41
|
const intl = useIntl();
|
|
37
42
|
const {
|
|
38
43
|
editorViewMode,
|
|
39
|
-
editorToolbarDockingPreference
|
|
44
|
+
editorToolbarDockingPreference,
|
|
45
|
+
isOffline
|
|
40
46
|
} = usePluginState(api);
|
|
41
47
|
const isToolbarDocked = editorToolbarDockingPreference === 'top';
|
|
48
|
+
const isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
42
49
|
if (!shouldShowPinMenuItem(editorViewMode)) {
|
|
43
50
|
return null;
|
|
44
51
|
}
|
|
45
52
|
const onClick = () => {
|
|
46
|
-
if (!api) {
|
|
53
|
+
if (!api || isDisabled) {
|
|
47
54
|
return;
|
|
48
55
|
}
|
|
49
56
|
if (isToolbarDocked) {
|
|
@@ -57,6 +64,7 @@ export const PinMenuItem = ({
|
|
|
57
64
|
const message = intl.formatMessage(isToolbarDocked ? selectionToolbarMessages.toolbarPositionPinedAtTop : selectionToolbarMessages.toolbarPositionUnpinnedConcise);
|
|
58
65
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
59
66
|
onClick: onClick,
|
|
67
|
+
isDisabled: isDisabled,
|
|
60
68
|
elemBefore: isToolbarDocked ? /*#__PURE__*/React.createElement(PinnedIcon, {
|
|
61
69
|
size: "small",
|
|
62
70
|
label: ""
|
|
@@ -35,9 +35,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
35
35
|
config = _ref.config;
|
|
36
36
|
var __selectionToolbarHandlers = [];
|
|
37
37
|
var primaryToolbarComponent;
|
|
38
|
-
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar)
|
|
39
|
-
exposure: true
|
|
40
|
-
});
|
|
38
|
+
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
41
39
|
var userPreferencesProvider = config.userPreferencesProvider,
|
|
42
40
|
contextualFormattingEnabled = config.contextualFormattingEnabled;
|
|
43
41
|
if (isToolbarAIFCEnabled) {
|
|
@@ -3,7 +3,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { bind } from 'bind-event-listener';
|
|
5
5
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
6
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
export var PageVisibilityWatcher = function PageVisibilityWatcher(_ref) {
|
|
8
7
|
var api = _ref.api,
|
|
9
8
|
userPreferencesProvider = _ref.userPreferencesProvider;
|
|
@@ -45,9 +44,6 @@ export var PageVisibilityWatcher = function PageVisibilityWatcher(_ref) {
|
|
|
45
44
|
return _ref2.apply(this, arguments);
|
|
46
45
|
};
|
|
47
46
|
}();
|
|
48
|
-
if (editorExperiment('platform_editor_controls_performance_fixes', false)) {
|
|
49
|
-
refreshPrefrerence();
|
|
50
|
-
}
|
|
51
47
|
return bind(document, {
|
|
52
48
|
type: 'visibilitychange',
|
|
53
49
|
listener: refreshPrefrerence
|
package/dist/esm/ui/PinButton.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
4
5
|
import { PinnedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
7
|
export var PinButton = function PinButton(_ref) {
|
|
6
8
|
var api = _ref.api;
|
|
7
9
|
var intl = useIntl();
|
|
8
10
|
var message = intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
11
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
12
|
+
isOffline = _useEditorToolbar.isOffline;
|
|
13
|
+
var isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
9
14
|
var onClick = function onClick() {
|
|
10
15
|
var _api$selectionToolbar, _api$selectionToolbar2;
|
|
11
|
-
if (!api) {
|
|
16
|
+
if (!api || isDisabled) {
|
|
12
17
|
return;
|
|
13
18
|
}
|
|
14
19
|
(_api$selectionToolbar = api.selectionToolbar.actions) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar2 = _api$selectionToolbar.setToolbarDocking) === null || _api$selectionToolbar2 === void 0 || _api$selectionToolbar2.call(_api$selectionToolbar, 'none');
|
|
@@ -21,6 +26,7 @@ export var PinButton = function PinButton(_ref) {
|
|
|
21
26
|
label: ""
|
|
22
27
|
}),
|
|
23
28
|
label: message,
|
|
24
|
-
onClick: onClick
|
|
29
|
+
onClick: onClick,
|
|
30
|
+
isDisabled: isDisabled
|
|
25
31
|
}));
|
|
26
32
|
};
|
|
@@ -4,6 +4,7 @@ import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
|
4
4
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
5
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
6
|
import { PinIcon, PinnedIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
8
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
var shouldShowPinMenuItem = function shouldShowPinMenuItem(editMode) {
|
|
@@ -14,17 +15,21 @@ var usePluginState = conditionalHooksFactory(function () {
|
|
|
14
15
|
}, function (api) {
|
|
15
16
|
var _useEditorToolbar = useEditorToolbar(),
|
|
16
17
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
17
|
-
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference
|
|
18
|
+
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
19
|
+
isOffline = _useEditorToolbar.isOffline;
|
|
18
20
|
return {
|
|
19
21
|
editorViewMode: editorViewMode,
|
|
20
|
-
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
22
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
23
|
+
isOffline: isOffline
|
|
21
24
|
};
|
|
22
25
|
}, function (api) {
|
|
23
26
|
var editorViewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
24
27
|
var editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
28
|
+
var isOffline = useSharedPluginStateSelector(api, 'connectivity.mode') === 'offline';
|
|
25
29
|
return {
|
|
26
30
|
editorViewMode: editorViewMode,
|
|
27
|
-
editorToolbarDockingPreference: editorToolbarDockingPreference
|
|
31
|
+
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
32
|
+
isOffline: isOffline
|
|
28
33
|
};
|
|
29
34
|
});
|
|
30
35
|
|
|
@@ -36,13 +41,15 @@ export var PinMenuItem = function PinMenuItem(_ref) {
|
|
|
36
41
|
var intl = useIntl();
|
|
37
42
|
var _usePluginState = usePluginState(api),
|
|
38
43
|
editorViewMode = _usePluginState.editorViewMode,
|
|
39
|
-
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference
|
|
44
|
+
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference,
|
|
45
|
+
isOffline = _usePluginState.isOffline;
|
|
40
46
|
var isToolbarDocked = editorToolbarDockingPreference === 'top';
|
|
47
|
+
var isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
41
48
|
if (!shouldShowPinMenuItem(editorViewMode)) {
|
|
42
49
|
return null;
|
|
43
50
|
}
|
|
44
51
|
var onClick = function onClick() {
|
|
45
|
-
if (!api) {
|
|
52
|
+
if (!api || isDisabled) {
|
|
46
53
|
return;
|
|
47
54
|
}
|
|
48
55
|
if (isToolbarDocked) {
|
|
@@ -56,6 +63,7 @@ export var PinMenuItem = function PinMenuItem(_ref) {
|
|
|
56
63
|
var message = intl.formatMessage(isToolbarDocked ? selectionToolbarMessages.toolbarPositionPinedAtTop : selectionToolbarMessages.toolbarPositionUnpinnedConcise);
|
|
57
64
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
58
65
|
onClick: onClick,
|
|
66
|
+
isDisabled: isDisabled,
|
|
59
67
|
elemBefore: isToolbarDocked ? /*#__PURE__*/React.createElement(PinnedIcon, {
|
|
60
68
|
size: "small",
|
|
61
69
|
label: ""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.11",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/menu": "^8.4.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags-react": "^0.3.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^13.10.0",
|
|
50
50
|
"@atlaskit/tokens": "^6.4.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"bind-event-listener": "^3.0.0"
|
|
@@ -105,6 +105,9 @@
|
|
|
105
105
|
"aifc_create_enabled": {
|
|
106
106
|
"type": "boolean"
|
|
107
107
|
},
|
|
108
|
+
"platform_editor_toolbar_aifc_patch_7": {
|
|
109
|
+
"type": "boolean"
|
|
110
|
+
},
|
|
108
111
|
"platform_editor_lcm_toolbar_docking_fix": {
|
|
109
112
|
"type": "boolean"
|
|
110
113
|
}
|