@atlaskit/editor-plugin-toolbar 3.4.14 → 3.4.16
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/experiences/selection-toolbar-open-experience.js +0 -8
- package/dist/cjs/toolbarPlugin.js +0 -16
- package/dist/cjs/ui/OverflowMenuSection.js +21 -0
- package/dist/cjs/ui/toolbar-components.js +11 -1
- package/dist/es2019/pm-plugins/experiences/selection-toolbar-open-experience.js +0 -8
- package/dist/es2019/toolbarPlugin.js +0 -20
- package/dist/es2019/ui/OverflowMenuSection.js +16 -0
- package/dist/es2019/ui/toolbar-components.js +12 -2
- package/dist/esm/pm-plugins/experiences/selection-toolbar-open-experience.js +0 -8
- package/dist/esm/toolbarPlugin.js +0 -16
- package/dist/esm/ui/OverflowMenuSection.js +14 -0
- package/dist/esm/ui/toolbar-components.js +12 -2
- package/dist/types/ui/OverflowMenuSection.d.ts +6 -0
- package/dist/types-ts4.5/ui/OverflowMenuSection.d.ts +6 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.4.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5baa955ebe237`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5baa955ebe237) -
|
|
8
|
+
Add new menu section for all extensions (inc. loom and 1p, 3p extensions), add logic to hide menu
|
|
9
|
+
button completely when there are no menu-sections with no menu-items associated with it
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.4.15
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
|
|
17
|
+
tsignores added for help-center local consumpton removed
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 3.4.14
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -63,8 +63,6 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
63
63
|
}), new _experiences.ExperienceCheckDomMutation({
|
|
64
64
|
onDomMutation: function onDomMutation(_ref2) {
|
|
65
65
|
var mutations = _ref2.mutations;
|
|
66
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
67
|
-
|
|
68
66
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
69
67
|
return {
|
|
70
68
|
status: 'success'
|
|
@@ -87,8 +85,6 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
87
85
|
init: function init() {
|
|
88
86
|
return {};
|
|
89
87
|
},
|
|
90
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
91
|
-
|
|
92
88
|
apply: function apply(_tr, pluginState, oldState, newState) {
|
|
93
89
|
if (!oldState.selection.empty && isSelectionWithoutTextContent(newState.selection)) {
|
|
94
90
|
experience.abort({
|
|
@@ -105,8 +101,6 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
105
101
|
}
|
|
106
102
|
},
|
|
107
103
|
props: {
|
|
108
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
109
|
-
|
|
110
104
|
handleDOMEvents: {
|
|
111
105
|
mousedown: function mousedown(_view, e) {
|
|
112
106
|
mouseDownPos = {
|
|
@@ -157,8 +151,6 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
157
151
|
var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutation(_ref4) {
|
|
158
152
|
var type = _ref4.type,
|
|
159
153
|
addedNodes = _ref4.addedNodes;
|
|
160
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
161
|
-
|
|
162
154
|
return type === 'childList' && (0, _toConsumableArray2.default)(addedNodes).some(isSelectionToolbarWithinNode);
|
|
163
155
|
};
|
|
164
156
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
@@ -30,8 +30,6 @@ function getSelectedNode(editorState) {
|
|
|
30
30
|
node: selection.node,
|
|
31
31
|
pos: selection.from,
|
|
32
32
|
nodeType: selection.node.type.name,
|
|
33
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
34
|
-
|
|
35
33
|
marks: selection.node.marks.map(function (mark) {
|
|
36
34
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
37
35
|
})
|
|
@@ -44,8 +42,6 @@ function getSelectedNode(editorState) {
|
|
|
44
42
|
node: selectedNode.node,
|
|
45
43
|
pos: selectedNode.pos,
|
|
46
44
|
nodeType: selectedNode.node.type.name,
|
|
47
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
48
|
-
|
|
49
45
|
marks: selectedNode.node.marks.map(function (mark) {
|
|
50
46
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
51
47
|
})
|
|
@@ -57,8 +53,6 @@ function getSelectedNode(editorState) {
|
|
|
57
53
|
node: parentNode.node,
|
|
58
54
|
pos: parentNode.pos,
|
|
59
55
|
nodeType: parentNode.node.type.name,
|
|
60
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
61
|
-
|
|
62
56
|
marks: parentNode.node.marks.map(function (mark) {
|
|
63
57
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
64
58
|
})
|
|
@@ -69,8 +63,6 @@ function getSelectedNode(editorState) {
|
|
|
69
63
|
node: $pos.parent,
|
|
70
64
|
pos: $pos.pos,
|
|
71
65
|
nodeType: $pos.parent.type.name,
|
|
72
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
73
|
-
|
|
74
66
|
marks: $pos.marks().map(function (mark) {
|
|
75
67
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
76
68
|
})
|
|
@@ -125,14 +117,12 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
125
117
|
return new _safePlugin.SafePlugin({
|
|
126
118
|
key: _pluginKey.editorToolbarPluginKey,
|
|
127
119
|
state: {
|
|
128
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
129
120
|
init: function init(_, editorState) {
|
|
130
121
|
return {
|
|
131
122
|
shouldShowToolbar: false,
|
|
132
123
|
selectedNode: getSelectedNode(editorState)
|
|
133
124
|
};
|
|
134
125
|
},
|
|
135
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
136
126
|
apply: function apply(tr, pluginState, _, newState) {
|
|
137
127
|
var meta = tr.getMeta(_pluginKey.editorToolbarPluginKey);
|
|
138
128
|
var newPluginState = _objectSpread({}, pluginState);
|
|
@@ -153,7 +143,6 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
153
143
|
return newPluginState;
|
|
154
144
|
}
|
|
155
145
|
},
|
|
156
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
157
146
|
view: function view(_view) {
|
|
158
147
|
var unbind = (0, _bindEventListener.bind)(_view.root, {
|
|
159
148
|
type: 'mouseup',
|
|
@@ -182,7 +171,6 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
182
171
|
}
|
|
183
172
|
});
|
|
184
173
|
return {
|
|
185
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
186
174
|
destroy: function destroy() {
|
|
187
175
|
unbind();
|
|
188
176
|
unbindEditorViewFocus();
|
|
@@ -190,11 +178,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
190
178
|
};
|
|
191
179
|
},
|
|
192
180
|
props: {
|
|
193
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
194
|
-
|
|
195
181
|
handleDOMEvents: {
|
|
196
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
197
|
-
|
|
198
182
|
mousedown: function mousedown(view) {
|
|
199
183
|
view.dispatch(view.state.tr.setMeta(_pluginKey.editorToolbarPluginKey, {
|
|
200
184
|
shouldShowToolbar: false
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.OverflowMenuSection = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
|
+
var OverflowMenuSection = exports.OverflowMenuSection = function OverflowMenuSection(_ref) {
|
|
12
|
+
var children = _ref.children;
|
|
13
|
+
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
14
|
+
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
15
|
+
var isEdit = editorViewMode === 'edit';
|
|
16
|
+
|
|
17
|
+
// only show separator in edit mode, when the pinned toolbar option is available
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
19
|
+
hasSeparator: isEdit
|
|
20
|
+
}, children);
|
|
21
|
+
};
|
|
@@ -14,6 +14,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
14
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
15
|
var _consts = require("./consts");
|
|
16
16
|
var _OverflowMenu = require("./OverflowMenu");
|
|
17
|
+
var _OverflowMenuSection = require("./OverflowMenuSection");
|
|
17
18
|
var _OverflowSection = require("./OverflowSection");
|
|
18
19
|
var _PrimaryToolbar = require("./PrimaryToolbar");
|
|
19
20
|
var _Section = require("./Section");
|
|
@@ -217,7 +218,16 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
217
218
|
var children = _ref9.children;
|
|
218
219
|
return /*#__PURE__*/_react.default.createElement(_OverflowMenu.OverflowMenu, null, children);
|
|
219
220
|
}
|
|
220
|
-
}, {
|
|
221
|
+
}], (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_overflow_menu_update') ? [{
|
|
222
|
+
type: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
223
|
+
key: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
224
|
+
parents: [{
|
|
225
|
+
type: _toolbar.OVERFLOW_MENU.type,
|
|
226
|
+
key: _toolbar.OVERFLOW_MENU.key,
|
|
227
|
+
rank: _toolbar.OVERFLOW_MENU_RANK[_toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.key]
|
|
228
|
+
}],
|
|
229
|
+
component: _OverflowMenuSection.OverflowMenuSection
|
|
230
|
+
}] : []), [{
|
|
221
231
|
type: _toolbar.PIN_SECTION.type,
|
|
222
232
|
key: _toolbar.PIN_SECTION.key,
|
|
223
233
|
parents: [{
|
|
@@ -57,8 +57,6 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
57
57
|
onDomMutation: ({
|
|
58
58
|
mutations
|
|
59
59
|
}) => {
|
|
60
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
61
|
-
|
|
62
60
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
63
61
|
return {
|
|
64
62
|
status: 'success'
|
|
@@ -77,8 +75,6 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
77
75
|
key: pluginKey,
|
|
78
76
|
state: {
|
|
79
77
|
init: () => ({}),
|
|
80
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
81
|
-
|
|
82
78
|
apply: (_tr, pluginState, oldState, newState) => {
|
|
83
79
|
if (!oldState.selection.empty && isSelectionWithoutTextContent(newState.selection)) {
|
|
84
80
|
experience.abort({
|
|
@@ -95,8 +91,6 @@ export const getSelectionToolbarOpenExperiencePlugin = ({
|
|
|
95
91
|
}
|
|
96
92
|
},
|
|
97
93
|
props: {
|
|
98
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
99
|
-
|
|
100
94
|
handleDOMEvents: {
|
|
101
95
|
mousedown: (_view, e) => {
|
|
102
96
|
mouseDownPos = {
|
|
@@ -149,8 +143,6 @@ const isSelectionToolbarAddedInMutation = ({
|
|
|
149
143
|
type,
|
|
150
144
|
addedNodes
|
|
151
145
|
}) => {
|
|
152
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
153
|
-
|
|
154
146
|
return type === 'childList' && [...addedNodes].some(isSelectionToolbarWithinNode);
|
|
155
147
|
};
|
|
156
148
|
const isSelectionToolbarWithinNode = node => {
|
|
@@ -21,8 +21,6 @@ function getSelectedNode(editorState) {
|
|
|
21
21
|
node: selection.node,
|
|
22
22
|
pos: selection.from,
|
|
23
23
|
nodeType: selection.node.type.name,
|
|
24
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
25
|
-
|
|
26
24
|
marks: selection.node.marks.map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
27
25
|
};
|
|
28
26
|
}
|
|
@@ -35,8 +33,6 @@ function getSelectedNode(editorState) {
|
|
|
35
33
|
node: selectedNode.node,
|
|
36
34
|
pos: selectedNode.pos,
|
|
37
35
|
nodeType: selectedNode.node.type.name,
|
|
38
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
39
|
-
|
|
40
36
|
marks: selectedNode.node.marks.map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
41
37
|
};
|
|
42
38
|
}
|
|
@@ -46,8 +42,6 @@ function getSelectedNode(editorState) {
|
|
|
46
42
|
node: parentNode.node,
|
|
47
43
|
pos: parentNode.pos,
|
|
48
44
|
nodeType: parentNode.node.type.name,
|
|
49
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
50
|
-
|
|
51
45
|
marks: parentNode.node.marks.map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
52
46
|
};
|
|
53
47
|
}
|
|
@@ -56,8 +50,6 @@ function getSelectedNode(editorState) {
|
|
|
56
50
|
node: $pos.parent,
|
|
57
51
|
pos: $pos.pos,
|
|
58
52
|
nodeType: $pos.parent.type.name,
|
|
59
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
60
|
-
|
|
61
53
|
marks: $pos.marks().map(mark => `${mark.type.name}:${JSON.stringify(mark.attrs)}`)
|
|
62
54
|
};
|
|
63
55
|
}
|
|
@@ -110,16 +102,12 @@ export const toolbarPlugin = ({
|
|
|
110
102
|
return new SafePlugin({
|
|
111
103
|
key: editorToolbarPluginKey,
|
|
112
104
|
state: {
|
|
113
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
114
|
-
|
|
115
105
|
init(_, editorState) {
|
|
116
106
|
return {
|
|
117
107
|
shouldShowToolbar: false,
|
|
118
108
|
selectedNode: getSelectedNode(editorState)
|
|
119
109
|
};
|
|
120
110
|
},
|
|
121
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
122
|
-
|
|
123
111
|
apply(tr, pluginState, _, newState) {
|
|
124
112
|
const meta = tr.getMeta(editorToolbarPluginKey);
|
|
125
113
|
let newPluginState = {
|
|
@@ -145,8 +133,6 @@ export const toolbarPlugin = ({
|
|
|
145
133
|
return newPluginState;
|
|
146
134
|
}
|
|
147
135
|
},
|
|
148
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
149
|
-
|
|
150
136
|
view(view) {
|
|
151
137
|
const unbind = bind(view.root, {
|
|
152
138
|
type: 'mouseup',
|
|
@@ -175,8 +161,6 @@ export const toolbarPlugin = ({
|
|
|
175
161
|
}
|
|
176
162
|
});
|
|
177
163
|
return {
|
|
178
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
179
|
-
|
|
180
164
|
destroy() {
|
|
181
165
|
unbind();
|
|
182
166
|
unbindEditorViewFocus();
|
|
@@ -184,11 +168,7 @@ export const toolbarPlugin = ({
|
|
|
184
168
|
};
|
|
185
169
|
},
|
|
186
170
|
props: {
|
|
187
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
188
|
-
|
|
189
171
|
handleDOMEvents: {
|
|
190
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
191
|
-
|
|
192
172
|
mousedown: view => {
|
|
193
173
|
view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
|
|
194
174
|
shouldShowToolbar: false
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
4
|
+
export const OverflowMenuSection = ({
|
|
5
|
+
children
|
|
6
|
+
}) => {
|
|
7
|
+
const {
|
|
8
|
+
editorViewMode
|
|
9
|
+
} = useEditorToolbar();
|
|
10
|
+
const isEdit = editorViewMode === 'edit';
|
|
11
|
+
|
|
12
|
+
// only show separator in edit mode, when the pinned toolbar option is available
|
|
13
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
14
|
+
hasSeparator: isEdit
|
|
15
|
+
}, children);
|
|
16
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS, TRACK_CHANGES_SECTION } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS, TRACK_CHANGES_SECTION, OVERFLOW_EXTENSIONS_MENU_SECTION, OVERFLOW_MENU_RANK } from '@atlaskit/editor-common/toolbar';
|
|
4
4
|
import { PrimaryToolbar as PrimaryToolbarBase, Show, Toolbar } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
7
|
import { SELECTION_TOOLBAR_LABEL } from './consts';
|
|
8
8
|
import { OverflowMenu } from './OverflowMenu';
|
|
9
|
+
import { OverflowMenuSection } from './OverflowMenuSection';
|
|
9
10
|
import { OverflowSection } from './OverflowSection';
|
|
10
11
|
import { PrimaryToolbar } from './PrimaryToolbar';
|
|
11
12
|
import { Section } from './Section';
|
|
@@ -210,7 +211,16 @@ export const getToolbarComponents = (contextualFormattingEnabled, api, disableSe
|
|
|
210
211
|
}) => {
|
|
211
212
|
return /*#__PURE__*/React.createElement(OverflowMenu, null, children);
|
|
212
213
|
}
|
|
213
|
-
}, {
|
|
214
|
+
}, ...(fg('platform_editor_toolbar_aifc_overflow_menu_update') ? [{
|
|
215
|
+
type: OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
216
|
+
key: OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
217
|
+
parents: [{
|
|
218
|
+
type: OVERFLOW_MENU.type,
|
|
219
|
+
key: OVERFLOW_MENU.key,
|
|
220
|
+
rank: OVERFLOW_MENU_RANK[OVERFLOW_EXTENSIONS_MENU_SECTION.key]
|
|
221
|
+
}],
|
|
222
|
+
component: OverflowMenuSection
|
|
223
|
+
}] : []), {
|
|
214
224
|
type: PIN_SECTION.type,
|
|
215
225
|
key: PIN_SECTION.key,
|
|
216
226
|
parents: [{
|
|
@@ -56,8 +56,6 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
56
56
|
}), new ExperienceCheckDomMutation({
|
|
57
57
|
onDomMutation: function onDomMutation(_ref2) {
|
|
58
58
|
var mutations = _ref2.mutations;
|
|
59
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
60
|
-
|
|
61
59
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
62
60
|
return {
|
|
63
61
|
status: 'success'
|
|
@@ -80,8 +78,6 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
80
78
|
init: function init() {
|
|
81
79
|
return {};
|
|
82
80
|
},
|
|
83
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
84
|
-
|
|
85
81
|
apply: function apply(_tr, pluginState, oldState, newState) {
|
|
86
82
|
if (!oldState.selection.empty && isSelectionWithoutTextContent(newState.selection)) {
|
|
87
83
|
experience.abort({
|
|
@@ -98,8 +94,6 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
98
94
|
}
|
|
99
95
|
},
|
|
100
96
|
props: {
|
|
101
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
102
|
-
|
|
103
97
|
handleDOMEvents: {
|
|
104
98
|
mousedown: function mousedown(_view, e) {
|
|
105
99
|
mouseDownPos = {
|
|
@@ -150,8 +144,6 @@ export var getSelectionToolbarOpenExperiencePlugin = function getSelectionToolba
|
|
|
150
144
|
var isSelectionToolbarAddedInMutation = function isSelectionToolbarAddedInMutation(_ref4) {
|
|
151
145
|
var type = _ref4.type,
|
|
152
146
|
addedNodes = _ref4.addedNodes;
|
|
153
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
154
|
-
|
|
155
147
|
return type === 'childList' && _toConsumableArray(addedNodes).some(isSelectionToolbarWithinNode);
|
|
156
148
|
};
|
|
157
149
|
var isSelectionToolbarWithinNode = function isSelectionToolbarWithinNode(node) {
|
|
@@ -23,8 +23,6 @@ function getSelectedNode(editorState) {
|
|
|
23
23
|
node: selection.node,
|
|
24
24
|
pos: selection.from,
|
|
25
25
|
nodeType: selection.node.type.name,
|
|
26
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
27
|
-
|
|
28
26
|
marks: selection.node.marks.map(function (mark) {
|
|
29
27
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
30
28
|
})
|
|
@@ -37,8 +35,6 @@ function getSelectedNode(editorState) {
|
|
|
37
35
|
node: selectedNode.node,
|
|
38
36
|
pos: selectedNode.pos,
|
|
39
37
|
nodeType: selectedNode.node.type.name,
|
|
40
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
41
|
-
|
|
42
38
|
marks: selectedNode.node.marks.map(function (mark) {
|
|
43
39
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
44
40
|
})
|
|
@@ -50,8 +46,6 @@ function getSelectedNode(editorState) {
|
|
|
50
46
|
node: parentNode.node,
|
|
51
47
|
pos: parentNode.pos,
|
|
52
48
|
nodeType: parentNode.node.type.name,
|
|
53
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
54
|
-
|
|
55
49
|
marks: parentNode.node.marks.map(function (mark) {
|
|
56
50
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
57
51
|
})
|
|
@@ -62,8 +56,6 @@ function getSelectedNode(editorState) {
|
|
|
62
56
|
node: $pos.parent,
|
|
63
57
|
pos: $pos.pos,
|
|
64
58
|
nodeType: $pos.parent.type.name,
|
|
65
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
66
|
-
|
|
67
59
|
marks: $pos.marks().map(function (mark) {
|
|
68
60
|
return "".concat(mark.type.name, ":").concat(JSON.stringify(mark.attrs));
|
|
69
61
|
})
|
|
@@ -118,14 +110,12 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
118
110
|
return new SafePlugin({
|
|
119
111
|
key: editorToolbarPluginKey,
|
|
120
112
|
state: {
|
|
121
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
122
113
|
init: function init(_, editorState) {
|
|
123
114
|
return {
|
|
124
115
|
shouldShowToolbar: false,
|
|
125
116
|
selectedNode: getSelectedNode(editorState)
|
|
126
117
|
};
|
|
127
118
|
},
|
|
128
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
129
119
|
apply: function apply(tr, pluginState, _, newState) {
|
|
130
120
|
var meta = tr.getMeta(editorToolbarPluginKey);
|
|
131
121
|
var newPluginState = _objectSpread({}, pluginState);
|
|
@@ -146,7 +136,6 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
146
136
|
return newPluginState;
|
|
147
137
|
}
|
|
148
138
|
},
|
|
149
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
150
139
|
view: function view(_view) {
|
|
151
140
|
var unbind = bind(_view.root, {
|
|
152
141
|
type: 'mouseup',
|
|
@@ -175,7 +164,6 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
175
164
|
}
|
|
176
165
|
});
|
|
177
166
|
return {
|
|
178
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
179
167
|
destroy: function destroy() {
|
|
180
168
|
unbind();
|
|
181
169
|
unbindEditorViewFocus();
|
|
@@ -183,11 +171,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
183
171
|
};
|
|
184
172
|
},
|
|
185
173
|
props: {
|
|
186
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
187
|
-
|
|
188
174
|
handleDOMEvents: {
|
|
189
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
190
|
-
|
|
191
175
|
mousedown: function mousedown(view) {
|
|
192
176
|
view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
|
|
193
177
|
shouldShowToolbar: false
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
4
|
+
export var OverflowMenuSection = function OverflowMenuSection(_ref) {
|
|
5
|
+
var children = _ref.children;
|
|
6
|
+
var _useEditorToolbar = useEditorToolbar(),
|
|
7
|
+
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
8
|
+
var isEdit = editorViewMode === 'edit';
|
|
9
|
+
|
|
10
|
+
// only show separator in edit mode, when the pinned toolbar option is available
|
|
11
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
12
|
+
hasSeparator: isEdit
|
|
13
|
+
}, children);
|
|
14
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS, TRACK_CHANGES_SECTION } from '@atlaskit/editor-common/toolbar';
|
|
4
|
+
import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_COLLAPSED_GROUP, TEXT_SECTION, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_SECTION_COLLAPSED, TEXT_COLLAPSED_MENU, TOOLBAR_RANK, TOOLBARS, TRACK_CHANGES_SECTION, OVERFLOW_EXTENSIONS_MENU_SECTION, OVERFLOW_MENU_RANK } from '@atlaskit/editor-common/toolbar';
|
|
5
5
|
import { PrimaryToolbar as PrimaryToolbarBase, Show, Toolbar } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
8
|
import { SELECTION_TOOLBAR_LABEL } from './consts';
|
|
9
9
|
import { OverflowMenu } from './OverflowMenu';
|
|
10
|
+
import { OverflowMenuSection } from './OverflowMenuSection';
|
|
10
11
|
import { OverflowSection } from './OverflowSection';
|
|
11
12
|
import { PrimaryToolbar } from './PrimaryToolbar';
|
|
12
13
|
import { Section } from './Section';
|
|
@@ -210,7 +211,16 @@ export var getToolbarComponents = function getToolbarComponents(contextualFormat
|
|
|
210
211
|
var children = _ref9.children;
|
|
211
212
|
return /*#__PURE__*/React.createElement(OverflowMenu, null, children);
|
|
212
213
|
}
|
|
213
|
-
}, {
|
|
214
|
+
}], _toConsumableArray(fg('platform_editor_toolbar_aifc_overflow_menu_update') ? [{
|
|
215
|
+
type: OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
216
|
+
key: OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
217
|
+
parents: [{
|
|
218
|
+
type: OVERFLOW_MENU.type,
|
|
219
|
+
key: OVERFLOW_MENU.key,
|
|
220
|
+
rank: OVERFLOW_MENU_RANK[OVERFLOW_EXTENSIONS_MENU_SECTION.key]
|
|
221
|
+
}],
|
|
222
|
+
component: OverflowMenuSection
|
|
223
|
+
}] : []), [{
|
|
214
224
|
type: PIN_SECTION.type,
|
|
215
225
|
key: PIN_SECTION.key,
|
|
216
226
|
parents: [{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-toolbar",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.16",
|
|
4
4
|
"description": "Toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^14.
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^14.8.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"bind-event-listener": "^3.0.0",
|
|
46
46
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^110.
|
|
49
|
+
"@atlaskit/editor-common": "^110.40.0",
|
|
50
50
|
"react": "^18.2.0"
|
|
51
51
|
},
|
|
52
52
|
"platform-feature-flags": {
|
|
@@ -64,6 +64,9 @@
|
|
|
64
64
|
},
|
|
65
65
|
"platform_editor_toolbar_aifc_undo_redo_confluence": {
|
|
66
66
|
"type": "boolean"
|
|
67
|
+
},
|
|
68
|
+
"platform_editor_toolbar_aifc_overflow_menu_update": {
|
|
69
|
+
"type": "boolean"
|
|
67
70
|
}
|
|
68
71
|
},
|
|
69
72
|
"techstack": {
|