@atlaskit/editor-common 71.0.3 → 72.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/cjs/analytics/types/enums.js +20 -1
  3. package/dist/cjs/i18n/index.js +13 -5
  4. package/dist/cjs/i18n/languages.js +42 -0
  5. package/dist/cjs/keymaps/index.js +55 -3
  6. package/dist/cjs/styles/index.js +8 -2
  7. package/dist/cjs/styles/shared/annotation.js +4 -7
  8. package/dist/cjs/styles/shared/block-marks.js +1 -1
  9. package/dist/cjs/styles/shared/code-block.js +3 -4
  10. package/dist/cjs/styles/shared/lists.js +55 -4
  11. package/dist/cjs/styles/shared/panel.js +6 -12
  12. package/dist/cjs/styles/shared/shadow.js +3 -1
  13. package/dist/cjs/styles/shared/table.js +2 -2
  14. package/dist/cjs/types/next-editor-plugin.js +5 -0
  15. package/dist/cjs/ui/DropList/index.js +1 -1
  16. package/dist/cjs/ui/Emoji/index.js +11 -2
  17. package/dist/cjs/ui/Popup/index.js +72 -2
  18. package/dist/cjs/ui/Popup/utils.js +13 -6
  19. package/dist/cjs/ui/UnsupportedBlock/index.js +2 -2
  20. package/dist/cjs/ui/UnsupportedInline/index.js +2 -2
  21. package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +138 -0
  22. package/dist/cjs/ui-color/ColorPalette/index.js +19 -1
  23. package/dist/cjs/ui-menu/DropdownMenu/index.js +2 -0
  24. package/dist/cjs/ui-menu/ToolbarButton/index.js +3 -1
  25. package/dist/cjs/utils/analytics.js +1 -38
  26. package/dist/cjs/utils/builder.js +44 -0
  27. package/dist/cjs/utils/compareNodes.js +86 -33
  28. package/dist/cjs/utils/index.js +47 -1
  29. package/dist/cjs/utils/list.js +47 -0
  30. package/dist/cjs/utils/plugin-state-factory.js +9 -9
  31. package/dist/cjs/utils/referentiality.js +281 -2
  32. package/dist/cjs/utils/track-unsupported-content.js +19 -20
  33. package/dist/cjs/utils/validate-using-spec.js +8 -2
  34. package/dist/cjs/version.json +1 -1
  35. package/dist/es2019/analytics/types/enums.js +20 -1
  36. package/dist/es2019/i18n/index.js +4 -3
  37. package/dist/es2019/i18n/languages.js +34 -0
  38. package/dist/es2019/keymaps/index.js +47 -0
  39. package/dist/es2019/styles/index.js +1 -1
  40. package/dist/es2019/styles/shared/annotation.js +4 -7
  41. package/dist/es2019/styles/shared/block-marks.js +8 -1
  42. package/dist/es2019/styles/shared/code-block.js +7 -6
  43. package/dist/es2019/styles/shared/lists.js +44 -2
  44. package/dist/es2019/styles/shared/panel.js +6 -11
  45. package/dist/es2019/styles/shared/shadow.js +21 -6
  46. package/dist/es2019/styles/shared/table.js +2 -3
  47. package/dist/es2019/types/next-editor-plugin.js +1 -0
  48. package/dist/es2019/ui/DropList/index.js +1 -1
  49. package/dist/es2019/ui/Emoji/index.js +11 -2
  50. package/dist/es2019/ui/Popup/index.js +68 -2
  51. package/dist/es2019/ui/Popup/utils.js +13 -6
  52. package/dist/es2019/ui/UnsupportedBlock/index.js +1 -1
  53. package/dist/es2019/ui/UnsupportedInline/index.js +1 -1
  54. package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +120 -0
  55. package/dist/es2019/ui-color/ColorPalette/index.js +28 -12
  56. package/dist/es2019/ui-menu/DropdownMenu/index.js +2 -0
  57. package/dist/es2019/ui-menu/ToolbarButton/index.js +3 -1
  58. package/dist/es2019/utils/analytics.js +0 -33
  59. package/dist/es2019/utils/builder.js +16 -0
  60. package/dist/es2019/utils/compareNodes.js +79 -28
  61. package/dist/es2019/utils/index.js +4 -2
  62. package/dist/es2019/utils/list.js +31 -0
  63. package/dist/es2019/utils/plugin-state-factory.js +9 -9
  64. package/dist/es2019/utils/referentiality.js +240 -0
  65. package/dist/es2019/utils/track-unsupported-content.js +20 -16
  66. package/dist/es2019/utils/validate-using-spec.js +8 -2
  67. package/dist/es2019/version.json +1 -1
  68. package/dist/esm/analytics/types/enums.js +20 -1
  69. package/dist/esm/i18n/index.js +4 -3
  70. package/dist/esm/i18n/languages.js +34 -0
  71. package/dist/esm/keymaps/index.js +48 -0
  72. package/dist/esm/styles/index.js +1 -1
  73. package/dist/esm/styles/shared/annotation.js +4 -7
  74. package/dist/esm/styles/shared/block-marks.js +1 -1
  75. package/dist/esm/styles/shared/code-block.js +3 -4
  76. package/dist/esm/styles/shared/lists.js +49 -2
  77. package/dist/esm/styles/shared/panel.js +6 -11
  78. package/dist/esm/styles/shared/shadow.js +2 -2
  79. package/dist/esm/styles/shared/table.js +2 -3
  80. package/dist/esm/types/next-editor-plugin.js +1 -0
  81. package/dist/esm/ui/DropList/index.js +1 -1
  82. package/dist/esm/ui/Emoji/index.js +11 -2
  83. package/dist/esm/ui/Popup/index.js +73 -2
  84. package/dist/esm/ui/Popup/utils.js +13 -6
  85. package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
  86. package/dist/esm/ui/UnsupportedInline/index.js +1 -1
  87. package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +124 -0
  88. package/dist/esm/ui-color/ColorPalette/index.js +18 -2
  89. package/dist/esm/ui-menu/DropdownMenu/index.js +2 -0
  90. package/dist/esm/ui-menu/ToolbarButton/index.js +3 -1
  91. package/dist/esm/utils/analytics.js +0 -33
  92. package/dist/esm/utils/builder.js +30 -0
  93. package/dist/esm/utils/compareNodes.js +83 -32
  94. package/dist/esm/utils/index.js +4 -2
  95. package/dist/esm/utils/list.js +31 -0
  96. package/dist/esm/utils/plugin-state-factory.js +9 -9
  97. package/dist/esm/utils/referentiality.js +269 -0
  98. package/dist/esm/utils/track-unsupported-content.js +19 -20
  99. package/dist/esm/utils/validate-using-spec.js +8 -2
  100. package/dist/esm/version.json +1 -1
  101. package/dist/types/analytics/types/enums.d.ts +23 -4
  102. package/dist/types/collab/types.d.ts +1 -1
  103. package/dist/types/i18n/index.d.ts +4 -3
  104. package/dist/types/i18n/languages.d.ts +35 -0
  105. package/dist/types/keymaps/index.d.ts +1 -0
  106. package/dist/types/styles/index.d.ts +1 -1
  107. package/dist/types/styles/shared/lists.d.ts +3 -1
  108. package/dist/types/types/collab.d.ts +1 -1
  109. package/dist/types/types/copy-button.d.ts +4 -0
  110. package/dist/types/types/feature-flags.d.ts +30 -25
  111. package/dist/types/types/floating-toolbar.d.ts +26 -1
  112. package/dist/types/types/index.d.ts +2 -1
  113. package/dist/types/types/next-editor-plugin.d.ts +61 -0
  114. package/dist/types/ui/Emoji/index.d.ts +2 -0
  115. package/dist/types/ui/Popup/index.d.ts +19 -0
  116. package/dist/types/ui/Popup/utils.d.ts +3 -3
  117. package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +214 -0
  118. package/dist/types/ui-color/ColorPalette/index.d.ts +7 -0
  119. package/dist/types/ui-menu/DropdownMenu/types.d.ts +1 -0
  120. package/dist/types/ui-menu/ToolbarButton/index.d.ts +3 -1
  121. package/dist/types/utils/analytics.d.ts +1 -21
  122. package/dist/types/utils/builder.d.ts +8 -0
  123. package/dist/types/utils/compareNodes.d.ts +16 -0
  124. package/dist/types/utils/index.d.ts +3 -1
  125. package/dist/types/utils/list.d.ts +10 -0
  126. package/dist/types/utils/plugin-state-factory.d.ts +1 -1
  127. package/dist/types/utils/referentiality.d.ts +4 -0
  128. package/dist/types/utils/track-unsupported-content.d.ts +14 -2
  129. package/package.json +14 -11
  130. package/report.api.md +1 -1
