@atlaskit/editor-common 74.41.1 → 74.42.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/analytics/types/table-events.js +1 -0
  3. package/dist/cjs/monitoring/error.js +1 -1
  4. package/dist/cjs/preset/plugin-commands.js +10 -0
  5. package/dist/cjs/preset/plugin-injection-api.js +17 -2
  6. package/dist/cjs/ui/DropList/index.js +1 -1
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/es2019/analytics/types/table-events.js +1 -0
  9. package/dist/es2019/monitoring/error.js +1 -1
  10. package/dist/es2019/preset/plugin-commands.js +10 -0
  11. package/dist/es2019/preset/plugin-injection-api.js +17 -2
  12. package/dist/es2019/ui/DropList/index.js +1 -1
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/esm/analytics/types/table-events.js +1 -0
  15. package/dist/esm/monitoring/error.js +1 -1
  16. package/dist/esm/preset/plugin-commands.js +10 -0
  17. package/dist/esm/preset/plugin-injection-api.js +17 -2
  18. package/dist/esm/ui/DropList/index.js +1 -1
  19. package/dist/esm/version.json +1 -1
  20. package/dist/types/analytics/types/table-events.d.ts +11 -3
  21. package/dist/types/hooks/useSharedPluginState.d.ts +5 -5
  22. package/dist/types/preset/plugin-commands.d.ts +10 -0
  23. package/dist/types/preset/plugin-injection-api.d.ts +9 -1
  24. package/dist/types/types/feature-flags.d.ts +0 -6
  25. package/dist/types/types/next-editor-plugin.d.ts +8 -0
  26. package/dist/types-ts4.5/analytics/types/table-events.d.ts +11 -3
  27. package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +5 -5
  28. package/dist/types-ts4.5/preset/plugin-commands.d.ts +10 -0
  29. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +9 -1
  30. package/dist/types-ts4.5/types/feature-flags.d.ts +0 -6
  31. package/dist/types-ts4.5/types/next-editor-plugin.d.ts +8 -0
  32. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.42.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7472b6ab3b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7472b6ab3b4) - [ED-19329] Add analytics event for table resize framerate
8
+ - [`9d2794a7753`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d2794a7753) - Add `executeCommand` to `pluginInjectionAPI` which should be used to dispatch a `PluginCommand` - from the `commands` property of a plugin.
9
+
10
+ ## 74.41.2
11
+
12
+ ### Patch Changes
13
+
14
+ - [`8b104cb7575`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8b104cb7575) - [ED-14769] Remove tableCellOptionsinFloatingToolbar feature flag & make it default behaviour
15
+
3
16
  ## 74.41.1
4
17
 
5
18
  ### Patch Changes
@@ -28,6 +28,7 @@ var TABLE_ACTION = /*#__PURE__*/function (TABLE_ACTION) {
28
28
  TABLE_ACTION["DISTRIBUTED_COLUMNS_WIDTHS"] = "distributedColumnsWidths";
29
29
  TABLE_ACTION["FIXED"] = "fixed";
30
30
  TABLE_ACTION["RESIZED"] = "resized";
31
+ TABLE_ACTION["RESIZE_PERF_SAMPLING"] = "resizePerfSampling";
31
32
  return TABLE_ACTION;
32
33
  }({});
