@atlaskit/editor-core 187.35.3 → 187.35.4

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,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.35.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`10a82c0490c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/10a82c0490c) - ED-19792 disable guideline plugin for comment and mobile.
8
+
3
9
  ## 187.35.3
4
10
 
5
11
  ### Patch Changes
@@ -39,6 +39,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
39
39
  function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent) {
40
40
  var isMobile = appearance === 'mobile';
41
41
  var isComment = appearance === 'comment';
42
+ var isChromeless = appearance === 'chromeless';
42
43
  var isFullPage = (0, _isFullPage.isFullPage)(appearance);
43
44
  var getEditorFeatureFlags = function getEditorFeatureFlags() {
44
45
  return featureFlags;
@@ -88,6 +89,9 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
88
89
  }
89
90
  return builder;
90
91
  }).maybeAdd(_editorPluginGuideline.guidelinePlugin, function (plugin, builder) {
92
+ if (isMobile || isComment || isChromeless) {
93
+ return builder;
94
+ }
91
95
  if (props.media || props.allowTables) {
92
96
  return builder.add(plugin);
93
97
  }
@@ -219,7 +219,9 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
219
219
  _this.setIsResizing(true);
220
220
  _this.updateSizeInPluginState(_this.state.size.width);
221
221
  // re-calculate guidelines
222
- _this.updateGuidelines();
222
+ if (_this.isGuidelineEnabled) {
223
+ _this.updateGuidelines();
224
+ }
223
225
  });
224
226
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResize", function (size, delta) {
225
227
  var _this$props4 = _this.props,
@@ -230,18 +232,27 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
230
232
  width = _this$calculateSizeSt.width,
231
233
  height = _this$calculateSizeSt.height,
232
234
  calculatedWidthWithLayout = _this$calculateSizeSt.calculatedWidthWithLayout;
233
- var guidelineSnaps = (0, _guideline.getGuidelineSnaps)(_this.state.guidelines, lineLength, layout);
234
- _this.updateActiveGuidelines(width, _this.state.guidelines, guidelineSnaps);
235
- var relativeSnaps = (0, _guideline.getRelativeGuideSnaps)(_this.state.relativeGuides, _this.aspectRatio);
236
- _this.setState({
237
- size: {
238
- width: width,
239
- height: height
240
- },
241
- snaps: {
242
- x: [].concat((0, _toConsumableArray2.default)(guidelineSnaps.snaps.x || []), (0, _toConsumableArray2.default)(relativeSnaps))
243
- }
244
- });
235
+ if (_this.isGuidelineEnabled) {
236
+ var guidelineSnaps = (0, _guideline.getGuidelineSnaps)(_this.state.guidelines, lineLength, layout);
237
+ _this.updateActiveGuidelines(width, _this.state.guidelines, guidelineSnaps);
238
+ var relativeSnaps = (0, _guideline.getRelativeGuideSnaps)(_this.state.relativeGuides, _this.aspectRatio);
239
+ _this.setState({
240
+ size: {
241
+ width: width,
242
+ height: height
243
+ },
244
+ snaps: {
245
+ x: [].concat((0, _toConsumableArray2.default)(guidelineSnaps.snaps.x || []), (0, _toConsumableArray2.default)(relativeSnaps))
246
+ }
247
+ });
248
+ } else {
249
+ _this.setState({
250
+ size: {
251
+ width: width,
252
+ height: height
253
+ }
254
+ });
255
+ }
245
256
  _this.updateSizeInPluginState(width);
246
257
  if (calculatedWidthWithLayout.layout !== layout) {
247
258
  updateSize(width, calculatedWidthWithLayout.layout);
@@ -423,6 +434,12 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
423
434
  var layoutColumn = this.props.view.state.schema.nodes.layoutColumn;
424
435
  return !!(0, _utils.findParentNodeOfTypeClosestToPos)($pos, [layoutColumn]);
425
436
  }
437
+ }, {
438
+ key: "isGuidelineEnabled",
439
+ get: function get() {
440
+ var _this$props$pluginInj7;
441
+ return !!((_this$props$pluginInj7 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj7 !== void 0 && _this$props$pluginInj7.guideline);
442
+ }
426
443
 
427
444
  // check if is inside of layout, table, expand, nestedExpand and list item
428
445
  }, {
@@ -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.35.3";
9
+ var version = "187.35.4";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -28,6 +28,7 @@ import { shouldForceTracking } from '@atlaskit/editor-common/utils';
28
28
  export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent) {
29
29
  const isMobile = appearance === 'mobile';
30
30
  const isComment = appearance === 'comment';
31
+ const isChromeless = appearance === 'chromeless';
31
32
  const isFullPage = fullPageCheck(appearance);
32
33
  const getEditorFeatureFlags = () => featureFlags;
33
34
  const editorSelectionAPI = createEditorSelectionAPI();
@@ -76,6 +77,9 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
76
77
  }
77
78
  return builder;
78
79
  }).maybeAdd(guidelinePlugin, (plugin, builder) => {
80
+ if (isMobile || isComment || isChromeless) {
81
+ return builder;
82
+ }
79
83
  if (props.media || props.allowTables) {
80
84
  return builder.add(plugin);
81
85
  }
@@ -196,7 +196,9 @@ class ResizableMediaSingleNext extends React.Component {
196
196
  this.setIsResizing(true);
197
197
  this.updateSizeInPluginState(this.state.size.width);
198
198
  // re-calculate guidelines
199
- this.updateGuidelines();
199
+ if (this.isGuidelineEnabled) {
200
+ this.updateGuidelines();
201
+ }
200
202
  });
201
203
  _defineProperty(this, "handleResize", (size, delta) => {
202
204
  const {
@@ -209,18 +211,27 @@ class ResizableMediaSingleNext extends React.Component {
209
211
  height,
210
212
  calculatedWidthWithLayout
211
213
  } = this.calculateSizeState(size, delta);
212
- const guidelineSnaps = getGuidelineSnaps(this.state.guidelines, lineLength, layout);
213
- this.updateActiveGuidelines(width, this.state.guidelines, guidelineSnaps);
214
- const relativeSnaps = getRelativeGuideSnaps(this.state.relativeGuides, this.aspectRatio);
215
- this.setState({
216
- size: {
217
- width,
218
- height
219
- },
220
- snaps: {
221
- x: [...(guidelineSnaps.snaps.x || []), ...relativeSnaps]
222
- }
223
- });
214
+ if (this.isGuidelineEnabled) {
215
+ const guidelineSnaps = getGuidelineSnaps(this.state.guidelines, lineLength, layout);
216
+ this.updateActiveGuidelines(width, this.state.guidelines, guidelineSnaps);
217
+ const relativeSnaps = getRelativeGuideSnaps(this.state.relativeGuides, this.aspectRatio);
218
+ this.setState({
219
+ size: {
220
+ width,
221
+ height
222
+ },
223
+ snaps: {
224
+ x: [...(guidelineSnaps.snaps.x || []), ...relativeSnaps]
225
+ }
226
+ });
227
+ } else {
228
+ this.setState({
229
+ size: {
230
+ width,
231
+ height
232
+ }
233
+ });
234
+ }
224
235
  this.updateSizeInPluginState(width);
225
236
  if (calculatedWidthWithLayout.layout !== layout) {
226
237
  updateSize(width, calculatedWidthWithLayout.layout);
@@ -374,6 +385,10 @@ class ResizableMediaSingleNext extends React.Component {
374
385
  } = this.props.view.state.schema.nodes;
375
386
  return !!findParentNodeOfTypeClosestToPos($pos, [layoutColumn]);
376
387
  }
388
+ get isGuidelineEnabled() {
389
+ var _this$props$pluginInj7;
390
+ return !!((_this$props$pluginInj7 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj7 !== void 0 && _this$props$pluginInj7.guideline);
391
+ }
377
392
 
378
393
  // check if is inside of layout, table, expand, nestedExpand and list item
379
394
  isNestedNode() {
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.35.3";
2
+ export const version = "187.35.4";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -32,6 +32,7 @@ import { shouldForceTracking } from '@atlaskit/editor-common/utils';
32
32
  export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent) {
33
33
  var isMobile = appearance === 'mobile';
34
34
  var isComment = appearance === 'comment';
35
+ var isChromeless = appearance === 'chromeless';
35
36
  var isFullPage = fullPageCheck(appearance);
36
37
  var getEditorFeatureFlags = function getEditorFeatureFlags() {
37
38
  return featureFlags;
@@ -81,6 +82,9 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
81
82
  }
82
83
  return builder;
83
84
  }).maybeAdd(guidelinePlugin, function (plugin, builder) {
85
+ if (isMobile || isComment || isChromeless) {
86
+ return builder;
87
+ }
84
88
  if (props.media || props.allowTables) {
85
89
  return builder.add(plugin);
86
90
  }
@@ -212,7 +212,9 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
212
212
  _this.setIsResizing(true);
213
213
  _this.updateSizeInPluginState(_this.state.size.width);
214
214
  // re-calculate guidelines
215
- _this.updateGuidelines();
215
+ if (_this.isGuidelineEnabled) {
216
+ _this.updateGuidelines();
217
+ }
216
218
  });
217
219
  _defineProperty(_assertThisInitialized(_this), "handleResize", function (size, delta) {
218
220
  var _this$props4 = _this.props,
@@ -223,18 +225,27 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
223
225
  width = _this$calculateSizeSt.width,
224
226
  height = _this$calculateSizeSt.height,
225
227
  calculatedWidthWithLayout = _this$calculateSizeSt.calculatedWidthWithLayout;
226
- var guidelineSnaps = getGuidelineSnaps(_this.state.guidelines, lineLength, layout);
227
- _this.updateActiveGuidelines(width, _this.state.guidelines, guidelineSnaps);
228
- var relativeSnaps = getRelativeGuideSnaps(_this.state.relativeGuides, _this.aspectRatio);
229
- _this.setState({
230
- size: {
231
- width: width,
232
- height: height
233
- },
234
- snaps: {
235
- x: [].concat(_toConsumableArray(guidelineSnaps.snaps.x || []), _toConsumableArray(relativeSnaps))
236
- }
237
- });
228
+ if (_this.isGuidelineEnabled) {
229
+ var guidelineSnaps = getGuidelineSnaps(_this.state.guidelines, lineLength, layout);
230
+ _this.updateActiveGuidelines(width, _this.state.guidelines, guidelineSnaps);
231
+ var relativeSnaps = getRelativeGuideSnaps(_this.state.relativeGuides, _this.aspectRatio);
232
+ _this.setState({
233
+ size: {
234
+ width: width,
235
+ height: height
236
+ },
237
+ snaps: {
238
+ x: [].concat(_toConsumableArray(guidelineSnaps.snaps.x || []), _toConsumableArray(relativeSnaps))
239
+ }
240
+ });
241
+ } else {
242
+ _this.setState({
243
+ size: {
244
+ width: width,
245
+ height: height
246
+ }
247
+ });
248
+ }
238
249
  _this.updateSizeInPluginState(width);
239
250
  if (calculatedWidthWithLayout.layout !== layout) {
240
251
  updateSize(width, calculatedWidthWithLayout.layout);
@@ -416,6 +427,12 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
416
427
  var layoutColumn = this.props.view.state.schema.nodes.layoutColumn;
417
428
  return !!findParentNodeOfTypeClosestToPos($pos, [layoutColumn]);
418
429
  }
430
+ }, {
431
+ key: "isGuidelineEnabled",
432
+ get: function get() {
433
+ var _this$props$pluginInj7;
434
+ return !!((_this$props$pluginInj7 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj7 !== void 0 && _this$props$pluginInj7.guideline);
435
+ }
419
436
 
420
437
  // check if is inside of layout, table, expand, nestedExpand and list item
421
438
  }, {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.35.3";
2
+ export var version = "187.35.4";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -31,6 +31,7 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
31
31
  get aspectRatio(): number;
32
32
  get insideInlineLike(): boolean;
33
33
  get insideLayout(): boolean;
34
+ get isGuidelineEnabled(): boolean;
34
35
  isNestedNode(): boolean;
35
36
  private getDefaultGuidelines;
36
37
  private updateGuidelines;
@@ -31,6 +31,7 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
31
31
  get aspectRatio(): number;
32
32
  get insideInlineLike(): boolean;
33
33
  get insideLayout(): boolean;
34
+ get isGuidelineEnabled(): boolean;
34
35
  isNestedNode(): boolean;
35
36
  private getDefaultGuidelines;
36
37
  private updateGuidelines;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.35.3",
3
+ "version": "187.35.4",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"