@atlaskit/editor-core 187.29.4 → 187.30.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.30.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e6582078cf9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e6582078cf9) - ED-19433 Create editor-plugin-emoji package for atlaskit
8
+ - Updated dependencies
9
+
10
+ ## 187.30.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`7f45581d141`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f45581d141) - ED-19630 fixed guideline alignment issue.
15
+
16
+ ### Patch Changes
17
+
18
+ - [`1e4b853a636`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1e4b853a636) - ED-19411 added guideline test, fixed invalid cursor location issue.
19
+ - Updated dependencies
20
+
3
21
  ## 187.29.4
4
22
 
5
23
  ### Patch Changes
@@ -36,6 +36,16 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
36
36
  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 */
37
37
  var resizerNextTestId = 'mediaSingle.resizerNext.testid';
38
38
  exports.resizerNextTestId = resizerNextTestId;
39
+ var handleComponent = {
40
+ left: (0, _react2.jsx)("div", {
41
+ "data-testid": "richMedia-resize-handle-left-elem",
42
+ contentEditable: false
43
+ }),
44
+ right: (0, _react2.jsx)("div", {
45
+ "data-testid": "richMedia-resize-handle-right-elem",
46
+ contentEditable: false
47
+ })
48
+ };
39
49
  var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
40
50
  (0, _inherits2.default)(ResizableMediaSingleNext, _React$Component);
41
51
  var _super = _createSuper(ResizableMediaSingleNext);
@@ -153,11 +163,18 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
153
163
  return Math.min(contentWidth || _editorSharedStyles.akEditorDefaultLayoutWidth, isVideoFile ? _mediaSingle.MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : _mediaSingle.MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH);
154
164
  }));
155
165
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getRelativeGuides", function () {
166
+ var _this$props$pluginInj5, _this$props$pluginInj6, _this$props$pluginInj7, _this$props$pluginInj8;
167
+ var guidelinePluginState = (_this$props$pluginInj5 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj5 === void 0 ? void 0 : (_this$props$pluginInj6 = _this$props$pluginInj5.dependencies) === null || _this$props$pluginInj6 === void 0 ? void 0 : (_this$props$pluginInj7 = _this$props$pluginInj6.guideline) === null || _this$props$pluginInj7 === void 0 ? void 0 : (_this$props$pluginInj8 = _this$props$pluginInj7.sharedState) === null || _this$props$pluginInj8 === void 0 ? void 0 : _this$props$pluginInj8.currentState();
168
+ var _ref = (guidelinePluginState === null || guidelinePluginState === void 0 ? void 0 : guidelinePluginState.rect) || {
169
+ top: 0,
170
+ left: 0
171
+ },
172
+ topOffset = _ref.top;
156
173
  var $pos = _this.$pos;
157
174
  var relativeGuides = $pos && $pos.nodeAfter && _this.state.size.width ? (0, _guideline.getRelativeGuidelines)(_this.state.relativeGuides, {
158
175
  node: $pos.nodeAfter,
159
176
  pos: $pos.pos
160
- }, _this.props.view, _this.props.lineLength, _this.state.size) : [];
177
+ }, _this.props.view, _this.props.lineLength, topOffset, _this.state.size) : [];
161
178
  return relativeGuides;
162
179
  });
163
180
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateActiveGuidelines", function () {
@@ -415,7 +432,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
415
432
  key: "isNestedNode",
416
433
  value: function isNestedNode() {
417
434
  var $pos = this.$pos;
418
- return !!($pos && $pos.parent.type !== $pos.parent.type.schema.nodes.doc);
435
+ return !!($pos && $pos.depth !== 0);
419
436
  }
420
437
  }, {
421
438
  key: "getDefaultGuidelines",
@@ -539,6 +556,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
539
556
  handleResizeStop: this.handleResizeStop,
540
557
  snap: this.state.snaps,
541
558
  resizeRatio: _utils2.nonWrappedLayouts.includes(layout) ? 2 : 1,
559
+ handleComponent: handleComponent,
542
560
  "data-testid": resizerNextTestId,
543
561
  isHandleVisible: selected
544
562
  }, children));
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.29.4";
9
+ var version = "187.30.1";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -18,6 +18,16 @@ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
18
18
  import throttle from 'lodash/throttle';
