@atlaskit/editor-plugin-primary-toolbar 4.1.0 → 4.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 +9 -0
- package/dist/cjs/pm-plugins/toolbar-configuration.js +24 -1
- package/dist/es2019/pm-plugins/toolbar-configuration.js +16 -1
- package/dist/esm/pm-plugins/toolbar-configuration.js +24 -1
- 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,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-primary-toolbar
|
|
2
2
|
|
|
3
|
+
## 4.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#193685](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/193685)
|
|
8
|
+
[`ee3ba46cb3d0a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee3ba46cb3d0a) -
|
|
9
|
+
[EDITOR-1073] Add undo/ redo & show diff to comment toolbar
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 4.1.0
|
|
4
13
|
|
|
5
14
|
### 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
|
};
|
|
@@ -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,6 +119,7 @@ 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'
|
|
@@ -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
|
};
|
|
@@ -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' | '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' | '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.1",
|
|
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
|
}
|