@@ -31,4 +31,244 @@ export const isReferencedSource = (state, node) => {
31
31
  return !found;
32
32
  });
33
33
  return found;
34
+ };
35
+
36
+ const getConnections = state => {
37
+ const result = {};
38
+ const {
39
+ doc,
40
+ schema
41
+ } = state; // Keeps a map of all raw ids -> to their preferred normalised varient. A node with both fragmentMark & localId will
42
+ // have both ids mapped here to the same normalized version.
43
+
44
+ const normalizedIds = new Map();
45
+ const dataConsumerSources = new Map(); // Perform a prelim scan creating the initial id to connection link mappings.
46
+ // This will also save a list of data sources consumed per node.
47
+
48
+ doc.descendants((node, pos) => {
49
+ var _node$attrs2, _fragmentMark$attrs$l, _fragmentMark, _fragmentMark$attrs, _node$attrs3, _fragmentMark2, _fragmentMark2$attrs, _node$attrs4, _fragmentMark$attrs$n, _fragmentMark3, _fragmentMark3$attrs;
50
+
51
+ let dataConsumer;
52
+ let fragmentMark;
53
+ node.marks.some(mark => {
54
+ if (mark.type === schema.marks.dataConsumer) {
55
+ dataConsumer = mark;
56
+ } else if (mark.type === schema.marks.fragment) {
57
+ fragmentMark = mark;
58
+ } // Stop searching marks if we've found both consumer and fragment.
59
+
60
+
61
+ return !!dataConsumer && !!fragmentMark;
62
+ }); // If node cannot be referenced by any means then abort.
63
+
64
+ if (!fragmentMark && !((_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.localId)) {
65
+ return true;
66
+ }
67
+
68
+ const normalizedId = (_fragmentMark$attrs$l = (_fragmentMark = fragmentMark) === null || _fragmentMark === void 0 ? void 0 : (_fragmentMark$attrs = _fragmentMark.attrs) === null || _fragmentMark$attrs === void 0 ? void 0 : _fragmentMark$attrs.localId) !== null && _fragmentMark$attrs$l !== void 0 ? _fragmentMark$attrs$l : (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId;
69
+
70
+ if (!normalizedId) {
71
+ return true;
72
+ }
73
+
74
+ if (!!((_fragmentMark2 = fragmentMark) !== null && _fragmentMark2 !== void 0 && (_fragmentMark2$attrs = _fragmentMark2.attrs) !== null && _fragmentMark2$attrs !== void 0 && _fragmentMark2$attrs.localId)) {
75
+ normalizedIds.set(fragmentMark.attrs.localId, normalizedId);
76
+ }
77
+
78
+ if (!!((_node$attrs4 = node.attrs) !== null && _node$attrs4 !== void 0 && _node$attrs4.localId)) {
79
+ normalizedIds.set(node.attrs.localId, normalizedId);
80
+ }
81
+
82
+ if (!!result[normalizedId]) {
83
+ // Duplicate ID has been found, we'll care about the first one for now.
84
+ return true;
85
+ }
86
+
87
+ result[normalizedId] = {
88
+ localId: normalizedId,
89
+ name: (_fragmentMark$attrs$n = (_fragmentMark3 = fragmentMark) === null || _fragmentMark3 === void 0 ? void 0 : (_fragmentMark3$attrs = _fragmentMark3.attrs) === null || _fragmentMark3$attrs === void 0 ? void 0 : _fragmentMark3$attrs.name) !== null && _fragmentMark$attrs$n !== void 0 ? _fragmentMark$attrs$n : normalizedId,
90
+ node,
91
+ pos,
92
+ targets: []
93
+ };
94
+
95
+ if (!!dataConsumer && dataConsumer.attrs.sources.length) {
96
+ dataConsumerSources.set(normalizedId, dataConsumer.attrs.sources);
97
+ } // Do not descend into children of a node which has a dataConsumer attached. This assumes all children of the node cannot
98
+ // be referenced by another node.
99
+
100
+
101
+ return !dataConsumer;
102
+ }); // This 2nd-pass only looks at the consumer sources and updates all connections with the correct id refs.
103
+
104
+ for (const [localId, sources] of dataConsumerSources) {
105
+ // This is a ref to the node (connection link) which contains the consumer.
106
+ sources.forEach(src => {
107
+ var _normalizedIds$get;
108
+
109
+ const normalizedId = (_normalizedIds$get = normalizedIds.get(src)) !== null && _normalizedIds$get !== void 0 ? _normalizedIds$get : src;
110
+ const srcLink = result[normalizedId];
111
+
112
+ if (srcLink && normalizedId !== localId) {
113
+ srcLink.targets.push(localId);
114
+ }
115
+ });
116
+ }
117
+
118
+ return result;
119
+ };
120
+
121
+ export const removeConnectedNodes = (state, node) => {
122
+ if (!node) {
123
+ return state.tr;
124
+ }
125
+
126
+ const selectedLocalIds = getSelectedLocalIds(state, node);
127
+ const allNodes = getConnections(state);
128
+ const idsToBeDeleted = getIdsToBeDeleted(selectedLocalIds, allNodes);
129
+
130
+ if (!(idsToBeDeleted !== null && idsToBeDeleted !== void 0 && idsToBeDeleted.length)) {
131
+ return state.tr;
132
+ }
133
+
134
+ const {
135
+ tr
136
+ } = state;
137
+ let newTr = tr;
138
+ idsToBeDeleted.forEach(id => {
139
+ if (!allNodes[id]) {
140
+ return;
141
+ }
142
+
143
+ const {
144
+ node,
145
+ pos
146
+ } = allNodes[id];
147
+ newTr = newTr.delete(newTr.mapping.map(pos), newTr.mapping.map(node.nodeSize + pos));
148
+ });
149
+ return newTr;
150
+ }; // find all ids need to be remove connected to selected extension
151
+
152
+ const getIdsToBeDeleted = (selectedIds, allNodes) => {
153
+ if (!selectedIds.size) {
154
+ return [];
155
+ }
156
+
157
+ let searchSet = [...selectedIds];
158
+ const deletedIds = new Set();
159
+
160
+ while (searchSet.length) {
161
+ const id = searchSet.pop();
162
+
163
+ if (allNodes[id]) {
164
+ var _allNodes$id$targets$, _allNodes$id;
165
+
166
+ deletedIds.add(allNodes[id].localId);
167
+ searchSet = searchSet.concat((_allNodes$id$targets$ = (_allNodes$id = allNodes[id]) === null || _allNodes$id === void 0 ? void 0 : _allNodes$id.targets.filter(targetId => {
168
+ var _allNodes$targetId;
169
+
170
+ return !deletedIds.has((_allNodes$targetId = allNodes[targetId]) === null || _allNodes$targetId === void 0 ? void 0 : _allNodes$targetId.localId);
171
+ })) !== null && _allNodes$id$targets$ !== void 0 ? _allNodes$id$targets$ : []);
172
+ }
173
+ }
174
+
175
+ return Array.from(deletedIds);
176
+ }; // for get children info for confirmation dialog
177
+
178
+
179
+ export const getChildrenInfo = (state, node) => {
180
+ if (!node) {
181
+ return [];
182
+ }
183
+
184
+ const childrenIdSet = new Set();
185
+ const childrenInfoArray = [];
186
+ const allNodes = getConnections(state);
187
+ const selectedNodeIds = getSelectedLocalIds(state, node);
188
+ selectedNodeIds.forEach(id => {
189
+ if (allNodes[id]) {
190
+ allNodes[id].targets.forEach(childrenIdSet.add, childrenIdSet);
191
+ }
192
+ });
193
+ childrenIdSet.forEach(id => {
194
+ childrenInfoArray.push({
195
+ id,
196
+ name: getNodeNameById(id, allNodes),
197
+ amount: getChildrenNodeAmount(id, allNodes)
198
+ });
199
+ });
200
+ return childrenInfoArray;
201
+ };
202
+
203
+ const getChildrenNodeAmount = (id, allNodes) => {
204
+ const searchTerms = new Set([id]);
205
+ const traverseHistory = new Map();
206
+ const childrenIds = new Set();
207
+ traverseHistory.set(id, false);
208
+
209
+ while (searchTerms.size > 0) {
210
+ const [currTerm] = searchTerms;
211
+ let targets = getNodeTargetsById(currTerm, allNodes);
212
+ targets.forEach(target => {
213
+ const isTargetCounted = traverseHistory.get(target);
214
+
215
+ if (!isTargetCounted) {
216
+ searchTerms.add(target);
217
+ childrenIds.add(target);
218
+ }
219
+
220
+ target !== id && childrenIds.add(target);
221
+ });
222
+ traverseHistory.set(currTerm, true);
223
+ searchTerms.delete(currTerm);
224
+ }
225
+
226
+ return childrenIds.size;
227
+ };
228
+
229
+ const getNodeTargetsById = (id, allNodes) => {
230
+ if (!id || !allNodes[id]) {
231
+ return [];
232
+ }
233
+
234
+ return allNodes[id].targets;
235
+ };
236
+
237
+ const DEFAULT_EXTENSION_NAME = 'Default extension';
238
+
239
+ const getNodeNameById = (id, allNodes) => {
240
+ if (typeof id === 'object') {
241
+ var _name2;
242
+
243
+ let name;
244
+ id.forEach(localId => {
245
+ var _name, _allNodes$localId;
246
+
247
+ name = (_name = name) !== null && _name !== void 0 ? _name : (_allNodes$localId = allNodes[localId]) === null || _allNodes$localId === void 0 ? void 0 : _allNodes$localId.name;
248
+ });
249
+ return (_name2 = name) !== null && _name2 !== void 0 ? _name2 : DEFAULT_EXTENSION_NAME;
250
+ }
251
+
252
+ if (!id || !allNodes[id]) {
253
+ return DEFAULT_EXTENSION_NAME;
254
+ }
255
+
256
+ return allNodes[id].name;
257
+ };
258
+
259
+ const getSelectedLocalIds = (state, node) => {
260
+ var _node$attrs5, _node$marks2, _node$marks2$find, _node$marks2$find$att;
261
+
262
+ if (!node) {
263
+ return new Set([]);
264
+ }
265
+
266
+ const localIds = new Set([(_node$attrs5 = node.attrs) === null || _node$attrs5 === void 0 ? void 0 : _node$attrs5.localId, (_node$marks2 = node.marks) === null || _node$marks2 === void 0 ? void 0 : (_node$marks2$find = _node$marks2.find(mark => mark.type === state.schema.marks.fragment)) === null || _node$marks2$find === void 0 ? void 0 : (_node$marks2$find$att = _node$marks2$find.attrs) === null || _node$marks2$find$att === void 0 ? void 0 : _node$marks2$find$att.localId].filter(Boolean));
267
+ return localIds;
268
+ };
269
+
270
+ export const getNodeName = (state, node) => {
271
+ var _node$marks$find$attr2, _node$marks3, _node$marks3$find, _node$marks3$find$att;
272
+
273
+ return (_node$marks$find$attr2 = node === null || node === void 0 ? void 0 : (_node$marks3 = node.marks) === null || _node$marks3 === void 0 ? void 0 : (_node$marks3$find = _node$marks3.find(mark => mark.type === state.schema.marks.fragment)) === null || _node$marks3$find === void 0 ? void 0 : (_node$marks3$find$att = _node$marks3$find.attrs) === null || _node$marks3$find$att === void 0 ? void 0 : _node$marks3$find$att.name) !== null && _node$marks$find$attr2 !== void 0 ? _node$marks$find$attr2 : '';
34
274
  };
@@ -1,4 +1,4 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from './analytics';
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics';
2
2
  const whitelistedAttributes = ['align', 'annotationType', 'extensionKey', 'extensionType', 'layout', 'type', 'localId', 'mode', 'language', 'timestamp', 'state', 'originalWidth', 'originalHeight', 'height', 'width', 'shortName', 'level', 'userType', 'order', 'panelType', 'color', 'style', 'isNumberColumnEnabled', 'colspan', 'rowspan', 'colwidth', 'background'];
3
3
 
4
4
  function concatAncestorHierarchy(node, ancestoryHierarchy) {
@@ -66,7 +66,6 @@ export const findAndTrackUnsupportedContentNodes = (node, schema, dispatchAnalyt
66
66
  const {
67
67
  originalValue
68
68
  } = mark.attrs || {};
69
- const sanitizedAttrs = sanitizeAttributes(originalValue.attrs) || {};
70
69
  const {
71
70
  type
72
71
  } = originalValue || {};
@@ -75,20 +74,19 @@ export const findAndTrackUnsupportedContentNodes = (node, schema, dispatchAnalyt
75
74
  ancestry: ancestorHierarchy,
76
75
  parentType: parentType,
77
76
  marks: [],
78
- attrs: sanitizedAttrs || {}
77
+ attrs: originalValue.attrs || {}
79
78
  };
80
79
  fireUnsupportedEvent(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.UNSUPPORTED_MARK, unsupportedNode);
81
80
  } else if (mark.type === unsupportedNodeAttribute) {
82
81
  const {
83
82
  unsupported
84
83
  } = mark.attrs || {};
85
- const sanitizedAttrs = sanitizeAttributes(unsupported) || {};
86
84
  const unsupportedNodeAttribute = {
87
85
  type: nodeType.name || '',
88
86
  ancestry: ancestorHierarchy,
89
87
  parentType: parentType,
90
88
  marks: [],
91
- attrs: sanitizedAttrs || {}
89
+ attrs: unsupported || {}
92
90
  };
93
91
  fireUnsupportedEvent(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.UNSUPPORTED_NODE_ATTRIBUTE, unsupportedNodeAttribute);
94
92
  }
@@ -112,8 +110,8 @@ export const findAndTrackUnsupportedContentNodes = (node, schema, dispatchAnalyt
112
110
  type: type || '',
113
111
  ancestry: ancestorHierarchy,
114
112
  parentType: parentType,
115
- marks: sanitizeMarks(marks) || [],
116
- attrs: sanitizeAttributes(attrs) || {}
113
+ marks: marks || [],
114
+ attrs: attrs || {}
117
115
  };
118
116
  const actionSubjectId = nodeType === unsupportedInline ? ACTION_SUBJECT_ID.UNSUPPORTED_INLINE : ACTION_SUBJECT_ID.UNSUPPORTED_BLOCK;
119
117
  fireUnsupportedEvent(dispatchAnalyticsEvent, actionSubjectId, unsupportedNode);
@@ -122,20 +120,26 @@ export const findAndTrackUnsupportedContentNodes = (node, schema, dispatchAnalyt
122
120
  node.content.forEach(childNode => findAndTrackUnsupportedContentNodes(childNode, schema, dispatchAnalyticsEvent, concatAncestorHierarchy(node, ancestorHierarchy)));
123
121
  }
124
122
  };
125
- export const fireUnsupportedEvent = (dispatchAnalyticsEvent, actionSubjectId, unsupportedNode = {}, errorCode) => {
126
- let attrs = {
127
- unsupportedNode: unsupportedNode
123
+ export const fireUnsupportedEvent = (dispatchAnalyticsEvent, actionSubjectId, unsupportedNode, errorCode) => {
124
+ const sanitizedAttrs = sanitizeAttributes(unsupportedNode.attrs);
125
+ const sanitizedMarks = sanitizeMarks(unsupportedNode.marks);
126
+ const sanitizedUnsupportedNode = {
127
+ type: unsupportedNode.type,
128
+ ancestry: unsupportedNode.ancestry,
129
+ parentType: unsupportedNode.parentType,
130
+ attrs: sanitizedAttrs,
131
+ marks: sanitizedMarks
128
132
  };
129
-
130
- if (errorCode) {
131
- attrs.errorCode = errorCode;
132
- }
133
-
134
133
  const payload = {
135
134
  action: ACTION.UNSUPPORTED_CONTENT_ENCOUNTERED,
136
135
  actionSubject: ACTION_SUBJECT.DOCUMENT,
137
136
  actionSubjectId,
138
- attributes: attrs,
137
+ attributes: {
138
+ unsupportedNode: sanitizedUnsupportedNode,
139
+ ...(!!errorCode && {
140
+ errorCode
141
+ })
142
+ },
139
143
  eventType: EVENT_TYPE.TRACK
140
144
  };
141
145
  dispatchAnalyticsEvent(payload);
@@ -1,6 +1,6 @@
1
1
  import { validator } from '@atlaskit/adf-utils/validator';
2
+ import { ACTION_SUBJECT_ID } from '../analytics';
2
3
  export const UNSUPPORTED_NODE_ATTRIBUTE = 'unsupportedNodeAttribute';
3
- import { ACTION_SUBJECT_ID } from './analytics';
4
4
  import { fireUnsupportedEvent } from './track-unsupported-content';
5
5
 
6
6
  const errorCallbackFor = (marks, validate, dispatchAnalyticsEvent) => {
@@ -102,7 +102,13 @@ function trackValidationError(dispatchAnalyticsEvent, error, entity) {
102
102
  return;
103
103
  }
104
104
 
105
- fireUnsupportedEvent(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.UNSUPPORTED_ERROR, entity, error.code);
105
+ fireUnsupportedEvent(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.UNSUPPORTED_ERROR, {
106
+ type: entity.type || '',
107
+ ancestry: entity.ancestorHierarchy || '',
108
+ parentType: entity.parentType || '',
109
+ marks: entity.marks || [],
110
+ attrs: entity.attrs || {}
111
+ }, error.code);
106
112
  }
107
113
 
108
114
  export const validateADFEntity = (schema, node, dispatchAnalyticsEvent) => {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "71.0.3",
3
+ "version": "72.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -99,7 +99,7 @@ export var ACTION;
99
99
  ACTION["TYPING_FINISHED"] = "typingFinished";
100
100
  ACTION["TYPING_STARTED"] = "typingStarted";
101
101
  ACTION["UNLINK"] = "unlinked";
102
- ACTION["UNSUPPORTED_CONTENT_ENCOUNTERED"] = "unsupportedContentEncountered";
102
+ ACTION["UNSUPPORTED_CONTENT_ENCOUNTERED"] = "unsupportedContentEncounteredV2";
103
103
  ACTION["UPDATED"] = "updated";
104
104
  ACTION["UPDATED_FRAGMENT_MARK_NAME"] = "updatedFragmentMarkName";
105
105
  ACTION["UPDATED_SOURCE"] = "updatedSource";
@@ -116,6 +116,16 @@ export var ACTION;
116
116
  ACTION["UFO_SESSION_COMPLETE"] = "ufoSessionComplete";
117
117
  ACTION["INVALID_PROSEMIRROR_DOCUMENT"] = "invalidProsemirrorDocument";
118
118
  ACTION["DOCUMENT_PROCESSING_ERROR"] = "documentProcessingError";
119
+ ACTION["RENDERER_TTI"] = "tti";
120
+ ACTION["CRASHED"] = "unhandledErrorCaught";
121
+ ACTION["SELECT_ALL_CAUGHT"] = "selectAllCaught";
122
+ ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
123
+ ACTION["SORT_COLUMN"] = "sortedColumn";
124
+ ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
125
+ ACTION["CREATE_NOT_ALLOWED"] = "createNotAllowed";
126
+ ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED"] = "unsupportedContentLevelsTrackingSucceeded";
127
+ ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED"] = "unsupportedContentLevelsTrackingErrored";
128
+ ACTION["UNSUPPORTED_TOOLTIP_VIEWED"] = "viewed";
119
129
  })(ACTION || (ACTION = {}));
120
130
 
121
131
  export var INPUT_METHOD;
@@ -202,6 +212,10 @@ export var ACTION_SUBJECT;
202
212
  ACTION_SUBJECT["CREATE_LINK_INLINE_DIALOG"] = "createLinkInlineDialog";
203
213
  ACTION_SUBJECT["CODE_BLOCK"] = "codeBlock";
204
214
  ACTION_SUBJECT["REACT_EDITOR_VIEW"] = "reactEditorView";
215
+ ACTION_SUBJECT["RENDERER"] = "renderer";
216
+ ACTION_SUBJECT["ANCHOR_LINK"] = "anchorLink";
217
+ ACTION_SUBJECT["LINK"] = "link";
218
+ ACTION_SUBJECT["TOOLTIP"] = "tooltip";
205
219
  })(ACTION_SUBJECT || (ACTION_SUBJECT = {}));
206
220
 
207
221
  export var ACTION_SUBJECT_ID;
@@ -319,9 +333,14 @@ export var ACTION_SUBJECT_ID;
319
333
  ACTION_SUBJECT_ID["TYPEAHEAD_QUICK_INSERT"] = "quickInsertTypeAhead";
320
334
  ACTION_SUBJECT_ID["UNKNOWN_NODE"] = "unknownNode";
321
335
  ACTION_SUBJECT_ID["UNLINK"] = "unlink";
336
+ ACTION_SUBJECT_ID["HEADING_ANCHOR_LINK"] = "headingAnchorLink";
337
+ ACTION_SUBJECT_ID["UNSUPPORTED_ERROR"] = "unsupportedUnhandled";
338
+ ACTION_SUBJECT_ID["UNSUPPORTED_NODE_ATTRIBUTE"] = "unsupportedNodeAttribute";
322
339
  ACTION_SUBJECT_ID["UNSUPPORTED_BLOCK"] = "unsupportedBlock";
323
340
  ACTION_SUBJECT_ID["UNSUPPORTED_INLINE"] = "unsupportedInline";
324
341
  ACTION_SUBJECT_ID["UNSUPPORTED_MARK"] = "unsupportedMark";
342
+ ACTION_SUBJECT_ID["ON_UNSUPPORTED_INLINE"] = "onUnsupportedInline";
343
+ ACTION_SUBJECT_ID["ON_UNSUPPORTED_BLOCK"] = "onUnsupportedBlock";
325
344
  })(ACTION_SUBJECT_ID || (ACTION_SUBJECT_ID = {}));
