@atlaskit/editor-core 187.32.3 → 187.32.6

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,18 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.32.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`20fa6edb5d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/20fa6edb5d4) - ED-19617 Extract Floating Toolbar VR test to editor-core
8
+ - [`7d9ffc3a1ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d9ffc3a1ce) - [ux] ED-19342 Fix: Inserting Code-Block at gap-cursor will not consume all the content after gap-cursor
9
+
10
+ ## 187.32.5
11
+
12
+ ### Patch Changes
13
+
14
+ - [`ee475b14581`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ee475b14581) - Set max width for nested media single node to 100% to make it reponsive to parent width change
15
+
3
16
  ## 187.32.3
4
17
 
5
18
  ### Patch Changes
@@ -7,10 +7,11 @@ exports.isConvertableToCodeBlock = isConvertableToCodeBlock;
7
7
  exports.transformToCodeBlockAction = transformToCodeBlockAction;
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _model = require("@atlaskit/editor-prosemirror/model");
10
+ var _selection = require("@atlaskit/editor-common/selection");
10
11
  var _utils = require("@atlaskit/editor-common/utils");
11
12
  function transformToCodeBlockAction(state, start, attrs) {
12
13
  var startOfCodeBlockText = state.selection.$from;
13
- var endPosition = state.selection.empty ? startOfCodeBlockText.end() : state.selection.$to.pos;
14
+ var endPosition = state.selection.empty && !(state.selection instanceof _selection.GapCursorSelection) ? startOfCodeBlockText.end() : state.selection.$to.pos;
14
15
  var startLinePosition = startOfCodeBlockText.start();
15
16
  //when cmd+A is used to select the content. start position should be 0.
16
17
  var parentStartPosition = startOfCodeBlockText.depth === 0 ? 0 : startOfCodeBlockText.before();
@@ -60,7 +61,7 @@ function transformToCodeBlockAction(state, start, attrs) {
60
61
 
61
62
  // Reposition cursor when inserting into layouts or table headers
62
63
  var mapped = tr.doc.resolve(tr.mapping.map(startMapped) + 1);
63
- var selection = _state.TextSelection.findFrom(mapped, 1, true);
64
+ var selection = _state.TextSelection.findFrom(mapped, state.selection instanceof _selection.GapCursorSelection ? -1 : 1, true);
64
65
  if (selection) {
65
66
  return tr.setSelection(selection);
66
67
  }
@@ -154,7 +154,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
154
154
  return dispatch(tr);
155
155
  }, _mediaSingle.MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
156
156
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calcMaxWidth", (0, _memoizeOne.default)(function (contentWidth, containerWidth, fullWidthMode) {
157
- if (_this.isNestedNode() || fullWidthMode) {
157
+ if (fullWidthMode) {
158
158
  return contentWidth;
159
159
  }
160
160
  return (0, _mediaSingle.calcMediaSingleMaxWidth)(containerWidth);
@@ -533,7 +533,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
533
533
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
534
534
  });
535
535
  var resizerNextClassName = (0, _classnames.default)(className, _styles.resizerStyles);
536
- var maxWidth = this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
536
+ var maxWidth = this.isNestedNode() ? undefined // fall back to 'max-width: 100%'
537
+ : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
537
538
  var minWidth = this.calcMinWidth(isVideoFile, lineLength);
