@atlaskit/editor-plugin-selection-toolbar 8.0.5 → 8.1.1
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 +22 -0
- package/dist/cjs/selectionToolbarPlugin.js +6 -8
- package/dist/cjs/ui/MenuSection.js +2 -12
- package/dist/cjs/ui/PinButton.js +1 -3
- package/dist/cjs/ui/PinMenuItem.js +3 -20
- package/dist/cjs/ui/toolbar-components.js +2 -3
- package/dist/es2019/selectionToolbarPlugin.js +6 -8
- package/dist/es2019/ui/MenuSection.js +2 -10
- package/dist/es2019/ui/PinButton.js +1 -3
- package/dist/es2019/ui/PinMenuItem.js +3 -18
- package/dist/es2019/ui/toolbar-components.js +2 -3
- package/dist/esm/selectionToolbarPlugin.js +6 -8
- package/dist/esm/ui/MenuSection.js +2 -12
- package/dist/esm/ui/PinButton.js +1 -3
- package/dist/esm/ui/PinMenuItem.js +3 -20
- package/dist/esm/ui/toolbar-components.js +2 -3
- package/package.json +5 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-toolbar
|
|
2
2
|
|
|
3
|
+
## 8.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9041ec452a104`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9041ec452a104) -
|
|
8
|
+
[EDITOR-4515] clean up fg platform_editor_toolbar_aifc_patch_7
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 8.1.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`6e8029473620b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e8029473620b) -
|
|
16
|
+
[EDITOR-4496] clean up experiment platform_editor_toolbar_aifc_patch_3 and remove view-mode plugin
|
|
17
|
+
dependency from loom plugin
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`7080196995b11`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7080196995b11) -
|
|
22
|
+
Cleaning up FG platform_editor_ai_generic_prep_for_aifc
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 8.0.5
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -191,14 +191,12 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
191
191
|
|
|
192
192
|
var editorViewModePlugin = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
|
|
193
193
|
var isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
194
|
+
var target = event.target;
|
|
195
|
+
if (target && target instanceof Element) {
|
|
196
|
+
var isRovoChangeToneButton = target.tagName === 'BUTTON' && _hasNestedSpanWithText(target, 'Change tone') || target.getAttribute('aria-label') === 'Change tone' || target.innerHTML === 'Change tone';
|
|
197
|
+
var isRovoTranslateButton = target.tagName === 'BUTTON' && _hasNestedSpanWithText(target, 'Translate options') || target.getAttribute('aria-label') === 'Translate options' || target.innerHTML === 'Translate options';
|
|
198
|
+
if (isRovoChangeToneButton || isRovoTranslateButton) {
|
|
199
|
+
return null;
|
|
202
200
|
}
|
|
203
201
|
}
|
|
204
202
|
_view.dispatch(_view.state.tr.setMeta(_pluginKey.selectionToolbarPluginKey, {
|
|
@@ -7,24 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.MenuSection = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
11
10
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
-
var
|
|
13
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
|
-
var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
15
|
-
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
16
|
-
}, function (api) {
|
|
11
|
+
var usePluginState = function usePluginState(_api) {
|
|
17
12
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
18
13
|
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
19
14
|
return {
|
|
20
15
|
editorViewMode: editorViewMode
|
|
21
16
|
};
|
|
22
|
-
}
|
|
23
|
-
var editorViewMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
24
|
-
return {
|
|
25
|
-
editorViewMode: editorViewMode
|
|
26
|
-
};
|
|
27
|
-
});
|
|
17
|
+
};
|
|
28
18
|
var MenuSection = exports.MenuSection = function MenuSection(_ref) {
|
|
29
19
|
var children = _ref.children,
|
|
30
20
|
api = _ref.api;
|
package/dist/cjs/ui/PinButton.js
CHANGED
|
@@ -10,14 +10,12 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
12
12
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var PinButton = exports.PinButton = function PinButton(_ref) {
|
|
15
14
|
var api = _ref.api;
|
|
16
15
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
17
16
|
var message = intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
18
17
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
19
|
-
|
|
20
|
-
var isDisabled = (0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
18
|
+
isDisabled = _useEditorToolbar.isOffline;
|
|
21
19
|
var onClick = function onClick() {
|
|
22
20
|
var _api$userPreferences;
|
|
23
21
|
if (!api || isDisabled) {
|
|
@@ -9,18 +9,11 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
12
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
|
-
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
14
12
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
-
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
17
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
13
|
var shouldShowPinMenuItem = function shouldShowPinMenuItem(editMode) {
|
|
19
14
|
return editMode !== 'view';
|
|
20
15
|
};
|
|
21
|
-
var usePluginState =
|
|
22
|
-
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
23
|
-
}, function (_api) {
|
|
16
|
+
var usePluginState = function usePluginState(_api) {
|
|
24
17
|
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
25
18
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
26
19
|
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
@@ -30,16 +23,7 @@ var usePluginState = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(fun
|
|
|
30
23
|
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
31
24
|
isOffline: isOffline
|
|
32
25
|
};
|
|
33
|
-
}
|
|
34
|
-
var editorViewMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
35
|
-
var editorToolbarDockingPreference = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
36
|
-
var isOffline = (0, _editorPluginConnectivity.isOfflineMode)((0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode'));
|
|
37
|
-
return {
|
|
38
|
-
editorViewMode: editorViewMode,
|
|
39
|
-
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
40
|
-
isOffline: isOffline
|
|
41
|
-
};
|
|
42
|
-
});
|
|
26
|
+
};
|
|
43
27
|
|
|
44
28
|
/**
|
|
45
29
|
* The menu-item version of pin only appears in selection toolbar - the primary toolbar will have its own component
|
|
@@ -50,9 +34,8 @@ var PinMenuItem = exports.PinMenuItem = function PinMenuItem(_ref) {
|
|
|
50
34
|
var _usePluginState = usePluginState(api),
|
|
51
35
|
editorViewMode = _usePluginState.editorViewMode,
|
|
52
36
|
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference,
|
|
53
|
-
|
|
37
|
+
isDisabled = _usePluginState.isOffline;
|
|
54
38
|
var isToolbarDocked = editorToolbarDockingPreference === 'top';
|
|
55
|
-
var isDisabled = (0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
56
39
|
if (!shouldShowPinMenuItem(editorViewMode)) {
|
|
57
40
|
return null;
|
|
58
41
|
}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getToolbarComponents = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
10
|
var _MenuSection = require("./MenuSection");
|
|
12
11
|
var _PinButton = require("./PinButton");
|
|
13
12
|
var _PinMenuItem = require("./PinMenuItem");
|
|
@@ -20,12 +19,12 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
20
19
|
key: _toolbar.OVERFLOW_MENU.key,
|
|
21
20
|
rank: _toolbar.OVERFLOW_MENU_RANK[_toolbar.PIN_MENU_SECTION.key]
|
|
22
21
|
}],
|
|
23
|
-
component:
|
|
22
|
+
component: function component(_ref) {
|
|
24
23
|
var children = _ref.children;
|
|
25
24
|
return /*#__PURE__*/_react.default.createElement(_MenuSection.MenuSection, {
|
|
26
25
|
api: api
|
|
27
26
|
}, children);
|
|
28
|
-
}
|
|
27
|
+
}
|
|
29
28
|
}, {
|
|
30
29
|
type: _toolbar.PIN_MENU_ITEM.type,
|
|
31
30
|
key: _toolbar.PIN_MENU_ITEM.key,
|
|
@@ -189,14 +189,12 @@ export const selectionToolbarPlugin = ({
|
|
|
189
189
|
|
|
190
190
|
const editorViewModePlugin = api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
|
|
191
191
|
const isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
192
|
+
const target = event.target;
|
|
193
|
+
if (target && target instanceof Element) {
|
|
194
|
+
const isRovoChangeToneButton = target.tagName === 'BUTTON' && hasNestedSpanWithText(target, 'Change tone') || target.getAttribute('aria-label') === 'Change tone' || target.innerHTML === 'Change tone';
|
|
195
|
+
const isRovoTranslateButton = target.tagName === 'BUTTON' && hasNestedSpanWithText(target, 'Translate options') || target.getAttribute('aria-label') === 'Translate options' || target.innerHTML === 'Translate options';
|
|
196
|
+
if (isRovoChangeToneButton || isRovoTranslateButton) {
|
|
197
|
+
return null;
|
|
200
198
|
}
|
|
201
199
|
}
|
|
202
200
|
view.dispatch(view.state.tr.setMeta(selectionToolbarPluginKey, {
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
3
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
5
|
-
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
const usePluginState = conditionalHooksFactory(() => expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true), api => {
|
|
4
|
+
const usePluginState = _api => {
|
|
8
5
|
const {
|
|
9
6
|
editorViewMode
|
|
10
7
|
} = useEditorToolbar();
|
|
11
8
|
return {
|
|
12
9
|
editorViewMode
|
|
13
10
|
};
|
|
14
|
-
}
|
|
15
|
-
const editorViewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
16
|
-
return {
|
|
17
|
-
editorViewMode
|
|
18
|
-
};
|
|
19
|
-
});
|
|
11
|
+
};
|
|
20
12
|
export const MenuSection = ({
|
|
21
13
|
children,
|
|
22
14
|
api
|
|
@@ -3,16 +3,14 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
5
|
import { PinnedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
export const PinButton = ({
|
|
8
7
|
api
|
|
9
8
|
}) => {
|
|
10
9
|
const intl = useIntl();
|
|
11
10
|
const message = intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
12
11
|
const {
|
|
13
|
-
isOffline
|
|
12
|
+
isOffline: isDisabled
|
|
14
13
|
} = useEditorToolbar();
|
|
15
|
-
const isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
16
14
|
const onClick = () => {
|
|
17
15
|
var _api$userPreferences;
|
|
18
16
|
if (!api || isDisabled) {
|
|
@@ -2,16 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
|
-
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
7
5
|
import { PinIcon, PinnedIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
6
|
const shouldShowPinMenuItem = editMode => {
|
|
12
7
|
return editMode !== 'view';
|
|
13
8
|
};
|
|
14
|
-
const usePluginState =
|
|
9
|
+
const usePluginState = _api => {
|
|
15
10
|
const {
|
|
16
11
|
editorViewMode,
|
|
17
12
|
editorToolbarDockingPreference,
|
|
@@ -22,16 +17,7 @@ const usePluginState = conditionalHooksFactory(() => expValEquals('platform_edit
|
|
|
22
17
|
editorToolbarDockingPreference,
|
|
23
18
|
isOffline
|
|
24
19
|
};
|
|
25
|
-
}
|
|
26
|
-
const editorViewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
27
|
-
const editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
28
|
-
const isOffline = isOfflineMode(useSharedPluginStateSelector(api, 'connectivity.mode'));
|
|
29
|
-
return {
|
|
30
|
-
editorViewMode,
|
|
31
|
-
editorToolbarDockingPreference,
|
|
32
|
-
isOffline
|
|
33
|
-
};
|
|
34
|
-
});
|
|
20
|
+
};
|
|
35
21
|
|
|
36
22
|
/**
|
|
37
23
|
* The menu-item version of pin only appears in selection toolbar - the primary toolbar will have its own component
|
|
@@ -43,10 +29,9 @@ export const PinMenuItem = ({
|
|
|
43
29
|
const {
|
|
44
30
|
editorViewMode,
|
|
45
31
|
editorToolbarDockingPreference,
|
|
46
|
-
isOffline
|
|
32
|
+
isOffline: isDisabled
|
|
47
33
|
} = usePluginState(api);
|
|
48
34
|
const isToolbarDocked = editorToolbarDockingPreference === 'top';
|
|
49
|
-
const isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
50
35
|
if (!shouldShowPinMenuItem(editorViewMode)) {
|
|
51
36
|
return null;
|
|
52
37
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OVERFLOW_MENU, OVERFLOW_MENU_RANK, PIN_BUTTON, PIN_GROUP, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_MENU_SECTION_RANK, PIN_GROUP_RANK, PIN_SECTION, PIN_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
import { MenuSection } from './MenuSection';
|
|
5
4
|
import { PinButton } from './PinButton';
|
|
6
5
|
import { PinMenuItem } from './PinMenuItem';
|
|
@@ -13,13 +12,13 @@ export const getToolbarComponents = (api, contextualFormattingEnabled) => {
|
|
|
13
12
|
key: OVERFLOW_MENU.key,
|
|
14
13
|
rank: OVERFLOW_MENU_RANK[PIN_MENU_SECTION.key]
|
|
15
14
|
}],
|
|
16
|
-
component:
|
|
15
|
+
component: ({
|
|
17
16
|
children
|
|
18
17
|
}) => {
|
|
19
18
|
return /*#__PURE__*/React.createElement(MenuSection, {
|
|
20
19
|
api: api
|
|
21
20
|
}, children);
|
|
22
|
-
}
|
|
21
|
+
}
|
|
23
22
|
}, {
|
|
24
23
|
type: PIN_MENU_ITEM.type,
|
|
25
24
|
key: PIN_MENU_ITEM.key,
|
|
@@ -184,14 +184,12 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
184
184
|
|
|
185
185
|
var editorViewModePlugin = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
|
|
186
186
|
var isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
187
|
+
var target = event.target;
|
|
188
|
+
if (target && target instanceof Element) {
|
|
189
|
+
var isRovoChangeToneButton = target.tagName === 'BUTTON' && _hasNestedSpanWithText(target, 'Change tone') || target.getAttribute('aria-label') === 'Change tone' || target.innerHTML === 'Change tone';
|
|
190
|
+
var isRovoTranslateButton = target.tagName === 'BUTTON' && _hasNestedSpanWithText(target, 'Translate options') || target.getAttribute('aria-label') === 'Translate options' || target.innerHTML === 'Translate options';
|
|
191
|
+
if (isRovoChangeToneButton || isRovoTranslateButton) {
|
|
192
|
+
return null;
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
195
|
_view.dispatch(_view.state.tr.setMeta(selectionToolbarPluginKey, {
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
3
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
5
|
-
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
var usePluginState = conditionalHooksFactory(function () {
|
|
8
|
-
return expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
9
|
-
}, function (api) {
|
|
4
|
+
var usePluginState = function usePluginState(_api) {
|
|
10
5
|
var _useEditorToolbar = useEditorToolbar(),
|
|
11
6
|
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
12
7
|
return {
|
|
13
8
|
editorViewMode: editorViewMode
|
|
14
9
|
};
|
|
15
|
-
}
|
|
16
|
-
var editorViewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
17
|
-
return {
|
|
18
|
-
editorViewMode: editorViewMode
|
|
19
|
-
};
|
|
20
|
-
});
|
|
10
|
+
};
|
|
21
11
|
export var MenuSection = function MenuSection(_ref) {
|
|
22
12
|
var children = _ref.children,
|
|
23
13
|
api = _ref.api;
|
package/dist/esm/ui/PinButton.js
CHANGED
|
@@ -3,14 +3,12 @@ import { useIntl } from 'react-intl-next';
|
|
|
3
3
|
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
5
|
import { PinnedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
export var PinButton = function PinButton(_ref) {
|
|
8
7
|
var api = _ref.api;
|
|
9
8
|
var intl = useIntl();
|
|
10
9
|
var message = intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
11
10
|
var _useEditorToolbar = useEditorToolbar(),
|
|
12
|
-
|
|
13
|
-
var isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
11
|
+
isDisabled = _useEditorToolbar.isOffline;
|
|
14
12
|
var onClick = function onClick() {
|
|
15
13
|
var _api$userPreferences;
|
|
16
14
|
if (!api || isDisabled) {
|
|
@@ -2,18 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
|
-
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
7
5
|
import { PinIcon, PinnedIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { conditionalHooksFactory } from '@atlaskit/platform-feature-flags-react';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
6
|
var shouldShowPinMenuItem = function shouldShowPinMenuItem(editMode) {
|
|
12
7
|
return editMode !== 'view';
|
|
13
8
|
};
|
|
14
|
-
var usePluginState =
|
|
15
|
-
return expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true);
|
|
16
|
-
}, function (_api) {
|
|
9
|
+
var usePluginState = function usePluginState(_api) {
|
|
17
10
|
var _useEditorToolbar = useEditorToolbar(),
|
|
18
11
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
19
12
|
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
@@ -23,16 +16,7 @@ var usePluginState = conditionalHooksFactory(function () {
|
|
|
23
16
|
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
24
17
|
isOffline: isOffline
|
|
25
18
|
};
|
|
26
|
-
}
|
|
27
|
-
var editorViewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
|
|
28
|
-
var editorToolbarDockingPreference = useSharedPluginStateSelector(api, 'userPreferences.preferences.toolbarDockingPosition');
|
|
29
|
-
var isOffline = isOfflineMode(useSharedPluginStateSelector(api, 'connectivity.mode'));
|
|
30
|
-
return {
|
|
31
|
-
editorViewMode: editorViewMode,
|
|
32
|
-
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
33
|
-
isOffline: isOffline
|
|
34
|
-
};
|
|
35
|
-
});
|
|
19
|
+
};
|
|
36
20
|
|
|
37
21
|
/**
|
|
38
22
|
* The menu-item version of pin only appears in selection toolbar - the primary toolbar will have its own component
|
|
@@ -43,9 +27,8 @@ export var PinMenuItem = function PinMenuItem(_ref) {
|
|
|
43
27
|
var _usePluginState = usePluginState(api),
|
|
44
28
|
editorViewMode = _usePluginState.editorViewMode,
|
|
45
29
|
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference,
|
|
46
|
-
|
|
30
|
+
isDisabled = _usePluginState.isOffline;
|
|
47
31
|
var isToolbarDocked = editorToolbarDockingPreference === 'top';
|
|
48
|
-
var isDisabled = fg('platform_editor_toolbar_aifc_patch_7') ? isOffline : false;
|
|
49
32
|
if (!shouldShowPinMenuItem(editorViewMode)) {
|
|
50
33
|
return null;
|
|
51
34
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OVERFLOW_MENU, OVERFLOW_MENU_RANK, PIN_BUTTON, PIN_GROUP, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_MENU_SECTION_RANK, PIN_GROUP_RANK, PIN_SECTION, PIN_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
import { MenuSection } from './MenuSection';
|
|
5
4
|
import { PinButton } from './PinButton';
|
|
6
5
|
import { PinMenuItem } from './PinMenuItem';
|
|
@@ -13,12 +12,12 @@ export var getToolbarComponents = function getToolbarComponents(api, contextualF
|
|
|
13
12
|
key: OVERFLOW_MENU.key,
|
|
14
13
|
rank: OVERFLOW_MENU_RANK[PIN_MENU_SECTION.key]
|
|
15
14
|
}],
|
|
16
|
-
component:
|
|
15
|
+
component: function component(_ref) {
|
|
17
16
|
var children = _ref.children;
|
|
18
17
|
return /*#__PURE__*/React.createElement(MenuSection, {
|
|
19
18
|
api: api
|
|
20
19
|
}, children);
|
|
21
|
-
}
|
|
20
|
+
}
|
|
22
21
|
}, {
|
|
23
22
|
type: PIN_MENU_ITEM.type,
|
|
24
23
|
key: PIN_MENU_ITEM.key,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,19 +35,18 @@
|
|
|
35
35
|
"@atlaskit/editor-plugin-connectivity": "^7.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-primary-toolbar": "^8.0.0",
|
|
38
|
-
"@atlaskit/editor-plugin-toolbar": "^4.
|
|
38
|
+
"@atlaskit/editor-plugin-toolbar": "^4.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-user-intent": "^5.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-user-preferences": "^5.0.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
42
42
|
"@atlaskit/editor-toolbar": "^0.19.0",
|
|
43
43
|
"@atlaskit/editor-toolbar-model": "^0.3.0",
|
|
44
|
-
"@atlaskit/icon": "^
|
|
44
|
+
"@atlaskit/icon": "^30.0.0",
|
|
45
45
|
"@atlaskit/icon-lab": "^5.14.0",
|
|
46
46
|
"@atlaskit/menu": "^8.4.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/
|
|
49
|
-
"@atlaskit/
|
|
50
|
-
"@atlaskit/tokens": "^10.0.0",
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^16.30.0",
|
|
49
|
+
"@atlaskit/tokens": "^10.1.0",
|
|
51
50
|
"@babel/runtime": "^7.0.0",
|
|
52
51
|
"bind-event-listener": "^3.0.0"
|
|
53
52
|
},
|
|
@@ -99,12 +98,6 @@
|
|
|
99
98
|
},
|
|
100
99
|
"platform_editor_use_preferences_plugin": {
|
|
101
100
|
"type": "boolean"
|
|
102
|
-
},
|
|
103
|
-
"platform_editor_ai_generic_prep_for_aifc": {
|
|
104
|
-
"type": "boolean"
|
|
105
|
-
},
|
|
106
|
-
"platform_editor_toolbar_aifc_patch_7": {
|
|
107
|
-
"type": "boolean"
|
|
108
101
|
}
|
|
109
102
|
}
|
|
110
103
|
}
|