326
345
 
327
346
  export var FLOATING_CONTROLS_TITLE;
@@ -1,15 +1,16 @@
1
1
  /**
2
2
  * NOTE:
3
3
  *
4
- * This file is automatically generated by i18n-tools.
5
- * DO NOT CHANGE IT BY HAND or your changes will be lost.
4
+ * ED-16073:
5
+ * This was manually updated since the original `@atlaskit/i18n-tools` has been deprecated
6
6
  */
7
7
  export { default as zh } from './zh';
8
8
  export { default as zh_TW } from './zh_TW';
9
9
  export { default as cs } from './cs';
10
10
  export { default as da } from './da';
11
11
  export { default as nl } from './nl';
12
- export { default as et } from './et';
12
+ export { default as en } from './en';
13
+ export { default as en_GB } from './en_GB';
13
14
  export { default as fi } from './fi';
14
15
  export { default as fr } from './fr';
15
16
  export { default as de } from './de';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * NOTE:
3
+ *
4
+ * ED-16073:
5
+ * This was manually updated since the original `@atlaskit/i18n-tools` has been deprecated
6
+ */
7
+ export default {
8
+ zh: 'Chinese (Simplified)',
9
+ zh_TW: 'Chinese (Traditional)',
10
+ cs: 'Czech',
11
+ da: 'Danish',
12
+ nl: 'Dutch',
13
+ en: 'English',
14
+ en_GB: 'English (United Kingdom)',
15
+ fi: 'Finnish',
16
+ fr: 'French',
17
+ de: 'German',
18
+ hu: 'Hungarian',
19
+ it: 'Italian',
20
+ ja: 'Japanese',
21
+ ko: 'Korean',
22
+ nb: 'Norwegian Bokmål',
23
+ pl: 'Polish',
24
+ pt_BR: 'Portuguese (Brazil)',
25
+ pt_PT: 'Portuguese (Portugal)',
26
+ ru: 'Russian',
27
+ sk: 'Slovak',
28
+ es: 'Spanish',
29
+ sv: 'Swedish',
30
+ th: 'Thai',
31
+ tr: 'Turkish',
32
+ uk: 'Ukrainian',
33
+ vi: 'Vietnamese'
34
+ };
@@ -1,3 +1,4 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
3
 
