@atlaskit/editor-common 96.3.7 → 96.4.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,13 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 96.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#177897](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177897)
8
+ [`28ec478469426`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/28ec478469426) -
9
+ Adding an option to the core API replaceDocument to opt-out of the scrollIntoView behaviour.
10
+
3
11
  ## 96.3.7
4
12
 
5
13
  ### Patch Changes
@@ -113,9 +113,14 @@ var copyHTMLToClipboard = exports.copyHTMLToClipboard = /*#__PURE__*/function ()
113
113
  break;
114
114
  case 12:
115
115
  if ((typeof document === "undefined" ? "undefined" : (0, _typeof2.default)(document)) !== undefined) {
116
- // ED-17083 extension copy seems have issue with ClipboardItem API
117
- // Hence of use of this polyfill
118
- copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
116
+ try {
117
+ // ED-17083 extension copy seems have issue with ClipboardItem API
118
+ // Hence of use of this polyfill
119
+ copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
120
+ } catch (error) {
121
+ // eslint-disable-next-line no-console
122
+ console.log(error);
123
+ }
119
124
  }
120
125
  case 13:
121
126
  case "end":
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "96.3.7";
20
+ var packageVersion = "96.4.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -47,7 +47,7 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
47
47
  editorView.dom.blur();
48
48
  return true;
49
49
  },
50
- replaceDocument: function replaceDocument(replaceValue) {
50
+ replaceDocument: function replaceDocument(replaceValue, options) {
51
51
  var editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
52
52
  if (!editorView || replaceValue === undefined || replaceValue === null) {
53
53
  return false;
@@ -56,8 +56,13 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
56
56
  var schema = state.schema;
57
57
  var content = Array.isArray(replaceValue) ? (0, _processRawValue.processRawFragmentValue)(schema, replaceValue) : (0, _processRawValue.processRawValue)(schema, replaceValue);
58
58
  if (content) {
59
+ var _options$scrollIntoVi2;
59
60
  var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
60
- editorView.dispatch(tr.scrollIntoView());
61
+ if ((_options$scrollIntoVi2 = options === null || options === void 0 ? void 0 : options.scrollIntoView) !== null && _options$scrollIntoVi2 !== void 0 ? _options$scrollIntoVi2 : true) {
62
+ editorView.dispatch(tr.scrollIntoView());
63
+ } else {
64
+ editorView.dispatch(tr);
65
+ }
61
66
  return true;
62
67
  }
63
68
  return false;
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "96.3.7";
27
+ var packageVersion = "96.4.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -45,9 +45,14 @@ export const copyHTMLToClipboard = async (elementToCopy, plainTextToCopy) => {
45
45
  throw new Error('Clipboard api is not supported');
46
46
  }
47
47
  } else if (typeof document !== undefined) {
48
- // ED-17083 extension copy seems have issue with ClipboardItem API
49
- // Hence of use of this polyfill
50
- copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
48
+ try {
49
+ // ED-17083 extension copy seems have issue with ClipboardItem API
50
+ // Hence of use of this polyfill
51
+ copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
52
+ } catch (error) {
53
+ // eslint-disable-next-line no-console
54
+ console.log(error);
55
+ }
51
56
  }
52
57
  };
53
58
 
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "96.3.7";
4
+ const packageVersion = "96.4.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -45,7 +45,7 @@ export const corePlugin = ({
45
45
  editorView.dom.blur();
46
46
  return true;
47
47
  },
