@atlaskit/editor-common 95.9.1 → 95.10.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,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 95.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#161872](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161872)
8
+ [`11eec41d47477`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/11eec41d47477) -
9
+ added new replace action to the core plugin actions to enable document replacement in a way that
10
+ doesn't reset editor state
11
+ - [#171350](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171350)
12
+ [`436dfb28a4833`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/436dfb28a4833) -
13
+ [ux] Support disabled type-ahead items while user is offline for media, emoji, and mentions.
14
+
3
15
  ## 95.9.1
4
16
 
5
17
  ### Patch Changes
@@ -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 = "95.9.1";
20
+ var packageVersion = "95.10.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
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.corePlugin = void 0;
7
+ var _processRawValue = require("../../../src/utils/processRawValue");
7
8
  var _editorCommands = require("../editor-commands");
8
9
  var _requestDocument = require("./requestDocument");
9
10
  /**
@@ -46,6 +47,21 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
46
47
  editorView.dom.blur();
47
48
  return true;
48
49
  },
50
+ replaceDocument: function replaceDocument(replaceValue) {
51
+ var editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
52
+ if (!editorView || replaceValue === undefined || replaceValue === null) {
53
+ return false;
54
+ }
55
+ var state = editorView.state;
56
+ var schema = state.schema;
57
+ var content = Array.isArray(replaceValue) ? (0, _processRawValue.processRawFragmentValue)(schema, replaceValue) : (0, _processRawValue.processRawValue)(schema, replaceValue);
58
+ if (content) {
59
+ var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
60
+ editorView.dispatch(tr.scrollIntoView());
61
+ return true;
62
+ }
63
+ return false;
64
+ },
49
65
  requestDocument: function requestDocument(onReceive, options) {
50
66
  var _config$getEditorView;
51
67
  var view = (_config$getEditorView = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView !== void 0 ? _config$getEditorView : null;
@@ -55,9 +55,12 @@ var SortOrder = exports.SortOrder = /*#__PURE__*/function (SortOrder) {
55
55
  SortOrder["DESC"] = "desc";
56
56
  SortOrder["NO_ORDER"] = "no_order";
57
57
  return SortOrder;
58
- }({}); // DEPREACTED
58
+ }({});
59
59
  /**
60
- * @depreacted
60
+ * @deprecated
61
+ */
62
+ /**
63
+ * @deprecated
61
64
  *
62
65
  * Please use ExtractPresetAPI from "@atlaskit/editor-common/preset" instead.
63
66
  */
@@ -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 = "95.9.1";
27
+ var packageVersion = "95.10.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -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 = "95.9.1";
4
+ const packageVersion = "95.10.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
@@ -1,3 +1,4 @@
1
+ import { processRawFragmentValue, processRawValue } from '../../../src/utils/processRawValue';
1
2
  import { editorCommandToPMCommand } from '../editor-commands';
2
3
  import { scheduleDocumentRequest } from './requestDocument';
3
4
 
