@atlaskit/editor-common 74.41.2 → 74.42.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 (47) 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/quick-insert/assets/action.js +23 -6
  7. package/dist/cjs/quick-insert/assets/code.js +31 -8
  8. package/dist/cjs/quick-insert/assets/decision.js +19 -5
  9. package/dist/cjs/quick-insert/assets/divider.js +35 -9
  10. package/dist/cjs/quick-insert/use-icon-themed.js +20 -0
  11. package/dist/cjs/ui/DropList/index.js +1 -1
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/analytics/types/table-events.js +1 -0
  14. package/dist/es2019/monitoring/error.js +1 -1
  15. package/dist/es2019/preset/plugin-commands.js +10 -0
  16. package/dist/es2019/preset/plugin-injection-api.js +17 -2
  17. package/dist/es2019/quick-insert/assets/action.js +24 -6
  18. package/dist/es2019/quick-insert/assets/code.js +32 -8
  19. package/dist/es2019/quick-insert/assets/decision.js +20 -5
  20. package/dist/es2019/quick-insert/assets/divider.js +36 -9
  21. package/dist/es2019/quick-insert/use-icon-themed.js +14 -0
  22. package/dist/es2019/ui/DropList/index.js +1 -1
  23. package/dist/es2019/version.json +1 -1
  24. package/dist/esm/analytics/types/table-events.js +1 -0
  25. package/dist/esm/monitoring/error.js +1 -1
  26. package/dist/esm/preset/plugin-commands.js +10 -0
  27. package/dist/esm/preset/plugin-injection-api.js +17 -2
  28. package/dist/esm/quick-insert/assets/action.js +23 -6
  29. package/dist/esm/quick-insert/assets/code.js +31 -8
  30. package/dist/esm/quick-insert/assets/decision.js +19 -5
  31. package/dist/esm/quick-insert/assets/divider.js +35 -9
  32. package/dist/esm/quick-insert/use-icon-themed.js +13 -0
  33. package/dist/esm/ui/DropList/index.js +1 -1
  34. package/dist/esm/version.json +1 -1
  35. package/dist/types/analytics/types/table-events.d.ts +11 -3
  36. package/dist/types/hooks/useSharedPluginState.d.ts +5 -5
  37. package/dist/types/preset/plugin-commands.d.ts +10 -0
  38. package/dist/types/preset/plugin-injection-api.d.ts +9 -1
  39. package/dist/types/quick-insert/use-icon-themed.d.ts +9 -0
  40. package/dist/types/types/next-editor-plugin.d.ts +8 -0
  41. package/dist/types-ts4.5/analytics/types/table-events.d.ts +11 -3
  42. package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +5 -5
  43. package/dist/types-ts4.5/preset/plugin-commands.d.ts +10 -0
  44. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +9 -1
  45. package/dist/types-ts4.5/quick-insert/use-icon-themed.d.ts +9 -0
  46. package/dist/types-ts4.5/types/next-editor-plugin.d.ts +8 -0
  47. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.42.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5f8e4780f9e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f8e4780f9e) - [ux] ED-19473 & ED-19435 Adds dark mode icons for action, code, decision, divider and Editor example to test them in none, light and dark modes.
