@atlaskit/editor-plugin-show-diff 10.4.9 → 10.5.1
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 +67 -0
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +14 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/traditional.js +14 -1
- package/dist/cjs/pm-plugins/decorations/createAnchorDecorationWidgets.js +52 -18
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +6 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +13 -0
- package/dist/es2019/pm-plugins/decorations/colorSchemes/traditional.js +13 -0
- package/dist/es2019/pm-plugins/decorations/createAnchorDecorationWidgets.js +60 -28
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +8 -3
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +13 -0
- package/dist/esm/pm-plugins/decorations/colorSchemes/traditional.js +13 -0
- package/dist/esm/pm-plugins/decorations/createAnchorDecorationWidgets.js +51 -18
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +8 -3
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +1 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/traditional.d.ts +1 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,72 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 10.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ded72f3ee293f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ded72f3ee293f) -
|
|
8
|
+
Fix table diff cell overlays to use rounded corners for delete row diffs when
|
|
9
|
+
platform_editor_table_diff_rounded_corners is enabled
|
|
10
|
+
- [`11b7096b9b80c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/11b7096b9b80c) -
|
|
11
|
+
CCI-17981: Fix diff indicator misalignment on page resize by observing measured DOM elements for
|
|
12
|
+
size changes
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 10.5.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`2cfc0f295c39a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2cfc0f295c39a) -
|
|
20
|
+
[ux] FG cleanup - Removes `confluence_frontend_content_wrapper` from platform (treated as
|
|
21
|
+
permanently launched / implicitly true).
|
|
22
|
+
|
|
23
|
+
## Breaking change
|
|
24
|
+
|
|
25
|
+
The `confluence_frontend_content_wrapper` gate previously guarded a scroll-gutter tweak in
|
|
26
|
+
`basePluginOptions` that only read the `base` builder's `__livePage` field. With the gate
|
|
27
|
+
launched, that field is no longer read, so the now-dead `base` option was removed rather than left
|
|
28
|
+
as vestigial API.
|
|
29
|
+
|
|
30
|
+
For `@atlaskit/editor-presets` (published):
|
|
31
|
+
- The `base` option was removed from the public preset plugin options type
|
|
32
|
+
(`AllPublicPluginOptions.base` is now `never`).
|
|
33
|
+
- `basePluginOptions()` no longer takes an argument (was `basePluginOptions({ options })`).
|
|
34
|
+
|
|
35
|
+
This is a **type-level** breaking change only. At runtime it is a no-op: the `base` option (and
|
|
36
|
+
the `__livePage` value passed through it) was already unused once the gate was on, so removing it
|
|
37
|
+
does not change editor behaviour. It is scored `major` for `@atlaskit/editor-presets` because that
|
|
38
|
+
package is published and the type contract change will break the builds of external TypeScript
|
|
39
|
+
consumers that still pass `base`. `@atlassian/confluence-presets` is `private` (not published) and
|
|
40
|
+
receives the same code change, so it is scored `minor`.
|
|
41
|
+
|
|
42
|
+
## Migration
|
|
43
|
+
|
|
44
|
+
Stop passing the `base` option to the preset, and call `basePluginOptions()` with no arguments:
|
|
45
|
+
|
|
46
|
+
```diff
|
|
47
|
+
fullPagePreset({
|
|
48
|
+
intl,
|
|
49
|
+
pluginOptions: {
|
|
50
|
+
- base: { __livePage },
|
|
51
|
+
// ...other plugin options unchanged
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```diff
|
|
57
|
+
- basePluginOptions({ options: { __livePage } });
|
|
58
|
+
+ basePluginOptions();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Note: `__livePage` itself is not removed — it remains a valid, live field on the other plugin
|
|
62
|
+
option builders (e.g. `selection`, `selectionMarker`, `collabEdit`, `card`). Only the unused
|
|
63
|
+
`base.__livePage` passthrough is gone. All in-repo consumers have been migrated as part of this
|
|
64
|
+
PR.
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies
|
|
69
|
+
|
|
3
70
|
## 10.4.9
|
|
4
71
|
|
|
5
72
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtendedNoUnderline = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtended = exports.editingStyleActive = exports.editingStyle = exports.editingContentStyleInBlockExtendedNoUnderline = exports.editingContentStyleInBlockExtended = exports.editingContentStyleInBlock = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedInlineContentStyleExtended = exports.deletedDecorationMarkerVariable = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
|
|
6
|
+
exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtendedNoUnderline = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtended = exports.editingStyleActive = exports.editingStyle = exports.editingContentStyleInBlockExtendedNoUnderline = exports.editingContentStyleInBlockExtended = exports.editingContentStyleInBlock = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedInlineContentStyleExtended = exports.deletedDecorationMarkerVariable = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedCellOverlayRoundedStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
|
|
7
7
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
8
|
// delete on platform_editor_diff_plugin_extended cleanup
|
|
9
9
|
var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
@@ -186,4 +186,17 @@ var deletedCellOverlayStyle = exports.deletedCellOverlayStyle = (0, _lazyNodeVie
|
|
|
186
186
|
zIndex: 1,
|
|
187
187
|
outline: "1px solid ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
188
188
|
pointerEvents: 'none'
|
|
189
|
+
});
|
|
190
|
+
var deletedCellOverlayRoundedStyle = exports.deletedCellOverlayRoundedStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
191
|
+
position: 'absolute',
|
|
192
|
+
top: 0,
|
|
193
|
+
left: 0,
|
|
194
|
+
width: '100%',
|
|
195
|
+
height: '100%',
|
|
196
|
+
backgroundColor: "rgba(from ".concat("var(--ds-background-accent-gray-subtlest, #F0F1F2)", " r g b / 0.5)"),
|
|
197
|
+
zIndex: 2,
|
|
198
|
+
outline: "1px solid ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
199
|
+
pointerEvents: 'none',
|
|
200
|
+
border: 'inherit',
|
|
201
|
+
borderRadius: 'inherit'
|
|
189
202
|
});
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.deletedTraditionalStyleQuoteNodeActive = exports.deletedTraditionalStyleQuoteNode = exports.deletedTraditionalRowStyle = exports.deletedTraditionalContentStyleUnboundedActive = exports.deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalCellOverlayStyle = exports.deletedTraditionalBlockOutlineRoundedNew = exports.deletedTraditionalBlockOutlineRoundedActive = exports.deletedTraditionalBlockOutlineRounded = exports.deletedTraditionalBlockOutlineNew = exports.deletedTraditionalBlockOutlineActive = exports.deletedTraditionalBlockOutline = void 0;
|
|
7
|
+
exports.deletedTraditionalStyleQuoteNodeActive = exports.deletedTraditionalStyleQuoteNode = exports.deletedTraditionalRowStyle = exports.deletedTraditionalContentStyleUnboundedActive = exports.deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalCellOverlayStyle = exports.deletedTraditionalCellOverlayRoundedStyle = exports.deletedTraditionalBlockOutlineRoundedNew = exports.deletedTraditionalBlockOutlineRoundedActive = exports.deletedTraditionalBlockOutlineRounded = exports.deletedTraditionalBlockOutlineNew = exports.deletedTraditionalBlockOutlineActive = exports.deletedTraditionalBlockOutline = void 0;
|
|
8
8
|
exports.getDeletedTraditionalInlineStyle = getDeletedTraditionalInlineStyle;
|
|
9
9
|
exports.traditionalStyleRuleNodeNew = exports.traditionalStyleRuleNodeActive = exports.traditionalStyleRuleNode = exports.traditionalStyleQuoteNodeNew = exports.traditionalStyleQuoteNodeActive = exports.traditionalStyleQuoteNode = exports.traditionalStyleNodeNew = exports.traditionalStyleNodeActive = exports.traditionalStyleNode = exports.traditionalStyleCardBlockNodeNew = exports.traditionalStyleCardBlockNodeActive = exports.traditionalStyleCardBlockNode = exports.traditionalInsertStyleActive = exports.traditionalInsertStyle = exports.traditionalDeletedDecorationMarkerVariableNew = exports.traditionalDeletedDecorationMarkerVariableActive = exports.traditionalDeletedDecorationMarkerVariable = exports.traditionalDecorationMarkerVariableNew = exports.traditionalDecorationMarkerVariableActive = exports.traditionalDecorationMarkerVariable = exports.traditionalAddedCellOverlayStyleNew = exports.traditionalAddedCellOverlayStyle = void 0;
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -214,4 +214,17 @@ var deletedTraditionalCellOverlayStyle = exports.deletedTraditionalCellOverlaySt
|
|
|
214
214
|
zIndex: 1,
|
|
215
215
|
outline: "1px solid ".concat("var(--ds-border-disabled, #0515240F)"),
|
|
216
216
|
pointerEvents: 'none'
|
|
217
|
+
});
|
|
218
|
+
var deletedTraditionalCellOverlayRoundedStyle = exports.deletedTraditionalCellOverlayRoundedStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
219
|
+
position: 'absolute',
|
|
220
|
+
top: 0,
|
|
221
|
+
left: 0,
|
|
222
|
+
width: '100%',
|
|
223
|
+
height: '100%',
|
|
224
|
+
backgroundColor: "rgba(from ".concat("var(--ds-background-accent-gray-subtlest, #F0F1F2)", " r g b / 0.5)"),
|
|
225
|
+
zIndex: 2,
|
|
226
|
+
outline: "1px solid ".concat("var(--ds-border-disabled, #0515240F)"),
|
|
227
|
+
pointerEvents: 'none',
|
|
228
|
+
border: 'inherit',
|
|
229
|
+
borderRadius: 'inherit'
|
|
217
230
|
});
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.createLeftAnchorWidget = exports.createInlineIndicatorAnchorWidgets = exports.createDocMarginAnchorWidget = exports.createBlockIndicatorAnchorWidgets = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
9
11
|
var _decorationKeys = require("./decorationKeys");
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
14
|
/**
|
|
11
15
|
* Resolves the doc-level block node (table/expand/layout) for `from`, along with
|
|
12
16
|
* the position right before it (`beforePos`). Falls back to `$from.nodeAfter`
|
|
@@ -138,6 +142,7 @@ var createLeftAnchorWidget = exports.createLeftAnchorWidget = function createLef
|
|
|
138
142
|
diffId: diffId,
|
|
139
143
|
anchorType: _decorationKeys.AnchorTypeKey.left
|
|
140
144
|
});
|
|
145
|
+
var leftResizeObserver;
|
|
141
146
|
return _view.Decoration.widget(beforePos, function (view, getPos) {
|
|
142
147
|
// Outer span stays in the flow but takes up no space.
|
|
143
148
|
var wrapper = document.createElement('div');
|
|
@@ -152,13 +157,7 @@ var createLeftAnchorWidget = exports.createLeftAnchorWidget = function createLef
|
|
|
152
157
|
anchor.style.setProperty('left', "calc(50% - ".concat((edgeCase === null || edgeCase === void 0 ? void 0 : edgeCase.leftOffset) || 0, "px)"));
|
|
153
158
|
anchor.style.setProperty('transform', 'translateX(-50%)');
|
|
154
159
|
wrapper.appendChild(anchor);
|
|
155
|
-
|
|
156
|
-
// The block DOM may not be settled synchronously (e.g. after a
|
|
157
|
-
// transaction), so defer the measurement like the gap cursor does.
|
|
158
|
-
requestAnimationFrame(function () {
|
|
159
|
-
// The widget may have been unmounted; bail if its position is gone.
|
|
160
|
-
// We still measure the stable block node position, not the widget's
|
|
161
|
-
// own position.
|
|
160
|
+
var measureWidth = function measureWidth() {
|
|
162
161
|
if (getPos() === undefined || edgeCase.measurePos === undefined) {
|
|
163
162
|
return;
|
|
164
163
|
}
|
|
@@ -167,13 +166,33 @@ var createLeftAnchorWidget = exports.createLeftAnchorWidget = function createLef
|
|
|
167
166
|
// The left anchor only needs the container width so the
|
|
168
167
|
// IndicatorBar can align against the block's horizontal extent.
|
|
169
168
|
anchor.style.setProperty('width', "".concat(dom.offsetWidth, "px"));
|
|
169
|
+
|
|
170
|
+
// Observe the measured element for size changes (e.g. page
|
|
171
|
+
// resize) so the indicator stays aligned. CCI-17981
|
|
172
|
+
if (!leftResizeObserver) {
|
|
173
|
+
leftResizeObserver = new ResizeObserver(function () {
|
|
174
|
+
if (getPos() !== undefined) {
|
|
175
|
+
anchor.style.setProperty('width', "".concat(dom.offsetWidth, "px"));
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
leftResizeObserver.observe(dom);
|
|
179
|
+
}
|
|
170
180
|
}
|
|
171
|
-
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// The block DOM may not be settled synchronously (e.g. after a
|
|
184
|
+
// transaction), so defer the measurement like the gap cursor does.
|
|
185
|
+
requestAnimationFrame(measureWidth);
|
|
172
186
|
return wrapper;
|
|
173
|
-
}, (0, _decorationKeys.buildAnchorDecorationSpec)({
|
|
187
|
+
}, _objectSpread(_objectSpread({}, (0, _decorationKeys.buildAnchorDecorationSpec)({
|
|
174
188
|
diffId: diffId,
|
|
175
189
|
anchorType: _decorationKeys.AnchorTypeKey.left,
|
|
176
190
|
side: -999
|
|
191
|
+
})), {}, {
|
|
192
|
+
destroy: function destroy() {
|
|
193
|
+
var _leftResizeObserver;
|
|
194
|
+
return (_leftResizeObserver = leftResizeObserver) === null || _leftResizeObserver === void 0 ? void 0 : _leftResizeObserver.disconnect();
|
|
195
|
+
}
|
|
177
196
|
}));
|
|
178
197
|
};
|
|
179
198
|
|
|
@@ -234,6 +253,7 @@ var createBlockIndicatorAnchorWidgets = exports.createBlockIndicatorAnchorWidget
|
|
|
234
253
|
// Measure the actual cell/row DOM when inside one; otherwise measure the
|
|
235
254
|
// widget's own position.
|
|
236
255
|
var measurePos = parentCellOrRow ? parentCellOrRow.pos : from;
|
|
256
|
+
var blockResizeObserver;
|
|
237
257
|
var blockWidget = _view.Decoration.widget(widgetPos, function (view, getPos) {
|
|
238
258
|
// Outer span stays in the flow but takes up no space.
|
|
239
259
|
var wrapper = document.createElement('span');
|
|
@@ -245,13 +265,7 @@ var createBlockIndicatorAnchorWidgets = exports.createBlockIndicatorAnchorWidget
|
|
|
245
265
|
anchor.style.setProperty('position', 'absolute');
|
|
246
266
|
anchor.style.setProperty('anchor-name', "--".concat(blockAnchorKey));
|
|
247
267
|
wrapper.appendChild(anchor);
|
|
248
|
-
|
|
249
|
-
// The block DOM may not be settled synchronously (e.g. after a
|
|
250
|
-
// transaction), so defer the measurement like the gap cursor does.
|
|
251
|
-
requestAnimationFrame(function () {
|
|
252
|
-
// The widget may have been unmounted; bail if its position is gone.
|
|
253
|
-
// We still measure the stable cell/row node position, not the
|
|
254
|
-
// widget's own position.
|
|
268
|
+
var _measureBlock = function measureBlock() {
|
|
255
269
|
if (getPos() === undefined) {
|
|
256
270
|
return;
|
|
257
271
|
}
|
|
@@ -270,15 +284,35 @@ var createBlockIndicatorAnchorWidgets = exports.createBlockIndicatorAnchorWidget
|
|
|
270
284
|
// The offset already accounts for the cell/row's position, so the
|
|
271
285
|
// margin-top must not be double-applied.
|
|
272
286
|
anchor.style.setProperty('margin-top', '0px');
|
|
287
|
+
|
|
288
|
+
// Observe the measured element for size changes (e.g. page
|
|
289
|
+
// resize) so the indicator stays aligned. CCI-17981
|
|
290
|
+
if (!blockResizeObserver) {
|
|
291
|
+
blockResizeObserver = new ResizeObserver(function () {
|
|
292
|
+
if (getPos() !== undefined) {
|
|
293
|
+
_measureBlock();
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
blockResizeObserver.observe(dom);
|
|
297
|
+
}
|
|
273
298
|
}
|
|
274
|
-
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// The block DOM may not be settled synchronously (e.g. after a
|
|
302
|
+
// transaction), so defer the measurement like the gap cursor does.
|
|
303
|
+
requestAnimationFrame(_measureBlock);
|
|
275
304
|
return wrapper;
|
|
276
|
-
}, (0, _decorationKeys.buildAnchorDecorationSpec)({
|
|
305
|
+
}, _objectSpread(_objectSpread({}, (0, _decorationKeys.buildAnchorDecorationSpec)({
|
|
277
306
|
diffId: diffId,
|
|
278
307
|
// Reuse the `from` anchor type slot; the generated key intentionally
|
|
279
308
|
// omits the anchor type so the single element backs top/bottom/left.
|
|
280
309
|
anchorType: _decorationKeys.AnchorTypeKey.from,
|
|
281
310
|
side: -1
|
|
311
|
+
})), {}, {
|
|
312
|
+
destroy: function destroy() {
|
|
313
|
+
var _blockResizeObserver;
|
|
314
|
+
return (_blockResizeObserver = blockResizeObserver) === null || _blockResizeObserver === void 0 ? void 0 : _blockResizeObserver.disconnect();
|
|
315
|
+
}
|
|
282
316
|
}));
|
|
283
317
|
return [blockWidget].concat(maybeLeftAnchor);
|
|
284
318
|
};
|
|
@@ -8,6 +8,7 @@ exports.createBlockChangedDecoration = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
12
|
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
12
13
|
var _standard = require("./colorSchemes/standard");
|
|
13
14
|
var _traditional = require("./colorSchemes/traditional");
|
|
@@ -155,7 +156,11 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
|
|
|
155
156
|
var style;
|
|
156
157
|
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) && ['tableCell', 'tableHeader'].includes(change.name)) {
|
|
157
158
|
var cellOverlay = document.createElement('div');
|
|
158
|
-
var
|
|
159
|
+
var isTraditional = colorScheme === 'traditional';
|
|
160
|
+
var isRoundedTable = (0, _expValEquals.expValEquals)('platform_editor_table_diff_rounded_corners', 'isEnabled', true);
|
|
161
|
+
var addedCellStyle = isTraditional ? _traditional.traditionalAddedCellOverlayStyle : _standard.addedCellOverlayStyle;
|
|
162
|
+
var deletedCellStyle = isTraditional ? isRoundedTable ? _traditional.deletedTraditionalCellOverlayRoundedStyle : _traditional.deletedTraditionalCellOverlayStyle : isRoundedTable ? _standard.deletedCellOverlayRoundedStyle : _standard.deletedCellOverlayStyle;
|
|
163
|
+
var cellOverlayStyle = isInserted ? addedCellStyle : deletedCellStyle;
|
|
159
164
|
cellOverlay.setAttribute('style', cellOverlayStyle);
|
|
160
165
|
decorations.push(
|
|
161
166
|
// change.to - 1 to position the overlay inside the end of the cell
|
|
@@ -180,4 +180,17 @@ export const deletedCellOverlayStyle = convertToInlineCss({
|
|
|
180
180
|
zIndex: 1,
|
|
181
181
|
outline: `1px solid ${"var(--ds-border-accent-gray, #7D818A)"}`,
|
|
182
182
|
pointerEvents: 'none'
|
|
183
|
+
});
|
|
184
|
+
export const deletedCellOverlayRoundedStyle = convertToInlineCss({
|
|
185
|
+
position: 'absolute',
|
|
186
|
+
top: 0,
|
|
187
|
+
left: 0,
|
|
188
|
+
width: '100%',
|
|
189
|
+
height: '100%',
|
|
190
|
+
backgroundColor: `rgba(from ${"var(--ds-background-accent-gray-subtlest, #F0F1F2)"} r g b / 0.5)`,
|
|
191
|
+
zIndex: 2,
|
|
192
|
+
outline: `1px solid ${"var(--ds-border-accent-gray, #7D818A)"}`,
|
|
193
|
+
pointerEvents: 'none',
|
|
194
|
+
border: 'inherit',
|
|
195
|
+
borderRadius: 'inherit'
|
|
183
196
|
});
|
|
@@ -206,4 +206,17 @@ export const deletedTraditionalCellOverlayStyle = convertToInlineCss({
|
|
|
206
206
|
zIndex: 1,
|
|
207
207
|
outline: `1px solid ${"var(--ds-border-disabled, #0515240F)"}`,
|
|
208
208
|
pointerEvents: 'none'
|
|
209
|
+
});
|
|
210
|
+
export const deletedTraditionalCellOverlayRoundedStyle = convertToInlineCss({
|
|
211
|
+
position: 'absolute',
|
|
212
|
+
top: 0,
|
|
213
|
+
left: 0,
|
|
214
|
+
width: '100%',
|
|
215
|
+
height: '100%',
|
|
216
|
+
backgroundColor: `rgba(from ${"var(--ds-background-accent-gray-subtlest, #F0F1F2)"} r g b / 0.5)`,
|
|
217
|
+
zIndex: 2,
|
|
218
|
+
outline: `1px solid ${"var(--ds-border-disabled, #0515240F)"}`,
|
|
219
|
+
pointerEvents: 'none',
|
|
220
|
+
border: 'inherit',
|
|
221
|
+
borderRadius: 'inherit'
|
|
209
222
|
});
|
|
@@ -136,6 +136,7 @@ export const createLeftAnchorWidget = ({
|
|
|
136
136
|
diffId,
|
|
137
137
|
anchorType: AnchorTypeKey.left
|
|
138
138
|
});
|
|
139
|
+
let leftResizeObserver;
|
|
139
140
|
return Decoration.widget(beforePos, (view, getPos) => {
|
|
140
141
|
// Outer span stays in the flow but takes up no space.
|
|
141
142
|
const wrapper = document.createElement('div');
|
|
@@ -150,13 +151,7 @@ export const createLeftAnchorWidget = ({
|
|
|
150
151
|
anchor.style.setProperty('left', `calc(50% - ${(edgeCase === null || edgeCase === void 0 ? void 0 : edgeCase.leftOffset) || 0}px)`);
|
|
151
152
|
anchor.style.setProperty('transform', 'translateX(-50%)');
|
|
152
153
|
wrapper.appendChild(anchor);
|
|
153
|
-
|
|
154
|
-
// The block DOM may not be settled synchronously (e.g. after a
|
|
155
|
-
// transaction), so defer the measurement like the gap cursor does.
|
|
156
|
-
requestAnimationFrame(() => {
|
|
157
|
-
// The widget may have been unmounted; bail if its position is gone.
|
|
158
|
-
// We still measure the stable block node position, not the widget's
|
|
159
|
-
// own position.
|
|
154
|
+
const measureWidth = () => {
|
|
160
155
|
if (getPos() === undefined || edgeCase.measurePos === undefined) {
|
|
161
156
|
return;
|
|
162
157
|
}
|
|
@@ -165,14 +160,35 @@ export const createLeftAnchorWidget = ({
|
|
|
165
160
|
// The left anchor only needs the container width so the
|
|
166
161
|
// IndicatorBar can align against the block's horizontal extent.
|
|
167
162
|
anchor.style.setProperty('width', `${dom.offsetWidth}px`);
|
|
163
|
+
|
|
164
|
+
// Observe the measured element for size changes (e.g. page
|
|
165
|
+
// resize) so the indicator stays aligned. CCI-17981
|
|
166
|
+
if (!leftResizeObserver) {
|
|
167
|
+
leftResizeObserver = new ResizeObserver(() => {
|
|
168
|
+
if (getPos() !== undefined) {
|
|
169
|
+
anchor.style.setProperty('width', `${dom.offsetWidth}px`);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
leftResizeObserver.observe(dom);
|
|
173
|
+
}
|
|
168
174
|
}
|
|
169
|
-
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// The block DOM may not be settled synchronously (e.g. after a
|
|
178
|
+
// transaction), so defer the measurement like the gap cursor does.
|
|
179
|
+
requestAnimationFrame(measureWidth);
|
|
170
180
|
return wrapper;
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
181
|
+
}, {
|
|
182
|
+
...buildAnchorDecorationSpec({
|
|
183
|
+
diffId,
|
|
184
|
+
anchorType: AnchorTypeKey.left,
|
|
185
|
+
side: -999
|
|
186
|
+
}),
|
|
187
|
+
destroy: () => {
|
|
188
|
+
var _leftResizeObserver;
|
|
189
|
+
return (_leftResizeObserver = leftResizeObserver) === null || _leftResizeObserver === void 0 ? void 0 : _leftResizeObserver.disconnect();
|
|
190
|
+
}
|
|
191
|
+
});
|
|
176
192
|
};
|
|
177
193
|
|
|
178
194
|
/**
|
|
@@ -229,6 +245,7 @@ export const createBlockIndicatorAnchorWidgets = ({
|
|
|
229
245
|
// Measure the actual cell/row DOM when inside one; otherwise measure the
|
|
230
246
|
// widget's own position.
|
|
231
247
|
const measurePos = parentCellOrRow ? parentCellOrRow.pos : from;
|
|
248
|
+
let blockResizeObserver;
|
|
232
249
|
const blockWidget = Decoration.widget(widgetPos, (view, getPos) => {
|
|
233
250
|
// Outer span stays in the flow but takes up no space.
|
|
234
251
|
const wrapper = document.createElement('span');
|
|
@@ -240,13 +257,7 @@ export const createBlockIndicatorAnchorWidgets = ({
|
|
|
240
257
|
anchor.style.setProperty('position', 'absolute');
|
|
241
258
|
anchor.style.setProperty('anchor-name', `--${blockAnchorKey}`);
|
|
242
259
|
wrapper.appendChild(anchor);
|
|
243
|
-
|
|
244
|
-
// The block DOM may not be settled synchronously (e.g. after a
|
|
245
|
-
// transaction), so defer the measurement like the gap cursor does.
|
|
246
|
-
requestAnimationFrame(() => {
|
|
247
|
-
// The widget may have been unmounted; bail if its position is gone.
|
|
248
|
-
// We still measure the stable cell/row node position, not the
|
|
249
|
-
// widget's own position.
|
|
260
|
+
const measureBlock = () => {
|
|
250
261
|
if (getPos() === undefined) {
|
|
251
262
|
return;
|
|
252
263
|
}
|
|
@@ -265,16 +276,37 @@ export const createBlockIndicatorAnchorWidgets = ({
|
|
|
265
276
|
// The offset already accounts for the cell/row's position, so the
|
|
266
277
|
// margin-top must not be double-applied.
|
|
267
278
|
anchor.style.setProperty('margin-top', '0px');
|
|
279
|
+
|
|
280
|
+
// Observe the measured element for size changes (e.g. page
|
|
281
|
+
// resize) so the indicator stays aligned. CCI-17981
|
|
282
|
+
if (!blockResizeObserver) {
|
|
283
|
+
blockResizeObserver = new ResizeObserver(() => {
|
|
284
|
+
if (getPos() !== undefined) {
|
|
285
|
+
measureBlock();
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
blockResizeObserver.observe(dom);
|
|
289
|
+
}
|
|
268
290
|
}
|
|
269
|
-
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// The block DOM may not be settled synchronously (e.g. after a
|
|
294
|
+
// transaction), so defer the measurement like the gap cursor does.
|
|
295
|
+
requestAnimationFrame(measureBlock);
|
|
270
296
|
return wrapper;
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
297
|
+
}, {
|
|
298
|
+
...buildAnchorDecorationSpec({
|
|
299
|
+
diffId,
|
|
300
|
+
// Reuse the `from` anchor type slot; the generated key intentionally
|
|
301
|
+
// omits the anchor type so the single element backs top/bottom/left.
|
|
302
|
+
anchorType: AnchorTypeKey.from,
|
|
303
|
+
side: -1
|
|
304
|
+
}),
|
|
305
|
+
destroy: () => {
|
|
306
|
+
var _blockResizeObserver;
|
|
307
|
+
return (_blockResizeObserver = blockResizeObserver) === null || _blockResizeObserver === void 0 ? void 0 : _blockResizeObserver.disconnect();
|
|
308
|
+
}
|
|
309
|
+
});
|
|
278
310
|
return [blockWidget, ...maybeLeftAnchor];
|
|
279
311
|
};
|
|
280
312
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
import { isExtendedEnabled } from '../isExtendedEnabled';
|
|
4
|
-
import { standardDecorationMarkerVariable, deletedDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, deletedContentStyleNew, deletedStyleQuoteNode, addedCellOverlayStyle, deletedCellOverlayStyle } from './colorSchemes/standard';
|
|
5
|
-
import { traditionalDecorationMarkerVariableActive, traditionalDecorationMarkerVariableNew, traditionalDeletedDecorationMarkerVariableActive, traditionalDeletedDecorationMarkerVariableNew, traditionalStyleQuoteNodeActive, traditionalStyleQuoteNodeNew, traditionalStyleRuleNodeActive, traditionalStyleRuleNodeNew, traditionalStyleCardBlockNodeActive, traditionalStyleCardBlockNodeNew, traditionalStyleNodeActive, traditionalStyleNodeNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, traditionalAddedCellOverlayStyle, deletedTraditionalCellOverlayStyle } from './colorSchemes/traditional';
|
|
5
|
+
import { standardDecorationMarkerVariable, deletedDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, deletedContentStyleNew, deletedStyleQuoteNode, addedCellOverlayStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from './colorSchemes/standard';
|
|
6
|
+
import { traditionalDecorationMarkerVariableActive, traditionalDecorationMarkerVariableNew, traditionalDeletedDecorationMarkerVariableActive, traditionalDeletedDecorationMarkerVariableNew, traditionalStyleQuoteNodeActive, traditionalStyleQuoteNodeNew, traditionalStyleRuleNodeActive, traditionalStyleRuleNodeNew, traditionalStyleCardBlockNodeActive, traditionalStyleCardBlockNodeNew, traditionalStyleNodeActive, traditionalStyleNodeNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, traditionalAddedCellOverlayStyle, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from './colorSchemes/traditional';
|
|
6
7
|
import { createBlockIndicatorAnchorWidgets } from './createAnchorDecorationWidgets';
|
|
7
8
|
import { buildDiffDecorationSpec } from './decorationKeys';
|
|
8
9
|
const displayNoneStyle = convertToInlineCss({
|
|
@@ -143,7 +144,11 @@ export const createBlockChangedDecoration = ({
|
|
|
143
144
|
let style;
|
|
144
145
|
if (isExtendedEnabled(diffType) && ['tableCell', 'tableHeader'].includes(change.name)) {
|
|
145
146
|
const cellOverlay = document.createElement('div');
|
|
146
|
-
const
|
|
147
|
+
const isTraditional = colorScheme === 'traditional';
|
|
148
|
+
const isRoundedTable = expValEquals('platform_editor_table_diff_rounded_corners', 'isEnabled', true);
|
|
149
|
+
const addedCellStyle = isTraditional ? traditionalAddedCellOverlayStyle : addedCellOverlayStyle;
|
|
150
|
+
const deletedCellStyle = isTraditional ? isRoundedTable ? deletedTraditionalCellOverlayRoundedStyle : deletedTraditionalCellOverlayStyle : isRoundedTable ? deletedCellOverlayRoundedStyle : deletedCellOverlayStyle;
|
|
151
|
+
const cellOverlayStyle = isInserted ? addedCellStyle : deletedCellStyle;
|
|
147
152
|
cellOverlay.setAttribute('style', cellOverlayStyle);
|
|
148
153
|
decorations.push(
|
|
149
154
|
// change.to - 1 to position the overlay inside the end of the cell
|
|
@@ -180,4 +180,17 @@ export var deletedCellOverlayStyle = convertToInlineCss({
|
|
|
180
180
|
zIndex: 1,
|
|
181
181
|
outline: "1px solid ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
182
182
|
pointerEvents: 'none'
|
|
183
|
+
});
|
|
184
|
+
export var deletedCellOverlayRoundedStyle = convertToInlineCss({
|
|
185
|
+
position: 'absolute',
|
|
186
|
+
top: 0,
|
|
187
|
+
left: 0,
|
|
188
|
+
width: '100%',
|
|
189
|
+
height: '100%',
|
|
190
|
+
backgroundColor: "rgba(from ".concat("var(--ds-background-accent-gray-subtlest, #F0F1F2)", " r g b / 0.5)"),
|
|
191
|
+
zIndex: 2,
|
|
192
|
+
outline: "1px solid ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
193
|
+
pointerEvents: 'none',
|
|
194
|
+
border: 'inherit',
|
|
195
|
+
borderRadius: 'inherit'
|
|
183
196
|
});
|
|
@@ -205,4 +205,17 @@ export var deletedTraditionalCellOverlayStyle = convertToInlineCss({
|
|
|
205
205
|
zIndex: 1,
|
|
206
206
|
outline: "1px solid ".concat("var(--ds-border-disabled, #0515240F)"),
|
|
207
207
|
pointerEvents: 'none'
|
|
208
|
+
});
|
|
209
|
+
export var deletedTraditionalCellOverlayRoundedStyle = convertToInlineCss({
|
|
210
|
+
position: 'absolute',
|
|
211
|
+
top: 0,
|
|
212
|
+
left: 0,
|
|
213
|
+
width: '100%',
|
|
214
|
+
height: '100%',
|
|
215
|
+
backgroundColor: "rgba(from ".concat("var(--ds-background-accent-gray-subtlest, #F0F1F2)", " r g b / 0.5)"),
|
|
216
|
+
zIndex: 2,
|
|
217
|
+
outline: "1px solid ".concat("var(--ds-border-disabled, #0515240F)"),
|
|
218
|
+
pointerEvents: 'none',
|
|
219
|
+
border: 'inherit',
|
|
220
|
+
borderRadius: 'inherit'
|
|
208
221
|
});
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
6
|
import { buildAnchorDecorationKey, buildAnchorDecorationSpec, AnchorDocMarginKey, AnchorTypeKey } from './decorationKeys';
|
|
@@ -133,6 +136,7 @@ export var createLeftAnchorWidget = function createLeftAnchorWidget(_ref) {
|
|
|
133
136
|
diffId: diffId,
|
|
134
137
|
anchorType: AnchorTypeKey.left
|
|
135
138
|
});
|
|
139
|
+
var leftResizeObserver;
|
|
136
140
|
return Decoration.widget(beforePos, function (view, getPos) {
|
|
137
141
|
// Outer span stays in the flow but takes up no space.
|
|
138
142
|
var wrapper = document.createElement('div');
|
|
@@ -147,13 +151,7 @@ export var createLeftAnchorWidget = function createLeftAnchorWidget(_ref) {
|
|
|
147
151
|
anchor.style.setProperty('left', "calc(50% - ".concat((edgeCase === null || edgeCase === void 0 ? void 0 : edgeCase.leftOffset) || 0, "px)"));
|
|
148
152
|
anchor.style.setProperty('transform', 'translateX(-50%)');
|
|
149
153
|
wrapper.appendChild(anchor);
|
|
150
|
-
|
|
151
|
-
// The block DOM may not be settled synchronously (e.g. after a
|
|
152
|
-
// transaction), so defer the measurement like the gap cursor does.
|
|
153
|
-
requestAnimationFrame(function () {
|
|
154
|
-
// The widget may have been unmounted; bail if its position is gone.
|
|
155
|
-
// We still measure the stable block node position, not the widget's
|
|
156
|
-
// own position.
|
|
154
|
+
var measureWidth = function measureWidth() {
|
|
157
155
|
if (getPos() === undefined || edgeCase.measurePos === undefined) {
|
|
158
156
|
return;
|
|
159
157
|
}
|
|
@@ -162,13 +160,33 @@ export var createLeftAnchorWidget = function createLeftAnchorWidget(_ref) {
|
|
|
162
160
|
// The left anchor only needs the container width so the
|
|
163
161
|
// IndicatorBar can align against the block's horizontal extent.
|
|
164
162
|
anchor.style.setProperty('width', "".concat(dom.offsetWidth, "px"));
|
|
163
|
+
|
|
164
|
+
// Observe the measured element for size changes (e.g. page
|
|
165
|
+
// resize) so the indicator stays aligned. CCI-17981
|
|
166
|
+
if (!leftResizeObserver) {
|
|
167
|
+
leftResizeObserver = new ResizeObserver(function () {
|
|
168
|
+
if (getPos() !== undefined) {
|
|
169
|
+
anchor.style.setProperty('width', "".concat(dom.offsetWidth, "px"));
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
leftResizeObserver.observe(dom);
|
|
173
|
+
}
|
|
165
174
|
}
|
|
166
|
-
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// The block DOM may not be settled synchronously (e.g. after a
|
|
178
|
+
// transaction), so defer the measurement like the gap cursor does.
|
|
179
|
+
requestAnimationFrame(measureWidth);
|
|
167
180
|
return wrapper;
|
|
168
|
-
}, buildAnchorDecorationSpec({
|
|
181
|
+
}, _objectSpread(_objectSpread({}, buildAnchorDecorationSpec({
|
|
169
182
|
diffId: diffId,
|
|
170
183
|
anchorType: AnchorTypeKey.left,
|
|
171
184
|
side: -999
|
|
185
|
+
})), {}, {
|
|
186
|
+
destroy: function destroy() {
|
|
187
|
+
var _leftResizeObserver;
|
|
188
|
+
return (_leftResizeObserver = leftResizeObserver) === null || _leftResizeObserver === void 0 ? void 0 : _leftResizeObserver.disconnect();
|
|
189
|
+
}
|
|
172
190
|
}));
|
|
173
191
|
};
|
|
174
192
|
|
|
@@ -229,6 +247,7 @@ export var createBlockIndicatorAnchorWidgets = function createBlockIndicatorAnch
|
|
|
229
247
|
// Measure the actual cell/row DOM when inside one; otherwise measure the
|
|
230
248
|
// widget's own position.
|
|
231
249
|
var measurePos = parentCellOrRow ? parentCellOrRow.pos : from;
|
|
250
|
+
var blockResizeObserver;
|
|
232
251
|
var blockWidget = Decoration.widget(widgetPos, function (view, getPos) {
|
|
233
252
|
// Outer span stays in the flow but takes up no space.
|
|
234
253
|
var wrapper = document.createElement('span');
|
|
@@ -240,13 +259,7 @@ export var createBlockIndicatorAnchorWidgets = function createBlockIndicatorAnch
|
|
|
240
259
|
anchor.style.setProperty('position', 'absolute');
|
|
241
260
|
anchor.style.setProperty('anchor-name', "--".concat(blockAnchorKey));
|
|
242
261
|
wrapper.appendChild(anchor);
|
|
243
|
-
|
|
244
|
-
// The block DOM may not be settled synchronously (e.g. after a
|
|
245
|
-
// transaction), so defer the measurement like the gap cursor does.
|
|
246
|
-
requestAnimationFrame(function () {
|
|
247
|
-
// The widget may have been unmounted; bail if its position is gone.
|
|
248
|
-
// We still measure the stable cell/row node position, not the
|
|
249
|
-
// widget's own position.
|
|
262
|
+
var _measureBlock = function measureBlock() {
|
|
250
263
|
if (getPos() === undefined) {
|
|
251
264
|
return;
|
|
252
265
|
}
|
|
@@ -265,15 +278,35 @@ export var createBlockIndicatorAnchorWidgets = function createBlockIndicatorAnch
|
|
|
265
278
|
// The offset already accounts for the cell/row's position, so the
|
|
266
279
|
// margin-top must not be double-applied.
|
|
267
280
|
anchor.style.setProperty('margin-top', '0px');
|
|
281
|
+
|
|
282
|
+
// Observe the measured element for size changes (e.g. page
|
|
283
|
+
// resize) so the indicator stays aligned. CCI-17981
|
|
284
|
+
if (!blockResizeObserver) {
|
|
285
|
+
blockResizeObserver = new ResizeObserver(function () {
|
|
286
|
+
if (getPos() !== undefined) {
|
|
287
|
+
_measureBlock();
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
blockResizeObserver.observe(dom);
|
|
291
|
+
}
|
|
268
292
|
}
|
|
269
|
-
}
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// The block DOM may not be settled synchronously (e.g. after a
|
|
296
|
+
// transaction), so defer the measurement like the gap cursor does.
|
|
297
|
+
requestAnimationFrame(_measureBlock);
|
|
270
298
|
return wrapper;
|
|
271
|
-
}, buildAnchorDecorationSpec({
|
|
299
|
+
}, _objectSpread(_objectSpread({}, buildAnchorDecorationSpec({
|
|
272
300
|
diffId: diffId,
|
|
273
301
|
// Reuse the `from` anchor type slot; the generated key intentionally
|
|
274
302
|
// omits the anchor type so the single element backs top/bottom/left.
|
|
275
303
|
anchorType: AnchorTypeKey.from,
|
|
276
304
|
side: -1
|
|
305
|
+
})), {}, {
|
|
306
|
+
destroy: function destroy() {
|
|
307
|
+
var _blockResizeObserver;
|
|
308
|
+
return (_blockResizeObserver = blockResizeObserver) === null || _blockResizeObserver === void 0 ? void 0 : _blockResizeObserver.disconnect();
|
|
309
|
+
}
|
|
277
310
|
}));
|
|
278
311
|
return [blockWidget].concat(maybeLeftAnchor);
|
|
279
312
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { isExtendedEnabled } from '../isExtendedEnabled';
|
|
5
|
-
import { standardDecorationMarkerVariable, deletedDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, deletedContentStyleNew, deletedStyleQuoteNode, addedCellOverlayStyle, deletedCellOverlayStyle } from './colorSchemes/standard';
|
|
6
|
-
import { traditionalDecorationMarkerVariableActive, traditionalDecorationMarkerVariableNew, traditionalDeletedDecorationMarkerVariableActive, traditionalDeletedDecorationMarkerVariableNew, traditionalStyleQuoteNodeActive, traditionalStyleQuoteNodeNew, traditionalStyleRuleNodeActive, traditionalStyleRuleNodeNew, traditionalStyleCardBlockNodeActive, traditionalStyleCardBlockNodeNew, traditionalStyleNodeActive, traditionalStyleNodeNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, traditionalAddedCellOverlayStyle, deletedTraditionalCellOverlayStyle } from './colorSchemes/traditional';
|
|
6
|
+
import { standardDecorationMarkerVariable, deletedDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, deletedContentStyleNew, deletedStyleQuoteNode, addedCellOverlayStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from './colorSchemes/standard';
|
|
7
|
+
import { traditionalDecorationMarkerVariableActive, traditionalDecorationMarkerVariableNew, traditionalDeletedDecorationMarkerVariableActive, traditionalDeletedDecorationMarkerVariableNew, traditionalStyleQuoteNodeActive, traditionalStyleQuoteNodeNew, traditionalStyleRuleNodeActive, traditionalStyleRuleNodeNew, traditionalStyleCardBlockNodeActive, traditionalStyleCardBlockNodeNew, traditionalStyleNodeActive, traditionalStyleNodeNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, traditionalAddedCellOverlayStyle, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from './colorSchemes/traditional';
|
|
7
8
|
import { createBlockIndicatorAnchorWidgets } from './createAnchorDecorationWidgets';
|
|
8
9
|
import { buildDiffDecorationSpec } from './decorationKeys';
|
|
9
10
|
var displayNoneStyle = convertToInlineCss({
|
|
@@ -148,7 +149,11 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
|
148
149
|
var style;
|
|
149
150
|
if (isExtendedEnabled(diffType) && ['tableCell', 'tableHeader'].includes(change.name)) {
|
|
150
151
|
var cellOverlay = document.createElement('div');
|
|
151
|
-
var
|
|
152
|
+
var isTraditional = colorScheme === 'traditional';
|
|
153
|
+
var isRoundedTable = expValEquals('platform_editor_table_diff_rounded_corners', 'isEnabled', true);
|
|
154
|
+
var addedCellStyle = isTraditional ? traditionalAddedCellOverlayStyle : addedCellOverlayStyle;
|
|
155
|
+
var deletedCellStyle = isTraditional ? isRoundedTable ? deletedTraditionalCellOverlayRoundedStyle : deletedTraditionalCellOverlayStyle : isRoundedTable ? deletedCellOverlayRoundedStyle : deletedCellOverlayStyle;
|
|
156
|
+
var cellOverlayStyle = isInserted ? addedCellStyle : deletedCellStyle;
|
|
152
157
|
cellOverlay.setAttribute('style', cellOverlayStyle);
|
|
153
158
|
decorations.push(
|
|
154
159
|
// change.to - 1 to position the overlay inside the end of the cell
|
|
@@ -38,3 +38,4 @@ export declare const standardDecorationMarkerVariable: string;
|
|
|
38
38
|
export declare const deletedDecorationMarkerVariable: string;
|
|
39
39
|
export declare const addedCellOverlayStyle: string;
|
|
40
40
|
export declare const deletedCellOverlayStyle: string;
|
|
41
|
+
export declare const deletedCellOverlayRoundedStyle: string;
|
|
@@ -37,3 +37,4 @@ export declare const traditionalDeletedDecorationMarkerVariableActive: string;
|
|
|
37
37
|
export declare const traditionalAddedCellOverlayStyle: string;
|
|
38
38
|
export declare const traditionalAddedCellOverlayStyleNew: string;
|
|
39
39
|
export declare const deletedTraditionalCellOverlayStyle: string;
|
|
40
|
+
export declare const deletedTraditionalCellOverlayRoundedStyle: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.1",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"@atlaskit/editor-plugin-user-intent": "^10.0.0",
|
|
28
28
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
29
29
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
30
|
-
"@atlaskit/platform-feature-flags": "^2.
|
|
31
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
32
|
-
"@atlaskit/tokens": "^16.
|
|
30
|
+
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
31
|
+
"@atlaskit/tmp-editor-statsig": "^131.0.0",
|
|
32
|
+
"@atlaskit/tokens": "^16.2.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
|
-
"@compiled/react": "^0.
|
|
34
|
+
"@compiled/react": "^1.0.0",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
36
36
|
"memoize-one": "^6.0.0",
|
|
37
37
|
"prosemirror-changeset": "^2.3.1"
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@atlaskit/button": "^24.3.0",
|
|
42
42
|
"@atlaskit/css": "^1.0.0",
|
|
43
43
|
"@atlaskit/dropdown-menu": "^17.1.0",
|
|
44
|
-
"@atlaskit/editor-core": "^221.
|
|
44
|
+
"@atlaskit/editor-core": "^221.11.0",
|
|
45
45
|
"@atlaskit/editor-json-transformer": "^9.0.0",
|
|
46
46
|
"@atlaskit/form": "^16.1.0",
|
|
47
|
-
"@atlaskit/primitives": "^22.
|
|
47
|
+
"@atlaskit/primitives": "^22.1.0",
|
|
48
48
|
"@atlaskit/section-message": "^9.2.0",
|
|
49
49
|
"@atlaskit/textarea": "^9.1.0",
|
|
50
50
|
"@atlassian/confluence-presets": "workspace:^",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"react-intl": "^7.0.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@atlaskit/editor-common": "^116.
|
|
57
|
+
"@atlaskit/editor-common": "^116.35.0",
|
|
58
58
|
"react": "^18.2.0"
|
|
59
59
|
},
|
|
60
60
|
"techstack": {
|