@atlaskit/editor-common 88.9.0 → 88.11.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/count-nodes/package.json +15 -0
  3. package/dist/cjs/monitoring/error.js +1 -1
  4. package/dist/cjs/styles/shared/blockquote.js +6 -0
  5. package/dist/cjs/styles/shared/media-single.js +1 -1
  6. package/dist/cjs/styles/shared/table.js +9 -2
  7. package/dist/cjs/ui/DropList/index.js +1 -1
  8. package/dist/cjs/ui/Emoji/index.js +1 -0
  9. package/dist/cjs/utils/document.js +0 -180
  10. package/dist/cjs/utils/index.js +32 -1
  11. package/dist/cjs/utils/processRawValue.js +185 -0
  12. package/dist/es2019/monitoring/error.js +1 -1
  13. package/dist/es2019/styles/shared/blockquote.js +6 -0
  14. package/dist/es2019/styles/shared/media-single.js +1 -1
  15. package/dist/es2019/styles/shared/table.js +27 -14
  16. package/dist/es2019/ui/DropList/index.js +1 -1
  17. package/dist/es2019/ui/Emoji/index.js +1 -0
  18. package/dist/es2019/utils/document.js +0 -183
  19. package/dist/es2019/utils/index.js +44 -2
  20. package/dist/es2019/utils/processRawValue.js +183 -0
  21. package/dist/esm/monitoring/error.js +1 -1
  22. package/dist/esm/styles/shared/blockquote.js +6 -0
  23. package/dist/esm/styles/shared/media-single.js +1 -1
  24. package/dist/esm/styles/shared/table.js +9 -2
  25. package/dist/esm/ui/DropList/index.js +1 -1
  26. package/dist/esm/ui/Emoji/index.js +1 -0
  27. package/dist/esm/utils/document.js +0 -179
  28. package/dist/esm/utils/index.js +44 -2
  29. package/dist/esm/utils/processRawValue.js +179 -0
  30. package/dist/types/collab/index.d.ts +1 -0
  31. package/dist/types/utils/document.d.ts +2 -6
  32. package/dist/types/utils/index.d.ts +42 -2
  33. package/dist/types/utils/processRawValue.d.ts +6 -0
  34. package/dist/types-ts4.5/collab/index.d.ts +1 -0
  35. package/dist/types-ts4.5/utils/document.d.ts +2 -6
  36. package/dist/types-ts4.5/utils/index.d.ts +42 -2
  37. package/dist/types-ts4.5/utils/processRawValue.d.ts +6 -0
  38. package/is-performance-api-available/package.json +15 -0
  39. package/package.json +8 -3
  40. package/performance/measure-render/package.json +15 -0
  41. package/performance/navigation/package.json +15 -0
  42. package/process-raw-value/package.json +15 -0
@@ -1,10 +1,4 @@
1
- import { transformDedupeMarks, transformIndentationMarks, transformInvalidMediaContent, transformMediaLinkMarks, transformNodesMissingContent, transformTextLinkCodeMarks } from '@atlaskit/adf-utils/transforms';
2
- import { Node } from '@atlaskit/editor-prosemirror/model';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
4
1
  import { isEmptyParagraph } from './editor-core-utils';