19
19
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
20
20
  export const resizerNextTestId = 'mediaSingle.resizerNext.testid';
21
+ const handleComponent = {
22
+ left: jsx("div", {
23
+ "data-testid": "richMedia-resize-handle-left-elem",
24
+ contentEditable: false
25
+ }),
26
+ right: jsx("div", {
27
+ "data-testid": "richMedia-resize-handle-right-elem",
28
+ contentEditable: false
29
+ })
30
+ };
21
31
  class ResizableMediaSingleNext extends React.Component {
22
32
  constructor(props) {
23
33
  super(props);
@@ -136,11 +146,19 @@ class ResizableMediaSingleNext extends React.Component {
136
146
  return Math.min(contentWidth || akEditorDefaultLayoutWidth, isVideoFile ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH);
137
147
  }));
138
148
  _defineProperty(this, "getRelativeGuides", () => {
149
+ var _this$props$pluginInj5, _this$props$pluginInj6, _this$props$pluginInj7, _this$props$pluginInj8;
150
+ const guidelinePluginState = (_this$props$pluginInj5 = this.props.pluginInjectionApi) === null || _this$props$pluginInj5 === void 0 ? void 0 : (_this$props$pluginInj6 = _this$props$pluginInj5.dependencies) === null || _this$props$pluginInj6 === void 0 ? void 0 : (_this$props$pluginInj7 = _this$props$pluginInj6.guideline) === null || _this$props$pluginInj7 === void 0 ? void 0 : (_this$props$pluginInj8 = _this$props$pluginInj7.sharedState) === null || _this$props$pluginInj8 === void 0 ? void 0 : _this$props$pluginInj8.currentState();
151
+ const {
152
+ top: topOffset
153
+ } = (guidelinePluginState === null || guidelinePluginState === void 0 ? void 0 : guidelinePluginState.rect) || {
154
+ top: 0,
155
+ left: 0
156
+ };
139
157
  const $pos = this.$pos;
140
158
  const relativeGuides = $pos && $pos.nodeAfter && this.state.size.width ? getRelativeGuidelines(this.state.relativeGuides, {
141
159
  node: $pos.nodeAfter,
142
160
  pos: $pos.pos
143
- }, this.props.view, this.props.lineLength, this.state.size) : [];
161
+ }, this.props.view, this.props.lineLength, topOffset, this.state.size) : [];
144
162
  return relativeGuides;
145
163
  });
146
164
  _defineProperty(this, "updateActiveGuidelines", (width = 0, guidelines, guidelineSnapsReference) => {
@@ -366,7 +384,7 @@ class ResizableMediaSingleNext extends React.Component {
366
384
  // check if is inside of layout, table, expand, nestedExpand and list item
367
385
  isNestedNode() {
368
386
  const $pos = this.$pos;
369
- return !!($pos && $pos.parent.type !== $pos.parent.type.schema.nodes.doc);
387
+ return !!($pos && $pos.depth !== 0);
370
388
  }
371
389
  getDefaultGuidelines() {
372
390
  const {
@@ -459,6 +477,7 @@ class ResizableMediaSingleNext extends React.Component {
459
477
  handleResizeStop: this.handleResizeStop,
460
478
  snap: this.state.snaps,
461
479
  resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
480
+ handleComponent: handleComponent,
462
481
  "data-testid": resizerNextTestId,
463
482
  isHandleVisible: selected
464
483
  }, children));
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.29.4";
2
+ export const version = "187.30.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -29,6 +29,16 @@ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
29
29
  import throttle from 'lodash/throttle';
30
30
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
31
31
  export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
32
+ var handleComponent = {
33
+ left: jsx("div", {
34
+ "data-testid": "richMedia-resize-handle-left-elem",
35
+ contentEditable: false
36
+ }),
37
+ right: jsx("div", {
38
+ "data-testid": "richMedia-resize-handle-right-elem",
39
+ contentEditable: false
40
+ })
41
+ };
32
42
  var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
33
43
  _inherits(ResizableMediaSingleNext, _React$Component);
34
44
  var _super = _createSuper(ResizableMediaSingleNext);
@@ -146,11 +156,18 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
146
156
  return Math.min(contentWidth || akEditorDefaultLayoutWidth, isVideoFile ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH);
147
157
  }));
