@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
@@ -37,6 +37,32 @@ export const TableSharedCssClassName = {
37
37
  TABLE_RESIZER_CONTAINER: `${tablePrefixSelector}-resizer-container`
38
38
  };
39
39
 
40
+ /* first block node has 0 top margin */
41
+ const firstNodeWithNotMarginTop = () => editorExperiment('nested-dnd', true) ?
42
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
43
+ css`
44
+ > :nth-child(1 of :not(style, .ProseMirror-gapcursor, .ProseMirror-widget, span)) {
45
+ margin-top: 0;
46
+ }
47
+ ` :
48
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
49
+ css`
50
+ > :first-child:not(style),
51
+ > style:first-child + * {
52
+ margin-top: 0;
53
+ }
54
+
55
+ > .ProseMirror-gapcursor:first-child + *,
56
+ > style:first-child + .ProseMirror-gapcursor + * {
57
+ margin-top: 0;
58
+ }
59
+
60
+ > .ProseMirror-gapcursor:first-child + span + *,
61
+ > style:first-child + .ProseMirror-gapcursor + span + * {
62
+ margin-top: 0;
63
+ }
64
+ `;
65
+
40
66
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Appears safe to auto-fix, but leaving it up to the team to remediate as the readability only gets worse with autofixing
41
67
  const tableSharedStyle = () => css`
42
68
  ${tableCellBackgroundStyleOverride()}
@@ -116,20 +142,7 @@ const tableSharedStyle = () => css`
116
142
  /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */
117
143
  ${browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : ''}
118
144
 
119
- > :first-child:not(style),
120
- > style:first-child + * {
121
- margin-top: 0;
122
- }
123
-
124
- > .ProseMirror-gapcursor:first-child + *,
125
- > style:first-child + .ProseMirror-gapcursor + * {
126
- margin-top: 0;
127
- }
128
-
129
- > .ProseMirror-gapcursor:first-child + span + *,
130
- > style:first-child + .ProseMirror-gapcursor + span + * {
131
- margin-top: 0;
132
- }
145
+ ${firstNodeWithNotMarginTop()}
133
146
 
134
147
  th p:not(:first-of-type),