5
- import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
6
- import { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
7
- import { validateADFEntity } from './validate-using-spec';
8
2
  export var getStepRange = function getStepRange(transaction) {
9
3
  var from = -1;
10
4
  var to = -1;
@@ -65,179 +59,6 @@ export function nodesBetweenChanged(tr, f, startPos) {
65
59
  }
66
60
  tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
67
61
  }
68
- export function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
69
- if (!value) {
70
- return;
71
- }
72
- var node;
73
- if (typeof value === 'string') {
74
- try {
75
- if (contentTransformer) {
76
- var doc = contentTransformer.parse(value);
77
- node = doc.toJSON();
78
- } else {
79
- node = JSON.parse(value);
80
- }
81
- } catch (e) {
82
- // eslint-disable-next-line no-console
83
- console.error("Error processing value: ".concat(value, " isn't a valid JSON"));
84
- return;
85
- }
86
- } else {
87
- node = value;
88
- }
89
- if (Array.isArray(node)) {
90
- // eslint-disable-next-line no-console
91
- console.error("Error processing value: ".concat(node, " is an array, but it must be an object."));
92
- return;
93
- }
94
- try {
95
- // ProseMirror always require a child under doc
96
- if (node.type === 'doc') {
97
- if (Array.isArray(node.content) && node.content.length === 0) {
98
- node.content.push({
99
- type: 'paragraph',
100
- content: []
101
- });
102
- }
103
- // Just making sure doc is always valid
104
- if (!node.version) {
105
- node.version = 1;
106
- }
107
- }
108
- if (contentTransformer) {
109
- return Node.fromJSON(schema, node);
110
- }
111
-
112
- // link mark on mediaSingle is deprecated, need to move link mark to child media node
113
- // https://product-fabric.atlassian.net/browse/ED-14043
114
- var _transformMediaLinkMa = transformMediaLinkMarks(node),
115
- transformedAdf = _transformMediaLinkMa.transformedAdf,
116
- isTransformed = _transformMediaLinkMa.isTransformed;
117
- if (isTransformed && dispatchAnalyticsEvent) {
118
- dispatchAnalyticsEvent({
119
- action: ACTION.MEDIA_LINK_TRANSFORMED,
120
- actionSubject: ACTION_SUBJECT.EDITOR,
121
- eventType: EVENT_TYPE.OPERATIONAL
122
- });
123
- }
124
-
125
- // See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
126
- // We declared in code mark spec that links and marks should not co-exist on
127
- // text nodes. This util strips code marks from bad text nodes and preserves links.
128
- // Otherwise, prosemirror will try to repair the invalid document by stripping links
129
- // and preserving code marks during content changes.
130
- var _transformTextLinkCod = transformTextLinkCodeMarks(transformedAdf);
131
- transformedAdf = _transformTextLinkCod.transformedAdf;
132
- isTransformed = _transformTextLinkCod.isTransformed;
133
- if (isTransformed && dispatchAnalyticsEvent) {
134
- dispatchAnalyticsEvent({
135
- action: ACTION.TEXT_LINK_MARK_TRANSFORMED,
136
- actionSubject: ACTION_SUBJECT.EDITOR,
137
- eventType: EVENT_TYPE.OPERATIONAL
138
- });
139
- }
140
- var discardedMarks = [];
141
- var _transformDedupeMarks = transformDedupeMarks(transformedAdf);
142
- transformedAdf = _transformDedupeMarks.transformedAdf;
143
- isTransformed = _transformDedupeMarks.isTransformed;
144
- discardedMarks = _transformDedupeMarks.discardedMarks;
145
- if (isTransformed && dispatchAnalyticsEvent) {
146
- dispatchAnalyticsEvent({
147
- action: ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
148
- actionSubject: ACTION_SUBJECT.EDITOR,
149
- eventType: EVENT_TYPE.OPERATIONAL,
150
- attributes: {
151
- /** UGC WARNING
152
- *
153
- * DO NOT include the `mark` attributes inside, we map here to only
154
- * extract the mark type as that is the only non-UGC safe information
155
- * that we can add to event-attributes
156
- *
157
- */
158
- discardedMarkTypes: discardedMarks.map(function (mark) {
159
- return mark.type;
160
- })
161
- }
162
- });
163
- }
164
- var _transformNodesMissin = transformNodesMissingContent(transformedAdf);
165
- transformedAdf = _transformNodesMissin.transformedAdf;
166
- isTransformed = _transformNodesMissin.isTransformed;
167
- if (isTransformed && dispatchAnalyticsEvent) {
168
- dispatchAnalyticsEvent({
169
- action: ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
170
- actionSubject: ACTION_SUBJECT.EDITOR,
171
- eventType: EVENT_TYPE.OPERATIONAL
172
- });
173
- }
174
- var _transformIndentation = transformIndentationMarks(transformedAdf);
175
- transformedAdf = _transformIndentation.transformedAdf;
176
- isTransformed = _transformIndentation.isTransformed;
177
- if (isTransformed && dispatchAnalyticsEvent) {
178
- dispatchAnalyticsEvent({
179
- action: ACTION.INDENTATION_MARKS_TRANSFORMED,
180
- actionSubject: ACTION_SUBJECT.EDITOR,
181
- eventType: EVENT_TYPE.OPERATIONAL
182
- });
183
- }
184
- var _transformInvalidMedi = transformInvalidMediaContent(transformedAdf);
185
- transformedAdf = _transformInvalidMedi.transformedAdf;
186
- isTransformed = _transformInvalidMedi.isTransformed;
187
- if (isTransformed && dispatchAnalyticsEvent) {
188
- dispatchAnalyticsEvent({
189
- action: ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
190
- actionSubject: ACTION_SUBJECT.EDITOR,
191
- eventType: EVENT_TYPE.OPERATIONAL
192
- });
193
- }
194
- var entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
195
- var newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
196
- var parsedDoc = Node.fromJSON(schema, newEntity);
197
-
198
- // throws an error if the document is invalid
199
- try {
200
- parsedDoc.check();
201
- } catch (err) {
202
- if (dispatchAnalyticsEvent) {
203
- dispatchAnalyticsEvent({
204
- action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
205
- actionSubject: ACTION_SUBJECT.EDITOR,
206
- eventType: EVENT_TYPE.OPERATIONAL
207
- });
208
- }
209
- throw err;
210
- }
211
- if (dispatchAnalyticsEvent) {
212
- findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
213
- }
214
- return parsedDoc;
215
- } catch (e) {
216
- if (dispatchAnalyticsEvent) {
217
- dispatchAnalyticsEvent({
218
- action: ACTION.DOCUMENT_PROCESSING_ERROR,
219
- actionSubject: ACTION_SUBJECT.EDITOR,
220
- eventType: EVENT_TYPE.OPERATIONAL
221
- });
222
- }
223
-
224
- // eslint-disable-next-line no-console
225
- console.error("Error processing document:\n".concat(e instanceof Error ? e.message : String(e), "\n\n"), JSON.stringify(node));
226
- if (isProseMirrorSchemaCheckError(e)) {
227
- throw e;
228
- }
229
- return;
230
- }
231
- }
232
- function isProseMirrorSchemaCheckError(error) {
233
- return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
234
- }
235
- var maySanitizePrivateContent = function maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent) {
236
- if (sanitizePrivateContent && providerFactory) {
237
- return sanitizeNodeForPrivacy(entity, providerFactory);
238
- }
239
- return entity;
240
- };
241
62
 