148
158
  _defineProperty(_assertThisInitialized(_this), "getRelativeGuides", function () {
159
+ var _this$props$pluginInj5, _this$props$pluginInj6, _this$props$pluginInj7, _this$props$pluginInj8;
160
+ var guidelinePluginState = (_this$props$pluginInj5 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj5 === void 0 ? void 0 : (_this$props$pluginInj6 = _this$props$pluginInj5.dependencies) === null || _this$props$pluginInj6 === void 0 ? void 0 : (_this$props$pluginInj7 = _this$props$pluginInj6.guideline) === null || _this$props$pluginInj7 === void 0 ? void 0 : (_this$props$pluginInj8 = _this$props$pluginInj7.sharedState) === null || _this$props$pluginInj8 === void 0 ? void 0 : _this$props$pluginInj8.currentState();
161
+ var _ref = (guidelinePluginState === null || guidelinePluginState === void 0 ? void 0 : guidelinePluginState.rect) || {
162
+ top: 0,
163
+ left: 0
164
+ },
165
+ topOffset = _ref.top;
149
166
  var $pos = _this.$pos;
150
167
  var relativeGuides = $pos && $pos.nodeAfter && _this.state.size.width ? getRelativeGuidelines(_this.state.relativeGuides, {
151
168
  node: $pos.nodeAfter,
152
169
  pos: $pos.pos
153
- }, _this.props.view, _this.props.lineLength, _this.state.size) : [];
170
+ }, _this.props.view, _this.props.lineLength, topOffset, _this.state.size) : [];
154
171
  return relativeGuides;
155
172
  });
156
173
  _defineProperty(_assertThisInitialized(_this), "updateActiveGuidelines", function () {
@@ -408,7 +425,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
408
425
  key: "isNestedNode",
409
426
  value: function isNestedNode() {
410
427
  var $pos = this.$pos;
411
- return !!($pos && $pos.parent.type !== $pos.parent.type.schema.nodes.doc);
428
+ return !!($pos && $pos.depth !== 0);
412
429
  }
413
430
  }, {
414
431
  key: "getDefaultGuidelines",
@@ -532,6 +549,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
532
549
  handleResizeStop: this.handleResizeStop,
533
550
  snap: this.state.snaps,
534
551
  resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
552
+ handleComponent: handleComponent,
535
553
  "data-testid": resizerNextTestId,
536
554
  isHandleVisible: selected
537
555
  }, children));
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.29.4";
2
+ export var version = "187.30.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,27 +1,17 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { EmojiDescription, EmojiProvider, EmojiId } from '@atlaskit/emoji';
5
- import type { Command, NextEditorPlugin, PMPluginFactoryParams, OptionalPlugin, EditorCommand } from '@atlaskit/editor-common/types';
6
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import type { EmojiDescription, EmojiProvider } from '@atlaskit/emoji';
5
+ import type { Command, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
6
+ import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
7
7
  import type { TypeAheadItem } from '../type-ahead/types';
8
- import type { EmojiPluginOptions, EmojiPluginState } from './types';
9
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
10
- import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
8
+ import type { EmojiPluginState } from './types';
11
9
  export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
12
10
  export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
13
11
  call: ResultFn;
14
12
  clear(): void;
15
13
  };
16
14
  export declare const defaultListLimit = 50;
17
- export type EmojiPlugin = NextEditorPlugin<'emoji', {
18
- pluginConfiguration: EmojiPluginOptions | undefined;
19
- dependencies: [OptionalPlugin<typeof analyticsPlugin>, TypeAheadPlugin];
20
- sharedState: EmojiPluginState | undefined;
21
- commands: {
22
- insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
23
- };
24
- }>;
25
15
  export declare const emojiPlugin: EmojiPlugin;