3
4
  var _templateObject;
@@ -141,6 +142,53 @@ export function findShortcutByKeymap(keymap) {
141
142
 
142
143
  return keymap.windows;
143
144
  }
145
+ export function getAriaKeyshortcuts(keymap) {
146
+ var keyShortcuts;
147
+
148
+ if (typeof keymap === 'string') {
149
+ keyShortcuts = keymap;
150
+ } else if (_typeof(keymap) === 'object') {
151
+ keyShortcuts = keymap[browser.mac ? 'mac' : 'windows'];
152
+ }
153
+
154
+ if (keyShortcuts) {
155
+ return keyShortcuts.toLowerCase().split('-').map(function (modifier) {
156
+ switch (modifier) {
157
+ case 'cmd':
158
+ return 'Meta';
159
+
160
+ case 'ctrl':
161
+ return 'Control';
162
+
163
+ case 'alt':
164
+ return 'Alt';
165
+
166
+ case 'shift':
167
+ return 'Shift';
168
+
169
+ case 'enter':
170
+ return 'Enter';
171
+
172
+ case 'esc':
173
+ return 'Esc';
174
+
175
+ case 'tab':
176
+ return 'Tab';
177
+
178
+ case 'space':
179
+ return 'Space';
180
+
181
+ case 'backspace':
182
+ return 'Backspace';
183
+
184
+ default:
185
+ return modifier.split('').join(' ');
186
+ }
187
+ }).join('+');
188
+ } else {
189
+ return undefined;
190
+ }
191
+ }
144
192
  var ALL = [toggleOrderedList, toggleBulletList, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleBlockQuote, insertNewLine, insertRule, splitCodeBlock, splitListItem, redo, undo, find, escape, enter, shiftEnter];