242
63
  /**
243
64
  * Returns false if node contains only empty inline nodes and hardBreaks.
@@ -55,10 +55,37 @@ export { default as ADFTraversor } from './traversor';
55
55
  export { analyticsEventKey, getAnalyticsAppearance, getAnalyticsEditorAppearance, getAnalyticsEventSeverity, SEVERITY } from './analytics';
56
56
  export { getUnsupportedContentLevelData, UNSUPPORTED_CONTENT_LEVEL_SEVERITY, UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS } from './unsupportedContent/get-unsupported-content-level-data';
57
57
  export { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
58
- export { getDistortedDurationMonitor, measureRender } from './performance/measure-render';
58
+ export {
59
+ /**
60
+ * @private
61
+ * @deprecated
62
+ *
63
+ * Please use `@atlaskit/editor-common/performance/measure-render` entry-point instead.
64
+ */
65
+ getDistortedDurationMonitor,
66
+ /**
67
+ * @private
68
+ * @deprecated
69
+ *
70
+ * Please use `@atlaskit/editor-common/performance/measure-render` entry-point instead.
71
+ */
72
+ measureRender } from './performance/measure-render';
59
73
  export { startMeasure, stopMeasure, clearMeasure } from './performance/measure';
60
74
  export { measureTTI, getTTISeverity, TTI_SEVERITY_THRESHOLD_DEFAULTS, TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS } from './performance/measure-tti';
75
+ /**
76
+ * @private
77
+ * @deprecated
78
+ *
79
+ * Private API - should not be used. Use `@atlaskit/editor-common/is-performance-api-available` if required.
80
+ *
81
+ */
61
82
  export { isPerformanceAPIAvailable, isPerformanceObserverAvailable } from './performance/is-performance-api-available';
83
+ /**
84
+ * @private
85
+ * @deprecated
86
+ *
87
+ * Private API - should not be used. Use `@atlaskit/editor-common/performance/navigation` if required.
88
+ */
62
89
  export { getResponseEndTime } from './performance/navigation';