26
16
  /**
27
17
  * Actions
@@ -1,9 +1 @@
1
- import type { EmojiProvider, EmojiDescription, EmojiResourceConfig } from '@atlaskit/emoji';
2
- export interface EmojiPluginOptions {
3
- headless?: boolean;
4
- }
5
- export type EmojiPluginState = {
6
- emojiProvider?: EmojiProvider;
7
- emojiResourceConfig?: EmojiResourceConfig;
8
- asciiMap?: Map<string, EmojiDescription>;
9
- };
1
+ export type { EmojiPluginState, EmojiPluginOptions, } from '@atlaskit/editor-plugin-emoji';
@@ -1,6 +1,6 @@
1
1
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { ImageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
3
- import type { EmojiPlugin } from '../emoji';
3
+ import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
4
4
  import type datePlugin from '../date';
5
5
  import type { tablesPlugin } from '@atlaskit/editor-plugin-table';
6
6
  import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
@@ -1,30 +1,17 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { EmojiDescription, EmojiProvider, EmojiId } from '@atlaskit/emoji';
5
- import type { Command, NextEditorPlugin, PMPluginFactoryParams, OptionalPlugin, EditorCommand } from '@atlaskit/editor-common/types';
6
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import type { EmojiDescription, EmojiProvider } from '@atlaskit/emoji';
5
+ import type { Command, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
6
+ import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
7
7
  import type { TypeAheadItem } from '../type-ahead/types';
8
- import type { EmojiPluginOptions, EmojiPluginState } from './types';
9
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
10
- import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
8
+ import type { EmojiPluginState } from './types';
11
9
  export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
12
10
  export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
13
11
  call: ResultFn;
14
12
  clear(): void;
15
13
  };
16
14
  export declare const defaultListLimit = 50;
17
- export type EmojiPlugin = NextEditorPlugin<'emoji', {
18
- pluginConfiguration: EmojiPluginOptions | undefined;
19
- dependencies: [
20
- OptionalPlugin<typeof analyticsPlugin>,
21
- TypeAheadPlugin
22
- ];
23
- sharedState: EmojiPluginState | undefined;
24
- commands: {
25
- insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
26
- };
27
- }>;
28
15
  export declare const emojiPlugin: EmojiPlugin;
29
16
  /**
30
17
  * Actions
@@ -1,9 +1 @@
1
- import type { EmojiProvider, EmojiDescription, EmojiResourceConfig } from '@atlaskit/emoji';
2
- export interface EmojiPluginOptions {
3
- headless?: boolean;
4
- }
5
- export type EmojiPluginState = {
6
- emojiProvider?: EmojiProvider;
7
- emojiResourceConfig?: EmojiResourceConfig;
8
- asciiMap?: Map<string, EmojiDescription>;
9
- };
1
+ export type { EmojiPluginState, EmojiPluginOptions, } from '@atlaskit/editor-plugin-emoji';
@@ -1,6 +1,6 @@
1
1
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { ImageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
3
- import type { EmojiPlugin } from '../emoji';
3
+ import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
4
4
  import type datePlugin from '../date';
5
5
  import type { tablesPlugin } from '@atlaskit/editor-plugin-table';
6
6
  import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.29.4",
3
+ "version": "187.30.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/code": "^14.6.0",
56
56
  "@atlaskit/date": "^0.10.0",
57
57
  "@atlaskit/datetime-picker": "^12.7.0",
58
- "@atlaskit/editor-common": "^74.50.0",
58
+ "@atlaskit/editor-common": "^74.51.0",
59
59
  "@atlaskit/editor-json-transformer": "^8.10.0",
60
60
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
61
61
  "@atlaskit/editor-palette": "1.5.1",
@@ -66,11 +66,12 @@
66
66
  "@atlaskit/editor-plugin-context-panel": "^0.1.0",
67
67
  "@atlaskit/editor-plugin-decorations": "^0.1.0",
68
68
  "@atlaskit/editor-plugin-editor-disabled": "^0.1.0",
69
+ "@atlaskit/editor-plugin-emoji": "^0.1.0",
69
70
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
70
71
  "@atlaskit/editor-plugin-floating-toolbar": "^0.3.0",
71
72
  "@atlaskit/editor-plugin-focus": "^0.1.0",
72
73
  "@atlaskit/editor-plugin-grid": "^0.1.0",
73
- "@atlaskit/editor-plugin-guideline": "^0.3.4",
74
+ "@atlaskit/editor-plugin-guideline": "^0.4.0",
74
75
  "@atlaskit/editor-plugin-hyperlink": "^0.3.0",
75
76
  "@atlaskit/editor-plugin-image-upload": "^0.1.0",
76
77
  "@atlaskit/editor-plugin-list": "^1.0.0",