@@ -44,6 +45,25 @@ export const corePlugin = ({
44
45
  editorView.dom.blur();
45
46
  return true;
46
47
  },
48
+ replaceDocument: replaceValue => {
49
+ const editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
50
+ if (!editorView || replaceValue === undefined || replaceValue === null) {
51
+ return false;
52
+ }
53
+ const {
54
+ state
55
+ } = editorView;
56
+ const {
57
+ schema
58
+ } = state;
59
+ const content = Array.isArray(replaceValue) ? processRawFragmentValue(schema, replaceValue) : processRawValue(schema, replaceValue);
60
+ if (content) {
61
+ const tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
62
+ editorView.dispatch(tr.scrollIntoView());
63
+ return true;
64
+ }
65
+ return false;
66
+ },
47
67
  requestDocument(onReceive, options) {
48
68
  var _config$getEditorView;
49
69
  const view = (_config$getEditorView = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView !== void 0 ? _config$getEditorView : null;
@@ -10,10 +10,12 @@ export let SortOrder = /*#__PURE__*/function (SortOrder) {
10
10
  export { AnnotationUpdateEmitter, AnnotationUpdateEvent } from './annotation/emitter';
11
11
  export { ToolbarSize, ToolbarWidths, ToolbarWidthsNext, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext } from './toolbar';
12
12
 
13
- // DEPREACTED
13
+ /**
14
+ * @deprecated
15
+ */
14
16
 
15
17
  /**
16
- * @depreacted
18
+ * @deprecated
17
19
  *
18
20
  * Please use ExtractPresetAPI from "@atlaskit/editor-common/preset" instead.
19
21
  */
@@ -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 = "95.9.1";
16
+ const packageVersion = "95.10.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -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 = "95.9.1";
10
+ var packageVersion = "95.10.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
@@ -1,3 +1,4 @@
1
+ import { processRawFragmentValue, processRawValue } from '../../../src/utils/processRawValue';
1
2
  import { editorCommandToPMCommand } from '../editor-commands';
2
3
  import { scheduleDocumentRequest } from './requestDocument';
3
4
 
@@ -41,6 +42,21 @@ export var corePlugin = function corePlugin(_ref) {
41
42
  editorView.dom.blur();
42
43
  return true;
43
44
  },
45
+ replaceDocument: function replaceDocument(replaceValue) {
46
+ var editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
47
+ if (!editorView || replaceValue === undefined || replaceValue === null) {
48
+ return false;
49
+ }
50
+ var state = editorView.state;
51
+ var schema = state.schema;
52
+ var content = Array.isArray(replaceValue) ? processRawFragmentValue(schema, replaceValue) : processRawValue(schema, replaceValue);
53
+ if (content) {
54
+ var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
55
+ editorView.dispatch(tr.scrollIntoView());
56
+ return true;
57
+ }
58
+ return false;
59
+ },
44
60
  requestDocument: function requestDocument(onReceive, options) {
45
61
  var _config$getEditorView;
46
62
  var view = (_config$getEditorView = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView !== void 0 ? _config$getEditorView : null;
@@ -10,10 +10,12 @@ export var SortOrder = /*#__PURE__*/function (SortOrder) {
10
10
  export { AnnotationUpdateEmitter, AnnotationUpdateEvent } from './annotation/emitter';
11
11
  export { ToolbarSize, ToolbarWidths, ToolbarWidthsNext, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext } from './toolbar';
12
12
 
13
- // DEPREACTED
13
+ /**
14
+ * @deprecated
15
+ */
14
16
 
15
17
  /**
16
- * @depreacted
18
+ * @deprecated
17
19
  *
18
20
  * Please use ExtractPresetAPI from "@atlaskit/editor-common/preset" instead.
19
21
  */
@@ -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 = "95.9.1";
24
+ var packageVersion = "95.10.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -47,9 +47,12 @@ export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOpt
47
47
  export type { Refs, RefsNode, DocBuilder } from './doc-builder';
48
48
  export type { SelectionToolbarGroup, SelectionToolbarHandler } from './selection-toolbar';
49
49
  export type { FeedbackInfo } from './feedback-dialog';
50
+ /**
51
+ * @deprecated
52
+ */
50
53
  import type { EditorPresetBuilder, ExtractPresetAPI } from '../preset';
51
54
  /**
52
- * @depreacted
55
+ * @deprecated
53
56
  *
54
57
  * Please use ExtractPresetAPI from "@atlaskit/editor-common/preset" instead.
55
58
  */
@@ -5,7 +5,7 @@
5
5
  * are put together - but for now `Builder` & `Preset` aim to beinterchangeable.
6
6
  */
7
7
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
8
- import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
8
+ import type { Fragment, Node, Schema } from '@atlaskit/editor-prosemirror/model';
9
9
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
10
10
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
11
  import type { FireAnalyticsCallback } from '../analytics';
@@ -50,6 +50,13 @@ export type CorePlugin = NextEditorPlugin<'core', {
50
50
  * @returns (boolean) if the blur was successful
51
51
  */
52
52
  blur: () => boolean;
53
+ /**
54
+ * Replaces the current content of the editor with the provided raw value.
55
+ *
56
+ * @param replaceValue - The new content to replace the current content. It can be of any type.
57
+ * @returns A boolean indicating whether the replacement was successful.
58
+ */
59
+ replaceDocument: (replaceValue: Node | Fragment | Array<Node> | Object | string) => boolean;
53
60
  /**
54
61
  * Request the editor document.
55
62
  * The document will return when available. If called multiple times it will throttle and return the
@@ -37,6 +37,7 @@ export type TypeAheadItem = {
37
37
  key?: string | number;
38
38
  icon?: () => ReactElement<any>;
39
39
  render?: (props: TypeAheadItemRenderProps) => React.ReactElement<TypeAheadItemRenderProps> | null;
40
+ isDisabledOffline?: boolean;
40
41
  [key: string]: any;
41
42
  };
42
43
  export type TypeAheadForceSelect = (props: TypeAheadForceSelectProps) => TypeAheadItem | undefined;
@@ -47,9 +47,12 @@ export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOpt
47
47
  export type { Refs, RefsNode, DocBuilder } from './doc-builder';
48
48
  export type { SelectionToolbarGroup, SelectionToolbarHandler } from './selection-toolbar';
49
49
  export type { FeedbackInfo } from './feedback-dialog';
50
+ /**
51
+ * @deprecated
52
+ */
50
53
  import type { EditorPresetBuilder, ExtractPresetAPI } from '../preset';
51
54
  /**
52
- * @depreacted
55
+ * @deprecated
53
56
  *
54
57
  * Please use ExtractPresetAPI from "@atlaskit/editor-common/preset" instead.
55
58
  */
@@ -5,7 +5,7 @@
5
5
  * are put together - but for now `Builder` & `Preset` aim to beinterchangeable.
6
6
  */
7
7
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
8
- import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
8
+ import type { Fragment, Node, Schema } from '@atlaskit/editor-prosemirror/model';
9
9
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
10
10
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
11
  import type { FireAnalyticsCallback } from '../analytics';
@@ -50,6 +50,13 @@ export type CorePlugin = NextEditorPlugin<'core', {
50
50
  * @returns (boolean) if the blur was successful
51
51
  */
52
52
  blur: () => boolean;
53
+ /**
54
+ * Replaces the current content of the editor with the provided raw value.
55
+ *
56
+ * @param replaceValue - The new content to replace the current content. It can be of any type.
57
+ * @returns A boolean indicating whether the replacement was successful.
58
+ */
59
+ replaceDocument: (replaceValue: Node | Fragment | Array<Node> | Object | string) => boolean;
53
60
  /**
54
61
  * Request the editor document.
55
62
  * The document will return when available. If called multiple times it will throttle and return the
@@ -37,6 +37,7 @@ export type TypeAheadItem = {
37
37
  key?: string | number;
38
38
  icon?: () => ReactElement<any>;
39
39
  render?: (props: TypeAheadItemRenderProps) => React.ReactElement<TypeAheadItemRenderProps> | null;
40
+ isDisabledOffline?: boolean;
40
41
  [key: string]: any;
41
42
  };
42
43
  export type TypeAheadForceSelect = (props: TypeAheadForceSelectProps) => TypeAheadItem | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "95.9.1",
3
+ "version": "95.10.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/"
@@ -124,16 +124,16 @@
124
124
  "@atlaskit/dropdown-menu": "^12.23.0",
125
125
  "@atlaskit/editor-json-transformer": "^8.21.0",
126
126
  "@atlaskit/editor-palette": "1.6.3",
127
- "@atlaskit/editor-prosemirror": "6.0.0",
127
+ "@atlaskit/editor-prosemirror": "6.2.1",
128
128
  "@atlaskit/editor-shared-styles": "^3.2.0",
129
129
  "@atlaskit/editor-tables": "^2.8.0",
130
130
  "@atlaskit/emoji": "^67.11.0",
131
- "@atlaskit/icon": "^22.27.0",
132
- "@atlaskit/icon-object": "^6.7.0",
131
+ "@atlaskit/icon": "^22.28.0",
132
+ "@atlaskit/icon-object": "^6.8.0",
133
133
  "@atlaskit/link-datasource": "^3.13.0",
134
134
  "@atlaskit/link-picker": "^1.47.0",
135
135
  "@atlaskit/media-card": "^78.15.0",
136
- "@atlaskit/media-client": "^28.4.0",
136
+ "@atlaskit/media-client": "^28.5.0",
137
137
  "@atlaskit/media-client-react": "^2.4.0",
138
138
  "@atlaskit/media-common": "^11.7.0",
139
139
  "@atlaskit/media-file-preview": "^0.9.0",
@@ -148,7 +148,7 @@
148
148
  "@atlaskit/primitives": "^13.3.0",
149
149
  "@atlaskit/profilecard": "^20.12.0",
150
150
  "@atlaskit/section-message": "^6.7.0",
151
- "@atlaskit/smart-card": "^32.1.0",
151
+ "@atlaskit/smart-card": "^32.2.0",
152
152
  "@atlaskit/smart-user-picker": "^6.11.0",
153
153
  "@atlaskit/spinner": "^16.3.0",
154
154
  "@atlaskit/task-decision": "^17.11.0",