63
90
  export { getExtensionRenderer } from './extension-handler';
64
91
  export { hasMergedCell, calcTableColumnWidths, convertProsemirrorTableNodeToArrayOfRows, isPositionNearTableRow } from './table';
@@ -92,12 +119,27 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
92
119
  // prosemirror-history does not export its plugin key
93
120
  export var pmHistoryPluginKey = 'history$';
94
121
  export { gridTypeForLayout } from './grid';
95
- export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, isSelectionEndOfParagraph, getChangedNodes } from './document';
122
+ export { nodesBetweenChanged, getStepRange, isEmptyDocument, hasDocAsParent, bracketTyped, hasVisibleContent, isSelectionEndOfParagraph, getChangedNodes } from './document';
123
+
124
+ /**
125
+ * @private
126
+ * @deprecated
127
+ *
128
+ * Use `@atlaskit/editor-common/process-raw-value` entry-point instead.
129
+ */
130
+ export { processRawValue } from './processRawValue';
96
131
  export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts } from './rich-media-utils';
97
132
  export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
98
133
  export { canRenderDatasource, getDatasourceType } from './datasource';
99
134
  export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode } from './commands';
100
135
  export { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, GUTTER_SIZE_MOBILE_IN_PX } from './scroll-gutter';
136
+
137
+ /**
138
+ * @private
139
+ * @deprecated
140
+ *
141
+ * Private API - do not use.
142
+ */
101
143
  export { getTimeSince } from './performance/get-performance-timing';
102
144
  export { countNodes } from './count-nodes';
