@atlaskit/editor-plugin-selection-toolbar 1.3.3 → 1.5.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 +20 -0
- package/dist/cjs/plugin.js +22 -5
- package/dist/es2019/plugin.js +22 -5
- package/dist/esm/plugin.js +22 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-toolbar
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#173684](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/173684)
|
|
8
|
+
[`e022c83d84bd3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e022c83d84bd3) -
|
|
9
|
+
Fix errors caused by not checking for undefined annotation toolbar
|
|
10
|
+
|
|
11
|
+
## 1.4.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#172933](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172933)
|
|
16
|
+
[`8323af2381d00`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8323af2381d00) -
|
|
17
|
+
Adds optional pluginName to the Selection group
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 1.3.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -12,6 +12,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
16
|
var _commands = require("./commands");
|
|
16
17
|
var _pluginKey = require("./plugin-key");
|
|
17
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -144,12 +145,28 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
144
145
|
|
|
145
146
|
// This flattens the groups passed into the floating toolbar into a single list of items
|
|
146
147
|
for (var i = 0; i < resolved.length; i++) {
|
|
148
|
+
var _resolved$i;
|
|
147
149
|
// add a seperator icon after each group except the last
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
if (Array.isArray((_resolved$i = resolved[i]) === null || _resolved$i === void 0 ? void 0 : _resolved$i.items)) {
|
|
151
|
+
items.push.apply(items, (0, _toConsumableArray2.default)(resolved[i].items));
|
|
152
|
+
}
|
|
153
|
+
if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true)) {
|
|
154
|
+
var shouldNotAddSeparator = false;
|
|
155
|
+
if (resolved[i] && resolved[i + 1]) {
|
|
156
|
+
var _resolved$i2, _resolved, _resolved$i3, _resolved2;
|
|
157
|
+
shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
|
|
158
|
+
}
|
|
159
|
+
if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
|
|
160
|
+
items.push({
|
|
161
|
+
type: 'separator'
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
if (i !== resolved.length - 1) {
|
|
166
|
+
items.push({
|
|
167
|
+
type: 'separator'
|
|
168
|
+
});
|
|
169
|
+
}
|
|
153
170
|
}
|
|
154
171
|
}
|
|
155
172
|
var calcToolbarPosition = options.config.preferenceToolbarAboveSelection ? _utils.calculateToolbarPositionAboveSelection : _utils.calculateToolbarPositionTrackHead;
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -3,6 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
import { toggleToolbar } from './commands';
|
|
7
8
|
import { selectionToolbarPluginKey } from './plugin-key';
|
|
8
9
|
export const selectionToolbarPlugin = options => {
|
|
@@ -133,12 +134,28 @@ export const selectionToolbarPlugin = options => {
|
|
|
133
134
|
|
|
134
135
|
// This flattens the groups passed into the floating toolbar into a single list of items
|
|
135
136
|
for (let i = 0; i < resolved.length; i++) {
|
|
137
|
+
var _resolved$i;
|
|
136
138
|
// add a seperator icon after each group except the last
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
if (Array.isArray((_resolved$i = resolved[i]) === null || _resolved$i === void 0 ? void 0 : _resolved$i.items)) {
|
|
140
|
+
items.push(...resolved[i].items);
|
|
141
|
+
}
|
|
142
|
+
if (editorExperiment('contextual_formatting_toolbar', true)) {
|
|
143
|
+
let shouldNotAddSeparator = false;
|
|
144
|
+
if (resolved[i] && resolved[i + 1]) {
|
|
145
|
+
var _resolved$i2, _resolved, _resolved$i3, _resolved2;
|
|
146
|
+
shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
|
|
147
|
+
}
|
|
148
|
+
if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
|
|
149
|
+
items.push({
|
|
150
|
+
type: 'separator'
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
if (i !== resolved.length - 1) {
|
|
155
|
+
items.push({
|
|
156
|
+
type: 'separator'
|
|
157
|
+
});
|
|
158
|
+
}
|
|
142
159
|
}
|
|
143
160
|
}
|
|
144
161
|
const calcToolbarPosition = options.config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
|
package/dist/esm/plugin.js
CHANGED
|
@@ -7,6 +7,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
7
7
|
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { toggleToolbar } from './commands';
|
|
11
12
|
import { selectionToolbarPluginKey } from './plugin-key';
|
|
12
13
|
export var selectionToolbarPlugin = function selectionToolbarPlugin(options) {
|
|
@@ -137,12 +138,28 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(options) {
|
|
|
137
138
|
|
|
138
139
|
// This flattens the groups passed into the floating toolbar into a single list of items
|
|
139
140
|
for (var i = 0; i < resolved.length; i++) {
|
|
141
|
+
var _resolved$i;
|
|
140
142
|
// add a seperator icon after each group except the last
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
if (Array.isArray((_resolved$i = resolved[i]) === null || _resolved$i === void 0 ? void 0 : _resolved$i.items)) {
|
|
144
|
+
items.push.apply(items, _toConsumableArray(resolved[i].items));
|
|
145
|
+
}
|
|
146
|
+
if (editorExperiment('contextual_formatting_toolbar', true)) {
|
|
147
|
+
var shouldNotAddSeparator = false;
|
|
148
|
+
if (resolved[i] && resolved[i + 1]) {
|
|
149
|
+
var _resolved$i2, _resolved, _resolved$i3, _resolved2;
|
|
150
|
+
shouldNotAddSeparator = ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i3 = resolved[i]) === null || _resolved$i3 === void 0 ? void 0 : _resolved$i3.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
|
|
151
|
+
}
|
|
152
|
+
if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
|
|
153
|
+
items.push({
|
|
154
|
+
type: 'separator'
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
if (i !== resolved.length - 1) {
|
|
159
|
+
items.push({
|
|
160
|
+
type: 'separator'
|
|
161
|
+
});
|
|
162
|
+
}
|
|
146
163
|
}
|
|
147
164
|
}
|
|
148
165
|
var calcToolbarPosition = options.config.preferenceToolbarAboveSelection ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^96.
|
|
39
|
+
"@atlaskit/editor-common": "^96.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|