@atlaskit/editor-common 74.36.4 → 74.38.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 (79) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/guideline/constants.js +4 -2
  3. package/dist/cjs/guideline/defaultGuideline.js +4 -3
  4. package/dist/cjs/guideline/index.js +10 -4
  5. package/dist/cjs/guideline/snapping.js +42 -30
  6. package/dist/cjs/keymaps/index.js +11 -7
  7. package/dist/cjs/monitoring/error.js +1 -1
  8. package/dist/cjs/preset/index.js +8 -1
  9. package/dist/cjs/preset/plugin-commands.js +19 -0
  10. package/dist/cjs/preset/plugin-injection-api.js +28 -1
  11. package/dist/cjs/types/layout.js +5 -0
  12. package/dist/cjs/types/plugin-command.js +5 -0
  13. package/dist/cjs/types/selection.js +5 -0
  14. package/dist/cjs/ui/DropList/index.js +1 -1
  15. package/dist/cjs/ui/MediaSingle/styled.js +1 -1
  16. package/dist/cjs/version.json +1 -1
  17. package/dist/es2019/guideline/constants.js +2 -1
  18. package/dist/es2019/guideline/defaultGuideline.js +4 -3
  19. package/dist/es2019/guideline/index.js +2 -2
  20. package/dist/es2019/guideline/snapping.js +35 -27
  21. package/dist/es2019/keymaps/index.js +10 -7
  22. package/dist/es2019/monitoring/error.js +1 -1
  23. package/dist/es2019/preset/index.js +2 -1
  24. package/dist/es2019/preset/plugin-commands.js +14 -0
  25. package/dist/es2019/preset/plugin-injection-api.js +21 -1
  26. package/dist/es2019/types/layout.js +1 -0
  27. package/dist/es2019/types/plugin-command.js +1 -0
  28. package/dist/es2019/types/selection.js +1 -0
  29. package/dist/es2019/ui/DropList/index.js +1 -1
  30. package/dist/es2019/ui/MediaSingle/styled.js +8 -7
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/esm/guideline/constants.js +2 -1
  33. package/dist/esm/guideline/defaultGuideline.js +4 -3
  34. package/dist/esm/guideline/index.js +2 -2
  35. package/dist/esm/guideline/snapping.js +40 -28
  36. package/dist/esm/keymaps/index.js +10 -7
  37. package/dist/esm/monitoring/error.js +1 -1
  38. package/dist/esm/preset/index.js +2 -1
  39. package/dist/esm/preset/plugin-commands.js +13 -0
  40. package/dist/esm/preset/plugin-injection-api.js +28 -1
  41. package/dist/esm/types/layout.js +1 -0
  42. package/dist/esm/types/plugin-command.js +1 -0
  43. package/dist/esm/types/selection.js +1 -0
  44. package/dist/esm/ui/DropList/index.js +1 -1
  45. package/dist/esm/ui/MediaSingle/styled.js +2 -1
  46. package/dist/esm/version.json +1 -1
  47. package/dist/types/collab/index.d.ts +25 -0
  48. package/dist/types/guideline/constants.d.ts +1 -0
  49. package/dist/types/guideline/dynamicGuideline.d.ts +1 -1
  50. package/dist/types/guideline/index.d.ts +3 -3
  51. package/dist/types/guideline/snapping.d.ts +12 -11
  52. package/dist/types/guideline/types.d.ts +13 -2
  53. package/dist/types/keymaps/index.d.ts +5 -1
  54. package/dist/types/preset/index.d.ts +1 -0
  55. package/dist/types/preset/plugin-commands.d.ts +3 -0
  56. package/dist/types/preset/plugin-injection-api.d.ts +1 -0
  57. package/dist/types/types/index.d.ts +4 -1
  58. package/dist/types/types/layout.d.ts +6 -0
  59. package/dist/types/types/next-editor-plugin.d.ts +10 -1
  60. package/dist/types/types/plugin-command.d.ts +7 -0
  61. package/dist/types/types/selection.d.ts +3 -0
  62. package/dist/types/ui/MediaSingle/styled.d.ts +3 -2
  63. package/dist/types-ts4.5/collab/index.d.ts +25 -0
  64. package/dist/types-ts4.5/guideline/constants.d.ts +1 -0
  65. package/dist/types-ts4.5/guideline/dynamicGuideline.d.ts +1 -1
  66. package/dist/types-ts4.5/guideline/index.d.ts +3 -3
  67. package/dist/types-ts4.5/guideline/snapping.d.ts +12 -11
  68. package/dist/types-ts4.5/guideline/types.d.ts +13 -2
  69. package/dist/types-ts4.5/keymaps/index.d.ts +5 -1
  70. package/dist/types-ts4.5/preset/index.d.ts +1 -0
  71. package/dist/types-ts4.5/preset/plugin-commands.d.ts +3 -0
  72. package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +1 -0
  73. package/dist/types-ts4.5/types/index.d.ts +4 -1
  74. package/dist/types-ts4.5/types/layout.d.ts +6 -0
  75. package/dist/types-ts4.5/types/next-editor-plugin.d.ts +10 -1
  76. package/dist/types-ts4.5/types/plugin-command.d.ts +7 -0
  77. package/dist/types-ts4.5/types/selection.d.ts +3 -0
  78. package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +3 -2
  79. package/package.json +1 -1