145
193
  export function makeKeymap(description, windows, mac, common) {
146
194
  return {
@@ -9,7 +9,7 @@ export { ruleSharedStyles } from './shared/rule';
9
9
  export { whitespaceSharedStyles } from './shared/whitespace';
10
10
  export { paragraphSharedStyles } from './shared/paragraph';
11
11
  export { linkSharedStyle } from './shared/link';
12
- export { listsSharedStyles, listPaddingLeftMarkerSpace } from './shared/lists';
12
+ export { listsSharedStyles, listItemCounterPadding, getOrderedListInlineStyles } from './shared/lists';
13
13
  export { indentationSharedStyles } from './shared/indentation';
14
14
  export { blockMarksSharedStyles } from './shared/block-marks';
15
15
  export { codeMarkSharedStyles } from './shared/code-mark';
@@ -20,23 +20,20 @@ var DY75a = 'rgba(111, 92, 37, 0.5)';
20
20
  var DY200 = '#82641c';
21
21
  export var AnnotationSharedCSSByState = function AnnotationSharedCSSByState(props) {
22
22
  return {
23
- /* eslint-disable */
24
23
  focus: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n // Background is not coming through in confluence, suspecting to be caused by some specific combination of\n // emotion and token look up\n\n background: ", ";\n border-bottom: 2px solid\n ", ";\n // TODO: https://product-fabric.atlassian.net/browse/DSP-4147\n box-shadow: ", ";\n cursor: pointer;\n "])), themed({
25
- light: Y75,
26
- dark: DY75
24
+ light: token('color.background.accent.yellow.subtler', Y75),
25
+ dark: token('color.background.accent.yellow.subtler', DY75)
27
26
  })(props), themed({
28
27
  light: token('color.border.accent.yellow', Y300),
29
28
  dark: token('color.border.accent.yellow', DY300)
30
29
  })(props), token('elevation.shadow.overlay', "1px 2px 3px ".concat(N60A, ", -1px 2px 3px ").concat(N60A))),
31
30
  blur: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: ", ";\n border-bottom: 2px solid\n ", ";\n cursor: pointer;\n "])), themed({
32
- light: Y75a,
33
- dark: DY75a
31
+ light: token('color.background.accent.yellow.subtlest', Y75a),
32
+ dark: token('color.background.accent.yellow.subtlest', DY75a)
34
33
  })(props), themed({
35
34
  light: token('color.border.accent.yellow', Y200a),
36
35
  dark: token('color.border.accent.yellow', DY200)
37
36
  })(props))