33
34
  exports.TABLE_ACTION = TABLE_ACTION;
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "74.41.1";
19
+ var packageVersion = "74.42.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -4,6 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.pluginCommandToPMCommand = pluginCommandToPMCommand;
7
+ /**
8
+ * Convert a PluginCommand to a standard Prosemirror Command.
9
+ * The preferred approach to dispatching a `PluginCommand` is via the
10
+ * `executeCommand` on `pluginInjectionAPI`. In some cases
11
+ * the type may require a Command until we refactor this out and this
12
+ * function is suitable for those cases.
13
+ *
14
+ * @param command A plugin command (a function that modifies and returns a `Transaction`)
15
+ * @returns Command
16
+ */
7
17
  function pluginCommandToPMCommand(command) {
8
18
  return function (_ref, dispatch) {
9
19
  var tr = _ref.tr;
@@ -13,6 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
13
13
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
14
14
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
15
15
  var _throttle = _interopRequireDefault(require("lodash/throttle"));
16
+ var _pluginCommands = require("./plugin-commands");
16
17
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
17
18
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
19
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -243,7 +244,8 @@ exports.SharedStateAPI = SharedStateAPI;
243
244
  var EditorPluginInjectionAPI = /*#__PURE__*/function () {
244
245
  function EditorPluginInjectionAPI(_ref6) {
245
246
  var _this2 = this;
246
- var getEditorState = _ref6.getEditorState;
247
+ var getEditorState = _ref6.getEditorState,
248
+ getEditorView = _ref6.getEditorView;
247
249
  (0, _classCallCheck2.default)(this, EditorPluginInjectionAPI);
248
250
  (0, _defineProperty2.default)(this, "onEditorViewUpdated", function (_ref7) {
249
251
  var newEditorState = _ref7.newEditorState,
@@ -270,6 +272,7 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
270
272
  this.plugins = new Map();
271
273
  this.actionsAPI = new ActionsAPI();
272
274
  this.commandsAPI = new PluginCommandsAPI();
275
+ this.getEditorView = getEditorView;
273
276
  }
274
277
  (0, _createClass2.default)(EditorPluginInjectionAPI, [{
275
278
  key: "api",
@@ -305,9 +308,21 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
305
308
  }
306
309
  });
307
310
  return {
308
- dependencies: dependencies
311
+ dependencies: dependencies,
312
+ executeCommand: this.executeCommand.bind(this)
309
313
  };
310
314
  }
315
+ }, {
316
+ key: "executeCommand",
317
+ value: function executeCommand(command) {
318
+ var editorView = this.getEditorView();
319
+ if (!editorView || !command) {
320
+ return false;
321
+ }
322
+ var state = editorView.state,
323
+ dispatch = editorView.dispatch;
324
+ return (0, _pluginCommands.pluginCommandToPMCommand)(command)(state, dispatch);
325
+ }
311
326
  }]);
312
327
  return EditorPluginInjectionAPI;
313
328
  }();
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.41.1";
27
+ var packageVersion = "74.42.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.41.1",
3
+ "version": "74.42.0",
4
4
  "sideEffects": false
5
5
  }
@@ -22,6 +22,7 @@ export let TABLE_ACTION = /*#__PURE__*/function (TABLE_ACTION) {
22
22
  TABLE_ACTION["DISTRIBUTED_COLUMNS_WIDTHS"] = "distributedColumnsWidths";
23
23
  TABLE_ACTION["FIXED"] = "fixed";
24
24
  TABLE_ACTION["RESIZED"] = "resized";
25
+ TABLE_ACTION["RESIZE_PERF_SAMPLING"] = "resizePerfSampling";
25
26
  return TABLE_ACTION;
26
27
  }({});