135
148
  td p:not(:first-of-type) {
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "88.9.0";
17
+ const packageVersion = "88.11.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  class DropList extends Component {
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { PureComponent } from 'react';
3
3
  import { ResourcedEmoji } from '@atlaskit/emoji/element';
4
4
  import { ProviderFactory, WithProviders } from '../../provider-factory';
5
+ // @deprecated - use Emoji from editor-plugin-emoji
5
6
  export default class EmojiNode extends PureComponent {
6
7
  constructor(props) {
7
8
  super(props);
@@ -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 const getStepRange = transaction => {
9
3
  let from = -1;
10
4
  let to = -1;
@@ -68,183 +62,6 @@ export function nodesBetweenChanged(tr, f, startPos) {
68
62
  }
69
63
  tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
70
64
  }
71
- export function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
72
- if (!value) {
73
- return;
74
- }
75
- let node;
76
- if (typeof value === 'string') {
77
- try {
78
- if (contentTransformer) {
79
- const doc = contentTransformer.parse(value);
80
- node = doc.toJSON();
81
- } else {
82
- node = JSON.parse(value);
83
- }
84
- } catch (e) {
85
- // eslint-disable-next-line no-console
86
- console.error(`Error processing value: ${value} isn't a valid JSON`);
87
- return;
88
- }
89
- } else {
90
- node = value;
91
- }
92
- if (Array.isArray(node)) {
93
- // eslint-disable-next-line no-console
94
- console.error(`Error processing value: ${node} is an array, but it must be an object.`);
95
- return;
96
- }
97
- try {
98
- // ProseMirror always require a child under doc
99
- if (node.type === 'doc') {
100
- if (Array.isArray(node.content) && node.content.length === 0) {
101
- node.content.push({
102
- type: 'paragraph',
103
- content: []
104
- });
105
- }
106
- // Just making sure doc is always valid
107
- if (!node.version) {
108
- node.version = 1;
109
- }
110
- }
111
- if (contentTransformer) {
112
- return Node.fromJSON(schema, node);
113
- }
114
-
115
- // link mark on mediaSingle is deprecated, need to move link mark to child media node
116
- // https://product-fabric.atlassian.net/browse/ED-14043
117
- let {
118
- transformedAdf,
119
- isTransformed
120
- } = transformMediaLinkMarks(node);
121
- if (isTransformed && dispatchAnalyticsEvent) {
122
- dispatchAnalyticsEvent({
123
- action: ACTION.MEDIA_LINK_TRANSFORMED,
124
- actionSubject: ACTION_SUBJECT.EDITOR,
125
- eventType: EVENT_TYPE.OPERATIONAL
126
- });
127
- }
128
-
129
- // See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
130
- // We declared in code mark spec that links and marks should not co-exist on
131
- // text nodes. This util strips code marks from bad text nodes and preserves links.
132
- // Otherwise, prosemirror will try to repair the invalid document by stripping links
133
- // and preserving code marks during content changes.
134
- ({
135
- transformedAdf,
136
- isTransformed
137
- } = transformTextLinkCodeMarks(transformedAdf));
138
- if (isTransformed && dispatchAnalyticsEvent) {
139
- dispatchAnalyticsEvent({
140
- action: ACTION.TEXT_LINK_MARK_TRANSFORMED,
141
- actionSubject: ACTION_SUBJECT.EDITOR,
142
- eventType: EVENT_TYPE.OPERATIONAL
143
- });
144
- }
145
- let discardedMarks = [];
146
- ({
147
- transformedAdf,
148
- isTransformed,
149
- discardedMarks
150
- } = transformDedupeMarks(transformedAdf));
151
- if (isTransformed && dispatchAnalyticsEvent) {
152
- dispatchAnalyticsEvent({
153
- action: ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
154
- actionSubject: ACTION_SUBJECT.EDITOR,
155
- eventType: EVENT_TYPE.OPERATIONAL,
156
- attributes: {
157
- /** UGC WARNING
158
- *
159
- * DO NOT include the `mark` attributes inside, we map here to only
160
- * extract the mark type as that is the only non-UGC safe information
161
- * that we can add to event-attributes
162
- *
163
- */
164
- discardedMarkTypes: discardedMarks.map(mark => mark.type)
165
- }
166
- });
167
- }
168
- ({
169
- transformedAdf,
170
- isTransformed
171
- } = transformNodesMissingContent(transformedAdf));
172
- if (isTransformed && dispatchAnalyticsEvent) {
173
- dispatchAnalyticsEvent({
174
- action: ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
175
- actionSubject: ACTION_SUBJECT.EDITOR,
176
- eventType: EVENT_TYPE.OPERATIONAL
177
- });
178
- }
179
- ({
180
- transformedAdf,
181
- isTransformed
182
- } = transformIndentationMarks(transformedAdf));
183
- if (isTransformed && dispatchAnalyticsEvent) {
184
- dispatchAnalyticsEvent({
185
- action: ACTION.INDENTATION_MARKS_TRANSFORMED,
186
- actionSubject: ACTION_SUBJECT.EDITOR,
187
- eventType: EVENT_TYPE.OPERATIONAL
188
- });
189
- }
190
- ({
191
- transformedAdf,
192
- isTransformed
193
- } = transformInvalidMediaContent(transformedAdf));
194
- if (isTransformed && dispatchAnalyticsEvent) {
195
- dispatchAnalyticsEvent({
196
- action: ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
197
- actionSubject: ACTION_SUBJECT.EDITOR,
198
- eventType: EVENT_TYPE.OPERATIONAL
199
- });
200
- }
201
- const entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
202
- let newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
203
- const parsedDoc = Node.fromJSON(schema, newEntity);
204
-
205
- // throws an error if the document is invalid
206
- try {
207
- parsedDoc.check();
208
- } catch (err) {
209
- if (dispatchAnalyticsEvent) {
210
- dispatchAnalyticsEvent({
211
- action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
212
- actionSubject: ACTION_SUBJECT.EDITOR,
213
- eventType: EVENT_TYPE.OPERATIONAL
214
- });
215
- }
216
- throw err;
217
- }
218
- if (dispatchAnalyticsEvent) {
219
- findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
220
- }
221
- return parsedDoc;
222
- } catch (e) {
223
- if (dispatchAnalyticsEvent) {
224
- dispatchAnalyticsEvent({
225
- action: ACTION.DOCUMENT_PROCESSING_ERROR,
226
- actionSubject: ACTION_SUBJECT.EDITOR,
227
- eventType: EVENT_TYPE.OPERATIONAL
228
- });
229
- }
230
-
231
- // eslint-disable-next-line no-console
232
- console.error(`Error processing document:\n${e instanceof Error ? e.message : String(e)}\n\n`, JSON.stringify(node));
233
- if (isProseMirrorSchemaCheckError(e)) {
234
- throw e;
235
- }
236
- return;
237
- }
238
- }
239
- function isProseMirrorSchemaCheckError(error) {
240
- return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
241
- }
242
- const maySanitizePrivateContent = (entity, providerFactory, sanitizePrivateContent) => {
243
- if (sanitizePrivateContent && providerFactory) {
244
- return sanitizeNodeForPrivacy(entity, providerFactory);
245
- }
246
- return entity;
247
- };
248
65
 
249
66
  /**
250
67
  * 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 const 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(obj1 = {}, obj2 = {}) {
@@ -0,0 +1,183 @@
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
+ let node;
12
+ if (typeof value === 'string') {
13
+ try {
14
+ if (contentTransformer) {
15
+ const 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: ${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: ${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
+ let {
54
+ transformedAdf,
55
+ isTransformed
56
+ } = transformMediaLinkMarks(node);
57
+ if (isTransformed && dispatchAnalyticsEvent) {
58
+ dispatchAnalyticsEvent({
59
+ action: ACTION.MEDIA_LINK_TRANSFORMED,
60
+ actionSubject: ACTION_SUBJECT.EDITOR,
61
+ eventType: EVENT_TYPE.OPERATIONAL
62
+ });
63
+ }
64
+
65
+ // See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
66
+ // We declared in code mark spec that links and marks should not co-exist on
67
+ // text nodes. This util strips code marks from bad text nodes and preserves links.
68
+ // Otherwise, prosemirror will try to repair the invalid document by stripping links
69
+ // and preserving code marks during content changes.
70
+ ({
71
+ transformedAdf,
72
+ isTransformed
73
+ } = transformTextLinkCodeMarks(transformedAdf));
74
+ if (isTransformed && dispatchAnalyticsEvent) {
75
+ dispatchAnalyticsEvent({
76
+ action: ACTION.TEXT_LINK_MARK_TRANSFORMED,
77
+ actionSubject: ACTION_SUBJECT.EDITOR,
78
+ eventType: EVENT_TYPE.OPERATIONAL
79
+ });
80
+ }
81
+ let discardedMarks = [];
82
+ ({
83
+ transformedAdf,
84
+ isTransformed,
85
+ discardedMarks
86
+ } = transformDedupeMarks(transformedAdf));
87
+ if (isTransformed && dispatchAnalyticsEvent) {
88
+ dispatchAnalyticsEvent({
89
+ action: ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
90
+ actionSubject: ACTION_SUBJECT.EDITOR,
91
+ eventType: EVENT_TYPE.OPERATIONAL,
92
+ attributes: {
93
+ /** UGC WARNING
94
+ *
95
+ * DO NOT include the `mark` attributes inside, we map here to only
96
+ * extract the mark type as that is the only non-UGC safe information
97
+ * that we can add to event-attributes
98
+ *
99
+ */
100
+ discardedMarkTypes: discardedMarks.map(mark => mark.type)
101
+ }
102
+ });
103
+ }
104
+ ({
105
+ transformedAdf,
106
+ isTransformed
107
+ } = transformNodesMissingContent(transformedAdf));
108
+ if (isTransformed && dispatchAnalyticsEvent) {
109
+ dispatchAnalyticsEvent({
110
+ action: ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
111
+ actionSubject: ACTION_SUBJECT.EDITOR,
112
+ eventType: EVENT_TYPE.OPERATIONAL
113
+ });
114
+ }
115
+ ({
116
+ transformedAdf,
117
+ isTransformed
118
+ } = transformIndentationMarks(transformedAdf));
119
+ if (isTransformed && dispatchAnalyticsEvent) {
120
+ dispatchAnalyticsEvent({
121
+ action: ACTION.INDENTATION_MARKS_TRANSFORMED,
122
+ actionSubject: ACTION_SUBJECT.EDITOR,
123
+ eventType: EVENT_TYPE.OPERATIONAL
124
+ });
125
+ }
126
+ ({
127
+ transformedAdf,
128
+ isTransformed
129
+ } = transformInvalidMediaContent(transformedAdf));
130
+ if (isTransformed && dispatchAnalyticsEvent) {
131
+ dispatchAnalyticsEvent({
132
+ action: ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
133
+ actionSubject: ACTION_SUBJECT.EDITOR,
134
+ eventType: EVENT_TYPE.OPERATIONAL
135
+ });
136
+ }
137
+ const entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
138
+ let newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
139
+ const parsedDoc = Node.fromJSON(schema, newEntity);
140
+
141
+ // throws an error if the document is invalid
142
+ try {
143
+ parsedDoc.check();
144
+ } catch (err) {
145
+ if (dispatchAnalyticsEvent) {
146
+ dispatchAnalyticsEvent({
147
+ action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
148
+ actionSubject: ACTION_SUBJECT.EDITOR,
149
+ eventType: EVENT_TYPE.OPERATIONAL
150
+ });
151
+ }
152
+ throw err;
153
+ }
154
+ if (dispatchAnalyticsEvent) {
155
+ findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
156
+ }
157
+ return parsedDoc;
158
+ } catch (e) {
159
+ if (dispatchAnalyticsEvent) {
160
+ dispatchAnalyticsEvent({
161
+ action: ACTION.DOCUMENT_PROCESSING_ERROR,
162
+ actionSubject: ACTION_SUBJECT.EDITOR,
163
+ eventType: EVENT_TYPE.OPERATIONAL
164
+ });
165
+ }
166
+
167
+ // eslint-disable-next-line no-console
168
+ console.error(`Error processing document:\n${e instanceof Error ? e.message : String(e)}\n\n`, JSON.stringify(node));
169
+ if (isProseMirrorSchemaCheckError(e)) {
170
+ throw e;
171
+ }
172
+ return;
173
+ }
174
+ }
175
+ function isProseMirrorSchemaCheckError(error) {
176
+ return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
177
+ }
178
+ const maySanitizePrivateContent = (entity, providerFactory, sanitizePrivateContent) => {
179
+ if (sanitizePrivateContent && providerFactory) {
180
+ return sanitizeNodeForPrivacy(entity, providerFactory);
181
+ }
182
+ return entity;
183
+ };
@@ -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 = "88.9.0";
10
+ var packageVersion = "88.11.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
@@ -7,6 +7,9 @@ export var blockquoteSharedStyles = css({
7
7
  '& blockquote': {
8
8
  boxSizing: 'border-box',
9
9
  color: 'inherit',
10
+ width: '100%',
11
+ clear: 'both',
12
+ display: 'inline-block',
10
13
  paddingLeft: "var(--ds-space-200, 16px)",
11
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
12
15
  borderLeft: "2px solid ".concat("var(--ds-border, ".concat(akEditorBlockquoteBorderColor, ")")),
@@ -50,6 +53,9 @@ export var blockquoteSharedStylesNew = css({
50
53
  '& blockquote': {
51
54
  boxSizing: 'border-box',
52
55
  color: 'inherit',
56
+ width: '100%',
57
+ clear: 'both',
58
+ display: 'inline-block',
53
59
  paddingLeft: "var(--ds-space-250, 20px)",
54
60
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
55
61
  borderLeft: "2px solid ".concat("var(--ds-border, ".concat(akEditorBlockquoteBorderColor, ")")),
@@ -26,7 +26,7 @@ var mediaSingleSharedStyle = css((_css = {}, _defineProperty(_css, "li .".concat
26
26
  marginBottom: "var(--ds-space-150, 12px)",
27
27
  clear: 'both',
28
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
29
- '&.image-wrap-left, &.image-wrap-right': {
29
+ '&.image-wrap-left[data-layout], &.image-wrap-right[data-layout]': {
30
30
  clear: 'none',
31
31
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
32
32
  '&:first-child': {
@@ -1,5 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
2
+ var _templateObject, _templateObject2, _templateObject3;
3
3
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
4
  import { css } from '@emotion/react';
5
5
  import { tableCellContentDomSelector, tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
@@ -39,9 +39,16 @@ export var TableSharedCssClassName = {
39
39
  TABLE_RESIZER_CONTAINER: "".concat(tablePrefixSelector, "-resizer-container")
40
40
  };
41
41
 
42
+ /* first block node has 0 top margin */
43
+ var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
44
+ return editorExperiment('nested-dnd', true) ? // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
45
+ css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t\t\t> :nth-child(1 of :not(style, .ProseMirror-gapcursor, .ProseMirror-widget, span)) {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t"]))) : // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
46
+ css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t\t\t\t> :first-child:not(style),\n\t\t\t\t> style:first-child + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\t> .ProseMirror-gapcursor:first-child + *,\n\t\t\t\t> style:first-child + .ProseMirror-gapcursor + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\t> .ProseMirror-gapcursor:first-child + span + *,\n\t\t\t\t> style:first-child + .ProseMirror-gapcursor + span + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t"])));
47
+ };
48
+
42
49
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Appears safe to auto-fix, but leaving it up to the team to remediate as the readability only gets worse with autofixing
43
50
  var tableSharedStyle = function tableSharedStyle() {
44
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t", "\n\t.", " {\n\t\tposition: relative;\n\t\tmargin: 0 auto ", ";\n\t\tbox-sizing: border-box;\n\n\t\t/**\n * Fix block top alignment inside table cells.\n */\n\t\t.decisionItemView-content-wrap:first-of-type > div {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.", "[data-number-column='true'] {\n\t\tpadding-left: ", "px;\n\t\tclear: both;\n\t}\n\n\t.", " {\n\t\twill-change: width, margin-left;\n\t}\n\n\t.", " table {\n\t\twill-change: width;\n\t}\n\n\t.", " > table {\n\t\tmargin: ", " 0 0 0;\n\t}\n\n\t.", " > table,\n\t.", " > table {\n\t\tmargin: ", " ", " 0 0;\n\t}\n\n\t/* avoid applying styles to nested tables (possible via extensions) */\n\t.", " > table,\n\t.", " > table,\n\t.", " > table {\n\t\tborder-collapse: collapse;\n\t\tborder: ", "px solid\n\t\t\t", ";\n\t\ttable-layout: fixed;\n\t\tfont-size: 1em;\n\t\twidth: 100%;\n\n\t\t&[data-autosize='true'] {\n\t\t\ttable-layout: auto;\n\t\t}\n\n\t\t& {\n\t\t\t* {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}\n\t\t\thr {\n\t\t\t\tbox-sizing: content-box;\n\t\t\t}\n\n\t\t\ttbody {\n\t\t\t\tborder-bottom: none;\n\t\t\t}\n\t\t\tth td {\n\t\t\t\tbackground-color: ", ";\n\t\t\t}\n\t\t\tth,\n\t\t\ttd {\n\t\t\t\tmin-width: ", "px;\n\t\t\t\tfont-weight: normal;\n\t\t\t\tvertical-align: top;\n\t\t\t\tborder: 1px solid ", ";\n\t\t\t\tborder-right-width: 0;\n\t\t\t\tborder-bottom-width: 0;\n\n\t\t\t\tpadding: ", ";\n\t\t\t\t/* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n\t\t\t\t", "\n\n\t\t\t\t> :first-child:not(style),\n > style:first-child + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\t> .ProseMirror-gapcursor:first-child + *,\n\t\t\t\t> style:first-child + .ProseMirror-gapcursor + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\t> .ProseMirror-gapcursor:first-child + span + *,\n\t\t\t\t> style:first-child + .ProseMirror-gapcursor + span + * {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\n\t\t\t\tth p:not(:first-of-type),\n\t\t\t\ttd p:not(:first-of-type) {\n\t\t\t\t\tmargin-top: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t\tth {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\ttext-align: left;\n\n\t\t\t\t/* only apply this styling to codeblocks in default background headercells */\n\t\t\t\t/* TODO this needs to be overhauled as it relies on unsafe selectors */\n\t\t\t\t&:not([style]):not(.danger) {\n\t\t\t\t\t.", ":not(.danger) {\n\t\t\t\t\t\tbackground-color: ", ";\n\n\t\t\t\t\t\t:not(.", ") {\n\t\t\t\t\t\t\tbox-shadow: 0px 0px 0px 1px ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\tbackground-image: ", ";\n\n\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* this is only relevant to the element taken care of by renderer */\n\t\t\t\t\t\t> [data-ds--code--code-block] {\n\t\t\t\t\t\t\tbackground-image: ", "!important;\n\n\t\t\t\t\t\t\tbackground-color: ", "!important;\n\n\t\t\t\t\t\t\t// selector lives inside @atlaskit/code\n\t\t\t\t\t\t\t--ds--code--line-number-bg-color: ", ";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"])), tableCellBackgroundStyleOverride(), TableSharedCssClassName.TABLE_CONTAINER, "var(--ds-space-200, 16px)", TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_RESIZER_CONTAINER, TableSharedCssClassName.TABLE_RESIZER_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, "var(--ds-space-300, 24px)", TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-neutral-subtle, white)", tableCellMinWidth, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), editorExperiment('table-nested-dnd', true) ? "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-250, 20px)") : "var(--ds-space-100, 8px)", browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : '', "var(--ds-space-150, 12px)", "var(--ds-background-accent-gray-subtlest, ".concat(akEditorTableToolbar, ")"), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, "var(--ds-surface-raised, rgb(235, 237, 240))", akEditorSelectedNodeClassName, "var(--ds-border, transparent)", CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, overflowShadow({
51
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t", "\n\t.", " {\n\t\tposition: relative;\n\t\tmargin: 0 auto ", ";\n\t\tbox-sizing: border-box;\n\n\t\t/**\n * Fix block top alignment inside table cells.\n */\n\t\t.decisionItemView-content-wrap:first-of-type > div {\n\t\t\tmargin-top: 0;\n\t\t}\n\t}\n\t.", "[data-number-column='true'] {\n\t\tpadding-left: ", "px;\n\t\tclear: both;\n\t}\n\n\t.", " {\n\t\twill-change: width, margin-left;\n\t}\n\n\t.", " table {\n\t\twill-change: width;\n\t}\n\n\t.", " > table {\n\t\tmargin: ", " 0 0 0;\n\t}\n\n\t.", " > table,\n\t.", " > table {\n\t\tmargin: ", " ", " 0 0;\n\t}\n\n\t/* avoid applying styles to nested tables (possible via extensions) */\n\t.", " > table,\n\t.", " > table,\n\t.", " > table {\n\t\tborder-collapse: collapse;\n\t\tborder: ", "px solid\n\t\t\t", ";\n\t\ttable-layout: fixed;\n\t\tfont-size: 1em;\n\t\twidth: 100%;\n\n\t\t&[data-autosize='true'] {\n\t\t\ttable-layout: auto;\n\t\t}\n\n\t\t& {\n\t\t\t* {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}\n\t\t\thr {\n\t\t\t\tbox-sizing: content-box;\n\t\t\t}\n\n\t\t\ttbody {\n\t\t\t\tborder-bottom: none;\n\t\t\t}\n\t\t\tth td {\n\t\t\t\tbackground-color: ", ";\n\t\t\t}\n\t\t\tth,\n\t\t\ttd {\n\t\t\t\tmin-width: ", "px;\n\t\t\t\tfont-weight: normal;\n\t\t\t\tvertical-align: top;\n\t\t\t\tborder: 1px solid ", ";\n\t\t\t\tborder-right-width: 0;\n\t\t\t\tborder-bottom-width: 0;\n\n\t\t\t\tpadding: ", ";\n\t\t\t\t/* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n\t\t\t\t", "\n\n\t\t\t\t", "\n\n\t\t\t\tth p:not(:first-of-type),\n\t\t\t\ttd p:not(:first-of-type) {\n\t\t\t\t\tmargin-top: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t\tth {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\ttext-align: left;\n\n\t\t\t\t/* only apply this styling to codeblocks in default background headercells */\n\t\t\t\t/* TODO this needs to be overhauled as it relies on unsafe selectors */\n\t\t\t\t&:not([style]):not(.danger) {\n\t\t\t\t\t.", ":not(.danger) {\n\t\t\t\t\t\tbackground-color: ", ";\n\n\t\t\t\t\t\t:not(.", ") {\n\t\t\t\t\t\t\tbox-shadow: 0px 0px 0px 1px ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\tbackground-image: ", ";\n\n\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* this is only relevant to the element taken care of by renderer */\n\t\t\t\t\t\t> [data-ds--code--code-block] {\n\t\t\t\t\t\t\tbackground-image: ", "!important;\n\n\t\t\t\t\t\t\tbackground-color: ", "!important;\n\n\t\t\t\t\t\t\t// selector lives inside @atlaskit/code\n\t\t\t\t\t\t\t--ds--code--line-number-bg-color: ", ";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"])), tableCellBackgroundStyleOverride(), TableSharedCssClassName.TABLE_CONTAINER, "var(--ds-space-200, 16px)", TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_RESIZER_CONTAINER, TableSharedCssClassName.TABLE_RESIZER_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, "var(--ds-space-300, 24px)", TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-neutral-subtle, white)", tableCellMinWidth, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), editorExperiment('table-nested-dnd', true) ? "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-250, 20px)") : "var(--ds-space-100, 8px)", browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : '', firstNodeWithNotMarginTop(), "var(--ds-space-150, 12px)", "var(--ds-background-accent-gray-subtlest, ".concat(akEditorTableToolbar, ")"), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, "var(--ds-surface-raised, rgb(235, 237, 240))", akEditorSelectedNodeClassName, "var(--ds-border, transparent)", CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, overflowShadow({
45
52
  leftCoverWidth: "var(--ds-space-300, 24px)"
46
53
  }), "var(--ds-background-neutral, rgb(235, 237, 240))", CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-neutral, rgb(226, 229, 233))", overflowShadow({
47
54
  leftCoverWidth: "var(--ds-space-300, 24px)"
@@ -22,7 +22,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
23
23
  import Layer from '../Layer';
24
24
  var packageName = "@atlaskit/editor-common";
25
- var packageVersion = "88.9.0";
25
+ var packageVersion = "88.11.0";
26
26
  var halfFocusRing = 1;
27
27
  var dropOffset = '0, 8';
28
28
  var DropList = /*#__PURE__*/function (_Component) {
@@ -10,6 +10,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
10
10
  import React, { PureComponent } from 'react';
11
11
  import { ResourcedEmoji } from '@atlaskit/emoji/element';
12
12
  import { ProviderFactory, WithProviders } from '../../provider-factory';
13
+ // @deprecated - use Emoji from editor-plugin-emoji
13
14
  var EmojiNode = /*#__PURE__*/function (_PureComponent) {
14
15
  _inherits(EmojiNode, _PureComponent);
15
16
  var _super = _createSuper(EmojiNode);