103
145
  export function shallowEqual() {
@@ -0,0 +1,179 @@
1
+ import { transformDedupeMarks, transformIndentationMarks, transformInvalidMediaContent, transformMediaLinkMarks, transformNodesMissingContent, transformTextLinkCodeMarks } from '@atlaskit/adf-utils/transforms';
2
+ import { Node } from '@atlaskit/editor-prosemirror/model';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
4
+ import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
5
+ import { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
6
+ import { validateADFEntity } from './validate-using-spec';
7
+ export function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
8
+ if (!value) {
9
+ return;
10
+ }
11
+ var node;
12
+ if (typeof value === 'string') {
13
+ try {
14
+ if (contentTransformer) {
15
+ var doc = contentTransformer.parse(value);
16
+ node = doc.toJSON();
17
+ } else {
18
+ node = JSON.parse(value);
19
+ }
20
+ } catch (e) {
21
+ // eslint-disable-next-line no-console
22
+ console.error("Error processing value: ".concat(value, " isn't a valid JSON"));
23
+ return;
24
+ }
25
+ } else {
26
+ node = value;
27
+ }
28
+ if (Array.isArray(node)) {
29
+ // eslint-disable-next-line no-console
30
+ console.error("Error processing value: ".concat(node, " is an array, but it must be an object."));
31
+ return;
32
+ }
33
+ try {
34
+ // ProseMirror always require a child under doc
35
+ if (node.type === 'doc') {
36
+ if (Array.isArray(node.content) && node.content.length === 0) {
37
+ node.content.push({
38
+ type: 'paragraph',
39
+ content: []
40
+ });
41
+ }
42
+ // Just making sure doc is always valid
43
+ if (!node.version) {
44
+ node.version = 1;
45
+ }
46
+ }
47
+ if (contentTransformer) {
48
+ return Node.fromJSON(schema, node);
49
+ }
50
+
51
+ // link mark on mediaSingle is deprecated, need to move link mark to child media node
52
+ // https://product-fabric.atlassian.net/browse/ED-14043
53
+ var _transformMediaLinkMa = transformMediaLinkMarks(node),
54
+ transformedAdf = _transformMediaLinkMa.transformedAdf,
55
+ isTransformed = _transformMediaLinkMa.isTransformed;
56
+ if (isTransformed && dispatchAnalyticsEvent) {
57
+ dispatchAnalyticsEvent({
58
+ action: ACTION.MEDIA_LINK_TRANSFORMED,
59
+ actionSubject: ACTION_SUBJECT.EDITOR,
60
+ eventType: EVENT_TYPE.OPERATIONAL
61
+ });
62
+ }
63
+
64
+ // See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
65
+ // We declared in code mark spec that links and marks should not co-exist on
66
+ // text nodes. This util strips code marks from bad text nodes and preserves links.
67
+ // Otherwise, prosemirror will try to repair the invalid document by stripping links
68
+ // and preserving code marks during content changes.
69
+ var _transformTextLinkCod = transformTextLinkCodeMarks(transformedAdf);
70
+ transformedAdf = _transformTextLinkCod.transformedAdf;
71
+ isTransformed = _transformTextLinkCod.isTransformed;
72
+ if (isTransformed && dispatchAnalyticsEvent) {
73
+ dispatchAnalyticsEvent({
74
+ action: ACTION.TEXT_LINK_MARK_TRANSFORMED,
75
+ actionSubject: ACTION_SUBJECT.EDITOR,
76
+ eventType: EVENT_TYPE.OPERATIONAL
77
+ });
78
+ }
79
+ var discardedMarks = [];
80
+ var _transformDedupeMarks = transformDedupeMarks(transformedAdf);
81
+ transformedAdf = _transformDedupeMarks.transformedAdf;
82
+ isTransformed = _transformDedupeMarks.isTransformed;
83
+ discardedMarks = _transformDedupeMarks.discardedMarks;
84
+ if (isTransformed && dispatchAnalyticsEvent) {
85
+ dispatchAnalyticsEvent({
86
+ action: ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
87
+ actionSubject: ACTION_SUBJECT.EDITOR,
88
+ eventType: EVENT_TYPE.OPERATIONAL,
89
+ attributes: {
90
+ /** UGC WARNING
91
+ *
92
+ * DO NOT include the `mark` attributes inside, we map here to only
93
+ * extract the mark type as that is the only non-UGC safe information
94
+ * that we can add to event-attributes
95
+ *
96
+ */
97
+ discardedMarkTypes: discardedMarks.map(function (mark) {
98
+ return mark.type;
99
+ })
100
+ }
101
+ });
102
+ }
103
+ var _transformNodesMissin = transformNodesMissingContent(transformedAdf);
104
+ transformedAdf = _transformNodesMissin.transformedAdf;
105
+ isTransformed = _transformNodesMissin.isTransformed;
106
+ if (isTransformed && dispatchAnalyticsEvent) {
107
+ dispatchAnalyticsEvent({
108
+ action: ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
109
+ actionSubject: ACTION_SUBJECT.EDITOR,
110
+ eventType: EVENT_TYPE.OPERATIONAL
111
+ });
112
+ }
113
+ var _transformIndentation = transformIndentationMarks(transformedAdf);
114
+ transformedAdf = _transformIndentation.transformedAdf;
115
+ isTransformed = _transformIndentation.isTransformed;
116
+ if (isTransformed && dispatchAnalyticsEvent) {
117
+ dispatchAnalyticsEvent({
118
+ action: ACTION.INDENTATION_MARKS_TRANSFORMED,
119
+ actionSubject: ACTION_SUBJECT.EDITOR,
120
+ eventType: EVENT_TYPE.OPERATIONAL
121
+ });
122
+ }
123
+ var _transformInvalidMedi = transformInvalidMediaContent(transformedAdf);
124
+ transformedAdf = _transformInvalidMedi.transformedAdf;
125
+ isTransformed = _transformInvalidMedi.isTransformed;
126
+ if (isTransformed && dispatchAnalyticsEvent) {
127
+ dispatchAnalyticsEvent({
128
+ action: ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
129
+ actionSubject: ACTION_SUBJECT.EDITOR,
130
+ eventType: EVENT_TYPE.OPERATIONAL
131
+ });
132
+ }
133
+ var entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
134
+ var newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
135
+ var parsedDoc = Node.fromJSON(schema, newEntity);
136
+
137
+ // throws an error if the document is invalid
138
+ try {
139
+ parsedDoc.check();
140
+ } catch (err) {
141
+ if (dispatchAnalyticsEvent) {
142
+ dispatchAnalyticsEvent({
143
+ action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
144
+ actionSubject: ACTION_SUBJECT.EDITOR,
145
+ eventType: EVENT_TYPE.OPERATIONAL
146
+ });
147
+ }
148
+ throw err;
149
+ }
150
+ if (dispatchAnalyticsEvent) {
151
+ findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
152
+ }
153
+ return parsedDoc;
154
+ } catch (e) {
155
+ if (dispatchAnalyticsEvent) {
156
+ dispatchAnalyticsEvent({
157
+ action: ACTION.DOCUMENT_PROCESSING_ERROR,
158
+ actionSubject: ACTION_SUBJECT.EDITOR,
159
+ eventType: EVENT_TYPE.OPERATIONAL
160
+ });
161
+ }
162
+
163
+ // eslint-disable-next-line no-console
164
+ console.error("Error processing document:\n".concat(e instanceof Error ? e.message : String(e), "\n\n"), JSON.stringify(node));
165
+ if (isProseMirrorSchemaCheckError(e)) {
166
+ throw e;
167
+ }
168
+ return;
169
+ }
170
+ }
171
+ function isProseMirrorSchemaCheckError(error) {
172
+ return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
173
+ }
174
+ var maySanitizePrivateContent = function maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent) {
175
+ if (sanitizePrivateContent && providerFactory) {
176
+ return sanitizeNodeForPrivacy(entity, providerFactory);
177
+ }
178
+ return entity;
179
+ };
@@ -222,6 +222,7 @@ export interface CollabInitPayload extends CollabEventInitData {
222
222
  version: number;
223
223
  metadata?: Metadata;
224
224
  reserveCursor?: boolean;
225
+ targetClientId?: string;
225
226
  }