38
- /* eslint-enable */
39
-
40
37
  };
41
38
  };
42
39
  export var annotationSharedStyles = function annotationSharedStyles(props) {
@@ -3,4 +3,4 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _templateObject;
4
4
 
5
5
  import { css } from '@emotion/react';
6
- export var blockMarksSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /**\n * We need to remove margin-top from first item\n * inside doc, tableCell, tableHeader, blockquote, etc.\n */\n *:not(.fabric-editor-block-mark) >,\n /* For nested block marks apart from those with indentation mark */\n *:not(.fabric-editor-block-mark) > div.fabric-editor-block-mark:first-of-type:not(.fabric-editor-indentation-mark),\n // If first document element has indentation mark remove margin-top\n .ProseMirror .fabric-editor-indentation-mark:first-of-type:first-child {\n p,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n .heading-wrapper {\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n }\n }\n"])));
6
+ export var blockMarksSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /**\n * We need to remove margin-top from first item\n * inside doc, tableCell, tableHeader, blockquote, etc.\n */\n *:not(.fabric-editor-block-mark) >,\n /* For nested block marks apart from those with indentation mark */\n *:not(.fabric-editor-block-mark) >\n div.fabric-editor-block-mark:first-of-type\n /* Do not remove the margin top for nodes inside indentation marks */\n :not(.fabric-editor-indentation-mark)\n /* Do not remove the margin top for nodes inside alignment marks */\n :not(.fabric-editor-alignment),\n // If first element inside a block node has alignment mark, then remove the margin-top\n .fabric-editor-alignment:first-of-type:first-child,\n // If first document element has indentation mark remove margin-top\n .ProseMirror .fabric-editor-indentation-mark:first-of-type:first-child {\n p,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n .heading-wrapper {\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n }\n }\n"])));
@@ -18,17 +18,16 @@ export var CodeBlockSharedCssClassName = {
18
18
  DS_CODEBLOCK: '[data-ds--code--code-block]'
19
19
  };
20
20
  export var codeBlockSharedStyles = function codeBlockSharedStyles(props) {
21
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n font-family: ", ";\n min-width: ", "px;\n cursor: pointer;\n\n --ds--code--bg-color: transparent;\n\n /* This is necessary to allow for arrow key navigation in/out of code blocks in Firefox. */\n white-space: normal;\n\n .", " {\n position: absolute;\n visibility: hidden;\n height: 1.5rem;\n top: 0px;\n left: 0px;\n }\n\n .", " {\n position: absolute;\n visibility: hidden;\n height: 1.5rem;\n bottom: 0px;\n right: 0px;\n }\n\n .", " {\n background-color: ", ";\n display: flex;\n border-radius: ", "px;\n width: 100%;\n counter-reset: line;\n overflow-x: auto;\n\n background-image: ", ";\n\n background-repeat: no-repeat;\n background-attachment: local, local, local, local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%, 8px 100%, 8px 100%,\n 8px 100%;\n background-position: 0 0, 0 0, 100% 0, 100% 0, 100% 0, 0 0;\n\n /* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */\n overflow-y: hidden;\n }\n\n .", " {\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n position: relative;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n ::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n color: ", ";\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, token('elevation.surface.raised', 'transparent'), borderRadius(), blockNodesVerticalMargin, akEditorCodeFontFamily, akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_START, CodeBlockSharedCssClassName.CODEBLOCK_END, CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, themed({
21
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n font-family: ", ";\n min-width: ", "px;\n cursor: pointer;\n\n --ds--code--bg-color: transparent;\n\n /* This is necessary to allow for arrow key navigation in/out of code blocks in Firefox. */\n white-space: normal;\n\n .", " {\n position: absolute;\n visibility: hidden;\n height: 1.5rem;\n top: 0px;\n left: 0px;\n }\n\n .", " {\n position: absolute;\n visibility: hidden;\n height: 1.5rem;\n bottom: 0px;\n right: 0px;\n }\n\n .", " {\n background-color: ", ";\n display: flex;\n border-radius: ", "px;\n width: 100%;\n counter-reset: line;\n overflow-x: auto;\n\n background-image: ", ";\n\n background-repeat: no-repeat;\n background-attachment: local, local, local, local, scroll, scroll, scroll,\n scroll;\n background-size: ", "px 100%, ", "px 100%,\n ", "px 100%, ", "px 100%, ", "px 100%,\n 1px 100%, ", "px 100%, 1px 100%;\n background-position: 0 0, 0 0, 100% 0, 100% 0, 100% 0, 100% 0, 0 0, 0 0;\n\n /* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */\n overflow-y: hidden;\n }\n\n .", " {\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n position: relative;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n ::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n color: ", ";\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, token('elevation.surface.raised', 'transparent'), borderRadius(), blockNodesVerticalMargin, akEditorCodeFontFamily, akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_START, CodeBlockSharedCssClassName.CODEBLOCK_END, CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, themed({
22
22
  light: token('color.background.neutral', N20),
23
23
  dark: token('color.background.neutral', DN50)
24
24
  })(props), borderRadius(), overflowShadow({
25
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4118
26
25
  background: themed({
27
26
  light: token('color.background.neutral', N20),
28
27
  dark: token('color.background.neutral', DN50)
29
28
  })(props),
30
- width: '8px'
31
- }), CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, themed({
29
+ leftCoverWidth: "".concat(gridSize() * 3, "px")
30
+ }), gridSize() * 3, gridSize() * 3, gridSize(), gridSize(), gridSize(), gridSize(), CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, themed({
32
31
  light: token('color.background.neutral', N30),
33
32
  dark: token('color.background.neutral', DN20)
34
33
  })(props), gridSize(), themed({