@atlaskit/editor-common 78.11.1 → 78.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 78.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#78508](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78508) [`0299ed52b4ff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0299ed52b4ff) - Move currentMediaNodeWithPos util to editor common package
8
+ - [#79350](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79350) [`ba4e64dca012`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ba4e64dca012) - Add FF to enable mapSelectionBackward to fix the cursor position
9
+ - Updated dependencies
10
+
3
11
  ## 78.11.1
4
12
 
5
13
  ### Patch Changes
@@ -87,6 +87,12 @@ Object.defineProperty(exports, "calculateOffsetLeft", {
87
87
  return _utils.calculateOffsetLeft;
88
88
  }
89
89
  });
90
+ Object.defineProperty(exports, "currentMediaNodeWithPos", {
91
+ enumerable: true,
92
+ get: function get() {
93
+ return _utils.currentMediaNodeWithPos;
94
+ }
95
+ });
90
96
  Object.defineProperty(exports, "getMaxWidthForNestedNode", {
91
97
  enumerable: true,
92
98
  get: function get() {
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.calcMinWidth = exports.calcMediaSinglePixelWidth = exports.calcMediaSingleMaxWidth = void 0;
7
7
  exports.calculateOffsetLeft = calculateOffsetLeft;
8
- exports.getMediaSingleInitialWidth = exports.getMaxWidthForNestedNodeNext = exports.getMaxWidthForNestedNode = void 0;
8
+ exports.getMediaSingleInitialWidth = exports.getMaxWidthForNestedNodeNext = exports.getMaxWidthForNestedNode = exports.currentMediaNodeWithPos = void 0;
9
9
  exports.getMediaSinglePixelWidth = getMediaSinglePixelWidth;
10
10
  exports.roundToNearest = exports.getParentWidthForNestedMediaSingleNodeForInsertion = exports.getParentWidthForNestedMediaSingleNode = void 0;
11
+ var _state = require("@atlaskit/editor-prosemirror/state");
11
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
13
  var _richMediaUtils = require("../utils/rich-media-utils");
13
14
  var _constants = require("./constants");
@@ -228,4 +229,27 @@ var getParentWidthForNestedMediaSingleNodeForInsertion = exports.getParentWidthF
228
229
  return parentDomNode.offsetWidth - parentPadding;
229
230
  }
230
231
  return null;
232
+ };
233
+
234
+ /**
235
+ *
236
+ * @param editorState current editor state
237
+ * @returns selected media node (child of mediaSingle only) with position
238
+ */
239
+ var currentMediaNodeWithPos = exports.currentMediaNodeWithPos = function currentMediaNodeWithPos(editorState) {
240
+ var doc = editorState.doc,
241
+ selection = editorState.selection,
242
+ schema = editorState.schema;
243
+ if (!doc || !selection || !(selection instanceof _state.NodeSelection) || selection.node.type !== schema.nodes.mediaSingle) {
244
+ return;
245
+ }
246
+ var pos = selection.$anchor.pos + 1;
247
+ var node = doc.nodeAt(pos);
248
+ if (!node || node.type !== schema.nodes.media) {
249
+ return;
250
+ }
251
+ return {
252
+ node: node,
253
+ pos: pos
254
+ };
231
255
  };
@@ -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 = "78.11.1";
19
+ var packageVersion = "78.11.2";
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
@@ -22,7 +22,7 @@ var _templateObject, _templateObject2, _templateObject3;
22
22
  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); }; }
23
23
  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 */
24
24
  var packageName = "@atlaskit/editor-common";
25
- var packageVersion = "78.11.1";
25
+ var packageVersion = "78.11.2";
26
26
  var halfFocusRing = 1;
27
27
  var dropOffset = '0, 8';
28
28
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,2 +1,2 @@
1
1
  export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID } from './constants';
2
- export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext } from './utils';
2
+ export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos } from './utils';
@@ -1,3 +1,4 @@
1
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
1
2
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
2
3
  import { floatingLayouts, isRichMediaInsideOfBlockNode } from '../utils/rich-media-utils';
3
4
  import { DEFAULT_IMAGE_WIDTH, DEFAULT_ROUNDING_INTERVAL, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, wrappedLayouts } from './constants';
@@ -211,4 +212,29 @@ export const getParentWidthForNestedMediaSingleNodeForInsertion = (resolvedPos,
211
212
  return parentDomNode.offsetWidth - parentPadding;
212
213
  }
213
214
  return null;
215
+ };
216
+
217
+ /**
218
+ *
219
+ * @param editorState current editor state
220
+ * @returns selected media node (child of mediaSingle only) with position
221
+ */
222
+ export const currentMediaNodeWithPos = editorState => {
223
+ const {
224
+ doc,
225
+ selection,
226
+ schema
227
+ } = editorState;
228
+ if (!doc || !selection || !(selection instanceof NodeSelection) || selection.node.type !== schema.nodes.mediaSingle) {
229
+ return;
230
+ }
231
+ const pos = selection.$anchor.pos + 1;
232
+ const node = doc.nodeAt(pos);
233
+ if (!node || node.type !== schema.nodes.media) {
234
+ return;
235
+ }
236
+ return {
237
+ node,
238
+ pos
239
+ };
214
240
  };
