@atlaskit/editor-plugin-primary-toolbar 4.1.0 → 4.1.2
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 +17 -0
- package/dist/cjs/pm-plugins/toolbar-configuration.js +27 -2
- package/dist/es2019/pm-plugins/toolbar-configuration.js +19 -2
- package/dist/esm/pm-plugins/toolbar-configuration.js +27 -2
- package/dist/types/primaryToolbarPluginType.d.ts +1 -1
- package/dist/types-ts4.5/primaryToolbarPluginType.d.ts +1 -1
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-primary-toolbar
|
|
2
2
|
|
|
3
|
+
## 4.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#192343](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/192343)
|
|
8
|
+
[`9cb0878241016`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9cb0878241016) -
|
|
9
|
+
ED-28736 more extensible selection extensions API
|
|
10
|
+
|
|
11
|
+
## 4.1.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#193685](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/193685)
|
|
16
|
+
[`ee3ba46cb3d0a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee3ba46cb3d0a) -
|
|
17
|
+
[EDITOR-1073] Add undo/ redo & show diff to comment toolbar
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 4.1.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -20,7 +20,11 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
20
20
|
configuration = toolbarConfigurationV2(true, shouldShowUndoRedoGroup);
|
|
21
21
|
} else {
|
|
22
22
|
var shouldShowFindGroup = !!contextualFormattingEnabled;
|
|
23
|
-
|
|
23
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_ai_in_document_streaming')) {
|
|
24
|
+
configuration = toolbarConfigurationV3(shouldShowFindGroup);
|
|
25
|
+
} else {
|
|
26
|
+
configuration = toolbarConfiguration(shouldShowFindGroup);
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
return configuration.filter(function (toolbarElement) {
|
|
26
30
|
return typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState);
|
|
@@ -34,6 +38,22 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
34
38
|
return acc;
|
|
35
39
|
}, []);
|
|
36
40
|
};
|
|
41
|
+
var trackChangesGroup = [{
|
|
42
|
+
name: 'separator',
|
|
43
|
+
enabled: function enabled(componentRegistry) {
|
|
44
|
+
return componentRegistry.has('undoRedo') || componentRegistry.has('trackChanges');
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
name: 'undoRedoPlugin',
|
|
48
|
+
enabled: function enabled(componentRegistry) {
|
|
49
|
+
return componentRegistry.has('undoRedoPlugin');
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
name: 'trackChanges',
|
|
53
|
+
enabled: function enabled(componentRegistry) {
|
|
54
|
+
return componentRegistry.has('trackChanges');
|
|
55
|
+
}
|
|
56
|
+
}];
|
|
37
57
|
var undoRedoGroup = [{
|
|
38
58
|
name: 'undoRedoPlugin'
|
|
39
59
|
}, {
|
|
@@ -130,6 +150,9 @@ var othersGroupNoFind = [{
|
|
|
130
150
|
var findGroup = [{
|
|
131
151
|
name: 'findReplace'
|
|
132
152
|
}];
|
|
153
|
+
var toolbarConfigurationV3 = function toolbarConfigurationV3(shouldShowFindGroup) {
|
|
154
|
+
return [].concat(spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, (0, _toConsumableArray2.default)(shouldShowFindGroup ? others : othersGroupNoFind), trackChangesGroup);
|
|
155
|
+
};
|
|
133
156
|
var toolbarConfiguration = function toolbarConfiguration(shouldShowFindGroup) {
|
|
134
157
|
return [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, (0, _toConsumableArray2.default)(shouldShowFindGroup ? others : othersGroupNoFind));
|
|
135
158
|
};
|
|
@@ -138,7 +161,9 @@ var pinToolbar = [{
|
|
|
138
161
|
}];
|
|
139
162
|
var toolbarConfigurationV2 = function toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoGroup) {
|
|
140
163
|
var shouldShowFindGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
141
|
-
return [].concat((0, _toConsumableArray2.default)(shouldShowUndoRedoGroup ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, (0, _toConsumableArray2.default)(shouldShowInsertBlock ? insertBlockGroup : []),
|
|
164
|
+
return [].concat((0, _toConsumableArray2.default)(shouldShowUndoRedoGroup ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, (0, _toConsumableArray2.default)(shouldShowInsertBlock ? insertBlockGroup : []), [{
|
|
165
|
+
name: 'selectionExtension'
|
|
166
|
+
}], pinToolbar, [{
|
|
142
167
|
name: 'beforePrimaryToolbar'
|
|
143
168
|
}], (0, _toConsumableArray2.default)(shouldShowFindGroup ? findGroup : []));
|
|
144
169
|
};
|
|
@@ -13,7 +13,11 @@ export const getToolbarComponents = ({
|
|
|
13
13
|
configuration = toolbarConfigurationV2(true, shouldShowUndoRedoGroup);
|
|
14
14
|
} else {
|
|
15
15
|
const shouldShowFindGroup = !!contextualFormattingEnabled;
|
|
16
|
-
|
|
16
|
+
if (fg('platform_editor_ai_in_document_streaming')) {
|
|
17
|
+
configuration = toolbarConfigurationV3(shouldShowFindGroup);
|
|
18
|
+
} else {
|
|
19
|
+
configuration = toolbarConfiguration(shouldShowFindGroup);
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
return configuration.filter(toolbarElement => typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState)).reduce((acc, toolbarElement) => {
|
|
19
23
|
if (componentRegistry.has(toolbarElement.name)) {
|
|
@@ -25,6 +29,16 @@ export const getToolbarComponents = ({
|
|
|
25
29
|
return acc;
|
|
26
30
|
}, []);
|
|
27
31
|
};
|
|
32
|
+
const trackChangesGroup = [{
|
|
33
|
+
name: 'separator',
|
|
34
|
+
enabled: componentRegistry => componentRegistry.has('undoRedo') || componentRegistry.has('trackChanges')
|
|
35
|
+
}, {
|
|
36
|
+
name: 'undoRedoPlugin',
|
|
37
|
+
enabled: componentRegistry => componentRegistry.has('undoRedoPlugin')
|
|
38
|
+
}, {
|
|
39
|
+
name: 'trackChanges',
|
|
40
|
+
enabled: componentRegistry => componentRegistry.has('trackChanges')
|
|
41
|
+
}];
|
|
28
42
|
const undoRedoGroup = [{
|
|
29
43
|
name: 'undoRedoPlugin'
|
|
30
44
|
}, {
|
|
@@ -105,10 +119,13 @@ const othersGroupNoFind = [{
|
|
|
105
119
|
const findGroup = [{
|
|
106
120
|
name: 'findReplace'
|
|
107
121
|
}];
|
|
122
|
+
const toolbarConfigurationV3 = shouldShowFindGroup => [...spellCheckGroup, ...blockTypeGroup, ...textFormattingGroup, ...alignmentGroup, ...textColorGroup, ...listFormattingGroup, ...insertBlockGroup, ...(shouldShowFindGroup ? others : othersGroupNoFind), ...trackChangesGroup];
|
|
108
123
|
const toolbarConfiguration = shouldShowFindGroup => [...undoRedoGroup, ...spellCheckGroup, ...blockTypeGroup, ...textFormattingGroup, ...alignmentGroup, ...textColorGroup, ...listFormattingGroup, ...insertBlockGroup, ...(shouldShowFindGroup ? others : othersGroupNoFind)];
|
|
109
124
|
const pinToolbar = [{
|
|
110
125
|
name: 'pinToolbar'
|
|
111
126
|
}];
|
|
112
|
-
const toolbarConfigurationV2 = (shouldShowInsertBlock, shouldShowUndoRedoGroup, shouldShowFindGroup = false) => [...(shouldShowUndoRedoGroup ? undoRedoGroup : []), ...blockTypeGroup, ...textFormattingGroup, ...textColorGroup, ...alignmentGroup, ...listFormattingGroup, ...hyperlinkGroup, ...(shouldShowInsertBlock ? insertBlockGroup : []),
|
|
127
|
+
const toolbarConfigurationV2 = (shouldShowInsertBlock, shouldShowUndoRedoGroup, shouldShowFindGroup = false) => [...(shouldShowUndoRedoGroup ? undoRedoGroup : []), ...blockTypeGroup, ...textFormattingGroup, ...textColorGroup, ...alignmentGroup, ...listFormattingGroup, ...hyperlinkGroup, ...(shouldShowInsertBlock ? insertBlockGroup : []), {
|
|
128
|
+
name: 'selectionExtension'
|
|
129
|
+
}, ...pinToolbar, {
|
|
113
130
|
name: 'beforePrimaryToolbar'
|
|
114
131
|
}, ...(shouldShowFindGroup ? findGroup : [])];
|
|
@@ -13,7 +13,11 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
|
|
|
13
13
|
configuration = toolbarConfigurationV2(true, shouldShowUndoRedoGroup);
|
|
14
14
|
} else {
|
|
15
15
|
var shouldShowFindGroup = !!contextualFormattingEnabled;
|
|
16
|
-
|
|
16
|
+
if (fg('platform_editor_ai_in_document_streaming')) {
|
|
17
|
+
configuration = toolbarConfigurationV3(shouldShowFindGroup);
|
|
18
|
+
} else {
|
|
19
|
+
configuration = toolbarConfiguration(shouldShowFindGroup);
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
return configuration.filter(function (toolbarElement) {
|
|
19
23
|
return typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState);
|
|
@@ -27,6 +31,22 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
|
|
|
27
31
|
return acc;
|
|
28
32
|
}, []);
|
|
29
33
|
};
|
|
34
|
+
var trackChangesGroup = [{
|
|
35
|
+
name: 'separator',
|
|
36
|
+
enabled: function enabled(componentRegistry) {
|
|
37
|
+
return componentRegistry.has('undoRedo') || componentRegistry.has('trackChanges');
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
name: 'undoRedoPlugin',
|
|
41
|
+
enabled: function enabled(componentRegistry) {
|
|
42
|
+
return componentRegistry.has('undoRedoPlugin');
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
name: 'trackChanges',
|
|
46
|
+
enabled: function enabled(componentRegistry) {
|
|
47
|
+
return componentRegistry.has('trackChanges');
|
|
48
|
+
}
|
|
49
|
+
}];
|
|
30
50
|
var undoRedoGroup = [{
|
|
31
51
|
name: 'undoRedoPlugin'
|
|
32
52
|
}, {
|
|
@@ -123,6 +143,9 @@ var othersGroupNoFind = [{
|
|
|
123
143
|
var findGroup = [{
|
|
124
144
|
name: 'findReplace'
|
|
125
145
|
}];
|
|
146
|
+
var toolbarConfigurationV3 = function toolbarConfigurationV3(shouldShowFindGroup) {
|
|
147
|
+
return [].concat(spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, _toConsumableArray(shouldShowFindGroup ? others : othersGroupNoFind), trackChangesGroup);
|
|
148
|
+
};
|
|
126
149
|
var toolbarConfiguration = function toolbarConfiguration(shouldShowFindGroup) {
|
|
127
150
|
return [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, _toConsumableArray(shouldShowFindGroup ? others : othersGroupNoFind));
|
|
128
151
|
};
|
|
@@ -131,7 +154,9 @@ var pinToolbar = [{
|
|
|
131
154
|
}];
|
|
132
155
|
var toolbarConfigurationV2 = function toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoGroup) {
|
|
133
156
|
var shouldShowFindGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
134
|
-
return [].concat(_toConsumableArray(shouldShowUndoRedoGroup ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, _toConsumableArray(shouldShowInsertBlock ? insertBlockGroup : []),
|
|
157
|
+
return [].concat(_toConsumableArray(shouldShowUndoRedoGroup ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, _toConsumableArray(shouldShowInsertBlock ? insertBlockGroup : []), [{
|
|
158
|
+
name: 'selectionExtension'
|
|
159
|
+
}], pinToolbar, [{
|
|
135
160
|
name: 'beforePrimaryToolbar'
|
|
136
161
|
}], _toConsumableArray(shouldShowFindGroup ? findGroup : []));
|
|
137
162
|
};
|
|
@@ -14,7 +14,7 @@ export type PrimaryToolbarPlugin = NextEditorPlugin<'primaryToolbar', {
|
|
|
14
14
|
pluginConfiguration?: PrimaryToolbarPluginOptions;
|
|
15
15
|
}>;
|
|
16
16
|
export type ComponentRegistry = Map<string, ToolbarUIComponentFactory>;
|
|
17
|
-
export type ToolbarElementNames = '
|
|
17
|
+
export type ToolbarElementNames = 'aiExperience' | 'aiSimplified' | 'alignment' | 'avatarGroup' | 'beforePrimaryToolbar' | 'blockType' | 'findReplace' | 'highlight' | 'hyperlink' | 'insertBlock' | 'loom' | 'overflowMenu' | 'pinToolbar' | 'selectionExtension' | 'separator' | 'spellCheck' | 'textColor' | 'textFormatting' | 'toolbarListsIndentation' | 'trackChanges' | 'undoRedoPlugin';
|
|
18
18
|
export type ToolbarElementConfig = {
|
|
19
19
|
name: ToolbarElementNames;
|
|
20
20
|
enabled?: (componentRegistry: ComponentRegistry, editorState: EditorState) => boolean;
|
|
@@ -14,7 +14,7 @@ export type PrimaryToolbarPlugin = NextEditorPlugin<'primaryToolbar', {
|
|
|
14
14
|
pluginConfiguration?: PrimaryToolbarPluginOptions;
|
|
15
15
|
}>;
|
|
16
16
|
export type ComponentRegistry = Map<string, ToolbarUIComponentFactory>;
|
|
17
|
-
export type ToolbarElementNames = '
|
|
17
|
+
export type ToolbarElementNames = 'aiExperience' | 'aiSimplified' | 'alignment' | 'avatarGroup' | 'beforePrimaryToolbar' | 'blockType' | 'findReplace' | 'highlight' | 'hyperlink' | 'insertBlock' | 'loom' | 'overflowMenu' | 'pinToolbar' | 'selectionExtension' | 'separator' | 'spellCheck' | 'textColor' | 'textFormatting' | 'toolbarListsIndentation' | 'trackChanges' | 'undoRedoPlugin';
|
|
18
18
|
export type ToolbarElementConfig = {
|
|
19
19
|
name: ToolbarElementNames;
|
|
20
20
|
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": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "Primary toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^9.17.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"@emotion/react": "^11.7.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atlaskit/editor-common": "^107.
|
|
45
|
+
"@atlaskit/editor-common": "^107.13.0",
|
|
46
46
|
"react": "^18.2.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"platform-feature-flags": {
|
|
87
|
+
"platform_editor_ai_in_document_streaming": {
|
|
88
|
+
"type": "boolean",
|
|
89
|
+
"referenceOnly": true
|
|
90
|
+
},
|
|
87
91
|
"platform_editor_undo_redo_find_on_primary_toolbar": {
|
|
88
92
|
"type": "boolean"
|
|
89
93
|
}
|