@atlaskit/editor-plugin-selection-toolbar 1.4.0 → 1.5.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/index.js +2 -2
  3. package/dist/cjs/{plugin.js → selectionToolbarPlugin.js} +8 -5
  4. package/dist/cjs/selectionToolbarPluginType.js +5 -0
  5. package/dist/es2019/index.js +1 -1
  6. package/dist/es2019/{plugin.js → selectionToolbarPlugin.js} +8 -5
  7. package/dist/es2019/selectionToolbarPluginType.js +1 -0
  8. package/dist/esm/index.js +1 -1
  9. package/dist/esm/{plugin.js → selectionToolbarPlugin.js} +8 -5
  10. package/dist/esm/selectionToolbarPluginType.js +1 -0
  11. package/dist/types/index.d.ts +2 -2
  12. package/dist/types/selectionToolbarPlugin.d.ts +2 -0
  13. package/dist/types/{plugin.d.ts → selectionToolbarPluginType.d.ts} +1 -2
  14. package/dist/types-ts4.5/index.d.ts +2 -2
  15. package/dist/types-ts4.5/selectionToolbarPlugin.d.ts +2 -0
  16. package/dist/types-ts4.5/{plugin.d.ts → selectionToolbarPluginType.d.ts} +1 -2
  17. package/package.json +6 -3
  18. /package/dist/cjs/{calculate-toolbar-position.js → pm-plugins/calculate-toolbar-position.js} +0 -0
  19. /package/dist/cjs/{commands.js → pm-plugins/commands.js} +0 -0
  20. /package/dist/cjs/{plugin-key.js → pm-plugins/plugin-key.js} +0 -0
  21. /package/dist/cjs/{types.js → types/index.js} +0 -0
  22. /package/dist/es2019/{calculate-toolbar-position.js → pm-plugins/calculate-toolbar-position.js} +0 -0
  23. /package/dist/es2019/{commands.js → pm-plugins/commands.js} +0 -0
  24. /package/dist/es2019/{plugin-key.js → pm-plugins/plugin-key.js} +0 -0
  25. /package/dist/es2019/{types.js → types/index.js} +0 -0
  26. /package/dist/esm/{calculate-toolbar-position.js → pm-plugins/calculate-toolbar-position.js} +0 -0
  27. /package/dist/esm/{commands.js → pm-plugins/commands.js} +0 -0
  28. /package/dist/esm/{plugin-key.js → pm-plugins/plugin-key.js} +0 -0
  29. /package/dist/esm/{types.js → types/index.js} +0 -0
  30. /package/dist/types/{calculate-toolbar-position.d.ts → pm-plugins/calculate-toolbar-position.d.ts} +0 -0
  31. /package/dist/types/{commands.d.ts → pm-plugins/commands.d.ts} +0 -0
  32. /package/dist/types/{plugin-key.d.ts → pm-plugins/plugin-key.d.ts} +0 -0
  33. /package/dist/types/{types.d.ts → types/index.d.ts} +0 -0
  34. /package/dist/types-ts4.5/{calculate-toolbar-position.d.ts → pm-plugins/calculate-toolbar-position.d.ts} +0 -0
  35. /package/dist/types-ts4.5/{commands.d.ts → pm-plugins/commands.d.ts} +0 -0
  36. /package/dist/types-ts4.5/{plugin-key.d.ts → pm-plugins/plugin-key.d.ts} +0 -0
  37. /package/dist/types-ts4.5/{types.d.ts → types/index.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#171440](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171440)
8
+ [`835f7bbff3122`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/835f7bbff3122) -
9
+ ED-25816: refactors plugins to meet folder standards
10
+ - Updated dependencies
11
+
12
+ ## 1.5.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#173684](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/173684)
17
+ [`e022c83d84bd3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e022c83d84bd3) -
18
+ Fix errors caused by not checking for undefined annotation toolbar
19
+
3
20
  ## 1.4.0
4
21
 
5
22
  ### Minor Changes
package/dist/cjs/index.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "selectionToolbarPlugin", {
7
7
  enumerable: true,
8
8
  get: function get() {
9
- return _plugin.selectionToolbarPlugin;
9
+ return _selectionToolbarPlugin.selectionToolbarPlugin;
10
10
  }
11
11
  });
12
- var _plugin = require("./plugin");
12
+ var _selectionToolbarPlugin = require("./selectionToolbarPlugin");
@@ -13,8 +13,8 @@ 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
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
- var _commands = require("./commands");
17
- var _pluginKey = require("./plugin-key");
16
+ var _commands = require("./pm-plugins/commands");
17
+ var _pluginKey = require("./pm-plugins/plugin-key");
18
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; }
19
19
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
20
  var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selectionToolbarPlugin(options) {
@@ -145,13 +145,16 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
145
145
 
146
146
  // This flattens the groups passed into the floating toolbar into a single list of items
147
147
  for (var i = 0; i < resolved.length; i++) {
148
+ var _resolved$i;
148
149
  // add a seperator icon after each group except the last
149
- items.push.apply(items, (0, _toConsumableArray2.default)(resolved[i].items));
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
+ }
150
153
  if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true)) {
151
154
  var shouldNotAddSeparator = false;
152
155
  if (resolved[i] && resolved[i + 1]) {
153
- var _resolved$i, _resolved, _resolved$i2, _resolved2;
154
- shouldNotAddSeparator = ((_resolved$i = resolved[i]) === null || _resolved$i === void 0 ? void 0 : _resolved$i.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
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';
155
158
  }
156
159
  if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
157
160
  items.push({
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1 +1 @@
1
- export { selectionToolbarPlugin } from './plugin';
1
+ export { selectionToolbarPlugin } from './selectionToolbarPlugin';
@@ -4,8 +4,8 @@ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHe
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
- import { toggleToolbar } from './commands';
8
- import { selectionToolbarPluginKey } from './plugin-key';
7
+ import { toggleToolbar } from './pm-plugins/commands';
8
+ import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
9
9
  export const selectionToolbarPlugin = options => {
10
10
  let __selectionToolbarHandlers = [];
11
11
  return {
@@ -134,13 +134,16 @@ export const selectionToolbarPlugin = options => {
134
134
 
135
135
  // This flattens the groups passed into the floating toolbar into a single list of items
136
136
  for (let i = 0; i < resolved.length; i++) {
137
+ var _resolved$i;
137
138
  // add a seperator icon after each group except the last
138
- items.push(...resolved[i].items);
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
+ }
139
142
  if (editorExperiment('contextual_formatting_toolbar', true)) {
140
143
  let shouldNotAddSeparator = false;
141
144
  if (resolved[i] && resolved[i + 1]) {
142
- var _resolved$i, _resolved, _resolved$i2, _resolved2;
143
- shouldNotAddSeparator = ((_resolved$i = resolved[i]) === null || _resolved$i === void 0 ? void 0 : _resolved$i.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
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';
144
147
  }
145
148
  if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
146
149
  items.push({
@@ -0,0 +1 @@
1
+ export {};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export { selectionToolbarPlugin } from './plugin';
1
+ export { selectionToolbarPlugin } from './selectionToolbarPlugin';
@@ -8,8 +8,8 @@ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHe
8
8
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
- import { toggleToolbar } from './commands';
12
- import { selectionToolbarPluginKey } from './plugin-key';
11
+ import { toggleToolbar } from './pm-plugins/commands';
12
+ import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
13
13
  export var selectionToolbarPlugin = function selectionToolbarPlugin(options) {
14
14
  var __selectionToolbarHandlers = [];
15
15
  return _objectSpread(_objectSpread({
@@ -138,13 +138,16 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(options) {
138
138
 
139
139
  // This flattens the groups passed into the floating toolbar into a single list of items
140
140
  for (var i = 0; i < resolved.length; i++) {
141
+ var _resolved$i;
141
142
  // add a seperator icon after each group except the last
142
- items.push.apply(items, _toConsumableArray(resolved[i].items));
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
+ }
143
146
  if (editorExperiment('contextual_formatting_toolbar', true)) {
144
147
  var shouldNotAddSeparator = false;
145
148
  if (resolved[i] && resolved[i + 1]) {
146
- var _resolved$i, _resolved, _resolved$i2, _resolved2;
147
- shouldNotAddSeparator = ((_resolved$i = resolved[i]) === null || _resolved$i === void 0 ? void 0 : _resolved$i.pluginName) === 'textColor' && ((_resolved = resolved[i + 1]) === null || _resolved === void 0 ? void 0 : _resolved.pluginName) === 'highlight' || ((_resolved$i2 = resolved[i]) === null || _resolved$i2 === void 0 ? void 0 : _resolved$i2.pluginName) === 'alignment' && ((_resolved2 = resolved[i + 1]) === null || _resolved2 === void 0 ? void 0 : _resolved2.pluginName) === 'toolbarListsIndentation';
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';
148
151
  }
149
152
  if (i !== resolved.length - 1 && !shouldNotAddSeparator) {
150
153
  items.push({
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- export { selectionToolbarPlugin } from './plugin';
2
- export type { SelectionToolbarPlugin } from './plugin';
1
+ export { selectionToolbarPlugin } from './selectionToolbarPlugin';
2
+ export type { SelectionToolbarPlugin } from './selectionToolbarPluginType';
@@ -0,0 +1,2 @@
1
+ import type { SelectionToolbarPlugin } from './selectionToolbarPluginType';
2
+ export declare const selectionToolbarPlugin: SelectionToolbarPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
3
- export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar', {
3
+ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
4
4
  pluginConfiguration: {
5
5
  /**
6
6
  * Defaults to false
@@ -13,4 +13,3 @@ export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar'
13
13
  unsuppressToolbar?: () => boolean;
14
14
  };
15
15
  }>;
16
- export type SelectionToolbarPlugin = typeof selectionToolbarPlugin;
@@ -1,2 +1,2 @@
1
- export { selectionToolbarPlugin } from './plugin';
2
- export type { SelectionToolbarPlugin } from './plugin';
1
+ export { selectionToolbarPlugin } from './selectionToolbarPlugin';
2
+ export type { SelectionToolbarPlugin } from './selectionToolbarPluginType';
@@ -0,0 +1,2 @@
1
+ import type { SelectionToolbarPlugin } from './selectionToolbarPluginType';
2
+ export declare const selectionToolbarPlugin: SelectionToolbarPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
3
- export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar', {
3
+ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
4
4
  pluginConfiguration: {
5
5
  /**
6
6
  * Defaults to false
@@ -15,4 +15,3 @@ export declare const selectionToolbarPlugin: NextEditorPlugin<'selectionToolbar'
15
15
  unsuppressToolbar?: () => boolean;
16
16
  };
17
17
  }>;
18
- export type SelectionToolbarPlugin = typeof selectionToolbarPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
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,11 +36,11 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@atlaskit/editor-common": "^96.1.0",
39
+ "@atlaskit/editor-common": "^96.3.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",
43
- "@atlaskit/tmp-editor-statsig": "^2.22.0",
43
+ "@atlaskit/tmp-editor-statsig": "^2.24.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "bind-event-listener": "^3.0.0"
46
46
  },
@@ -58,6 +58,9 @@
58
58
  },
59
59
  "techstack": {
60
60
  "@atlassian/frontend": {
61
+ "code-structure": [
62
+ "editor-plugin"
63
+ ],
61
64
  "import-structure": [
62
65
  "atlassian-conventions"
63
66
  ],
File without changes
File without changes
File without changes
File without changes