@@ -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 = "78.11.1";
3
+ const packageVersion = "78.11.2";
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
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "78.11.1";
10
+ const packageVersion = "78.11.2";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends Component {
@@ -1,2 +1,2 @@
1
1
  export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID } from './constants';
2
- export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext } from './utils';
2
+ export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos } from './utils';
@@ -1,3 +1,4 @@
1
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
1
2
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
2
3
  import { floatingLayouts, isRichMediaInsideOfBlockNode } from '../utils/rich-media-utils';
3
4
  import { DEFAULT_IMAGE_WIDTH, DEFAULT_ROUNDING_INTERVAL, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, wrappedLayouts } from './constants';
@@ -219,4 +220,27 @@ export var getParentWidthForNestedMediaSingleNodeForInsertion = function getPare
219
220
  return parentDomNode.offsetWidth - parentPadding;
220
221
  }
221
222
  return null;
223
+ };
224
+
225
+ /**
226
+ *
227
+ * @param editorState current editor state
228
+ * @returns selected media node (child of mediaSingle only) with position
229
+ */
230
+ export var currentMediaNodeWithPos = function currentMediaNodeWithPos(editorState) {
231
+ var doc = editorState.doc,
232
+ selection = editorState.selection,
233
+ schema = editorState.schema;
234
+ if (!doc || !selection || !(selection instanceof NodeSelection) || selection.node.type !== schema.nodes.mediaSingle) {
235
+ return;
236
+ }
237
+ var pos = selection.$anchor.pos + 1;
238
+ var node = doc.nodeAt(pos);
239
+ if (!node || node.type !== schema.nodes.media) {
240
+ return;
241
+ }
242
+ return {
243
+ node: node,
244
+ pos: pos
245
+ };
222
246
  };
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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 = "78.11.1";
9
+ var packageVersion = "78.11.2";
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
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
17
17
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
18
18
  import Layer from '../Layer';
19
19
  var packageName = "@atlaskit/editor-common";
20
- var packageVersion = "78.11.1";
20
+ var packageVersion = "78.11.2";
21
21
  var halfFocusRing = 1;
22
22
  var dropOffset = '0, 8';
23
23
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,2 +1,2 @@
1
1
  export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID, } from './constants';
2
- export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, } from './utils';
2
+ export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos, } from './utils';
@@ -1,5 +1,6 @@
1
1
  import type { RichMediaLayout } from '@atlaskit/adf-schema';
2
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
5
  /**
5
6
  * Convert media node width to pixel
@@ -90,3 +91,12 @@ export declare const getParentWidthForNestedMediaSingleNode: (resolvedPos: Resol
90
91
  * @returns parent width used for media single initial width on insertion
91
92
  */
92
93
  export declare const getParentWidthForNestedMediaSingleNodeForInsertion: (resolvedPos: ResolvedPos, view: EditorView) => number | null;
94
+ /**
95
+ *
96
+ * @param editorState current editor state
97
+ * @returns selected media node (child of mediaSingle only) with position
98
+ */
99
+ export declare const currentMediaNodeWithPos: (editorState: EditorState) => {
100
+ node: PMNode;
101
+ pos: number;
102
+ } | undefined;
@@ -1,2 +1,2 @@
1
1
  export { MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, MEDIA_SINGLE_GUTTER_SIZE, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, Layout as MediaSingleLayout, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, wrappedLayouts, CAPTION_PLACEHOLDER_ID, } from './constants';
2
- export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, } from './utils';
2
+ export { getMediaSinglePixelWidth, calcMediaSinglePixelWidth, calcMediaSingleMaxWidth, getMediaSingleInitialWidth, calculateOffsetLeft, roundToNearest, calcMinWidth, getMaxWidthForNestedNode, getMaxWidthForNestedNodeNext, currentMediaNodeWithPos, } from './utils';
@@ -1,5 +1,6 @@
1
1
  import type { RichMediaLayout } from '@atlaskit/adf-schema';
2
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
5
  /**
5
6
  * Convert media node width to pixel
@@ -90,3 +91,12 @@ export declare const getParentWidthForNestedMediaSingleNode: (resolvedPos: Resol
90
91
  * @returns parent width used for media single initial width on insertion
91
92
  */
92
93
  export declare const getParentWidthForNestedMediaSingleNodeForInsertion: (resolvedPos: ResolvedPos, view: EditorView) => number | null;
94
+ /**
95
+ *
96
+ * @param editorState current editor state
97
+ * @returns selected media node (child of mediaSingle only) with position
98
+ */
99
+ export declare const currentMediaNodeWithPos: (editorState: EditorState) => {
100
+ node: PMNode;
101
+ pos: number;
102
+ } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "78.11.1",
3
+ "version": "78.11.2",
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/"
@@ -121,7 +121,7 @@
121
121
  "@atlaskit/media-file-preview": "^0.5.0",
122
122
  "@atlaskit/media-picker": "^66.3.0",
123
123
  "@atlaskit/media-ui": "^25.4.0",
124
- "@atlaskit/media-viewer": "48.3.3",
124
+ "@atlaskit/media-viewer": "48.3.4",
125
125
  "@atlaskit/mention": "^23.0.0",
126
126
  "@atlaskit/menu": "^2.1.0",
127
127
  "@atlaskit/platform-feature-flags": "^0.2.0",