@atlaskit/editor-plugin-selection-toolbar 4.3.8 → 4.3.9
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 +8 -0
- package/dist/cjs/selectionToolbarPlugin.js +1 -1
- package/dist/cjs/ui/PinButton.js +33 -0
- package/dist/cjs/ui/toolbar-components.js +31 -2
- package/dist/es2019/selectionToolbarPlugin.js +1 -1
- package/dist/es2019/ui/PinButton.js +27 -0
- package/dist/es2019/ui/toolbar-components.js +32 -3
- package/dist/esm/selectionToolbarPlugin.js +1 -1
- package/dist/esm/ui/PinButton.js +26 -0
- package/dist/esm/ui/toolbar-components.js +32 -3
- package/dist/types/ui/PinButton.d.ts +6 -0
- package/dist/types/ui/toolbar-components.d.ts +1 -1
- package/dist/types-ts4.5/ui/PinButton.d.ts +6 -0
- package/dist/types-ts4.5/ui/toolbar-components.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-toolbar
|
|
2
2
|
|
|
3
|
+
## 4.3.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b27824f2875be`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b27824f2875be) -
|
|
8
|
+
[ux] [ED-28821] Add pin button to full page primary toolbar
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 4.3.8
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -47,7 +47,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
47
47
|
contextualFormattingEnabled = config.contextualFormattingEnabled;
|
|
48
48
|
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true)) {
|
|
49
49
|
var _api$toolbar;
|
|
50
|
-
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api));
|
|
50
|
+
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api, contextualFormattingEnabled));
|
|
51
51
|
} else {
|
|
52
52
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
53
53
|
exposure: true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PinButton = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
+
var PinButton = exports.PinButton = function PinButton(_ref) {
|
|
13
|
+
var api = _ref.api;
|
|
14
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
15
|
+
var message = intl.formatMessage(_messages.selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
16
|
+
var onClick = function onClick() {
|
|
17
|
+
var _api$selectionToolbar, _api$selectionToolbar2;
|
|
18
|
+
if (!api) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
(_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');
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
|
|
24
|
+
content: message
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
|
|
26
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.PinnedIcon, {
|
|
27
|
+
size: "small",
|
|
28
|
+
label: ""
|
|
29
|
+
}),
|
|
30
|
+
label: message,
|
|
31
|
+
onClick: onClick
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
@@ -7,9 +7,10 @@ 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 _PinButton = require("./PinButton");
|
|
10
11
|
var _PinMenuItem = require("./PinMenuItem");
|
|
11
|
-
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api) {
|
|
12
|
-
|
|
12
|
+
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api, contextualFormattingEnabled) {
|
|
13
|
+
var components = [{
|
|
13
14
|
type: _toolbar.PIN_MENU_SECTION.type,
|
|
14
15
|
key: _toolbar.PIN_MENU_SECTION.key,
|
|
15
16
|
parents: [{
|
|
@@ -31,4 +32,32 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
}];
|
|
35
|
+
|
|
36
|
+
// Add pin button to primary toolbar when contextual formatting is enabled
|
|
37
|
+
if (contextualFormattingEnabled) {
|
|
38
|
+
var pinButtonComponents = [{
|
|
39
|
+
type: _toolbar.PIN_GROUP.type,
|
|
40
|
+
key: _toolbar.PIN_GROUP.key,
|
|
41
|
+
parents: [{
|
|
42
|
+
type: _toolbar.PIN_SECTION.type,
|
|
43
|
+
key: _toolbar.PIN_SECTION.key,
|
|
44
|
+
rank: _toolbar.PIN_SECTION_RANK[_toolbar.PIN_GROUP.key]
|
|
45
|
+
}]
|
|
46
|
+
}, {
|
|
47
|
+
type: _toolbar.PIN_BUTTON.type,
|
|
48
|
+
key: _toolbar.PIN_BUTTON.key,
|
|
49
|
+
parents: [{
|
|
50
|
+
type: _toolbar.PIN_GROUP.type,
|
|
51
|
+
key: _toolbar.PIN_GROUP.key,
|
|
52
|
+
rank: _toolbar.PIN_GROUP_RANK[_toolbar.PIN_BUTTON.key]
|
|
53
|
+
}],
|
|
54
|
+
component: function component() {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_PinButton.PinButton, {
|
|
56
|
+
api: api
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}];
|
|
60
|
+
components.push.apply(components, pinButtonComponents);
|
|
61
|
+
}
|
|
62
|
+
return components;
|
|
34
63
|
};
|
|
@@ -39,7 +39,7 @@ export const selectionToolbarPlugin = ({
|
|
|
39
39
|
} = config;
|
|
40
40
|
if (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)) {
|
|
41
41
|
var _api$toolbar;
|
|
42
|
-
api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents(api));
|
|
42
|
+
api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents(api, contextualFormattingEnabled));
|
|
43
43
|
} else {
|
|
44
44
|
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
45
45
|
exposure: true
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { PinnedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
5
|
+
export const PinButton = ({
|
|
6
|
+
api
|
|
7
|
+
}) => {
|
|
8
|
+
const intl = useIntl();
|
|
9
|
+
const message = intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
10
|
+
const onClick = () => {
|
|
11
|
+
var _api$selectionToolbar, _api$selectionToolbar2;
|
|
12
|
+
if (!api) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
(_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');
|
|
16
|
+
};
|
|
17
|
+
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
18
|
+
content: message
|
|
19
|
+
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
20
|
+
iconBefore: /*#__PURE__*/React.createElement(PinnedIcon, {
|
|
21
|
+
size: "small",
|
|
22
|
+
label: ""
|
|
23
|
+
}),
|
|
24
|
+
label: message,
|
|
25
|
+
onClick: onClick
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OVERFLOW_MENU, OVERFLOW_MENU_RANK, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
|
|
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 { PinButton } from './PinButton';
|
|
3
4
|
import { PinMenuItem } from './PinMenuItem';
|
|
4
|
-
export const getToolbarComponents = api => {
|
|
5
|
-
|
|
5
|
+
export const getToolbarComponents = (api, contextualFormattingEnabled) => {
|
|
6
|
+
const components = [{
|
|
6
7
|
type: PIN_MENU_SECTION.type,
|
|
7
8
|
key: PIN_MENU_SECTION.key,
|
|
8
9
|
parents: [{
|
|
@@ -24,4 +25,32 @@ export const getToolbarComponents = api => {
|
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
}];
|
|
28
|
+
|
|
29
|
+
// Add pin button to primary toolbar when contextual formatting is enabled
|
|
30
|
+
if (contextualFormattingEnabled) {
|
|
31
|
+
const pinButtonComponents = [{
|
|
32
|
+
type: PIN_GROUP.type,
|
|
33
|
+
key: PIN_GROUP.key,
|
|
34
|
+
parents: [{
|
|
35
|
+
type: PIN_SECTION.type,
|
|
36
|
+
key: PIN_SECTION.key,
|
|
37
|
+
rank: PIN_SECTION_RANK[PIN_GROUP.key]
|
|
38
|
+
}]
|
|
39
|
+
}, {
|
|
40
|
+
type: PIN_BUTTON.type,
|
|
41
|
+
key: PIN_BUTTON.key,
|
|
42
|
+
parents: [{
|
|
43
|
+
type: PIN_GROUP.type,
|
|
44
|
+
key: PIN_GROUP.key,
|
|
45
|
+
rank: PIN_GROUP_RANK[PIN_BUTTON.key]
|
|
46
|
+
}],
|
|
47
|
+
component: () => {
|
|
48
|
+
return /*#__PURE__*/React.createElement(PinButton, {
|
|
49
|
+
api: api
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}];
|
|
53
|
+
components.push(...pinButtonComponents);
|
|
54
|
+
}
|
|
55
|
+
return components;
|
|
27
56
|
};
|
|
@@ -40,7 +40,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
40
40
|
contextualFormattingEnabled = config.contextualFormattingEnabled;
|
|
41
41
|
if (expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true)) {
|
|
42
42
|
var _api$toolbar;
|
|
43
|
-
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents(api));
|
|
43
|
+
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents(api, contextualFormattingEnabled));
|
|
44
44
|
} else {
|
|
45
45
|
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
46
46
|
exposure: true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { selectionToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { PinnedIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
5
|
+
export var PinButton = function PinButton(_ref) {
|
|
6
|
+
var api = _ref.api;
|
|
7
|
+
var intl = useIntl();
|
|
8
|
+
var message = intl.formatMessage(selectionToolbarMessages.toolbarPositionPinedAtTop);
|
|
9
|
+
var onClick = function onClick() {
|
|
10
|
+
var _api$selectionToolbar, _api$selectionToolbar2;
|
|
11
|
+
if (!api) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
(_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');
|
|
15
|
+
};
|
|
16
|
+
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
17
|
+
content: message
|
|
18
|
+
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
19
|
+
iconBefore: /*#__PURE__*/React.createElement(PinnedIcon, {
|
|
20
|
+
size: "small",
|
|
21
|
+
label: ""
|
|
22
|
+
}),
|
|
23
|
+
label: message,
|
|
24
|
+
onClick: onClick
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OVERFLOW_MENU, OVERFLOW_MENU_RANK, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_MENU_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
|
|
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 { PinButton } from './PinButton';
|
|
3
4
|
import { PinMenuItem } from './PinMenuItem';
|
|
4
|
-
export var getToolbarComponents = function getToolbarComponents(api) {
|
|
5
|
-
|
|
5
|
+
export var getToolbarComponents = function getToolbarComponents(api, contextualFormattingEnabled) {
|
|
6
|
+
var components = [{
|
|
6
7
|
type: PIN_MENU_SECTION.type,
|
|
7
8
|
key: PIN_MENU_SECTION.key,
|
|
8
9
|
parents: [{
|
|
@@ -24,4 +25,32 @@ export var getToolbarComponents = function getToolbarComponents(api) {
|
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
}];
|
|
28
|
+
|
|
29
|
+
// Add pin button to primary toolbar when contextual formatting is enabled
|
|
30
|
+
if (contextualFormattingEnabled) {
|
|
31
|
+
var pinButtonComponents = [{
|
|
32
|
+
type: PIN_GROUP.type,
|
|
33
|
+
key: PIN_GROUP.key,
|
|
34
|
+
parents: [{
|
|
35
|
+
type: PIN_SECTION.type,
|
|
36
|
+
key: PIN_SECTION.key,
|
|
37
|
+
rank: PIN_SECTION_RANK[PIN_GROUP.key]
|
|
38
|
+
}]
|
|
39
|
+
}, {
|
|
40
|
+
type: PIN_BUTTON.type,
|
|
41
|
+
key: PIN_BUTTON.key,
|
|
42
|
+
parents: [{
|
|
43
|
+
type: PIN_GROUP.type,
|
|
44
|
+
key: PIN_GROUP.key,
|
|
45
|
+
rank: PIN_GROUP_RANK[PIN_BUTTON.key]
|
|
46
|
+
}],
|
|
47
|
+
component: function component() {
|
|
48
|
+
return /*#__PURE__*/React.createElement(PinButton, {
|
|
49
|
+
api: api
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}];
|
|
53
|
+
components.push.apply(components, pinButtonComponents);
|
|
54
|
+
}
|
|
55
|
+
return components;
|
|
27
56
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
|
+
export declare const PinButton: ({ api }: {
|
|
5
|
+
api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
3
3
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
|
-
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<SelectionToolbarPlugin
|
|
4
|
+
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<SelectionToolbarPlugin>, contextualFormattingEnabled?: boolean) => RegisterComponent[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
|
+
export declare const PinButton: ({ api }: {
|
|
5
|
+
api?: ExtractInjectionAPI<SelectionToolbarPlugin>;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
3
3
|
import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
|
|
4
|
-
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<SelectionToolbarPlugin
|
|
4
|
+
export declare const getToolbarComponents: (api?: ExtractInjectionAPI<SelectionToolbarPlugin>, contextualFormattingEnabled?: boolean) => RegisterComponent[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.9",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/editor-plugin-connectivity": "^3.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
|
|
41
|
-
"@atlaskit/editor-plugin-toolbar": "^0.
|
|
41
|
+
"@atlaskit/editor-plugin-toolbar": "^0.4.0",
|
|
42
42
|
"@atlaskit/editor-plugin-user-intent": "^1.1.0",
|
|
43
43
|
"@atlaskit/editor-plugin-user-preferences": "^1.2.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"@atlaskit/icon-lab": "^5.6.0",
|
|
49
49
|
"@atlaskit/menu": "^8.3.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^11.5.0",
|
|
52
52
|
"@atlaskit/tokens": "^6.0.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"bind-event-listener": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@atlaskit/editor-common": "^107.
|
|
57
|
+
"@atlaskit/editor-common": "^107.28.0",
|
|
58
58
|
"react": "^18.2.0",
|
|
59
59
|
"react-dom": "^18.2.0",
|
|
60
60
|
"react-intl-next": "npm:react-intl@^5.18.1"
|