538
539
  return (0, _react2.jsx)("div", {
539
540
  ref: this.saveWrapper,
@@ -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.32.3";
9
+ var version = "187.32.6";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,9 +1,10 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
+ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
4
  import { timestampToString, mapSlice } from '@atlaskit/editor-common/utils';
4
5
  export function transformToCodeBlockAction(state, start, attrs) {
5
6
  const startOfCodeBlockText = state.selection.$from;
6
- const endPosition = state.selection.empty ? startOfCodeBlockText.end() : state.selection.$to.pos;
7
+ const endPosition = state.selection.empty && !(state.selection instanceof GapCursorSelection) ? startOfCodeBlockText.end() : state.selection.$to.pos;
7
8
  const startLinePosition = startOfCodeBlockText.start();
8
9
  //when cmd+A is used to select the content. start position should be 0.
9
10
  const parentStartPosition = startOfCodeBlockText.depth === 0 ? 0 : startOfCodeBlockText.before();
@@ -53,7 +54,7 @@ export function transformToCodeBlockAction(state, start, attrs) {
53
54
 
54
55
  // Reposition cursor when inserting into layouts or table headers
55
56
  const mapped = tr.doc.resolve(tr.mapping.map(startMapped) + 1);
56
- const selection = TextSelection.findFrom(mapped, 1, true);
57
+ const selection = TextSelection.findFrom(mapped, state.selection instanceof GapCursorSelection ? -1 : 1, true);
57
58
  if (selection) {
58
59
  return tr.setSelection(selection);
59
60
  }
@@ -137,7 +137,7 @@ class ResizableMediaSingleNext extends React.Component {
137
137
  return dispatch(tr);
138
138
  }, MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
139
139
  _defineProperty(this, "calcMaxWidth", memoizeOne((contentWidth, containerWidth, fullWidthMode) => {
140
- if (this.isNestedNode() || fullWidthMode) {
140
+ if (fullWidthMode) {
141
141
  return contentWidth;
142
142
  }
143
143
  return calcMediaSingleMaxWidth(containerWidth);
@@ -452,7 +452,8 @@ class ResizableMediaSingleNext extends React.Component {
452
452
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
453
453
  });
454
454
  const resizerNextClassName = classnames(className, resizerStyles);
455
- const maxWidth = this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
455
+ const maxWidth = this.isNestedNode() ? undefined // fall back to 'max-width: 100%'
456
+ : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
456
457
  const minWidth = this.calcMinWidth(isVideoFile, lineLength);
457
458
  return jsx("div", {
458
459
  ref: this.saveWrapper,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.32.3";
2
+ export const version = "187.32.6";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,9 +1,10 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
3
+ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
4
  import { timestampToString, mapSlice } from '@atlaskit/editor-common/utils';
4
5
  export function transformToCodeBlockAction(state, start, attrs) {
5
6
  var startOfCodeBlockText = state.selection.$from;
6
- var endPosition = state.selection.empty ? startOfCodeBlockText.end() : state.selection.$to.pos;
7
+ var endPosition = state.selection.empty && !(state.selection instanceof GapCursorSelection) ? startOfCodeBlockText.end() : state.selection.$to.pos;
7
8
  var startLinePosition = startOfCodeBlockText.start();
8
9
  //when cmd+A is used to select the content. start position should be 0.
9
10
  var parentStartPosition = startOfCodeBlockText.depth === 0 ? 0 : startOfCodeBlockText.before();
@@ -53,7 +54,7 @@ export function transformToCodeBlockAction(state, start, attrs) {
53
54
 
54
55
  // Reposition cursor when inserting into layouts or table headers
55
56
  var mapped = tr.doc.resolve(tr.mapping.map(startMapped) + 1);
56
- var selection = TextSelection.findFrom(mapped, 1, true);
57
+ var selection = TextSelection.findFrom(mapped, state.selection instanceof GapCursorSelection ? -1 : 1, true);
57
58
  if (selection) {
58
59
  return tr.setSelection(selection);
59
60
  }
@@ -147,7 +147,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
147
147
  return dispatch(tr);
148
148
  }, MEDIA_SINGLE_RESIZE_THROTTLE_TIME));
149
149
  _defineProperty(_assertThisInitialized(_this), "calcMaxWidth", memoizeOne(function (contentWidth, containerWidth, fullWidthMode) {
150
- if (_this.isNestedNode() || fullWidthMode) {
150
+ if (fullWidthMode) {
151
151
  return contentWidth;
152
152
  }
153
153
  return calcMediaSingleMaxWidth(containerWidth);
@@ -526,7 +526,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
526
526
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
527
527
  });
528
528
  var resizerNextClassName = classnames(className, resizerStyles);
529
- var maxWidth = this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
529
+ var maxWidth = this.isNestedNode() ? undefined // fall back to 'max-width: 100%'
530
+ : this.calcMaxWidth(lineLength, containerWidth, fullWidthMode);
530
531
  var minWidth = this.calcMinWidth(isVideoFile, lineLength);
531
532
  return jsx("div", {
532
533
  ref: this.saveWrapper,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.32.3";
2
+ export var version = "187.32.6";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.32.3",
3
+ "version": "187.32.6",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -105,7 +105,7 @@
105
105
  "@atlaskit/radio": "^5.6.0",
106
106
  "@atlaskit/section-message": "^6.4.0",
107
107
  "@atlaskit/select": "^16.5.0",
108
- "@atlaskit/smart-card": "^26.16.0",
108
+ "@atlaskit/smart-card": "^26.17.0",
109
109
  "@atlaskit/smart-user-picker": "^6.3.0",
110
110
  "@atlaskit/spinner": "^15.5.0",
111
111
  "@atlaskit/status": "^1.3.0",