48
- replaceDocument: replaceValue => {
48
+ replaceDocument: (replaceValue, options) => {
49
49
  const editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
50
50
  if (!editorView || replaceValue === undefined || replaceValue === null) {
51
51
  return false;
@@ -58,8 +58,13 @@ export const corePlugin = ({
58
58
  } = state;
59
59
  const content = Array.isArray(replaceValue) ? processRawFragmentValue(schema, replaceValue) : processRawValue(schema, replaceValue);
60
60
  if (content) {
61
+ var _options$scrollIntoVi2;
61
62
  const tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
62
- editorView.dispatch(tr.scrollIntoView());
63
+ if ((_options$scrollIntoVi2 = options === null || options === void 0 ? void 0 : options.scrollIntoView) !== null && _options$scrollIntoVi2 !== void 0 ? _options$scrollIntoVi2 : true) {
64
+ editorView.dispatch(tr.scrollIntoView());
65
+ } else {
66
+ editorView.dispatch(tr);
67
+ }
63
68
  return true;
64
69
  }
65
70
  return false;
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "96.3.7";
16
+ const packageVersion = "96.4.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -103,9 +103,14 @@ export var copyHTMLToClipboard = /*#__PURE__*/function () {
103
103
  break;
104
104
  case 12:
105
105
  if ((typeof document === "undefined" ? "undefined" : _typeof(document)) !== undefined) {
106
- // ED-17083 extension copy seems have issue with ClipboardItem API
107
- // Hence of use of this polyfill
108
- copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
106
+ try {
107
+ // ED-17083 extension copy seems have issue with ClipboardItem API
108
+ // Hence of use of this polyfill
109
+ copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
110
+ } catch (error) {
111
+ // eslint-disable-next-line no-console
112
+ console.log(error);
113
+ }
109
114
  }
110
115
  case 13:
111
116
  case "end":
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "96.3.7";
10
+ var packageVersion = "96.4.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -42,7 +42,7 @@ export var corePlugin = function corePlugin(_ref) {
42
42
  editorView.dom.blur();
43
43
  return true;
44
44
  },
45
- replaceDocument: function replaceDocument(replaceValue) {
45
+ replaceDocument: function replaceDocument(replaceValue, options) {
46
46
  var editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
47
47
  if (!editorView || replaceValue === undefined || replaceValue === null) {
48
48
  return false;
@@ -51,8 +51,13 @@ export var corePlugin = function corePlugin(_ref) {
51
51
  var schema = state.schema;
52
52
  var content = Array.isArray(replaceValue) ? processRawFragmentValue(schema, replaceValue) : processRawValue(schema, replaceValue);
53
53
  if (content) {
54
+ var _options$scrollIntoVi2;
54
55
  var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
55
- editorView.dispatch(tr.scrollIntoView());
56
+ if ((_options$scrollIntoVi2 = options === null || options === void 0 ? void 0 : options.scrollIntoView) !== null && _options$scrollIntoVi2 !== void 0 ? _options$scrollIntoVi2 : true) {
57
+ editorView.dispatch(tr.scrollIntoView());
58
+ } else {
59
+ editorView.dispatch(tr);
60
+ }
56
61
  return true;
57
62
  }
58
63
  return false;
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "96.3.7";
24
+ var packageVersion = "96.4.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -54,9 +54,13 @@ export type CorePlugin = NextEditorPlugin<'core', {
54
54
  * Replaces the current content of the editor with the provided raw value.
55
55
  *
56
56
  * @param replaceValue - The new content to replace the current content. It can be of any type.
57
+ * @param options - Options
58
+ * @param options.scrollIntoView (boolean) if the view should also scroll on replace. True by default
57
59
  * @returns A boolean indicating whether the replacement was successful.
58
60
  */
59
- replaceDocument: (replaceValue: Node | Fragment | Array<Node> | Object | string) => boolean;
61
+ replaceDocument: (replaceValue: Node | Fragment | Array<Node> | Object | string, options?: {
62
+ scrollIntoView?: boolean;
63
+ }) => boolean;
60
64
  /**
61
65
  * Request the editor document.
62
66
  * The document will return when available. If called multiple times it will throttle and return the
@@ -54,9 +54,13 @@ export type CorePlugin = NextEditorPlugin<'core', {
54
54
  * Replaces the current content of the editor with the provided raw value.
55
55
  *
56
56
  * @param replaceValue - The new content to replace the current content. It can be of any type.
57
+ * @param options - Options
58
+ * @param options.scrollIntoView (boolean) if the view should also scroll on replace. True by default
57
59
  * @returns A boolean indicating whether the replacement was successful.
58
60
  */
59
- replaceDocument: (replaceValue: Node | Fragment | Array<Node> | Object | string) => boolean;
61
+ replaceDocument: (replaceValue: Node | Fragment | Array<Node> | Object | string, options?: {
62
+ scrollIntoView?: boolean;
63
+ }) => boolean;
60
64
  /**
61
65
  * Request the editor document.
62
66
  * The document will return when available. If called multiple times it will throttle and return the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "96.3.7",
3
+ "version": "96.4.0",
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/"