27
28
  export let TABLE_BREAKOUT = /*#__PURE__*/function (TABLE_BREAKOUT) {
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "74.41.1";
3
+ const packageVersion = "74.42.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Convert a PluginCommand to a standard Prosemirror Command.
3
+ * The preferred approach to dispatching a `PluginCommand` is via the
4
+ * `executeCommand` on `pluginInjectionAPI`. In some cases
5
+ * the type may require a Command until we refactor this out and this
6
+ * function is suitable for those cases.
7
+ *
8
+ * @param command A plugin command (a function that modifies and returns a `Transaction`)
9
+ * @returns Command
10
+ */
1
11
  export function pluginCommandToPMCommand(command) {
2
12
  return ({
3
13
  tr
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import isEqual from 'lodash/isEqual';
3
3
  import throttle from 'lodash/throttle';
4
+ import { pluginCommandToPMCommand } from './plugin-commands';
4
5
  function hasGetSharedState(plugin) {
5
6
  return typeof plugin.getSharedState === 'function';
6
7
  }
@@ -160,7 +161,8 @@ export class SharedStateAPI {
160
161
  }
161
162
  export class EditorPluginInjectionAPI {
162
163
  constructor({
163
- getEditorState
164
+ getEditorState,
165
+ getEditorView
164
166
  }) {
165
167
  _defineProperty(this, "onEditorViewUpdated", ({
166
168
  newEditorState,
@@ -188,6 +190,7 @@ export class EditorPluginInjectionAPI {
188
190
  this.plugins = new Map();
189
191
  this.actionsAPI = new ActionsAPI();
190
192
  this.commandsAPI = new PluginCommandsAPI();
193
+ this.getEditorView = getEditorView;
191
194
  }
192
195
  api() {
193
196
  const {
@@ -223,7 +226,19 @@ export class EditorPluginInjectionAPI {
223
226
  }
224
227
  });
225
228
  return {
226
- dependencies
229
+ dependencies,
230
+ executeCommand: this.executeCommand.bind(this)
227
231
  };
228
232
  }
233
+ executeCommand(command) {
234
+ const editorView = this.getEditorView();
235
+ if (!editorView || !command) {
236
+ return false;
237
+ }
238
+ const {
239
+ state,
240
+ dispatch
241
+ } = editorView;
242
+ return pluginCommandToPMCommand(command)(state, dispatch);
243
+ }
229
244
  }
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.41.1";
11
+ const packageVersion = "74.42.0";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.41.1",
3
+ "version": "74.42.0",
4
4
  "sideEffects": false
5
5
  }
@@ -22,6 +22,7 @@ export var TABLE_ACTION = /*#__PURE__*/function (TABLE_ACTION) {
22
22
  TABLE_ACTION["DISTRIBUTED_COLUMNS_WIDTHS"] = "distributedColumnsWidths";
23
23
  TABLE_ACTION["FIXED"] = "fixed";
24
24
  TABLE_ACTION["RESIZED"] = "resized";
25
+ TABLE_ACTION["RESIZE_PERF_SAMPLING"] = "resizePerfSampling";
25
26
  return TABLE_ACTION;
26
27
  }({});
27
28
  export var TABLE_BREAKOUT = /*#__PURE__*/function (TABLE_BREAKOUT) {
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "74.41.1";
9
+ var packageVersion = "74.42.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Convert a PluginCommand to a standard Prosemirror Command.
3
+ * The preferred approach to dispatching a `PluginCommand` is via the
4
+ * `executeCommand` on `pluginInjectionAPI`. In some cases
5
+ * the type may require a Command until we refactor this out and this
6
+ * function is suitable for those cases.
7
+ *
8
+ * @param command A plugin command (a function that modifies and returns a `Transaction`)
9
+ * @returns Command
10
+ */
1
11
  export function pluginCommandToPMCommand(command) {
2
12
  return function (_ref, dispatch) {
3
13
  var tr = _ref.tr;
@@ -9,6 +9,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
9
9
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
10
  import isEqual from 'lodash/isEqual';
11
11
  import throttle from 'lodash/throttle';
12
+ import { pluginCommandToPMCommand } from './plugin-commands';
12
13
  function hasGetSharedState(plugin) {
13
14
  return typeof plugin.getSharedState === 'function';
14
15
  }
@@ -234,7 +235,8 @@ export var SharedStateAPI = /*#__PURE__*/function () {
234
235
  export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
235
236
  function EditorPluginInjectionAPI(_ref6) {
236
237
  var _this2 = this;
237
- var getEditorState = _ref6.getEditorState;
238
+ var getEditorState = _ref6.getEditorState,
239
+ getEditorView = _ref6.getEditorView;
238
240
  _classCallCheck(this, EditorPluginInjectionAPI);
239
241
  _defineProperty(this, "onEditorViewUpdated", function (_ref7) {
240
242
  var newEditorState = _ref7.newEditorState,
@@ -261,6 +263,7 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
261
263
  this.plugins = new Map();
262
264
  this.actionsAPI = new ActionsAPI();
263
265
  this.commandsAPI = new PluginCommandsAPI();
266
+ this.getEditorView = getEditorView;
264
267
  }
265
268
  _createClass(EditorPluginInjectionAPI, [{
266
269
  key: "api",
@@ -296,9 +299,21 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
296
299
  }
297
300
  });
298
301
  return {
299
- dependencies: dependencies
302
+ dependencies: dependencies,
303
+ executeCommand: this.executeCommand.bind(this)
300
304
  };
301
305
  }
306
+ }, {
307
+ key: "executeCommand",
308
+ value: function executeCommand(command) {
309
+ var editorView = this.getEditorView();
310
+ if (!editorView || !command) {
311
+ return false;
312
+ }
313
+ var state = editorView.state,
314
+ dispatch = editorView.dispatch;
315
+ return pluginCommandToPMCommand(command)(state, dispatch);
316
+ }
302
317
  }]);
303
318
  return EditorPluginInjectionAPI;
304
319
  }();
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.41.1";
21
+ var packageVersion = "74.42.0";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.41.1",
3
+ "version": "74.42.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import type { TableSortOrder as SortOrder } from '@atlaskit/adf-schema/steps';
2
2
  import type { ACTION_SUBJECT, INPUT_METHOD } from './enums';
3
- import type { TableAEP, UIAEP } from './utils';
3
+ import type { OperationalAEP, TableAEP, UIAEP } from './utils';
4
4
  export declare enum TABLE_ACTION {
5
5
  DELETED = "deleted",
6
6
  CLEARED = "cleared",
@@ -23,7 +23,8 @@ export declare enum TABLE_ACTION {
23
23
  ATTEMPTED_TABLE_WIDTH_CHANGE = "attemptedTableWidthChange",
24
24
  DISTRIBUTED_COLUMNS_WIDTHS = "distributedColumnsWidths",
25
25
  FIXED = "fixed",
26
- RESIZED = "resized"
26
+ RESIZED = "resized",
27
+ RESIZE_PERF_SAMPLING = "resizePerfSampling"
27
28
  }
28
29
  export declare enum TABLE_BREAKOUT {
29
30
  WIDE = "wide",
@@ -57,6 +58,12 @@ type ResizedInfo = {
57
58
  totalTableWidth: number | null;
58
59
  nodeSize: number;
59
60
  } & TotalRowAndColCount;
61
+ type ResizePreviewInfo = {
62
+ frameRate: number;
63
+ isInitialSample: boolean;
64
+ docSize: number;
65
+ nodeSize: number;
66
+ };
60
67
  type TableDeleteAEP = TableAEP<TABLE_ACTION.DELETED, {
61
68
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
62
69
  } & TotalRowAndColCount, undefined>;
@@ -106,5 +113,6 @@ type TableFixedAEP = TableAEP<TABLE_ACTION.FIXED, {
106
113
  reason: string;
107
114
  }, undefined>;
108
115
  type TableResizedAEP = TableAEP<TABLE_ACTION.RESIZED, ResizedInfo, undefined>;
109
- export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP | TableResizedAEP;
116
+ type TableResizePerfSamplingAEP = OperationalAEP<TABLE_ACTION.RESIZE_PERF_SAMPLING, ACTION_SUBJECT.TABLE, undefined, ResizePreviewInfo, undefined>;
117
+ export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP | TableResizedAEP | TableResizePerfSamplingAEP;
110
118
  export {};
@@ -1,8 +1,8 @@
1
- import type { ExtractPluginSharedState, NextEditorPluginMetadata, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
2
- type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPI<any, any> | undefined, PluginList extends string[]> = Readonly<{
3
- [K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPI<any, any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
1
+ import type { ExtractPluginSharedState, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPIWithDependencies } from '../types/next-editor-plugin';
2
+ type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPIWithDependencies<any> | undefined, PluginList extends string[]> = Readonly<{
3
+ [K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPIWithDependencies<any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
4
4
  }>;
5
- type ExtractPluginNames<Name extends string, Metadata extends NextEditorPluginMetadata> = keyof PluginInjectionAPI<Name, Metadata>['dependencies'];
5
+ type ExtractPluginNames<API extends PluginInjectionAPIWithDependencies<any>> = API extends PluginInjectionAPIWithDependencies<any> ? keyof API['dependencies'] : never;
6
6
  /**
7
7
  *
8
8
  * Used to return the current plugin state of
@@ -35,5 +35,5 @@ type ExtractPluginNames<Name extends string, Metadata extends NextEditorPluginMe
35
35
  * @returns A corresponding object, the keys are names of the plugin with `State` appended,
36
36
  * the values are the shared state exposed by that plugin.
37
37
  */
38
- export declare function useSharedPluginState<Name extends string, Metadata extends NextEditorPluginMetadata, PluginNames extends ExtractPluginNames<Name, Metadata>[]>(injectionApi: PluginInjectionAPI<Name, Metadata> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
38
+ export declare function useSharedPluginState<Plugins extends NextEditorPlugin<any, any>[], PluginNames extends ExtractPluginNames<PluginInjectionAPIWithDependencies<Plugins>>[]>(injectionApi: PluginInjectionAPIWithDependencies<Plugins> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
39
39
  export {};
@@ -1,3 +1,13 @@
1
1
  import type { Command } from '../types/command';
2
2
  import type { PluginCommand } from '../types/plugin-command';
3
+ /**
4
+ * Convert a PluginCommand to a standard Prosemirror Command.
5
+ * The preferred approach to dispatching a `PluginCommand` is via the
6
+ * `executeCommand` on `pluginInjectionAPI`. In some cases
7
+ * the type may require a Command until we refactor this out and this
8
+ * function is suitable for those cases.
9
+ *
10
+ * @param command A plugin command (a function that modifies and returns a `Transaction`)
11
+ * @returns Command
12
+ */
3
13
  export declare function pluginCommandToPMCommand(command: PluginCommand | undefined): Command;
@@ -1,9 +1,14 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
3
  import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
4
+ import type { PluginCommand } from '../types/plugin-command';
3
5
  type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
4
6
  type SharedStateAPIProps = {
5
7
  getEditorState: () => EditorState | undefined;
6
8
  };
9
+ interface PluginInjectionAPIProps extends SharedStateAPIProps {
10
+ getEditorView: () => EditorView | undefined;
11
+ }
7
12
  type EditorStateDiff = {
8
13
  readonly newEditorState: EditorState;
9
14
  readonly oldEditorState: EditorState | undefined;
@@ -34,10 +39,13 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
34
39
  private actionsAPI;
35
40
  private commandsAPI;
36
41
  private plugins;
37
- constructor({ getEditorState }: SharedStateAPIProps);
42
+ private getEditorView;
43
+ constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
38
44
  api<T extends NextEditorPlugin<any, any>>(): {
39
45
  dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name extends string, any> | undefined) => DefaultEditorPlugin<infer Name extends string, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (((config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>) | import("../types/next-editor-plugin").OptionalPlugin<(config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : []]>;
46
+ executeCommand: (command: PluginCommand | undefined) => boolean;
40
47
  };
48
+ private executeCommand;
41
49
  onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
42
50
  onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
43
51
  private addPlugin;
@@ -250,12 +250,6 @@ export type FeatureFlags = {
250
250
  * @default undefined
251
251
  */
252
252
  chromeCursorHandlerFixedVersion?: number;
253
- /**
254
- * Enable table cell options in the floating toolbar
255
- * @see https://product-fabric.atlassian.net/browse/ED-14418
256
- * @default false
257
- */
258
- tableCellOptionsInFloatingToolbar?: boolean;
259
253
  /**
260
254
  * @description
261
255
  * Enable display of a preview modal on mouse over of inline smart card
@@ -38,6 +38,14 @@ export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorP
38
38
  NextEditorPlugin<Name, Metadata>,
39
39
  ...ExtractPluginDependenciesFromMetadata<Metadata>
40
40
  ]>;
41
+ /**
42
+ * Dispatches a PluginCommand to ProseMirror
43
+ *
44
+ * @param action A function (PluginCommand | undefined) that takes a `Transaction` and returns a `Transaction` if it
45
+ * is successful or `null` if it shouldn't be dispatched.
46
+ * @returns (boolean) if the command was successful in dispatching
47
+ */
48
+ executeCommand: (action: PluginCommand | undefined) => boolean;
41
49
  };
42
50
  export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
43
51
  dependencies: CreatePluginDependenciesAPI<[
@@ -1,6 +1,6 @@
1
1
  import type { TableSortOrder as SortOrder } from '@atlaskit/adf-schema/steps';
2
2
  import type { ACTION_SUBJECT, INPUT_METHOD } from './enums';
3
- import type { TableAEP, UIAEP } from './utils';
3
+ import type { OperationalAEP, TableAEP, UIAEP } from './utils';
4
4
  export declare enum TABLE_ACTION {
5
5
  DELETED = "deleted",
6
6
  CLEARED = "cleared",
@@ -23,7 +23,8 @@ export declare enum TABLE_ACTION {
23
23
  ATTEMPTED_TABLE_WIDTH_CHANGE = "attemptedTableWidthChange",
24
24
  DISTRIBUTED_COLUMNS_WIDTHS = "distributedColumnsWidths",
25
25
  FIXED = "fixed",
26
- RESIZED = "resized"
26
+ RESIZED = "resized",
27
+ RESIZE_PERF_SAMPLING = "resizePerfSampling"
27
28
  }
28
29
  export declare enum TABLE_BREAKOUT {
29
30
  WIDE = "wide",
@@ -57,6 +58,12 @@ type ResizedInfo = {
57
58
  totalTableWidth: number | null;
58
59
  nodeSize: number;
59
60
  } & TotalRowAndColCount;
61
+ type ResizePreviewInfo = {
62
+ frameRate: number;
63
+ isInitialSample: boolean;
64
+ docSize: number;
65
+ nodeSize: number;
66
+ };
60
67
  type TableDeleteAEP = TableAEP<TABLE_ACTION.DELETED, {
61
68
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
62
69
  } & TotalRowAndColCount, undefined>;
@@ -106,5 +113,6 @@ type TableFixedAEP = TableAEP<TABLE_ACTION.FIXED, {
106
113
  reason: string;
107
114
  }, undefined>;
108
115
  type TableResizedAEP = TableAEP<TABLE_ACTION.RESIZED, ResizedInfo, undefined>;
109
- export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP | TableResizedAEP;
116
+ type TableResizePerfSamplingAEP = OperationalAEP<TABLE_ACTION.RESIZE_PERF_SAMPLING, ACTION_SUBJECT.TABLE, undefined, ResizePreviewInfo, undefined>;
117
+ export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP | TableResizedAEP | TableResizePerfSamplingAEP;
110
118
  export {};
@@ -1,8 +1,8 @@
1
- import type { ExtractPluginSharedState, NextEditorPluginMetadata, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
2
- type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPI<any, any> | undefined, PluginList extends string[]> = Readonly<{
3
- [K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPI<any, any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
1
+ import type { ExtractPluginSharedState, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPIWithDependencies } from '../types/next-editor-plugin';
2
+ type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPIWithDependencies<any> | undefined, PluginList extends string[]> = Readonly<{
3
+ [K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPIWithDependencies<any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
4
4
  }>;
5
- type ExtractPluginNames<Name extends string, Metadata extends NextEditorPluginMetadata> = keyof PluginInjectionAPI<Name, Metadata>['dependencies'];
5
+ type ExtractPluginNames<API extends PluginInjectionAPIWithDependencies<any>> = API extends PluginInjectionAPIWithDependencies<any> ? keyof API['dependencies'] : never;
6
6
  /**
7
7
  *
8
8
  * Used to return the current plugin state of
@@ -35,5 +35,5 @@ type ExtractPluginNames<Name extends string, Metadata extends NextEditorPluginMe
35
35
  * @returns A corresponding object, the keys are names of the plugin with `State` appended,
36
36
  * the values are the shared state exposed by that plugin.
37
37
  */
38
- export declare function useSharedPluginState<Name extends string, Metadata extends NextEditorPluginMetadata, PluginNames extends ExtractPluginNames<Name, Metadata>[]>(injectionApi: PluginInjectionAPI<Name, Metadata> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
38
+ export declare function useSharedPluginState<Plugins extends NextEditorPlugin<any, any>[], PluginNames extends ExtractPluginNames<PluginInjectionAPIWithDependencies<Plugins>>[]>(injectionApi: PluginInjectionAPIWithDependencies<Plugins> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
39
39
  export {};
@@ -1,3 +1,13 @@
1
1
  import type { Command } from '../types/command';
2
2
  import type { PluginCommand } from '../types/plugin-command';
3
+ /**
4
+ * Convert a PluginCommand to a standard Prosemirror Command.
5
+ * The preferred approach to dispatching a `PluginCommand` is via the
6
+ * `executeCommand` on `pluginInjectionAPI`. In some cases
7
+ * the type may require a Command until we refactor this out and this
8
+ * function is suitable for those cases.
9
+ *
10
+ * @param command A plugin command (a function that modifies and returns a `Transaction`)
11
+ * @returns Command
12
+ */
3
13
  export declare function pluginCommandToPMCommand(command: PluginCommand | undefined): Command;
@@ -1,9 +1,14 @@
1
1
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
3
  import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
4
+ import type { PluginCommand } from '../types/plugin-command';
3
5
  type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
4
6
  type SharedStateAPIProps = {
5
7
  getEditorState: () => EditorState | undefined;
6
8
  };
9
+ interface PluginInjectionAPIProps extends SharedStateAPIProps {
10
+ getEditorView: () => EditorView | undefined;
11
+ }
7
12
  type EditorStateDiff = {
8
13
  readonly newEditorState: EditorState;
9
14
  readonly oldEditorState: EditorState | undefined;
@@ -34,7 +39,8 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
34
39
  private actionsAPI;
35
40
  private commandsAPI;
36
41
  private plugins;
37
- constructor({ getEditorState }: SharedStateAPIProps);
42
+ private getEditorView;
43
+ constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
38
44
  api<T extends NextEditorPlugin<any, any>>(): {
39
45
  dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[
40
46
  NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name extends string, any> | undefined) => DefaultEditorPlugin<infer Name extends string, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>,
@@ -42,7 +48,9 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
42
48
  ] : [
43
49
  ]
44
50
  ]>;
51
+ executeCommand: (command: PluginCommand | undefined) => boolean;
45
52
  };
53
+ private executeCommand;
46
54
  onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
47
55
  onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
48
56
  private addPlugin;
@@ -250,12 +250,6 @@ export type FeatureFlags = {
250
250
  * @default undefined
251
251
  */
252
252
  chromeCursorHandlerFixedVersion?: number;
253
- /**
254
- * Enable table cell options in the floating toolbar
255
- * @see https://product-fabric.atlassian.net/browse/ED-14418
256
- * @default false
257
- */
258
- tableCellOptionsInFloatingToolbar?: boolean;
259
253
  /**
260
254
  * @description
261
255
  * Enable display of a preview modal on mouse over of inline smart card
@@ -38,6 +38,14 @@ export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorP
38
38
  NextEditorPlugin<Name, Metadata>,
39
39
  ...ExtractPluginDependenciesFromMetadata<Metadata>
40
40
  ]>;
41
+ /**
42
+ * Dispatches a PluginCommand to ProseMirror
43
+ *
44
+ * @param action A function (PluginCommand | undefined) that takes a `Transaction` and returns a `Transaction` if it
45
+ * is successful or `null` if it shouldn't be dispatched.
46
+ * @returns (boolean) if the command was successful in dispatching
47
+ */
48
+ executeCommand: (action: PluginCommand | undefined) => boolean;
41
49
  };
42
50
  export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
43
51
  dependencies: CreatePluginDependenciesAPI<[
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.41.1",
3
+ "version": "74.42.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -87,7 +87,7 @@
87
87
  "@atlaskit/analytics-namespaced-context": "^6.7.0",
88
88
  "@atlaskit/analytics-next": "^9.1.0",
89
89
  "@atlaskit/analytics-next-stable-react-context": "1.0.1",
90
- "@atlaskit/button": "^16.8.0",
90
+ "@atlaskit/button": "^16.9.0",
91
91
  "@atlaskit/code": "^14.6.0",
92
92
  "@atlaskit/codemod-utils": "^4.2.0",
93
93
  "@atlaskit/editor-palette": "1.5.1",