@atlaskit/editor-plugin-primary-toolbar 2.2.0 → 2.3.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 +8 -0
- package/dist/cjs/pm-plugins/toolbar-configuration.js +26 -2
- package/dist/es2019/pm-plugins/toolbar-configuration.js +31 -9
- package/dist/esm/pm-plugins/toolbar-configuration.js +26 -2
- package/dist/types/primaryToolbarPluginType.d.ts +1 -1
- package/dist/types-ts4.5/primaryToolbarPluginType.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-primary-toolbar
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#116013](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116013)
|
|
8
|
+
[`18e022766bfd3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18e022766bfd3) -
|
|
9
|
+
[ux] ED-26464 Hiding primary toolbar and docking contextual toolbar items to top
|
|
10
|
+
|
|
3
11
|
## 2.2.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getToolbarComponents = void 0;
|
|
7
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
7
8
|
var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(componentRegistry, editorState) {
|
|
8
|
-
return
|
|
9
|
+
return ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
10
|
+
exposure: true
|
|
11
|
+
}) ? toolbarConfigurationV2 : toolbarConfiguration).filter(function (toolbarElement) {
|
|
9
12
|
return typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState);
|
|
10
13
|
}).reduce(function (acc, toolbarElement) {
|
|
11
14
|
if (componentRegistry.has(toolbarElement.name)) {
|
|
@@ -69,6 +72,16 @@ var textColorGroup = [{
|
|
|
69
72
|
return componentRegistry.has('textColor') || componentRegistry.has('highlight');
|
|
70
73
|
}
|
|
71
74
|
}];
|
|
75
|
+
var alignmentAndListGroup = [{
|
|
76
|
+
name: 'alignment'
|
|
77
|
+
}, {
|
|
78
|
+
name: 'toolbarListsIndentation'
|
|
79
|
+
}, {
|
|
80
|
+
name: 'separator',
|
|
81
|
+
enabled: function enabled(componentRegistry) {
|
|
82
|
+
return componentRegistry.has('toolbarListsIndentation') || componentRegistry.has('alignment');
|
|
83
|
+
}
|
|
84
|
+
}];
|
|
72
85
|
var listFormatting = [{
|
|
73
86
|
name: 'toolbarListsIndentation'
|
|
74
87
|
}, {
|
|
@@ -77,6 +90,14 @@ var listFormatting = [{
|
|
|
77
90
|
return componentRegistry.has('toolbarListsIndentation');
|
|
78
91
|
}
|
|
79
92
|
}];
|
|
93
|
+
var hyperlinkGroup = [{
|
|
94
|
+
name: 'hyperlink'
|
|
95
|
+
}, {
|
|
96
|
+
name: 'separator',
|
|
97
|
+
enabled: function enabled(componentRegistry) {
|
|
98
|
+
return componentRegistry.has('hyperlink');
|
|
99
|
+
}
|
|
100
|
+
}];
|
|
80
101
|
var insertBlockGroup = [{
|
|
81
102
|
name: 'insertBlock'
|
|
82
103
|
}];
|
|
@@ -92,4 +113,7 @@ var others = [{
|
|
|
92
113
|
}, {
|
|
93
114
|
name: 'loom'
|
|
94
115
|
}];
|
|
95
|
-
var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormatting, insertBlockGroup, others);
|
|
116
|
+
var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormatting, insertBlockGroup, others);
|
|
117
|
+
var toolbarConfigurationV2 = [].concat(blockTypeGroup, textFormattingGroup, textColorGroup, alignmentAndListGroup, hyperlinkGroup, [{
|
|
118
|
+
name: 'beforePrimaryToolbar'
|
|
119
|
+
}]);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
2
|
+
export const getToolbarComponents = (componentRegistry, editorState) => {
|
|
3
|
+
return (editorExperiment('platform_editor_controls', 'variant1', {
|
|
4
|
+
exposure: true
|
|
5
|
+
}) ? toolbarConfigurationV2 : toolbarConfiguration).filter(toolbarElement => typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState)).reduce((acc, toolbarElement) => {
|
|
6
|
+
if (componentRegistry.has(toolbarElement.name)) {
|
|
7
|
+
const component = componentRegistry.get(toolbarElement.name);
|
|
8
|
+
if (!!component) {
|
|
9
|
+
acc.push(component);
|
|
10
|
+
}
|
|
6
11
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
12
|
+
return acc;
|
|
13
|
+
}, []);
|
|
14
|
+
};
|
|
10
15
|
const undoRedoGroup = [{
|
|
11
16
|
name: 'undoRedoPlugin'
|
|
12
17
|
}, {
|
|
@@ -47,12 +52,26 @@ const textColorGroup = [{
|
|
|
47
52
|
name: 'separator',
|
|
48
53
|
enabled: componentRegistry => componentRegistry.has('textColor') || componentRegistry.has('highlight')
|
|
49
54
|
}];
|
|
55
|
+
const alignmentAndListGroup = [{
|
|
56
|
+
name: 'alignment'
|
|
57
|
+
}, {
|
|
58
|
+
name: 'toolbarListsIndentation'
|
|
59
|
+
}, {
|
|
60
|
+
name: 'separator',
|
|
61
|
+
enabled: componentRegistry => componentRegistry.has('toolbarListsIndentation') || componentRegistry.has('alignment')
|
|
62
|
+
}];
|
|
50
63
|
const listFormatting = [{
|
|
51
64
|
name: 'toolbarListsIndentation'
|
|
52
65
|
}, {
|
|
53
66
|
name: 'separator',
|
|
54
67
|
enabled: componentRegistry => componentRegistry.has('toolbarListsIndentation')
|
|
55
68
|
}];
|
|
69
|
+
const hyperlinkGroup = [{
|
|
70
|
+
name: 'hyperlink'
|
|
71
|
+
}, {
|
|
72
|
+
name: 'separator',
|
|
73
|
+
enabled: componentRegistry => componentRegistry.has('hyperlink')
|
|
74
|
+
}];
|
|
56
75
|
const insertBlockGroup = [{
|
|
57
76
|
name: 'insertBlock'
|
|
58
77
|
}];
|
|
@@ -68,4 +87,7 @@ const others = [{
|
|
|
68
87
|
}, {
|
|
69
88
|
name: 'loom'
|
|
70
89
|
}];
|
|
71
|
-
const toolbarConfiguration = [...undoRedoGroup, ...spellCheckGroup, ...blockTypeGroup, ...textFormattingGroup, ...alignmentGroup, ...textColorGroup, ...listFormatting, ...insertBlockGroup, ...others];
|
|
90
|
+
const toolbarConfiguration = [...undoRedoGroup, ...spellCheckGroup, ...blockTypeGroup, ...textFormattingGroup, ...alignmentGroup, ...textColorGroup, ...listFormatting, ...insertBlockGroup, ...others];
|
|
91
|
+
const toolbarConfigurationV2 = [...blockTypeGroup, ...textFormattingGroup, ...textColorGroup, ...alignmentAndListGroup, ...hyperlinkGroup, {
|
|
92
|
+
name: 'beforePrimaryToolbar'
|
|
93
|
+
}];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
1
2
|
export var getToolbarComponents = function getToolbarComponents(componentRegistry, editorState) {
|
|
2
|
-
return
|
|
3
|
+
return (editorExperiment('platform_editor_controls', 'variant1', {
|
|
4
|
+
exposure: true
|
|
5
|
+
}) ? toolbarConfigurationV2 : toolbarConfiguration).filter(function (toolbarElement) {
|
|
3
6
|
return typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState);
|
|
4
7
|
}).reduce(function (acc, toolbarElement) {
|
|
5
8
|
if (componentRegistry.has(toolbarElement.name)) {
|
|
@@ -63,6 +66,16 @@ var textColorGroup = [{
|
|
|
63
66
|
return componentRegistry.has('textColor') || componentRegistry.has('highlight');
|
|
64
67
|
}
|
|
65
68
|
}];
|
|
69
|
+
var alignmentAndListGroup = [{
|
|
70
|
+
name: 'alignment'
|
|
71
|
+
}, {
|
|
72
|
+
name: 'toolbarListsIndentation'
|
|
73
|
+
}, {
|
|
74
|
+
name: 'separator',
|
|
75
|
+
enabled: function enabled(componentRegistry) {
|
|
76
|
+
return componentRegistry.has('toolbarListsIndentation') || componentRegistry.has('alignment');
|
|
77
|
+
}
|
|
78
|
+
}];
|
|
66
79
|
var listFormatting = [{
|
|
67
80
|
name: 'toolbarListsIndentation'
|
|
68
81
|
}, {
|
|
@@ -71,6 +84,14 @@ var listFormatting = [{
|
|
|
71
84
|
return componentRegistry.has('toolbarListsIndentation');
|
|
72
85
|
}
|
|
73
86
|
}];
|
|
87
|
+
var hyperlinkGroup = [{
|
|
88
|
+
name: 'hyperlink'
|
|
89
|
+
}, {
|
|
90
|
+
name: 'separator',
|
|
91
|
+
enabled: function enabled(componentRegistry) {
|
|
92
|
+
return componentRegistry.has('hyperlink');
|
|
93
|
+
}
|
|
94
|
+
}];
|
|
74
95
|
var insertBlockGroup = [{
|
|
75
96
|
name: 'insertBlock'
|
|
76
97
|
}];
|
|
@@ -86,4 +107,7 @@ var others = [{
|
|
|
86
107
|
}, {
|
|
87
108
|
name: 'loom'
|
|
88
109
|
}];
|
|
89
|
-
var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormatting, insertBlockGroup, others);
|
|
110
|
+
var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormatting, insertBlockGroup, others);
|
|
111
|
+
var toolbarConfigurationV2 = [].concat(blockTypeGroup, textFormattingGroup, textColorGroup, alignmentAndListGroup, hyperlinkGroup, [{
|
|
112
|
+
name: 'beforePrimaryToolbar'
|
|
113
|
+
}]);
|
|
@@ -10,7 +10,7 @@ export type PrimaryToolbarPlugin = NextEditorPlugin<'primaryToolbar', {
|
|
|
10
10
|
};
|
|
11
11
|
}>;
|
|
12
12
|
export type ComponentRegistry = Map<string, ToolbarUIComponentFactory>;
|
|
13
|
-
export type ToolbarElementNames = 'separator' | 'undoRedoPlugin' | 'blockType' | 'textFormatting' | 'alignment' | 'textColor' | 'highlight' | 'toolbarListsIndentation' | 'insertBlock' | 'beforePrimaryToolbar' | 'avatarGroup' | 'findReplace' | 'aiExperience' | 'loom' | 'spellCheck';
|
|
13
|
+
export type ToolbarElementNames = 'separator' | 'undoRedoPlugin' | 'blockType' | 'textFormatting' | 'alignment' | 'textColor' | 'highlight' | 'hyperlink' | 'toolbarListsIndentation' | 'insertBlock' | 'beforePrimaryToolbar' | 'avatarGroup' | 'findReplace' | 'aiExperience' | 'aiSimplified' | 'loom' | 'spellCheck';
|
|
14
14
|
export type ToolbarElementConfig = {
|
|
15
15
|
name: ToolbarElementNames;
|
|
16
16
|
enabled?: (componentRegistry: ComponentRegistry, editorState: EditorState) => boolean;
|
|
@@ -10,7 +10,7 @@ export type PrimaryToolbarPlugin = NextEditorPlugin<'primaryToolbar', {
|
|
|
10
10
|
};
|
|
11
11
|
}>;
|
|
12
12
|
export type ComponentRegistry = Map<string, ToolbarUIComponentFactory>;
|
|
13
|
-
export type ToolbarElementNames = 'separator' | 'undoRedoPlugin' | 'blockType' | 'textFormatting' | 'alignment' | 'textColor' | 'highlight' | 'toolbarListsIndentation' | 'insertBlock' | 'beforePrimaryToolbar' | 'avatarGroup' | 'findReplace' | 'aiExperience' | 'loom' | 'spellCheck';
|
|
13
|
+
export type ToolbarElementNames = 'separator' | 'undoRedoPlugin' | 'blockType' | 'textFormatting' | 'alignment' | 'textColor' | 'highlight' | 'hyperlink' | 'toolbarListsIndentation' | 'insertBlock' | 'beforePrimaryToolbar' | 'avatarGroup' | 'findReplace' | 'aiExperience' | 'aiSimplified' | 'loom' | 'spellCheck';
|
|
14
14
|
export type ToolbarElementConfig = {
|
|
15
15
|
name: ToolbarElementNames;
|
|
16
16
|
enabled?: (componentRegistry: ComponentRegistry, editorState: EditorState) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-primary-toolbar",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Primary toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
".": "./src/index.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^99.
|
|
39
|
+
"@atlaskit/editor-common": "^99.18.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"@emotion/react": "^11.7.1"
|