@atlaskit/editor-plugin-show-diff 19.0.3 → 20.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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +57 -93
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -26
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +7 -22
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/cjs/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/cjs/pm-plugins/getDefaultDiffType.js +10 -0
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +5 -15
- package/dist/cjs/pm-plugins/main.js +45 -53
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/cjs/showDiffPlugin.js +14 -24
- package/dist/cjs/showDiffPluginType.js +1 -1
- package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/cjs/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +67 -105
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +11 -23
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +8 -18
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -54
- package/dist/es2019/pm-plugins/decorations/decorationKeys.js +6 -16
- package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +2 -7
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +53 -125
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +11 -12
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -7
- package/dist/es2019/pm-plugins/getDefaultDiffType.js +2 -0
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +6 -19
- package/dist/es2019/pm-plugins/main.js +49 -65
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +18 -3
- package/dist/es2019/showDiffPlugin.js +12 -24
- package/dist/es2019/showDiffPluginType.js +1 -1
- package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/es2019/ui/ContributorTag/contributorTagController.js +30 -2
- package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +56 -92
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/esm/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/esm/pm-plugins/getDefaultDiffType.js +4 -0
- package/dist/esm/pm-plugins/getScrollableDecorations.js +6 -16
- package/dist/esm/pm-plugins/main.js +44 -52
- package/dist/esm/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/esm/showDiffPlugin.js +14 -24
- package/dist/esm/showDiffPluginType.js +1 -1
- package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/esm/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/esm/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +0 -3
- package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/decorationKeys.d.ts +5 -8
- package/dist/types/pm-plugins/decorations/utils/createDeletedLineBreakWidget.d.ts +3 -5
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +4 -6
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +3 -4
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +4 -4
- package/dist/types/pm-plugins/getDefaultDiffType.d.ts +2 -0
- package/dist/types/pm-plugins/getScrollableDecorations.d.ts +1 -2
- package/dist/types/pm-plugins/main.d.ts +0 -1
- package/dist/types/showDiffPluginType.d.ts +1 -3
- package/docs/smart-diff-design.md +13 -29
- package/package.json +11 -11
- package/dist/cjs/pm-plugins/isExtendedEnabled.js +0 -23
- package/dist/es2019/pm-plugins/isExtendedEnabled.js +0 -13
- package/dist/esm/pm-plugins/isExtendedEnabled.js +0 -17
- package/dist/types/pm-plugins/isExtendedEnabled.d.ts +0 -12
|
@@ -12,7 +12,6 @@ var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
|
12
12
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
|
-
var _isExtendedEnabled = require("../../isExtendedEnabled");
|
|
16
15
|
var _createInlineChangedDecoration = require("../createInlineChangedDecoration");
|
|
17
16
|
var _revealStyles = require("../revealStyles");
|
|
18
17
|
var _getAttrChangeRanges = require("./getAttrChangeRanges");
|
|
@@ -120,14 +119,6 @@ var applyDeletedNodeMarkupNext = function applyDeletedNodeMarkupNext(_ref3) {
|
|
|
120
119
|
var applyDeletedNodeMarkup = function applyDeletedNodeMarkup(args) {
|
|
121
120
|
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? applyDeletedNodeMarkupNext(args) : applyDeletedNodeMarkupLegacy(args);
|
|
122
121
|
};
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Checks if a node should apply deleted styles directly without wrapper
|
|
126
|
-
* to preserve natural block-level margins
|
|
127
|
-
*/
|
|
128
|
-
var shouldApplyStylesDirectly = function shouldApplyStylesDirectly(nodeName) {
|
|
129
|
-
return nodeName === 'heading';
|
|
130
|
-
};
|
|
131
122
|
var applyCellOverlayStyles = function applyCellOverlayStyles(_ref4) {
|
|
132
123
|
var element = _ref4.element,
|
|
133
124
|
colorScheme = _ref4.colorScheme,
|
|
@@ -196,37 +187,17 @@ var createBlockNodeWrapper = function createBlockNodeWrapper() {
|
|
|
196
187
|
wrapper.setAttribute('style', baseStyle);
|
|
197
188
|
return wrapper;
|
|
198
189
|
};
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Applies styles directly to an HTML element by merging with existing styles
|
|
202
|
-
*/
|
|
203
|
-
var applyStylesToElement = function applyStylesToElement(_ref5) {
|
|
190
|
+
var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref5) {
|
|
204
191
|
var element = _ref5.element,
|
|
205
192
|
targetNode = _ref5.targetNode,
|
|
206
193
|
colorScheme = _ref5.colorScheme,
|
|
207
194
|
isActive = _ref5.isActive,
|
|
208
195
|
isInserted = _ref5.isInserted,
|
|
209
|
-
diffType = _ref5.diffType,
|
|
210
196
|
_ref5$hideAddedDiffsU = _ref5.hideAddedDiffsUnderline,
|
|
211
197
|
hideAddedDiffsUnderline = _ref5$hideAddedDiffsU === void 0 ? false : _ref5$hideAddedDiffsU;
|
|
212
198
|
var currentStyle = element.getAttribute('style') || '';
|
|
213
|
-
var contentStyle = (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
214
199
|
var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
|
|
215
|
-
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive,
|
|
216
|
-
element.setAttribute('style', "".concat(currentStyle).concat(contentStyle).concat(nodeSpecificStyle));
|
|
217
|
-
};
|
|
218
|
-
var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref6) {
|
|
219
|
-
var element = _ref6.element,
|
|
220
|
-
targetNode = _ref6.targetNode,
|
|
221
|
-
colorScheme = _ref6.colorScheme,
|
|
222
|
-
isActive = _ref6.isActive,
|
|
223
|
-
isInserted = _ref6.isInserted,
|
|
224
|
-
diffType = _ref6.diffType,
|
|
225
|
-
_ref6$hideAddedDiffsU = _ref6.hideAddedDiffsUnderline,
|
|
226
|
-
hideAddedDiffsUnderline = _ref6$hideAddedDiffsU === void 0 ? false : _ref6$hideAddedDiffsU;
|
|
227
|
-
var currentStyle = element.getAttribute('style') || '';
|
|
228
|
-
var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
|
|
229
|
-
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
200
|
+
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) || '';
|
|
230
201
|
if (targetNode.type.name === 'decisionList') {
|
|
231
202
|
var nestedInsertedNodeStyle = (0, _wrapBlockNodeViewStyles.resolveNestedInsertedNodeStyle)(colorScheme);
|
|
232
203
|
element.querySelectorAll('li').forEach(function (listItem) {
|
|
@@ -256,21 +227,21 @@ var appendStyleToElement = function appendStyleToElement(element, style) {
|
|
|
256
227
|
var currentStyle = element.getAttribute('style') || '';
|
|
257
228
|
element.setAttribute('style', combineStyles(currentStyle, style));
|
|
258
229
|
};
|
|
259
|
-
var wrapAtomicInlineNode = function wrapAtomicInlineNode(
|
|
260
|
-
var element =
|
|
261
|
-
className =
|
|
262
|
-
style =
|
|
230
|
+
var wrapAtomicInlineNode = function wrapAtomicInlineNode(_ref6) {
|
|
231
|
+
var element = _ref6.element,
|
|
232
|
+
className = _ref6.className,
|
|
233
|
+
style = _ref6.style;
|
|
263
234
|
var wrapper = document.createElement('span');
|
|
264
235
|
wrapper.className = className;
|
|
265
236
|
wrapper.setAttribute('style', style);
|
|
266
237
|
element.replaceWith(wrapper);
|
|
267
238
|
wrapper.append(element);
|
|
268
239
|
};
|
|
269
|
-
var applyInlineLeafNodeStyles = function applyInlineLeafNodeStyles(
|
|
270
|
-
var element =
|
|
271
|
-
targetNode =
|
|
272
|
-
contentStyle =
|
|
273
|
-
colorScheme =
|
|
240
|
+
var applyInlineLeafNodeStyles = function applyInlineLeafNodeStyles(_ref7) {
|
|
241
|
+
var element = _ref7.element,
|
|
242
|
+
targetNode = _ref7.targetNode,
|
|
243
|
+
contentStyle = _ref7.contentStyle,
|
|
244
|
+
colorScheme = _ref7.colorScheme;
|
|
274
245
|
// NodeViewSerializer appends one DOM node per direct ProseMirror child, preserving order.
|
|
275
246
|
var childDomNodes = (0, _toConsumableArray2.default)(element.childNodes);
|
|
276
247
|
targetNode.content.forEach(function (childNode, _offset, index) {
|
|
@@ -306,23 +277,22 @@ var applyInlineLeafNodeStyles = function applyInlineLeafNodeStyles(_ref8) {
|
|
|
306
277
|
var quoteBlockLevelStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
307
278
|
display: 'flow-root'
|
|
308
279
|
});
|
|
309
|
-
var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(
|
|
310
|
-
var element =
|
|
311
|
-
targetNode =
|
|
312
|
-
colorScheme =
|
|
313
|
-
isActive =
|
|
314
|
-
isInserted =
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
highlightInlineLeafNodes = _ref9$highlightInline === void 0 ? false : _ref9$highlightInline;
|
|
280
|
+
var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref8) {
|
|
281
|
+
var element = _ref8.element,
|
|
282
|
+
targetNode = _ref8.targetNode,
|
|
283
|
+
colorScheme = _ref8.colorScheme,
|
|
284
|
+
isActive = _ref8.isActive,
|
|
285
|
+
isInserted = _ref8.isInserted,
|
|
286
|
+
_ref8$hideAddedDiffsU = _ref8.hideAddedDiffsUnderline,
|
|
287
|
+
hideAddedDiffsUnderline = _ref8$hideAddedDiffsU === void 0 ? false : _ref8$hideAddedDiffsU,
|
|
288
|
+
_ref8$highlightInline = _ref8.highlightInlineLeafNodes,
|
|
289
|
+
highlightInlineLeafNodes = _ref8$highlightInline === void 0 ? false : _ref8$highlightInline;
|
|
320
290
|
var currentStyle = element.getAttribute('style') || '';
|
|
321
|
-
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNode.type.name, colorScheme, isInserted, isActive,
|
|
291
|
+
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNode.type.name, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) || '';
|
|
322
292
|
if (nodeSpecificStyle) {
|
|
323
293
|
element.setAttribute('style', "".concat(currentStyle).concat(nodeSpecificStyle));
|
|
324
294
|
}
|
|
325
|
-
var contentStyle = (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted,
|
|
295
|
+
var contentStyle = (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
326
296
|
var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
|
327
297
|
var textNodesToWrap = [];
|
|
328
298
|
var currentNode = walker.nextNode();
|
|
@@ -351,24 +321,23 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref9)
|
|
|
351
321
|
/**
|
|
352
322
|
* Creates a content wrapper with deleted styles for a block node
|
|
353
323
|
*/
|
|
354
|
-
var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(
|
|
355
|
-
var nodeView =
|
|
356
|
-
targetNode =
|
|
357
|
-
colorScheme =
|
|
358
|
-
isActive =
|
|
359
|
-
isInserted =
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
hideAddedDiffsUnderline = _ref0$hideAddedDiffsU === void 0 ? false : _ref0$hideAddedDiffsU;
|
|
324
|
+
var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref9) {
|
|
325
|
+
var nodeView = _ref9.nodeView,
|
|
326
|
+
targetNode = _ref9.targetNode,
|
|
327
|
+
colorScheme = _ref9.colorScheme,
|
|
328
|
+
isActive = _ref9.isActive,
|
|
329
|
+
isInserted = _ref9.isInserted,
|
|
330
|
+
_ref9$hideAddedDiffsU = _ref9.hideAddedDiffsUnderline,
|
|
331
|
+
hideAddedDiffsUnderline = _ref9$hideAddedDiffsU === void 0 ? false : _ref9$hideAddedDiffsU;
|
|
363
332
|
var contentWrapper = document.createElement('div');
|
|
364
333
|
var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
|
|
365
|
-
var nodeStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive,
|
|
334
|
+
var nodeStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline);
|
|
366
335
|
|
|
367
336
|
// When the extended experiment is enabled and the content is inserted,
|
|
368
337
|
// block widget nodes that already have dedicated node-level styling (e.g. boxShadow outline)
|
|
369
338
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
370
|
-
var shouldSkipContentStyle =
|
|
371
|
-
var contentStyle = shouldSkipContentStyle ? '' : (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted,
|
|
339
|
+
var shouldSkipContentStyle = isInserted && nodeStyle !== undefined;
|
|
340
|
+
var contentStyle = shouldSkipContentStyle ? '' : (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
372
341
|
contentWrapper.setAttribute('style', "".concat(contentStyle).concat(nodeStyle || ''));
|
|
373
342
|
contentWrapper.append(nodeView);
|
|
374
343
|
return contentWrapper;
|
|
@@ -380,14 +349,14 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref0
|
|
|
380
349
|
* to wait for the rich-media-item to appear before attaching the lozenge.
|
|
381
350
|
* @returns true if embedCard was handled
|
|
382
351
|
*/
|
|
383
|
-
var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(
|
|
384
|
-
var dom =
|
|
385
|
-
nodeView =
|
|
386
|
-
targetNode =
|
|
387
|
-
lozenge =
|
|
388
|
-
colorScheme =
|
|
389
|
-
|
|
390
|
-
isActive =
|
|
352
|
+
var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref0) {
|
|
353
|
+
var dom = _ref0.dom,
|
|
354
|
+
nodeView = _ref0.nodeView,
|
|
355
|
+
targetNode = _ref0.targetNode,
|
|
356
|
+
lozenge = _ref0.lozenge,
|
|
357
|
+
colorScheme = _ref0.colorScheme,
|
|
358
|
+
_ref0$isActive = _ref0.isActive,
|
|
359
|
+
isActive = _ref0$isActive === void 0 ? false : _ref0$isActive;
|
|
391
360
|
if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
|
|
392
361
|
return false;
|
|
393
362
|
}
|
|
@@ -423,14 +392,14 @@ var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref1) {
|
|
|
423
392
|
* Handles special mediaSingle node rendering with lozenge on child media element
|
|
424
393
|
* @returns true if mediaSingle was handled, false otherwise
|
|
425
394
|
*/
|
|
426
|
-
var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(
|
|
427
|
-
var dom =
|
|
428
|
-
nodeView =
|
|
429
|
-
targetNode =
|
|
430
|
-
lozenge =
|
|
431
|
-
colorScheme =
|
|
432
|
-
|
|
433
|
-
isActive =
|
|
395
|
+
var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref1) {
|
|
396
|
+
var dom = _ref1.dom,
|
|
397
|
+
nodeView = _ref1.nodeView,
|
|
398
|
+
targetNode = _ref1.targetNode,
|
|
399
|
+
lozenge = _ref1.lozenge,
|
|
400
|
+
colorScheme = _ref1.colorScheme,
|
|
401
|
+
_ref1$isActive = _ref1.isActive,
|
|
402
|
+
isActive = _ref1$isActive === void 0 ? false : _ref1$isActive;
|
|
434
403
|
if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
|
|
435
404
|
return false;
|
|
436
405
|
}
|
|
@@ -463,22 +432,21 @@ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref10)
|
|
|
463
432
|
/**
|
|
464
433
|
* Appends a block node with wrapper, lozenge, and appropriate styling
|
|
465
434
|
*/
|
|
466
|
-
var wrapBlockNode = function wrapBlockNode(
|
|
467
|
-
var dom =
|
|
468
|
-
nodeView =
|
|
469
|
-
targetNode =
|
|
470
|
-
colorScheme =
|
|
471
|
-
intl =
|
|
472
|
-
|
|
473
|
-
isActive =
|
|
474
|
-
|
|
475
|
-
isInserted =
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
hideAddedDiffsUnderline = _ref11$hideAddedDiffs === void 0 ? false : _ref11$hideAddedDiffs;
|
|
435
|
+
var wrapBlockNode = function wrapBlockNode(_ref10) {
|
|
436
|
+
var dom = _ref10.dom,
|
|
437
|
+
nodeView = _ref10.nodeView,
|
|
438
|
+
targetNode = _ref10.targetNode,
|
|
439
|
+
colorScheme = _ref10.colorScheme,
|
|
440
|
+
intl = _ref10.intl,
|
|
441
|
+
_ref10$isActive = _ref10.isActive,
|
|
442
|
+
isActive = _ref10$isActive === void 0 ? false : _ref10$isActive,
|
|
443
|
+
_ref10$isInserted = _ref10.isInserted,
|
|
444
|
+
isInserted = _ref10$isInserted === void 0 ? false : _ref10$isInserted,
|
|
445
|
+
_ref10$hideAddedDiffs = _ref10.hideAddedDiffsUnderline,
|
|
446
|
+
hideAddedDiffsUnderline = _ref10$hideAddedDiffs === void 0 ? false : _ref10$hideAddedDiffs;
|
|
479
447
|
var blockWrapper = createBlockNodeWrapper();
|
|
480
448
|
var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
|
|
481
|
-
if (shouldShowRemovedLozenge(targetNodeName) &&
|
|
449
|
+
if (shouldShowRemovedLozenge(targetNodeName) && !isInserted) {
|
|
482
450
|
var lozenge = createRemovedLozenge(intl, isActive, colorScheme);
|
|
483
451
|
if (handleEmbedCardWithLozenge({
|
|
484
452
|
dom: dom,
|
|
@@ -508,7 +476,6 @@ var wrapBlockNode = function wrapBlockNode(_ref11) {
|
|
|
508
476
|
colorScheme: colorScheme,
|
|
509
477
|
isActive: isActive,
|
|
510
478
|
isInserted: isInserted,
|
|
511
|
-
diffType: diffType,
|
|
512
479
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
513
480
|
});
|
|
514
481
|
blockWrapper.append(contentWrapper);
|
|
@@ -528,106 +495,75 @@ var wrapBlockNode = function wrapBlockNode(_ref11) {
|
|
|
528
495
|
* For heading nodes, applies styles directly to preserve natural margins.
|
|
529
496
|
* For other block nodes, uses wrapper approach with optional lozenge.
|
|
530
497
|
*/
|
|
531
|
-
var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(
|
|
532
|
-
var dom =
|
|
533
|
-
nodeView =
|
|
534
|
-
targetNode =
|
|
535
|
-
colorScheme =
|
|
536
|
-
intl =
|
|
537
|
-
|
|
538
|
-
isActive =
|
|
539
|
-
|
|
540
|
-
isInserted =
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if (isInserted && (0, _wrapBlockNodeViewStyles.isMultiContainerBlockNode)(targetNode.type.name)) {
|
|
549
|
-
applyMultiContainerLikeStyles({
|
|
550
|
-
element: nodeView,
|
|
551
|
-
targetNode: targetNode,
|
|
552
|
-
colorScheme: colorScheme,
|
|
553
|
-
isActive: isActive,
|
|
554
|
-
isInserted: isInserted,
|
|
555
|
-
diffType: diffType,
|
|
556
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
557
|
-
});
|
|
558
|
-
dom.append(nodeView);
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
if ((0, _wrapBlockNodeViewStyles.isTextLikeBlockNode)(targetNode.type.name)) {
|
|
562
|
-
applyTextLikeBlockNodeStyles({
|
|
563
|
-
element: nodeView,
|
|
564
|
-
targetNode: targetNode,
|
|
565
|
-
colorScheme: colorScheme,
|
|
566
|
-
isActive: isActive,
|
|
567
|
-
isInserted: isInserted,
|
|
568
|
-
diffType: diffType,
|
|
569
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
570
|
-
highlightInlineLeafNodes: highlightInlineLeafNodes
|
|
571
|
-
});
|
|
572
|
-
if (targetNode.type.name === 'blockquote' && (0, _fg.fg)('platform_editor_ai_show_diff_patch_1')) {
|
|
573
|
-
appendStyleToElement(nodeView, quoteBlockLevelStyle);
|
|
574
|
-
}
|
|
575
|
-
dom.append(nodeView);
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
if (targetNode.type.name === 'table') {
|
|
579
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_diff_rounded_corners')) {
|
|
580
|
-
(0, _tableCellEdgeAttrs.applyTableCellEdgeAttrs)({
|
|
581
|
-
element: nodeView,
|
|
582
|
-
tableNode: targetNode
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
applyCellOverlayStyles({
|
|
586
|
-
element: nodeView,
|
|
587
|
-
colorScheme: colorScheme,
|
|
588
|
-
isInserted: isInserted
|
|
589
|
-
});
|
|
590
|
-
dom.append(nodeView);
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
wrapBlockNode({
|
|
595
|
-
dom: dom,
|
|
596
|
-
nodeView: nodeView,
|
|
597
|
-
targetNode: targetNode,
|
|
598
|
-
colorScheme: colorScheme,
|
|
599
|
-
intl: intl,
|
|
600
|
-
isActive: isActive,
|
|
601
|
-
isInserted: isInserted,
|
|
602
|
-
diffType: diffType,
|
|
603
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
604
|
-
});
|
|
605
|
-
return;
|
|
606
|
-
} else {
|
|
607
|
-
if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
|
|
608
|
-
// Apply deleted styles directly to preserve natural block-level margins
|
|
609
|
-
applyStylesToElement({
|
|
498
|
+
var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_ref11) {
|
|
499
|
+
var dom = _ref11.dom,
|
|
500
|
+
nodeView = _ref11.nodeView,
|
|
501
|
+
targetNode = _ref11.targetNode,
|
|
502
|
+
colorScheme = _ref11.colorScheme,
|
|
503
|
+
intl = _ref11.intl,
|
|
504
|
+
_ref11$isActive = _ref11.isActive,
|
|
505
|
+
isActive = _ref11$isActive === void 0 ? false : _ref11$isActive,
|
|
506
|
+
_ref11$isInserted = _ref11.isInserted,
|
|
507
|
+
isInserted = _ref11$isInserted === void 0 ? false : _ref11$isInserted,
|
|
508
|
+
_ref11$hideAddedDiffs = _ref11.hideAddedDiffsUnderline,
|
|
509
|
+
hideAddedDiffsUnderline = _ref11$hideAddedDiffs === void 0 ? false : _ref11$hideAddedDiffs,
|
|
510
|
+
_ref11$highlightInlin = _ref11.highlightInlineLeafNodes,
|
|
511
|
+
highlightInlineLeafNodes = _ref11$highlightInlin === void 0 ? false : _ref11$highlightInlin;
|
|
512
|
+
if (nodeView instanceof HTMLElement) {
|
|
513
|
+
if (isInserted && (0, _wrapBlockNodeViewStyles.isMultiContainerBlockNode)(targetNode.type.name)) {
|
|
514
|
+
applyMultiContainerLikeStyles({
|
|
610
515
|
element: nodeView,
|
|
611
516
|
targetNode: targetNode,
|
|
612
517
|
colorScheme: colorScheme,
|
|
613
518
|
isActive: isActive,
|
|
614
519
|
isInserted: isInserted,
|
|
615
|
-
|
|
520
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
616
521
|
});
|
|
617
522
|
dom.append(nodeView);
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
if ((0, _wrapBlockNodeViewStyles.isTextLikeBlockNode)(targetNode.type.name)) {
|
|
526
|
+
applyTextLikeBlockNodeStyles({
|
|
527
|
+
element: nodeView,
|
|
622
528
|
targetNode: targetNode,
|
|
623
529
|
colorScheme: colorScheme,
|
|
624
|
-
intl: intl,
|
|
625
530
|
isActive: isActive,
|
|
626
531
|
isInserted: isInserted,
|
|
627
|
-
|
|
532
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
533
|
+
highlightInlineLeafNodes: highlightInlineLeafNodes
|
|
628
534
|
});
|
|
535
|
+
if (targetNode.type.name === 'blockquote' && (0, _fg.fg)('platform_editor_ai_show_diff_patch_1')) {
|
|
536
|
+
appendStyleToElement(nodeView, quoteBlockLevelStyle);
|
|
537
|
+
}
|
|
538
|
+
dom.append(nodeView);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (targetNode.type.name === 'table') {
|
|
542
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_diff_rounded_corners')) {
|
|
543
|
+
(0, _tableCellEdgeAttrs.applyTableCellEdgeAttrs)({
|
|
544
|
+
element: nodeView,
|
|
545
|
+
tableNode: targetNode
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
applyCellOverlayStyles({
|
|
549
|
+
element: nodeView,
|
|
550
|
+
colorScheme: colorScheme,
|
|
551
|
+
isInserted: isInserted
|
|
552
|
+
});
|
|
553
|
+
dom.append(nodeView);
|
|
554
|
+
return;
|
|
629
555
|
}
|
|
630
556
|
}
|
|
557
|
+
wrapBlockNode({
|
|
558
|
+
dom: dom,
|
|
559
|
+
nodeView: nodeView,
|
|
560
|
+
targetNode: targetNode,
|
|
561
|
+
colorScheme: colorScheme,
|
|
562
|
+
intl: intl,
|
|
563
|
+
isActive: isActive,
|
|
564
|
+
isInserted: isInserted,
|
|
565
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
566
|
+
});
|
|
631
567
|
};
|
|
632
568
|
|
|
633
569
|
/**
|
|
@@ -635,13 +571,12 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
|
|
|
635
571
|
* CSS backgrounds don't work when applied to a wrapper around a paragraph, so
|
|
636
572
|
* the wrapper needs to be injected inside the node around the child content.
|
|
637
573
|
*/
|
|
638
|
-
var injectInnerWrapper = exports.injectInnerWrapper = function injectInnerWrapper(
|
|
639
|
-
var node =
|
|
640
|
-
colorScheme =
|
|
641
|
-
isActive =
|
|
642
|
-
isInserted =
|
|
643
|
-
|
|
644
|
-
reveal = _ref13.reveal;
|
|
574
|
+
var injectInnerWrapper = exports.injectInnerWrapper = function injectInnerWrapper(_ref12) {
|
|
575
|
+
var node = _ref12.node,
|
|
576
|
+
colorScheme = _ref12.colorScheme,
|
|
577
|
+
isActive = _ref12.isActive,
|
|
578
|
+
isInserted = _ref12.isInserted,
|
|
579
|
+
reveal = _ref12.reveal;
|
|
645
580
|
var wrapper = document.createElement('span');
|
|
646
581
|
var revealStyle = (0, _revealStyles.applyRevealToElement)({
|
|
647
582
|
colorScheme: colorScheme,
|
|
@@ -650,7 +585,7 @@ var injectInnerWrapper = exports.injectInnerWrapper = function injectInnerWrappe
|
|
|
650
585
|
isInserted: isInserted !== null && isInserted !== void 0 ? isInserted : false,
|
|
651
586
|
reveal: reveal
|
|
652
587
|
});
|
|
653
|
-
wrapper.setAttribute('style', (isInserted ? (0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive,
|
|
588
|
+
wrapper.setAttribute('style', (isInserted ? (0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive, Boolean(revealStyle))) + revealStyle);
|
|
654
589
|
(0, _toConsumableArray2.default)(node.childNodes).forEach(function (child) {
|
|
655
590
|
var removedChild = node.removeChild(child);
|
|
656
591
|
wrapper.append(removedChild);
|
|
@@ -665,8 +600,7 @@ var injectInnerWrapper = exports.injectInnerWrapper = function injectInnerWrappe
|
|
|
665
600
|
var createContentWrapper = exports.createContentWrapper = function createContentWrapper(colorScheme) {
|
|
666
601
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
667
602
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
668
|
-
var
|
|
669
|
-
var reveal = arguments.length > 4 ? arguments[4] : undefined;
|
|
603
|
+
var reveal = arguments.length > 3 ? arguments[3] : undefined;
|
|
670
604
|
var wrapper = document.createElement('span');
|
|
671
605
|
var baseStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
672
606
|
position: 'relative',
|
|
@@ -681,21 +615,14 @@ var createContentWrapper = exports.createContentWrapper = function createContent
|
|
|
681
615
|
isInserted: isInserted,
|
|
682
616
|
reveal: reveal
|
|
683
617
|
});
|
|
684
|
-
var deletedStyle = (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive,
|
|
685
|
-
if (
|
|
686
|
-
|
|
687
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat((0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive)).concat(revealStyle));
|
|
688
|
-
} else {
|
|
689
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle).concat(revealStyle));
|
|
690
|
-
var strikethrough = document.createElement('span');
|
|
691
|
-
strikethrough.setAttribute('style', (0, _wrapBlockNodeViewStyles.getDeletedContentStyleUnbounded)(colorScheme, isActive));
|
|
692
|
-
wrapper.append(strikethrough);
|
|
693
|
-
}
|
|
618
|
+
var deletedStyle = (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive, Boolean(revealStyle));
|
|
619
|
+
if (isInserted) {
|
|
620
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat((0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive)).concat(revealStyle));
|
|
694
621
|
} else {
|
|
695
622
|
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle).concat(revealStyle));
|
|
696
|
-
var
|
|
697
|
-
|
|
698
|
-
wrapper.append(
|
|
623
|
+
var strikethrough = document.createElement('span');
|
|
624
|
+
strikethrough.setAttribute('style', (0, _wrapBlockNodeViewStyles.getDeletedContentStyleUnbounded)(colorScheme, isActive));
|
|
625
|
+
wrapper.append(strikethrough);
|
|
699
626
|
}
|
|
700
627
|
return wrapper;
|
|
701
628
|
};
|
|
@@ -8,7 +8,6 @@ exports.resolveRemovedLozengeStyle = exports.resolveNestedInsertedNodeStyle = ex
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
10
10
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
|
-
var _isExtendedEnabled = require("../../isExtendedEnabled");
|
|
12
11
|
var _factory = require("../colorSchemes/factory");
|
|
13
12
|
var _schemes = require("../colorSchemes/schemes");
|
|
14
13
|
var _wrapBlockNodeViewStyles = require("./wrapBlockNodeViewStyles.legacy");
|
|
@@ -47,10 +46,9 @@ var isTextLikeBlockNode = exports.isTextLikeBlockNode = function isTextLikeBlock
|
|
|
47
46
|
var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme) {
|
|
48
47
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
49
48
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
50
|
-
var
|
|
51
|
-
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
49
|
+
var hideAddedDiffsUnderline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
52
50
|
var colors = getColorScheme(colorScheme);
|
|
53
|
-
if (
|
|
51
|
+
if (isInserted) {
|
|
54
52
|
return (0, _factory.buildInsertedInlineStyle)(colors, isActive, hideAddedDiffsUnderline);
|
|
55
53
|
}
|
|
56
54
|
var base = (0, _factory.buildDeletedInlineContentStyle)(colors, isActive ? 'active' : 'new');
|
|
@@ -58,7 +56,7 @@ var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme
|
|
|
58
56
|
// Text-like blocks (heading, lists, blockquote) render their deleted content through this
|
|
59
57
|
// getter rather than `getDeletedContentStyle`, so without this they never receive the
|
|
60
58
|
// glyphTint background + underline that plain deleted text already gets.
|
|
61
|
-
if ((0, _fg.fg)('confluence_ncs_step_diffing_version_history') && colors.deletedInlineTreatment === 'glyphTint'
|
|
59
|
+
if ((0, _fg.fg)('confluence_ncs_step_diffing_version_history') && colors.deletedInlineTreatment === 'glyphTint') {
|
|
62
60
|
return base + (0, _factory.buildDeletedInlineContentStyleExtended)(colors, isActive);
|
|
63
61
|
}
|
|
64
62
|
return base;
|
|
@@ -66,10 +64,9 @@ var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme
|
|
|
66
64
|
var getChangedNodeStyleNext = function getChangedNodeStyleNext(nodeName, colorScheme) {
|
|
67
65
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
68
66
|
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
69
|
-
var
|
|
70
|
-
var hideAddedDiffsUnderline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
67
|
+
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
71
68
|
var colors = getColorScheme(colorScheme);
|
|
72
|
-
if (
|
|
69
|
+
if (isInserted) {
|
|
73
70
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
74
71
|
return hideAddedDiffsUnderline || (0, _fg.fg)('platform_editor_ai_show_diff_patch_1') ? (0, _factory.buildInsertStyleInBlockExtendedNoUnderline)(nestedContentScheme) : (0, _factory.buildInsertStyleInBlockExtended)(nestedContentScheme);
|
|
75
72
|
}
|
|
@@ -108,13 +105,12 @@ var getInsertedContentStyleNext = function getInsertedContentStyleNext(colorSche
|
|
|
108
105
|
};
|
|
109
106
|
var getDeletedContentStyleNext = function getDeletedContentStyleNext(colorScheme) {
|
|
110
107
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
111
|
-
var
|
|
112
|
-
var omitHighlight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
108
|
+
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
113
109
|
var colors = getColorScheme(colorScheme);
|
|
114
110
|
var base = (0, _factory.buildDeletedInlineContentStyle)(colors, isActive ? 'active' : 'new');
|
|
115
111
|
|
|
116
112
|
// glyphTint adds a background highlight and border-bottom over the tint; strikethrough does not.
|
|
117
|
-
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint' &&
|
|
113
|
+
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint' && !omitHighlight;
|
|
118
114
|
return needsExtendedHighlight ? base + (0, _factory.buildDeletedInlineContentStyleExtended)(colors, isActive) : base;
|
|
119
115
|
};
|
|
120
116
|
var resolveCellOverlayStyleNext = function resolveCellOverlayStyleNext(_ref) {
|
|
@@ -145,18 +141,16 @@ var hasRestingDeletedRingNext = function hasRestingDeletedRingNext(colorScheme)
|
|
|
145
141
|
var getChangedContentStyle = exports.getChangedContentStyle = function getChangedContentStyle(colorScheme) {
|
|
146
142
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
147
143
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getChangedContentStyleNext(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline) : (0, _wrapBlockNodeViewStyles.getChangedContentStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme), isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
144
|
+
var hideAddedDiffsUnderline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
145
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getChangedContentStyleNext(colorScheme, isActive, isInserted, hideAddedDiffsUnderline) : (0, _wrapBlockNodeViewStyles.getChangedContentStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme), isActive, isInserted, hideAddedDiffsUnderline);
|
|
151
146
|
};
|
|
152
147
|
|
|
153
148
|
/** Node-specific style for a changed block node, or `undefined` when the node type has none. */
|
|
154
149
|
var getChangedNodeStyle = exports.getChangedNodeStyle = function getChangedNodeStyle(nodeName, colorScheme) {
|
|
155
150
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
156
151
|
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getChangedNodeStyleNext(nodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) : (0, _wrapBlockNodeViewStyles.getChangedNodeStyleLegacy)(nodeName, (0, _schemes.getLegacyColorScheme)(colorScheme), isInserted, isActive, diffType, hideAddedDiffsUnderline);
|
|
152
|
+
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
153
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getChangedNodeStyleNext(nodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) : (0, _wrapBlockNodeViewStyles.getChangedNodeStyleLegacy)(nodeName, (0, _schemes.getLegacyColorScheme)(colorScheme), isInserted, isActive, hideAddedDiffsUnderline);
|
|
160
154
|
};
|
|
161
155
|
|
|
162
156
|
/** The positioned line drawn across deleted content spanning an unbounded range. */
|
|
@@ -175,9 +169,8 @@ var getInsertedContentStyle = exports.getInsertedContentStyle = function getInse
|
|
|
175
169
|
/** Inline style for deleted content. */
|
|
176
170
|
var getDeletedContentStyle = exports.getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
177
171
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, diffType, omitHighlight) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme), isActive, diffType, omitHighlight);
|
|
172
|
+
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
173
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, omitHighlight) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme), isActive, omitHighlight);
|
|
181
174
|
};
|
|
182
175
|
|
|
183
176
|
/**
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.resolveRemovedLozengeStyleLegacy = exports.resolveNestedInsertedNodeStyleLegacy = exports.resolveCellOverlayStyleLegacy = exports.hasRestingDeletedRingLegacy = exports.getInsertedContentStyleLegacy = exports.getDeletedContentStyleUnboundedLegacy = exports.getDeletedContentStyleLegacy = exports.getChangedNodeStyleLegacy = exports.getChangedContentStyleLegacy = void 0;
|
|
7
7
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
8
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
9
|
-
var _isExtendedEnabled = require("../../isExtendedEnabled");
|
|
10
9
|
var _standard = require("../colorSchemes/standard");
|
|
11
10
|
var _traditional = require("../colorSchemes/traditional");
|
|
12
11
|
/**
|
|
@@ -86,9 +85,8 @@ var isTextLikeBlockNode = function isTextLikeBlockNode(nodeName) {
|
|
|
86
85
|
var getChangedContentStyleLegacy = exports.getChangedContentStyleLegacy = function getChangedContentStyleLegacy(colorScheme) {
|
|
87
86
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
88
87
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted) {
|
|
88
|
+
var hideAddedDiffsUnderline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
89
|
+
if (isInserted) {
|
|
92
90
|
if (colorScheme === 'traditional') {
|
|
93
91
|
return isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
94
92
|
}
|
|
@@ -107,10 +105,9 @@ var getChangedContentStyleLegacy = exports.getChangedContentStyleLegacy = functi
|
|
|
107
105
|
var getChangedNodeStyleLegacy = exports.getChangedNodeStyleLegacy = function getChangedNodeStyleLegacy(nodeName, colorScheme) {
|
|
108
106
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
109
107
|
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
110
|
-
var
|
|
111
|
-
var hideAddedDiffsUnderline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
108
|
+
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
112
109
|
var isTraditional = colorScheme === 'traditional';
|
|
113
|
-
if (
|
|
110
|
+
if (isInserted) {
|
|
114
111
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
115
112
|
return hideAddedDiffsUnderline || (0, _fg.fg)('platform_editor_ai_show_diff_patch_1') ? _standard.editingContentStyleInBlockExtendedNoUnderline : _standard.editingContentStyleInBlockExtended;
|
|
116
113
|
}
|
|
@@ -170,12 +167,11 @@ var getInsertedContentStyleLegacy = exports.getInsertedContentStyleLegacy = func
|
|
|
170
167
|
/** Pre-refactor inline style for deleted content. */
|
|
171
168
|
var getDeletedContentStyleLegacy = exports.getDeletedContentStyleLegacy = function getDeletedContentStyleLegacy(colorScheme) {
|
|
172
169
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
173
|
-
var
|
|
174
|
-
var omitHighlight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
170
|
+
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
175
171
|
if (colorScheme === 'traditional') {
|
|
176
172
|
return (0, _traditional.getDeletedTraditionalInlineStyle)(isActive);
|
|
177
173
|
}
|
|
178
|
-
if (
|
|
174
|
+
if (!omitHighlight) {
|
|
179
175
|
return (isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyleNew)()) + _standard.deletedInlineContentStyleExtended;
|
|
180
176
|
}
|
|
181
177
|
return isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDefaultDiffType = void 0;
|
|
7
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
|
+
var getDefaultDiffType = exports.getDefaultDiffType = function getDefaultDiffType() {
|
|
9
|
+
return (0, _fg.fg)('platform_editor_ai_smart_diff') ? 'smart' : 'inline';
|
|
10
|
+
};
|