226
227
  export interface CollabEventConnectionData {
227
228
  sid: string;
@@ -1,9 +1,6 @@
1
- import type { ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import { Node } from '@atlaskit/editor-prosemirror/model';
1
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import { type Node } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { DispatchAnalyticsEvent } from '../analytics';
5
- import type { ProviderFactory } from '../provider-factory';
6
- import type { ReplaceRawValue, Transformer } from '../types';
7
4
  type ChangedFn = (node: Node, pos: number, parent: Node | null, index: number) => boolean | void;
8
5
  export declare const getStepRange: (transaction: Transaction | ReadonlyTransaction) => {
9
6
  from: number;
@@ -16,7 +13,6 @@ export declare function hasDocAsParent($anchor: ResolvedPos): boolean;
16
13
  export declare function isEmptyDocument(node: Node): boolean;
17
14
  export declare function bracketTyped(state: EditorState): boolean;
18
15
  export declare function nodesBetweenChanged(tr: Transaction | ReadonlyTransaction, f: ChangedFn, startPos?: number): void;
19
- export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
20
16
  /**
21
17
  * Returns false if node contains only empty inline nodes and hardBreaks.
22
18
  */
@@ -63,10 +63,37 @@ export { analyticsEventKey, getAnalyticsAppearance, getAnalyticsEditorAppearance
63
63
  export { getUnsupportedContentLevelData, UNSUPPORTED_CONTENT_LEVEL_SEVERITY, UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS, type UnsupportedContentLevelsTracking, } from './unsupportedContent/get-unsupported-content-level-data';
64
64
  export type { UnsupportedContentTooltipPayload, UnsupportedContentPayload, } from './unsupportedContent/types';
65
65
  export { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
66
- export { getDistortedDurationMonitor, measureRender } from './performance/measure-render';
66
+ export {
67
+ /**
68
+ * @private
69
+ * @deprecated
70
+ *
71
+ * Please use `@atlaskit/editor-common/performance/measure-render` entry-point instead.
72
+ */
73
+ getDistortedDurationMonitor,
74
+ /**
75
+ * @private
76
+ * @deprecated
77
+ *
78
+ * Please use `@atlaskit/editor-common/performance/measure-render` entry-point instead.
79
+ */
80
+ measureRender, } from './performance/measure-render';
67
81
  export { startMeasure, stopMeasure, clearMeasure } from './performance/measure';
68
82
  export { measureTTI, getTTISeverity, TTI_SEVERITY_THRESHOLD_DEFAULTS, TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS, } from './performance/measure-tti';
83
+ /**
84
+ * @private
85
+ * @deprecated
86
+ *
87
+ * Private API - should not be used. Use `@atlaskit/editor-common/is-performance-api-available` if required.
88
+ *
89
+ */
69
90
  export { isPerformanceAPIAvailable, isPerformanceObserverAvailable, } from './performance/is-performance-api-available';
91
+ /**
92
+ * @private
93
+ * @deprecated
94
+ *
95
+ * Private API - should not be used. Use `@atlaskit/editor-common/performance/navigation` if required.
96
+ */
70
97
  export { getResponseEndTime } from './performance/navigation';
71
98
  export { getExtensionRenderer } from './extension-handler';
72
99
  export { hasMergedCell, calcTableColumnWidths, convertProsemirrorTableNodeToArrayOfRows, isPositionNearTableRow, } from './table';
@@ -102,13 +129,26 @@ export { getItemCounterDigitsSize, getOrderFromOrderedListNode, resolveOrder, is
102
129
  export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLinkDomain, findFilepaths, isLinkInMatches, FILEPATH_REGEXP, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent, canLinkBeCreatedInRange, } from './hyperlink';
103
130
  export declare const pmHistoryPluginKey = "history$";
104
131
  export { gridTypeForLayout } from './grid';
105
- export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, isSelectionEndOfParagraph, getChangedNodes, } from './document';
132
+ export { nodesBetweenChanged, getStepRange, isEmptyDocument, hasDocAsParent, bracketTyped, hasVisibleContent, isSelectionEndOfParagraph, getChangedNodes, } from './document';
133
+ /**
134
+ * @private
135
+ * @deprecated
136
+ *
137
+ * Use `@atlaskit/editor-common/process-raw-value` entry-point instead.
138
+ */
139
+ export { processRawValue } from './processRawValue';
106
140
  export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts, } from './rich-media-utils';
107
141
  export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
108
142
  export { canRenderDatasource, getDatasourceType } from './datasource';
109
143
  export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode, } from './commands';
110
144
  export type { WalkNode } from './commands';
111
145
  export { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, GUTTER_SIZE_MOBILE_IN_PX } from './scroll-gutter';
146
+ /**
147
+ * @private
148
+ * @deprecated
149
+ *
150
+ * Private API - do not use.
151
+ */
112
152
  export { getTimeSince } from './performance/get-performance-timing';
113
153
  export { countNodes } from './count-nodes';
114
154
  export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
@@ -0,0 +1,6 @@
1
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
+ import { Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { DispatchAnalyticsEvent } from '../analytics';
4
+ import type { ProviderFactory } from '../provider-factory';
5
+ import type { ReplaceRawValue, Transformer } from '../types';
6
+ export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
@@ -222,6 +222,7 @@ export interface CollabInitPayload extends CollabEventInitData {
222
222
  version: number;
223
223
  metadata?: Metadata;
224
224
  reserveCursor?: boolean;
225
+ targetClientId?: string;
225
226
  }
226
227
  export interface CollabEventConnectionData {
227
228
  sid: string;
@@ -1,9 +1,6 @@
1
- import type { ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import { Node } from '@atlaskit/editor-prosemirror/model';
1
+ import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
+ import { type Node } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { DispatchAnalyticsEvent } from '../analytics';
5
- import type { ProviderFactory } from '../provider-factory';
6
- import type { ReplaceRawValue, Transformer } from '../types';
7
4
  type ChangedFn = (node: Node, pos: number, parent: Node | null, index: number) => boolean | void;
8
5
  export declare const getStepRange: (transaction: Transaction | ReadonlyTransaction) => {
9
6
  from: number;
@@ -16,7 +13,6 @@ export declare function hasDocAsParent($anchor: ResolvedPos): boolean;
16
13
  export declare function isEmptyDocument(node: Node): boolean;
17
14
  export declare function bracketTyped(state: EditorState): boolean;
18
15
  export declare function nodesBetweenChanged(tr: Transaction | ReadonlyTransaction, f: ChangedFn, startPos?: number): void;
19
- export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
20
16
  /**
21
17
  * Returns false if node contains only empty inline nodes and hardBreaks.
22
18
  */
@@ -63,10 +63,37 @@ export { analyticsEventKey, getAnalyticsAppearance, getAnalyticsEditorAppearance
63
63
  export { getUnsupportedContentLevelData, UNSUPPORTED_CONTENT_LEVEL_SEVERITY, UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS, type UnsupportedContentLevelsTracking, } from './unsupportedContent/get-unsupported-content-level-data';
64
64
  export type { UnsupportedContentTooltipPayload, UnsupportedContentPayload, } from './unsupportedContent/types';
65
65
  export { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
66
- export { getDistortedDurationMonitor, measureRender } from './performance/measure-render';
66
+ export {
67
+ /**
68
+ * @private
69
+ * @deprecated
70
+ *
71
+ * Please use `@atlaskit/editor-common/performance/measure-render` entry-point instead.
72
+ */
73
+ getDistortedDurationMonitor,
74
+ /**
75
+ * @private
76
+ * @deprecated
77
+ *
78
+ * Please use `@atlaskit/editor-common/performance/measure-render` entry-point instead.
79
+ */
80
+ measureRender, } from './performance/measure-render';
67
81
  export { startMeasure, stopMeasure, clearMeasure } from './performance/measure';
68
82
  export { measureTTI, getTTISeverity, TTI_SEVERITY_THRESHOLD_DEFAULTS, TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS, } from './performance/measure-tti';
83
+ /**
84
+ * @private
85
+ * @deprecated
86
+ *
87
+ * Private API - should not be used. Use `@atlaskit/editor-common/is-performance-api-available` if required.
88
+ *
89
+ */
69
90
  export { isPerformanceAPIAvailable, isPerformanceObserverAvailable, } from './performance/is-performance-api-available';
91
+ /**
92
+ * @private
93
+ * @deprecated
94
+ *
95
+ * Private API - should not be used. Use `@atlaskit/editor-common/performance/navigation` if required.
96
+ */
70
97
  export { getResponseEndTime } from './performance/navigation';
71
98
  export { getExtensionRenderer } from './extension-handler';
72
99
  export { hasMergedCell, calcTableColumnWidths, convertProsemirrorTableNodeToArrayOfRows, isPositionNearTableRow, } from './table';
@@ -102,13 +129,26 @@ export { getItemCounterDigitsSize, getOrderFromOrderedListNode, resolveOrder, is
102
129
  export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLinkDomain, findFilepaths, isLinkInMatches, FILEPATH_REGEXP, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent, canLinkBeCreatedInRange, } from './hyperlink';
103
130
  export declare const pmHistoryPluginKey = "history$";
104
131
  export { gridTypeForLayout } from './grid';
105
- export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, isSelectionEndOfParagraph, getChangedNodes, } from './document';
132
+ export { nodesBetweenChanged, getStepRange, isEmptyDocument, hasDocAsParent, bracketTyped, hasVisibleContent, isSelectionEndOfParagraph, getChangedNodes, } from './document';
133
+ /**
134
+ * @private
135
+ * @deprecated
136
+ *
137
+ * Use `@atlaskit/editor-common/process-raw-value` entry-point instead.
138
+ */
139
+ export { processRawValue } from './processRawValue';
106
140
  export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts, } from './rich-media-utils';
107
141
  export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
108
142
  export { canRenderDatasource, getDatasourceType } from './datasource';
109
143
  export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode, } from './commands';
110
144
  export type { WalkNode } from './commands';
111
145
  export { GUTTER_SELECTOR, GUTTER_SIZE_IN_PX, GUTTER_SIZE_MOBILE_IN_PX } from './scroll-gutter';
146
+ /**
147
+ * @private
148
+ * @deprecated
149
+ *
150
+ * Private API - do not use.
151
+ */
112
152
  export { getTimeSince } from './performance/get-performance-timing';
113
153
  export { countNodes } from './count-nodes';
114
154
  export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
@@ -0,0 +1,6 @@
1
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
+ import { Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { DispatchAnalyticsEvent } from '../analytics';
4
+ import type { ProviderFactory } from '../provider-factory';
5
+ import type { ReplaceRawValue, Transformer } from '../types';
6
+ export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/is-performance-api-available",
3
+ "main": "../dist/cjs/utils/performance/is-performance-api-available.js",
4
+ "module": "../dist/esm/utils/performance/is-performance-api-available.js",
5
+ "module:es2019": "../dist/es2019/utils/performance/is-performance-api-available.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/utils/performance/is-performance-api-available.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.4": {
10
+ "*": [
11
+ "../dist/types-ts4.5/utils/performance/is-performance-api-available.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }