@atlaskit/editor-core 159.0.0 → 161.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 161.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 160.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`a0b1dde9b9e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a0b1dde9b9e) - [ux] Fixed the issue where the "change table width" button was incorrectly positioned, overlapping the side panel, when the table is being rendered in sticky header mode.
14
+
15
+ ## 159.0.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [`e68f0f554fa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e68f0f554fa) - remove mousedown handler for inline links and add a vr test for the logic
20
+ - Updated dependencies
21
+
3
22
  ## 159.0.0
4
23
 
5
24
  ### Patch Changes
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -21,7 +23,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
21
23
 
22
24
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
25
 
24
- var _react = _interopRequireDefault(require("react"));
26
+ var _react = _interopRequireWildcard(require("react"));
25
27
 
26
28
  var _classnames2 = _interopRequireDefault(require("classnames"));
27
29
 
@@ -43,6 +45,10 @@ var _types = require("../../types");
43
45
 
44
46
  var _prosemirrorUtils = require("prosemirror-utils");
45
47
 
48
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
49
+
50
+ 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; }
51
+
46
52
  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); }; }
47
53
 
48
54
  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; } }
@@ -87,6 +93,18 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
87
93
  }
88
94
 
89
95
  _this = _super.call.apply(_super, [this].concat(args));
96
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "stickyButtonRef", /*#__PURE__*/(0, _react.createRef)());
97
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resizeObserver", new ResizeObserver(function (entries) {
98
+ entries.forEach(function (entry) {
99
+ var resizeButton = _this.stickyButtonRef.current;
100
+ var tableWrapper = _this.props.targetRef;
101
+
102
+ if (resizeButton && tableWrapper) {
103
+ var clientRect = tableWrapper.getBoundingClientRect();
104
+ resizeButton.style.left = "".concat(clientRect.right, "px");
105
+ }
106
+ });
107
+ }));
90
108
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
91
109
  var _this$props$editorVie = _this.props.editorView,
92
110
  state = _this$props$editorVie.state,
@@ -135,20 +153,22 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
135
153
  }
136
154
  }, {
137
155
  key: "renderSticky",
138
- value: function renderSticky(button, targetRef) {
156
+ value: function renderSticky(button, targetRef, tableRef) {
139
157
  var title = this.getTitle();
140
158
 
141
- if (!targetRef || !(targetRef instanceof HTMLElement)) {
159
+ if (!(targetRef instanceof HTMLElement) || !(tableRef instanceof HTMLElement)) {
142
160
  return null;
143
161
  }
144
162
 
145
163
  var pos = targetRef.getBoundingClientRect();
164
+ var tablePos = tableRef.getBoundingClientRect();
146
165
  return /*#__PURE__*/_react.default.createElement("div", {
166
+ ref: this.stickyButtonRef,
147
167
  "aria-label": title,
148
168
  style: {
149
169
  position: 'fixed',
150
170
  top: pos.top + 22,
151
- left: pos.right + 10
171
+ left: tablePos.right
152
172
  }
153
173
  }, button);
154
174
  }
@@ -186,12 +206,32 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
186
206
  var button = this.toolbarButton();
187
207
  var stickyTargetRef = stickyHeader && stickyHeader.sticky && stickyHeader.pos ? this.getStickyTargetRef(stickyHeader.pos) : null;
188
208
 
189
- if (stickyTargetRef) {
190
- return this.renderSticky(button, stickyTargetRef);
209
+ if (stickyTargetRef && this.props.targetRef) {
210
+ return this.renderSticky(button, stickyTargetRef, this.props.targetRef);
191
211
  } else {
192
212
  return this.renderPopup(button);
193
213
  }
194
214
  }
215
+ }, {
216
+ key: "componentDidMount",
217
+ value: function componentDidMount() {
218
+ var dom = this.props.editorView.dom;
219
+ var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
220
+
221
+ if (scrollPanel instanceof HTMLElement) {
222
+ this.resizeObserver.observe(scrollPanel);
223
+ }
224
+ }
225
+ }, {
226
+ key: "componentWillUnmount",
227
+ value: function componentWillUnmount() {
228
+ var dom = this.props.editorView.dom;
229
+ var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
230
+
231
+ if (scrollPanel instanceof HTMLElement) {
232
+ this.resizeObserver.unobserve(scrollPanel);
233
+ }
234
+ }
195
235
  }, {
196
236
  key: "shouldComponentUpdate",
197
237
  value: function shouldComponentUpdate(nextProps) {
@@ -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 = "159.0.0";
9
+ var version = "161.0.0";
10
10
  exports.version = version;
11
11
 
12
12
  var nextMajorVersion = function nextMajorVersion() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "159.0.0",
3
+ "version": "161.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React from 'react';
2
+ import React, { createRef } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { injectIntl } from 'react-intl-next';
5
5
  import { Popup } from '@atlaskit/editor-common/ui';
@@ -34,6 +34,20 @@ class LayoutButton extends React.Component {
34
34
  constructor(...args) {
35
35
  super(...args);
36
36
 
37
+ _defineProperty(this, "stickyButtonRef", /*#__PURE__*/createRef());
38
+
39
+ _defineProperty(this, "resizeObserver", new ResizeObserver(entries => {
40
+ entries.forEach(entry => {
41
+ const resizeButton = this.stickyButtonRef.current;
42
+ const tableWrapper = this.props.targetRef;
43
+
44
+ if (resizeButton && tableWrapper) {
45
+ const clientRect = tableWrapper.getBoundingClientRect();
46
+ resizeButton.style.left = `${clientRect.right}px`;
47
+ }
48
+ });
49
+ }));
50
+
37
51
  _defineProperty(this, "handleClick", () => {
38
52
  const {
39
53
  state,
@@ -83,20 +97,22 @@ class LayoutButton extends React.Component {
83
97
  return node.dataset['headerRow'] && node.classList.contains('sticky') ? node : null;
84
98
  }
85
99
 
86
- renderSticky(button, targetRef) {
100
+ renderSticky(button, targetRef, tableRef) {
87
101
  const title = this.getTitle();
88
102
 
89
- if (!targetRef || !(targetRef instanceof HTMLElement)) {
103
+ if (!(targetRef instanceof HTMLElement) || !(tableRef instanceof HTMLElement)) {
90
104
  return null;
91
105
  }
92
106
 
93
107
  const pos = targetRef.getBoundingClientRect();
108
+ const tablePos = tableRef.getBoundingClientRect();
94
109
  return /*#__PURE__*/React.createElement("div", {
110
+ ref: this.stickyButtonRef,
95
111
  "aria-label": title,
96
112
  style: {
97
113
  position: 'fixed',
98
114
  top: pos.top + 22,
99
- left: pos.right + 10
115
+ left: tablePos.right
100
116
  }
101
117
  }, button);
102
118
  }
@@ -135,13 +151,31 @@ class LayoutButton extends React.Component {
135
151
  const button = this.toolbarButton();
136
152
  const stickyTargetRef = stickyHeader && stickyHeader.sticky && stickyHeader.pos ? this.getStickyTargetRef(stickyHeader.pos) : null;
137
153
 
138
- if (stickyTargetRef) {
139
- return this.renderSticky(button, stickyTargetRef);
154
+ if (stickyTargetRef && this.props.targetRef) {
155
+ return this.renderSticky(button, stickyTargetRef, this.props.targetRef);
140
156
  } else {
141
157
  return this.renderPopup(button);
142
158
  }
143
159
  }
144
160
 
161
+ componentDidMount() {
162
+ const dom = this.props.editorView.dom;
163
+ const scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
164
+
165
+ if (scrollPanel instanceof HTMLElement) {
166
+ this.resizeObserver.observe(scrollPanel);
167
+ }
168
+ }
169
+
170
+ componentWillUnmount() {
171
+ const dom = this.props.editorView.dom;
172
+ const scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
173
+
174
+ if (scrollPanel instanceof HTMLElement) {
175
+ this.resizeObserver.unobserve(scrollPanel);
176
+ }
177
+ }
178
+
145
179
  shouldComponentUpdate(nextProps) {
146
180
  const {
147
181
  targetRef,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "159.0.0";
2
+ export const version = "161.0.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "159.0.0",
3
+ "version": "161.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -14,7 +14,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
14
14
 
15
15
  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; }
16
16
 
17
- import React from 'react';
17
+ import React, { createRef } from 'react';
18
18
  import classnames from 'classnames';
19
19
  import { injectIntl } from 'react-intl-next';
20
20
  import { Popup } from '@atlaskit/editor-common/ui';
@@ -63,6 +63,20 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
63
63
 
64
64
  _this = _super.call.apply(_super, [this].concat(args));
65
65
 
66
+ _defineProperty(_assertThisInitialized(_this), "stickyButtonRef", /*#__PURE__*/createRef());
67
+
68
+ _defineProperty(_assertThisInitialized(_this), "resizeObserver", new ResizeObserver(function (entries) {
69
+ entries.forEach(function (entry) {
70
+ var resizeButton = _this.stickyButtonRef.current;
71
+ var tableWrapper = _this.props.targetRef;
72
+
73
+ if (resizeButton && tableWrapper) {
74
+ var clientRect = tableWrapper.getBoundingClientRect();
75
+ resizeButton.style.left = "".concat(clientRect.right, "px");
76
+ }
77
+ });
78
+ }));
79
+
66
80
  _defineProperty(_assertThisInitialized(_this), "handleClick", function () {
67
81
  var _this$props$editorVie = _this.props.editorView,
68
82
  state = _this$props$editorVie.state,
@@ -112,20 +126,22 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
112
126
  }
113
127
  }, {
114
128
  key: "renderSticky",
115
- value: function renderSticky(button, targetRef) {
129
+ value: function renderSticky(button, targetRef, tableRef) {
116
130
  var title = this.getTitle();
117
131
 
118
- if (!targetRef || !(targetRef instanceof HTMLElement)) {
132
+ if (!(targetRef instanceof HTMLElement) || !(tableRef instanceof HTMLElement)) {
119
133
  return null;
120
134
  }
121
135
 
122
136
  var pos = targetRef.getBoundingClientRect();
137
+ var tablePos = tableRef.getBoundingClientRect();
123
138
  return /*#__PURE__*/React.createElement("div", {
139
+ ref: this.stickyButtonRef,
124
140
  "aria-label": title,
125
141
  style: {
126
142
  position: 'fixed',
127
143
  top: pos.top + 22,
128
- left: pos.right + 10
144
+ left: tablePos.right
129
145
  }
130
146
  }, button);
131
147
  }
@@ -163,12 +179,32 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
163
179
  var button = this.toolbarButton();
164
180
  var stickyTargetRef = stickyHeader && stickyHeader.sticky && stickyHeader.pos ? this.getStickyTargetRef(stickyHeader.pos) : null;
165
181
 
166
- if (stickyTargetRef) {
167
- return this.renderSticky(button, stickyTargetRef);
182
+ if (stickyTargetRef && this.props.targetRef) {
183
+ return this.renderSticky(button, stickyTargetRef, this.props.targetRef);
168
184
  } else {
169
185
  return this.renderPopup(button);
170
186
  }
171
187
  }
188
+ }, {
189
+ key: "componentDidMount",
190
+ value: function componentDidMount() {
191
+ var dom = this.props.editorView.dom;
192
+ var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
193
+
194
+ if (scrollPanel instanceof HTMLElement) {
195
+ this.resizeObserver.observe(scrollPanel);
196
+ }
197
+ }
198
+ }, {
199
+ key: "componentWillUnmount",
200
+ value: function componentWillUnmount() {
201
+ var dom = this.props.editorView.dom;
202
+ var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
203
+
204
+ if (scrollPanel instanceof HTMLElement) {
205
+ this.resizeObserver.unobserve(scrollPanel);
206
+ }
207
+ }
172
208
  }, {
173
209
  key: "shouldComponentUpdate",
174
210
  value: function shouldComponentUpdate(nextProps) {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "159.0.0";
2
+ export var version = "161.0.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "159.0.0",
3
+ "version": "161.0.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "159.0.0",
3
+ "version": "161.0.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -129,7 +129,7 @@
129
129
  },
130
130
  "peerDependencies": {
131
131
  "@atlaskit/media-core": "^32.2.0",
132
- "@atlaskit/smart-card": "^17.5.0",
132
+ "@atlaskit/smart-card": "^17.6.0",
133
133
  "react": "^16.8.0",
134
134
  "react-dom": "^16.8.0",
135
135
  "react-intl": "^2.6.0",
@@ -157,10 +157,10 @@
157
157
  "@atlaskit/page-layout": "^1.0.1",
158
158
  "@atlaskit/profilecard": "^16.3.0",
159
159
  "@atlaskit/pubsub": "^6.0.0",
160
- "@atlaskit/renderer": "^90.0.0",
160
+ "@atlaskit/renderer": "^91.0.0",
161
161
  "@atlaskit/section-message": "^6.1.0",
162
162
  "@atlaskit/share": "*",
163
- "@atlaskit/smart-card": "^17.5.0",
163
+ "@atlaskit/smart-card": "^17.6.0",
164
164
  "@atlaskit/synchrony-test-helpers": "^2.3.0",
165
165
  "@atlaskit/textarea": "^4.3.0",
166
166
  "@atlaskit/toggle": "^12.4.0",