@@ -7,6 +7,9 @@ function hasGetSharedState(plugin) {
7
7
  function hasActions(plugin) {
8
8
  return typeof plugin.actions === 'object';
9
9
  }
10
+ function hasCommands(plugin) {
11
+ return typeof plugin.commands === 'object';
12
+ }
10
13
  const filterPluginsWithListeners = ({
11
14
  listeners,
12
15
  plugins
@@ -70,6 +73,19 @@ class ActionsAPI {
70
73
  });
71
74
  }
72
75
  }
76
+ class PluginCommandsAPI {
77
+ createAPI(plugin) {
78
+ if (!plugin || !hasCommands(plugin)) {
79
+ return {};
80
+ }
81
+ return new Proxy(plugin.commands || {}, {
82
+ get: function (target, prop, receiver) {
83
+ // We will be able to track perfomance here
84
+ return Reflect.get(target, prop);
85
+ }
86
+ });
87
+ }
88
+ }
73
89
  export class SharedStateAPI {
74
90
  constructor({
75
91
  getEditorState
@@ -171,11 +187,13 @@ export class EditorPluginInjectionAPI {
171
187
  });
172
188
  this.plugins = new Map();
173
189
  this.actionsAPI = new ActionsAPI();
190
+ this.commandsAPI = new PluginCommandsAPI();
174
191
  }
175
192
  api() {
176
193
  const {
177
194
  sharedStateAPI,
178
195
  actionsAPI,
196
+ commandsAPI,
179
197
  getPluginByName
180
198
  } = this;
181
199
  const dependencies = new Proxy({}, {
@@ -195,9 +213,11 @@ export class EditorPluginInjectionAPI {
195
213
  }
196
214
  const sharedState = sharedStateAPI.createAPI(plugin);
197
215
  const actions = actionsAPI.createAPI(plugin);
216
+ const commands = commandsAPI.createAPI(plugin);
198
217
  const proxyCoreAPI = {
199
218
  sharedState,
200
- actions
219
+ actions,
220
+ commands
201
221
  };
202
222
  return proxyCoreAPI;
203
223
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -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.36.4";
11
+ const packageVersion = "74.38.0";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import React from 'react';
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
@@ -134,16 +135,16 @@ export const MediaSingleDimensionHelper = ({
134
135
  min-width: 100%;
135
136
  `}
136
137
  max-width: ${calcMaxWidth(layout, containerWidth)};
137
- &[class*='is-resizing'] {
138
- ${isExtendedResizeExperienceOn && `max-width: ${calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode)};
138
+ ${isExtendedResizeExperienceOn && `&[class*='is-resizing'] {
139
+ .new-file-experience-wrapper {
140
+ box-shadow: none !important;
141
+ }
142
+
143
+ max-width: ${calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode)};
139
144
 
140
145
  ${nonWrappedLayouts.includes(layout) && `margin-left: 50%;
141
146
  transform: translateX(-50%);`}
142
-
143
- .new-file-experience-wrapper {
144
- box-shadow: none;
145
- }`}
146
- }
147
+ }`}
147
148
 
148
149
  /* Handles responsiveness of non-nested, not-resizing nodes in editor */
149
150
  &[class*='not-resizing'] {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.36.4",
3
+ "version": "74.38.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1 +1,2 @@
1
- export var MEDIA_DYNAMIC_GUIDELINE_PREFIX = 'media_';
1
+ export var MEDIA_DYNAMIC_GUIDELINE_PREFIX = 'media_';
2
+ export var INNER_GRID_GUIDELINE_PREFIX = 'grid_';
@@ -1,19 +1,20 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import memoizeOne from 'memoize-one';
3
3
  import { breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
4
+ import { roundToNearest } from '../media-single';
4
5
  import { getContainerWidthOrFullEditorWidth } from './utils';
5
6
  var getDefaultGuidelines = memoizeOne(function (editorWidth) {
6
7
  return [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6].map(function (val, index) {
7
8
  return {
8
9
  key: "grid_".concat(index),
9
10
  position: {
10
- x: val / 12 * editorWidth
11
+ x: roundToNearest(val / 12 * editorWidth)
11
12
  }
12
13
  };
13
14
  });
14
15
  });
15
16
  var getWideGuidelines = memoizeOne(function (editorWidth) {
16
- var wideSpacing = editorWidth * breakoutWideScaleRatio / 2;
17
+ var wideSpacing = roundToNearest(editorWidth * breakoutWideScaleRatio / 2);
17
18
  return [{
18
19
  key: "wide_left",
19
20
  position: {
@@ -27,7 +28,7 @@ var getWideGuidelines = memoizeOne(function (editorWidth) {
27
28
  }];
28
29
  });
29
30
  var getFullWidthGuidelines = memoizeOne(function (containerWidth) {
30
- var fullWidth = getContainerWidthOrFullEditorWidth(containerWidth);
31
+ var fullWidth = roundToNearest(getContainerWidthOrFullEditorWidth(containerWidth));
31
32
  return [{
32
33
  key: "full_width_left",
33
34
  position: {
@@ -2,6 +2,6 @@ export { generateDynamicGuidelines } from './dynamicGuideline';
2
2
  export { createFixedGuidelinesFromLengths, createGuidesFromLengths } from './fixedGuideline';
3
3
  export { generateDefaultGuidelines } from './defaultGuideline';
4
4
  export { getGuidelinesWithHighlights } from './updateGuideline';
5
- export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
6
- export { getSnapWidth, findClosestSnap } from './snapping';
5
+ export { MEDIA_DYNAMIC_GUIDELINE_PREFIX, INNER_GRID_GUIDELINE_PREFIX } from './constants';
6
+ export { getGuidelineSnaps, findClosestSnap } from './snapping';
7
7
  export { isVerticalPosition, getContainerWidthOrFullEditorWidth } from './utils';
@@ -1,21 +1,25 @@
1
- import { MediaSingleLayout } from '../media-single';
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import memoizeOne from 'memoize-one';
2
3
  import { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
4
+ import { isVerticalPosition } from './utils';
5
+
3
6
  /**
4
7
  * Returns keys of guidelines that are closest to the image and withthin the snapGap.
5
8
  * If both default and dynamic guidelines present, only returns default guidelines
6
9
  */
7
- export var findClosestSnap = function findClosestSnap(mediaSingleWidth, snapArray, snapTo) {
10
+ export var findClosestSnap = function findClosestSnap(mediaSingleWidth, snapArray, guidelineSnaps) {
8
11
  var snapGap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
9
12
  var closestGapIndex = snapArray.reduce(function (prev, curr, index) {
10
13
  return Math.abs(curr - mediaSingleWidth) < Math.abs(snapArray[prev] - mediaSingleWidth) ? index : prev;
11
14
  }, 0);
12
15
  var gap = Math.abs(snapArray[closestGapIndex] - mediaSingleWidth);
13
16
  if (gap < snapGap) {
14
- var snappingWidth = Math.round(snapTo[closestGapIndex].width);
17
+ var snappingWidth = snapArray[closestGapIndex];
15
18
  var guidelineKeys = [];
16
- snapTo.forEach(function (s) {
17
- if (Math.round(Math.abs(s.width)) === snappingWidth) {
18
- guidelineKeys.push(s.guidelineKey);
19
+ // find wich guideline have the matching snap width
20
+ guidelineSnaps.forEach(function (gs) {
21
+ if (gs.width === snappingWidth) {
22
+ guidelineKeys.push(gs.guidelineKey);
19
23
  }
20
24
  });
21
25
  var defaultGuidelineKeys = guidelineKeys.filter(function (guidelineKey) {
@@ -33,35 +37,43 @@ export var findClosestSnap = function findClosestSnap(mediaSingleWidth, snapArra
33
37
  keys: []
34
38
  };
35
39
  };
36
-
37
- /**
38
- * Get snapping widths and respective guideline keys
39
- */
40
- export var getSnapWidth = function getSnapWidth(guidelines, mediaSingleWidth, snap, layout) {
41
- return guidelines.map(function (guideline) {
42
- var _guideline$position;
43
- var positionX = (_guideline$position = guideline.position) !== null && _guideline$position !== void 0 && _guideline$position.x && typeof guideline.position.x === 'number' ? guideline.position.x : 0;
44
- if (layout === MediaSingleLayout.CENTER || layout === MediaSingleLayout.WIDE || layout === MediaSingleLayout.FULL_WIDTH) {
45
- return {
46
- guidelineKey: guideline.key,
47
- width: mediaSingleWidth + (snap - positionX) * 2
48
- };
49
- } else if (layout === MediaSingleLayout.ALIGN_END || layout === MediaSingleLayout.WRAP_RIGHT) {
40
+ export var getGuidelineSnaps = memoizeOne(function (guidelines, editorWidth) {
41
+ var layout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'center';
42
+ var offset = editorWidth / 2;
43
+ var getPositionX = function getPositionX(position) {
44
+ return isVerticalPosition(position) ? position.x : 0;
45
+ };
46
+ var calcXSnaps = function calcXSnaps(guidelineReference) {
47
+ var snapsWidth = guidelineReference.filter(function (g) {
48
+ return g.width > 0;
49
+ }).map(function (g) {
50
+ return g.width;
51
+ });
52
+ var uniqueSnapWidth = _toConsumableArray(new Set(snapsWidth));
53
+ return snapsWidth.length ? uniqueSnapWidth : undefined;
54
+ };
55
+ var guidelinesSnapsReference = guidelines.map(function (guideline) {
56
+ var positionX = getPositionX(guideline.position);
57
+ if (['align-end', 'wrap-right'].includes(layout)) {
50
58
  return {
51
59
  guidelineKey: guideline.key,
52
- width: mediaSingleWidth + (snap - positionX)
60
+ width: offset - positionX
53
61
  };
54
- } else if (layout === MediaSingleLayout.ALIGN_START || layout === MediaSingleLayout.WRAP_LEFT) {
62
+ } else if (['align-start', 'wrap-left'].includes(layout)) {
55
63
  return {
56
64
  guidelineKey: guideline.key,
57
- width: mediaSingleWidth + positionX - snap
65
+ width: positionX + offset
58
66
  };
59
67
  }
60
68
  return {
61
- guidelineKey: '',
62
- width: 0
69
+ guidelineKey: guideline.key,
70
+ width: Math.abs(positionX) * 2
63
71
  };
64
- }).filter(function (guideline) {
65
- return guideline.guidelineKey !== '';
66
72
  });
67
- };
73
+ return {
74
+ guidelineReference: guidelinesSnapsReference,
75
+ snaps: {
76
+ x: calcXSnaps(guidelinesSnapsReference)
77
+ }
78
+ };
79
+ });
@@ -5,6 +5,7 @@ var _templateObject;
5
5
  import React, { Fragment } from 'react';
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { N400 } from '@atlaskit/theme/colors';
8
+ import { pluginCommandToPMCommand } from '../preset/plugin-commands';
8
9
  import { browser } from '../utils';
9
10
  export var addAltText = makeKeyMapWithCommon('Add Alt Text', 'Mod-Alt-y');
10
11
  export var navToEditorToolbar = makeKeyMapWithCommon('Navigate to editor toolbar', 'Alt-F9');
@@ -182,15 +183,17 @@ export function makeKeyMapWithCommon(description, common) {
182
183
  var mac = common.replace(/Mod/i, 'Cmd');
183
184
  return makeKeymap(description, windows, mac, common);
184
185
  }
186
+ function combineWithOldCommand(cmd, oldCmd) {
187
+ return function (state, dispatch, editorView) {
188
+ return oldCmd(state, dispatch) || cmd(state, dispatch, editorView);
189
+ };
190
+ }
185
191
  export function bindKeymapWithCommand(shortcut, cmd, keymap) {
186
192
  var oldCmd = keymap[shortcut];
187
- var newCmd = cmd;
188
- if (keymap[shortcut]) {
189
- newCmd = function newCmd(state, dispatch, editorView) {
190
- return oldCmd(state, dispatch) || cmd(state, dispatch, editorView);
191
- };
192
- }
193
- keymap[shortcut] = newCmd;
193
+ keymap[shortcut] = oldCmd ? combineWithOldCommand(cmd, oldCmd) : cmd;
194
+ }
195
+ export function bindKeymapWithPluginCommand(shortcut, cmd, keymap) {
196
+ bindKeymapWithCommand(shortcut, pluginCommandToPMCommand(cmd), keymap);
194
197
  }
195
198
  export function findKeyMapForBrowser(keyMap) {
196
199
  if (keyMap) {
@@ -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.36.4";
9
+ var packageVersion = "74.38.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,2 +1,3 @@
1
1
  export { EditorPresetBuilder } from './builder';
2
- export { EditorPluginInjectionAPI } from './plugin-injection-api';
2
+ export { EditorPluginInjectionAPI } from './plugin-injection-api';
3
+ export { pluginCommandToPMCommand } from './plugin-commands';
@@ -0,0 +1,13 @@
1
+ export function pluginCommandToPMCommand(command) {
2
+ return function (_ref, dispatch) {
3
+ var tr = _ref.tr;
4
+ var newTr = command === null || command === void 0 ? void 0 : command({
5
+ tr: tr
6
+ });
7
+ if (newTr) {
8
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch(newTr);
9
+ return true;
10
+ }
11
+ return false;
12
+ };
13
+ }
@@ -15,6 +15,9 @@ function hasGetSharedState(plugin) {
15
15
  function hasActions(plugin) {
16
16
  return _typeof(plugin.actions) === 'object';
17
17
  }
18
+ function hasCommands(plugin) {
19
+ return _typeof(plugin.commands) === 'object';
20
+ }
18
21
  var filterPluginsWithListeners = function filterPluginsWithListeners(_ref) {
19
22
  var listeners = _ref.listeners,
20
23
  plugins = _ref.plugins;
@@ -113,6 +116,26 @@ var ActionsAPI = /*#__PURE__*/function () {
113
116
  }]);
114
117
  return ActionsAPI;
115
118
  }();
119
+ var PluginCommandsAPI = /*#__PURE__*/function () {
120
+ function PluginCommandsAPI() {
121
+ _classCallCheck(this, PluginCommandsAPI);
122
+ }
123
+ _createClass(PluginCommandsAPI, [{
124
+ key: "createAPI",
125
+ value: function createAPI(plugin) {
126
+ if (!plugin || !hasCommands(plugin)) {
127
+ return {};
128
+ }
129
+ return new Proxy(plugin.commands || {}, {
130
+ get: function get(target, prop, receiver) {
131
+ // We will be able to track perfomance here
132
+ return Reflect.get(target, prop);
133
+ }
134
+ });
135
+ }
136
+ }]);
137
+ return PluginCommandsAPI;
138
+ }();
116
139
  export var SharedStateAPI = /*#__PURE__*/function () {
117
140
  function SharedStateAPI(_ref4) {
118
141
  var getEditorState = _ref4.getEditorState;
@@ -237,12 +260,14 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
237
260
  });
238
261
  this.plugins = new Map();
239
262
  this.actionsAPI = new ActionsAPI();
263
+ this.commandsAPI = new PluginCommandsAPI();
240
264
  }
241
265
  _createClass(EditorPluginInjectionAPI, [{
242
266
  key: "api",
243
267
  value: function api() {
244
268
  var sharedStateAPI = this.sharedStateAPI,
245
269
  actionsAPI = this.actionsAPI,
270
+ commandsAPI = this.commandsAPI,
246
271
  getPluginByName = this.getPluginByName;
247
272
  var dependencies = new Proxy({}, {
248
273
  get: function get(target, prop, receiver) {
@@ -261,9 +286,11 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
261
286
  }
262
287
  var sharedState = sharedStateAPI.createAPI(plugin);
263
288
  var actions = actionsAPI.createAPI(plugin);
289
+ var commands = commandsAPI.createAPI(plugin);
264
290
  var proxyCoreAPI = {
265
291
  sharedState: sharedState,
266
- actions: actions
292
+ actions: actions,
293
+ commands: commands
267
294
  };
268
295
  return proxyCoreAPI;
269
296
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -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.36.4";
21
+ var packageVersion = "74.38.0";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -3,6 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _excluded = ["children"];
4
4
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
5
5
  /** @jsx jsx */
6
+
6
7
  import React from 'react';
7
8
  import { css, jsx } from '@emotion/react';
8
9
  import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
@@ -131,7 +132,7 @@ export var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref
131
132
  isExtendedResizeExperienceOn = _ref.isExtendedResizeExperienceOn,
132
133
  _ref$isNestedNode = _ref.isNestedNode,
133
134
  isNestedNode = _ref$isNestedNode === void 0 ? false : _ref$isNestedNode;
134
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n &[class*='is-resizing'] {\n ", "\n }\n\n /* Handles responsiveness of non-nested, not-resizing nodes in editor */\n &[class*='not-resizing'] {\n ", "\n }\n\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), isExtendedResizeExperienceOn && "max-width: ".concat(calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode), ";\n\n ").concat(nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n .new-file-experience-wrapper {\n box-shadow: none;\n }"), !isNestedNode && "max-width: ".concat(layout !== 'full-width' && mediaSingleWidth && calcMaxWidthWhenNotResizing(containerWidth, mediaSingleWidth), ";\n\n ").concat(nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n // override min-width to counteract max-width set in old experience\n ").concat(layout === 'full-width' && "min-width: ".concat(getEffectiveFullWidth(containerWidth, fullWidthMode), " !important;"), ";"), float(layout), calcMargin(layout), isImageAligned(layout));
135
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n ", "\n\n /* Handles responsiveness of non-nested, not-resizing nodes in editor */\n &[class*='not-resizing'] {\n ", "\n }\n\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), isExtendedResizeExperienceOn && "&[class*='is-resizing'] {\n .new-file-experience-wrapper {\n box-shadow: none !important;\n }\n\n max-width: ".concat(calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode), ";\n\n ").concat(nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n }"), !isNestedNode && "max-width: ".concat(layout !== 'full-width' && mediaSingleWidth && calcMaxWidthWhenNotResizing(containerWidth, mediaSingleWidth), ";\n\n ").concat(nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n // override min-width to counteract max-width set in old experience\n ").concat(layout === 'full-width' && "min-width: ".concat(getEffectiveFullWidth(containerWidth, fullWidthMode), " !important;"), ";"), float(layout), calcMargin(layout), isImageAligned(layout));
135
136
  };
136
137
  var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
137
138
  var hasFallbackContainer = _ref2.hasFallbackContainer,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.36.4",
3
+ "version": "74.38.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,8 @@
1
+ import type { ReactElement } from 'react';
1
2
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
4
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
5
+ import type { Providers } from '../provider-factory';
4
6
  export type NewCollabSyncUpErrorAttributes = {
5
7
  lengthOfUnconfirmedSteps?: number;
6
8
  tries: number;
@@ -348,4 +350,27 @@ export interface CollabEditProvider<Events extends CollabEvents = CollabEvents>
348
350
  } & Events[K]): void;
349
351
  getFinalAcknowledgedState(): Promise<ResolvedEditorState>;
350
352
  }
353
+ export type CollabEditOptions = {
354
+ provider?: Providers['collabEditProvider'];
355
+ userId?: string;
356
+ useNativePlugin?: boolean;
357
+ } & CollabInviteToEditProps & CollabAnalyticsProps;
358
+ export type InviteToEditButtonProps = {
359
+ onClick: (event: React.MouseEvent<HTMLElement>) => void;
360
+ selected: boolean;
361
+ };
362
+ export type InviteToEditComponentProps = {
363
+ children: ReactElement<InviteToEditButtonProps>;
364
+ };
365
+ export interface CollabInviteToEditProps {
366
+ inviteToEditHandler?: (event: React.MouseEvent<HTMLElement>) => void;
367
+ isInviteToEditButtonSelected?: boolean;
368
+ inviteToEditComponent?: React.ComponentType<InviteToEditComponentProps>;
369
+ }
370
+ export interface CollabAnalyticsProps {
371
+ /**
372
+ * @description Control wether Synchrony entity error events are tracked
373
+ */
374
+ EXPERIMENTAL_allowInternalErrorAnalytics?: boolean;
375
+ }
351
376
  export {};
@@ -1 +1,2 @@
1
1
  export declare const MEDIA_DYNAMIC_GUIDELINE_PREFIX = "media_";
2
+ export declare const INNER_GRID_GUIDELINE_PREFIX = "grid_";
@@ -1,4 +1,4 @@
1
- import { EditorState } from '@atlaskit/editor-prosemirror/state';
1
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { GuidelineConfig } from './types';
3
3
  export declare const generateDynamicGuidelines: (state: EditorState, editorWidth: number, styles?: Omit<GuidelineConfig, 'key' | 'position'>) => ({
4
4
  styles?: {
@@ -2,7 +2,7 @@ export { generateDynamicGuidelines } from './dynamicGuideline';
2
2
  export { createFixedGuidelinesFromLengths, createGuidesFromLengths, } from './fixedGuideline';
3
3
  export { generateDefaultGuidelines } from './defaultGuideline';
4
4
  export { getGuidelinesWithHighlights } from './updateGuideline';
5
- export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
6
- export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, } from './types';
7
- export { getSnapWidth, findClosestSnap } from './snapping';
5
+ export { MEDIA_DYNAMIC_GUIDELINE_PREFIX, INNER_GRID_GUIDELINE_PREFIX, } from './constants';
6
+ export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, GuidelineSnap, GuidelineSnapsReference, } from './types';
7
+ export { getGuidelineSnaps, findClosestSnap } from './snapping';
8
8
  export { isVerticalPosition, getContainerWidthOrFullEditorWidth, } from './utils';
@@ -1,18 +1,19 @@
1
- import { RichMediaLayout } from '@atlaskit/adf-schema';
2
- import type { GuidelineConfig } from './types';
3
- export type SnapTo = {
4
- guidelineKey: string;
5
- width: number;
6
- };
1
+ import type { RichMediaLayout } from '@atlaskit/adf-schema';
2
+ import type { GuidelineConfig, GuidelineSnap } from './types';
7
3
  /**
8
4
  * Returns keys of guidelines that are closest to the image and withthin the snapGap.
9
5
  * If both default and dynamic guidelines present, only returns default guidelines
10
6
  */
11
- export declare const findClosestSnap: (mediaSingleWidth: number, snapArray: number[], snapTo: SnapTo[], snapGap?: number) => {
7
+ export declare const findClosestSnap: (mediaSingleWidth: number, snapArray: number[], guidelineSnaps: GuidelineSnap[], snapGap?: number) => {
12
8
  gap: number;
13
9
  keys: string[];
14
10
  };
15
- /**
16
- * Get snapping widths and respective guideline keys
17
- */
18
- export declare const getSnapWidth: (guidelines: GuidelineConfig[], mediaSingleWidth: number, snap: number, layout: RichMediaLayout | null) => SnapTo[];
11
+ export declare const getGuidelineSnaps: import("memoize-one").MemoizedFn<(guidelines: GuidelineConfig[], editorWidth: number, layout?: RichMediaLayout) => {
12
+ guidelineReference: {
13
+ guidelineKey: string;
14
+ width: number;
15
+ }[];
16
+ snaps: {
17
+ x: number[] | undefined;
18
+ };
19
+ }>;
@@ -1,5 +1,5 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import { CSSToken } from '@atlaskit/tokens';
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { CSSToken } from '@atlaskit/tokens';
3
3
  export declare enum WidthTypes {
4
4
  PERCENTAGE = "percentage",
5
5
  PIXEL = "pixel"
@@ -40,3 +40,14 @@ export interface GuidelinePluginOptions {
40
40
  }
41
41
  export type DisplayGrid = (props: Required<GuidelinePluginState>) => boolean;
42
42
  export type DisplayGuideline = (view: EditorView) => DisplayGrid;
43
+ export type GuidelineSnap = {
44
+ guidelineKey: string;
45
+ width: number;
46
+ };
47
+ export type GuidelineSnapsReference = {
48
+ snaps: {
49
+ x?: number[];
50
+ y?: number[];
51
+ };
52
+ guidelineReference: GuidelineSnap[];
53
+ };
@@ -2,6 +2,7 @@
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import type { Command } from '../types/command';
5
+ import type { PluginCommand } from '../types/plugin-command';
5
6
  export declare const addAltText: Keymap;
6
7
  export declare const navToEditorToolbar: Keymap;
7
8
  export declare const navToFloatingToolbar: Keymap;
@@ -85,7 +86,10 @@ export interface Keymap {
85
86
  common?: string;
86
87
  }
87
88
  export declare function bindKeymapWithCommand(shortcut: string, cmd: Command, keymap: {
88
- [key: string]: Function;
89
+ [key: string]: Command;
90
+ }): void;
91
+ export declare function bindKeymapWithPluginCommand(shortcut: string, cmd: PluginCommand, keymap: {
92
+ [key: string]: Command;
89
93
  }): void;
90
94
  export declare function findKeyMapForBrowser(keyMap: Keymap): string | undefined;
91
95
  export { DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP, } from './consts';
@@ -1,2 +1,3 @@
1
1
  export { EditorPresetBuilder } from './builder';
2
2
  export { EditorPluginInjectionAPI } from './plugin-injection-api';
3
+ export { pluginCommandToPMCommand } from './plugin-commands';
@@ -0,0 +1,3 @@
1
+ import type { Command } from '../types/command';
2
+ import type { PluginCommand } from '../types/plugin-command';
3
+ export declare function pluginCommandToPMCommand(command: PluginCommand | undefined): Command;
@@ -32,6 +32,7 @@ interface PluginInjectionAPIDefinition {
32
32
  export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefinition {
33
33
  private sharedStateAPI;
34
34
  private actionsAPI;
35
+ private commandsAPI;
35
36
  private plugins;
36
37
  constructor({ getEditorState }: SharedStateAPIProps);
37
38
  api<T extends NextEditorPlugin<any, any>>(): {
@@ -1,4 +1,4 @@
1
- import { Node } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Node } from '@atlaskit/editor-prosemirror/model';
2
2
  export interface Transformer<T> {
3
3
  encode(node: Node): T;
4
4
  parse(content: T): Node;
@@ -29,6 +29,7 @@ export type { PMPluginFactoryParams, PMPluginFactory, PMPlugin, } from './plugin
29
29
  export type { NodeConfig, MarkConfig, NodeViewConfig, } from './prosemirror-config';
30
30
  export type { PluginsOptions, EditorPlugin, getPosHandler, getPosHandlerNode, } from './editor-plugin';
31
31
  export type { NextEditorPlugin, AllEditorPresetPluginTypes, PluginDependenciesAPI, ExtractPluginNameFromAllBuilderPlugins, SafePresetCheck, DefaultEditorPlugin, OptionalPlugin, PluginInjectionAPI, CreatePluginDependenciesAPI, NextEditorPluginMetadata, ExtractInjectionAPI, ExtractPluginActions, PluginInjectionAPIWithDependency, PluginInjectionAPIWithDependencies, } from './next-editor-plugin';
32
+ export type { PluginCommand, PluginCommandWithMetadata, } from './plugin-command';
32
33
  export type IconProps = {
33
34
  label?: string;
34
35
  };
@@ -43,3 +44,5 @@ export type { AllowedBlockTypes, HeadingLevels, NormalTextLevel, HeadingLevelsAn
43
44
  export type { ColumnResizingPluginState } from './tables';
44
45
  export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper, } from './input-rules';
45
46
  export type { TextFormattingOptions, TextFormattingState, InputMethodToolbar, InputMethodBasic, } from './text-formatting';
47
+ export type { LayoutPluginOptions } from './layout';
48
+ export type { LongPressSelectionPluginOptions } from './selection';
@@ -0,0 +1,6 @@
1
+ import type { LongPressSelectionPluginOptions } from './selection';
2
+ export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
3
+ allowBreakout?: boolean;
4
+ UNSAFE_addSidebarLayouts?: boolean;
5
+ UNSAFE_allowSingleColumnLayout?: boolean;
6
+ }