8
+
9
+ ## 74.42.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`7472b6ab3b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7472b6ab3b4) - [ED-19329] Add analytics event for table resize framerate
14
+ - [`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.
15
+
3
16
  ## 74.41.2
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.2";
19
+ var packageVersion = "74.42.1";
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
  }();
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = IconAction;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
9
+ var _useIconThemed2 = require("../use-icon-themed");
10
10
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
11
11
 
12
12
  function IconAction() {
13
+ var _useIconThemed = (0, _useIconThemed2.useIconThemed)(),
14
+ iconThemed = _useIconThemed.iconThemed;
13
15
  return /*#__PURE__*/_react.default.createElement("svg", {
14
16
  focusable: "false",
15
17
  "aria-hidden": true,
@@ -19,15 +21,24 @@ function IconAction() {
19
21
  fill: "none",
20
22
  fillRule: "evenodd"
21
23
  }, /*#__PURE__*/_react.default.createElement("path", {
22
- fill: "#FFF",
24
+ fill: iconThemed({
25
+ light: '#FFF',
26
+ dark: '#161A1D'
27
+ }),
23
28
  d: "M0 0h40v40H0z"
24
29
  }), /*#__PURE__*/_react.default.createElement("g", {
25
30
  transform: "translate(7 10)"
26
31
  }, /*#__PURE__*/_react.default.createElement("path", {
27
32
  d: "M3 0h30v20H3a3 3 0 01-3-3V3a3 3 0 013-3z",
28
- fill: "#ECEDF0"
33
+ fill: iconThemed({
34
+ light: '#ECEDF0',
35
+ dark: '#454F59'
36
+ })
29
37
  }), /*#__PURE__*/_react.default.createElement("rect", {
30
- fill: "#0052CC",
38
+ fill: iconThemed({
39
+ light: '#0052CC',
40
+ dark: '#09326C'
41
+ }),
31
42
  x: 5,
32
43
  y: 5,
33
44
  width: 10,
@@ -35,9 +46,15 @@ function IconAction() {
35
46
  rx: 2
36
47
  }), /*#__PURE__*/_react.default.createElement("path", {
37
48
  d: "M8.81 12.365l.05.055a.5.5 0 00.77-.042l.048-.065 3.11-4.205a.666.666 0 00-.09-.886.554.554 0 00-.82.098l-2.703 3.655-1.096-1.184a.553.553 0 00-.825 0 .667.667 0 000 .892l1.556 1.682z",
38
- fill: "#FFF"
49
+ fill: iconThemed({
50
+ light: '#FFF',
51
+ dark: '#8696A7'
52
+ })
39
53
  }), /*#__PURE__*/_react.default.createElement("path", {
40
54
  d: "M20 9h13v2H20a1 1 0 010-2z",
41
- fill: "#C1C7D0"
55
+ fill: iconThemed({
56
+ light: '#C1C7D0',
57
+ dark: '#738496'
58
+ })
42
59
  }))));
43
60
  }
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = IconCode;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
9
+ var _useIconThemed2 = require("../use-icon-themed");
10
10
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
11
11
 
12
12
  function IconCode() {
13
+ var _useIconThemed = (0, _useIconThemed2.useIconThemed)(),
14
+ iconThemed = _useIconThemed.iconThemed;
13
15
  return /*#__PURE__*/_react.default.createElement("svg", {
14
16
  focusable: "false",
15
17
  "aria-hidden": true,
@@ -17,16 +19,28 @@ function IconCode() {
17
19
  height: 40,
18
20
  fillRule: "evenodd"
19
21
  }, /*#__PURE__*/_react.default.createElement("path", {
20
- fill: "#fff",
22
+ fill: iconThemed({
23
+ light: '#fff',
24
+ dark: '#161A1D'
25
+ }),
21
26
  d: "M0 0h40v40H0z"
22
27
  }), /*#__PURE__*/_react.default.createElement("path", {
23
- fill: "#ebecf0",
28
+ fill: iconThemed({
29
+ light: '#ebecf0',
30
+ dark: '#2C333A'
31
+ }),
24
32
  d: "M13 6h26v28H13z"
25
33
  }), /*#__PURE__*/_react.default.createElement("path", {
26
34
  d: "M9 6h4v28H9a2 2 0 01-2-2V8a2 2 0 012-2z",
27
- fill: "#dfe1e6"
35
+ fill: iconThemed({
36
+ light: '#dfe1e6',
37
+ dark: '#454F59'
38
+ })
28
39
  }), /*#__PURE__*/_react.default.createElement("g", {
29
- fill: "#a5adba"
40
+ fill: iconThemed({
41
+ light: '#a5adba',
42
+ dark: '#8696A7'
43
+ })
30
44
  }, /*#__PURE__*/_react.default.createElement("rect", {
31
45
  x: 9,
32
46
  y: 9,
@@ -52,7 +66,10 @@ function IconCode() {
52
66
  height: 1,
53
67
  rx: 0.5
54
68
  })), /*#__PURE__*/_react.default.createElement("g", {
55
- fill: "#4c9aff"
69
+ fill: iconThemed({
70
+ light: '#4c9aff',
71
+ dark: '#1D7AFC'
72
+ })
56
73
  }, /*#__PURE__*/_react.default.createElement("rect", {
57
74
  x: 28,
58
75
  y: 25,
@@ -66,7 +83,10 @@ function IconCode() {
66
83
  height: 1,
67
84
  rx: 0.5
68
85
  })), /*#__PURE__*/_react.default.createElement("g", {
69
- fill: "#ff7452"
86
+ fill: iconThemed({
87
+ light: '#ff7452',
88
+ dark: '#B22515'
89
+ })
70
90
  }, /*#__PURE__*/_react.default.createElement("rect", {
71
91
  x: 16,
72
92
  y: 17,
@@ -80,7 +100,10 @@ function IconCode() {
80
100
  height: 1,
81
101
  rx: 0.5
82
102
  })), /*#__PURE__*/_react.default.createElement("g", {
83
- fill: "#a5adba"
103
+ fill: iconThemed({
104
+ light: '#a5adba',
105
+ dark: '#8696A7'
106
+ })
84
107
  }, /*#__PURE__*/_react.default.createElement("rect", {
85
108
  x: 9,
86
109
  y: 13,
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = IconDecision;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
9
+ var _useIconThemed2 = require("../use-icon-themed");
10
10
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
11
11
 
12
12
  function IconDecision() {
13
+ var _useIconThemed = (0, _useIconThemed2.useIconThemed)(),
14
+ iconThemed = _useIconThemed.iconThemed;
13
15
  return /*#__PURE__*/_react.default.createElement("svg", {
14
16
  focusable: "false",
15
17
  "aria-hidden": true,
@@ -19,16 +21,28 @@ function IconDecision() {
19
21
  fill: "none",
20
22
  fillRule: "evenodd"
21
23
  }, /*#__PURE__*/_react.default.createElement("path", {
22
- fill: "#FFF",
24
+ fill: iconThemed({
25
+ light: '#FFF',
26
+ dark: '#161A1D'
27
+ }),
23
28
  d: "M0 0h40v40H0z"
24
29
  }), /*#__PURE__*/_react.default.createElement("path", {
25
30
  d: "M10 10h29v20H10a3 3 0 01-3-3V13a3 3 0 013-3z",
26
- fill: "#ECEDF0"
31
+ fill: iconThemed({
32
+ light: '#ECEDF0',
33
+ dark: '#454F59'
34
+ })
27
35
  }), /*#__PURE__*/_react.default.createElement("path", {
28
36
  d: "M14.414 16l3.293 3.293c.187.187.293.442.293.707v5a1 1 0 01-2 0v-4.586l-3-3V18.5a1 1 0 01-2 0V15a1 1 0 011-1h3.5a1 1 0 010 2h-1.086zm8.293-1.707a.999.999 0 010 1.414l-2.5 2.5a.997.997 0 01-1.414 0 .999.999 0 010-1.414l2.5-2.5a.999.999 0 011.414 0z",
29
- fill: "#36B37E"
37
+ fill: iconThemed({
38
+ light: '#36B37E',
39
+ dark: '#1F845A'
40
+ })
30
41
  }), /*#__PURE__*/_react.default.createElement("path", {
31
42
  d: "M27 19h12v2H27a1 1 0 010-2z",
32
- fill: "#C1C7D0"
43
+ fill: iconThemed({
44
+ light: '#C1C7D0',
45
+ dark: '#738496'
46
+ })
33
47
  })));
34
48
  }
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = IconDivider;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
9
+ var _useIconThemed2 = require("../use-icon-themed");
10
10
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
11
11
 
12
12
  function IconDivider() {
13
+ var _useIconThemed = (0, _useIconThemed2.useIconThemed)(),
14
+ iconThemed = _useIconThemed.iconThemed;
13
15
  return /*#__PURE__*/_react.default.createElement("svg", {
14
16
  focusable: "false",
15
17
  "aria-hidden": true,
@@ -19,52 +21,76 @@ function IconDivider() {
19
21
  fill: "none",
20
22
  fillRule: "evenodd"
21
23
  }, /*#__PURE__*/_react.default.createElement("path", {
22
- fill: "#FFF",
24
+ fill: iconThemed({
25
+ light: '#FFF',
26
+ dark: '#161A1D'
27
+ }),
23
28
  d: "M0 0h40v40H0z"
24
29
  }), /*#__PURE__*/_react.default.createElement("rect", {
25
- fill: "#C1C7D0",
30
+ fill: iconThemed({
31
+ light: '#C1C7D0',
32
+ dark: '#5A6977'
33
+ }),
26
34
  x: 6,
27
35
  y: 19,
28
36
  width: 28,
29
37
  height: 2,
30
38
  rx: 1
31
39
  }), /*#__PURE__*/_react.default.createElement("rect", {
32
- fill: "#C1C7D0",
40
+ fill: iconThemed({
41
+ light: '#C1C7D0',
42
+ dark: '#5A6977'
43
+ }),
33
44
  x: 12,
34
45
  y: 14,
35
46
  width: 16,
36
47
  height: 1,
37
48
  rx: 0.5
38
49
  }), /*#__PURE__*/_react.default.createElement("rect", {
39
- fill: "#C1C7D0",
50
+ fill: iconThemed({
51
+ light: '#C1C7D0',
52
+ dark: '#5A6977'
53
+ }),
40
54
  x: 12,
41
55
  y: 11,
42
56
  width: 16,
43
57
  height: 1,
44
58
  rx: 0.5
45
59
  }), /*#__PURE__*/_react.default.createElement("rect", {
46
- fill: "#C1C7D0",
60
+ fill: iconThemed({
61
+ light: '#C1C7D0',
62
+ dark: '#5A6977'
63
+ }),
47
64
  x: 12,
48
65
  y: 8,
49
66
  width: 16,
50
67
  height: 1,
51
68
  rx: 0.5
52
69
  }), /*#__PURE__*/_react.default.createElement("rect", {
53
- fill: "#C1C7D0",
70
+ fill: iconThemed({
71
+ light: '#C1C7D0',
72
+ dark: '#5A6977'
73
+ }),
54
74
  x: 12,
55
75
  y: 31,
56
76
  width: 9,
57
77
  height: 1,
58
78
  rx: 0.5
59
79
  }), /*#__PURE__*/_react.default.createElement("rect", {
60
- fill: "#C1C7D0",
80
+ fill: iconThemed({
81
+ light: '#C1C7D0',
82
+ dark: '#5A6977'
83
+ }),
61
84
  x: 12,
62
85
  y: 28,
63
86
  width: 16,
64
87
  height: 1,
65
88
  rx: 0.5
66
89
  }), /*#__PURE__*/_react.default.createElement("rect", {
67
- fill: "#C1C7D0",
90
+ fill: iconThemed({
91
+ light: '#C1C7D0',
92
+ dark: '#5A6977'
93
+ }),
68
94
  x: 12,
69
95
  y: 25,
70
96
  width: 16,
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useIconThemed = void 0;
7
+ var _tokens = require("@atlaskit/tokens");
8
+ /**
9
+ * Warning -- if additional color modes beyond light and dark are added in future -- this will have unexpected behaviour
10
+ */
11
+ var useIconThemed = function useIconThemed() {
12
+ var _useThemeObserver = (0, _tokens.useThemeObserver)(),
13
+ colorMode = _useThemeObserver.colorMode;
14
+ return {
15
+ iconThemed: function iconThemed(colors) {
16
+ return colorMode && colorMode === 'dark' ? colors['dark'] : colors['light'];
17
+ }
18
+ };
19
+ };
20
+ exports.useIconThemed = useIconThemed;
@@ -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.2";
27
+ var packageVersion = "74.42.1";
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.2",
3
+ "version": "74.42.1",
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.2";
3
+ const packageVersion = "74.42.1";
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
  }
@@ -1,7 +1,10 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
1
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
2
  import React from 'react';
3
+ import { useIconThemed } from '../use-icon-themed';
4
4
  export default function IconAction() {
5
+ const {
6
+ iconThemed
7
+ } = useIconThemed();
5
8
  return /*#__PURE__*/React.createElement("svg", {
6
9
  focusable: "false",
7
10
  "aria-hidden": true,
@@ -11,15 +14,24 @@ export default function IconAction() {
11
14
  fill: "none",
12
15
  fillRule: "evenodd"
13
16
  }, /*#__PURE__*/React.createElement("path", {
14
- fill: "#FFF",
17
+ fill: iconThemed({
18
+ light: '#FFF',
19
+ dark: '#161A1D'
20
+ }),
15
21
  d: "M0 0h40v40H0z"
16
22
  }), /*#__PURE__*/React.createElement("g", {
17
23
  transform: "translate(7 10)"
18
24
  }, /*#__PURE__*/React.createElement("path", {
19
25
  d: "M3 0h30v20H3a3 3 0 01-3-3V3a3 3 0 013-3z",
20
- fill: "#ECEDF0"
26
+ fill: iconThemed({
27
+ light: '#ECEDF0',
28
+ dark: '#454F59'
29
+ })
21
30
  }), /*#__PURE__*/React.createElement("rect", {
22
- fill: "#0052CC",
31
+ fill: iconThemed({
32
+ light: '#0052CC',
33
+ dark: '#09326C'
34
+ }),
23
35
  x: 5,
24
36
  y: 5,
25
37
  width: 10,
@@ -27,9 +39,15 @@ export default function IconAction() {
27
39
  rx: 2
28
40
  }), /*#__PURE__*/React.createElement("path", {
29
41
  d: "M8.81 12.365l.05.055a.5.5 0 00.77-.042l.048-.065 3.11-4.205a.666.666 0 00-.09-.886.554.554 0 00-.82.098l-2.703 3.655-1.096-1.184a.553.553 0 00-.825 0 .667.667 0 000 .892l1.556 1.682z",
30
- fill: "#FFF"
42
+ fill: iconThemed({
43
+ light: '#FFF',
44
+ dark: '#8696A7'
45
+ })
31
46
  }), /*#__PURE__*/React.createElement("path", {
32
47
  d: "M20 9h13v2H20a1 1 0 010-2z",
33
- fill: "#C1C7D0"
48
+ fill: iconThemed({
49
+ light: '#C1C7D0',
50
+ dark: '#738496'
51
+ })
34
52
  }))));
35
53
  }
@@ -1,7 +1,10 @@
1
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4138
2
1
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
2
  import React from 'react';
3
+ import { useIconThemed } from '../use-icon-themed';
4
4
  export default function IconCode() {
5
+ const {
6
+ iconThemed
7
+ } = useIconThemed();
5
8
  return /*#__PURE__*/React.createElement("svg", {
6
9
  focusable: "false",
7
10
  "aria-hidden": true,
@@ -9,16 +12,28 @@ export default function IconCode() {
9
12
  height: 40,
10
13
  fillRule: "evenodd"
11
14
  }, /*#__PURE__*/React.createElement("path", {
12
- fill: "#fff",
15
+ fill: iconThemed({
16
+ light: '#fff',
17
+ dark: '#161A1D'
18
+ }),
13
19
  d: "M0 0h40v40H0z"
14
20
  }), /*#__PURE__*/React.createElement("path", {
15
- fill: "#ebecf0",
21
+ fill: iconThemed({
22
+ light: '#ebecf0',
23
+ dark: '#2C333A'
24
+ }),
16
25
  d: "M13 6h26v28H13z"
17
26
  }), /*#__PURE__*/React.createElement("path", {
18
27
  d: "M9 6h4v28H9a2 2 0 01-2-2V8a2 2 0 012-2z",
19
- fill: "#dfe1e6"
28
+ fill: iconThemed({
29
+ light: '#dfe1e6',
30
+ dark: '#454F59'
31
+ })
20
32
  }), /*#__PURE__*/React.createElement("g", {
21
- fill: "#a5adba"
33
+ fill: iconThemed({
34
+ light: '#a5adba',
35
+ dark: '#8696A7'
36
+ })
22
37
  }, /*#__PURE__*/React.createElement("rect", {
23
38
  x: 9,
24
39
  y: 9,
@@ -44,7 +59,10 @@ export default function IconCode() {
44
59
  height: 1,
45
60
  rx: 0.5
46
61
  })), /*#__PURE__*/React.createElement("g", {
47
- fill: "#4c9aff"
62
+ fill: iconThemed({
63
+ light: '#4c9aff',
64
+ dark: '#1D7AFC'
65
+ })
48
66
  }, /*#__PURE__*/React.createElement("rect", {
49
67
  x: 28,
50
68
  y: 25,
@@ -58,7 +76,10 @@ export default function IconCode() {
58
76
  height: 1,
59
77
  rx: 0.5
60
78
  })), /*#__PURE__*/React.createElement("g", {
61
- fill: "#ff7452"
79
+ fill: iconThemed({
80
+ light: '#ff7452',
81
+ dark: '#B22515'
82
+ })
62
83
  }, /*#__PURE__*/React.createElement("rect", {
63
84
  x: 16,
64
85
  y: 17,
@@ -72,7 +93,10 @@ export default function IconCode() {
72
93
  height: 1,
73
94
  rx: 0.5
74
95
  })), /*#__PURE__*/React.createElement("g", {
75
- fill: "#a5adba"
96
+ fill: iconThemed({
97
+ light: '#a5adba',
98
+ dark: '#8696A7'
99
+ })
76
100
  }, /*#__PURE__*/React.createElement("rect", {
77
101
  x: 9,
78
102
  y: 13,