@atlaskit/editor-plugin-show-diff 20.0.10 → 21.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 +26 -0
- package/dist/cjs/pm-plugins/NodeViewSerializer.js +71 -7
- package/dist/cjs/pm-plugins/calculateDiff/attrAwareTokenEncoder.js +9 -7
- package/dist/cjs/pm-plugins/createEditorProxy.js +84 -0
- package/dist/cjs/pm-plugins/decorations/createContributorTagWidget.js +25 -6
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +35 -11
- package/dist/cjs/pm-plugins/decorations/utils/excerptIncludeAttrs.js +27 -0
- package/dist/cjs/pm-plugins/decorations/utils/getAttrChangeRanges.js +7 -0
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +38 -2
- package/dist/cjs/pm-plugins/markViews.js +65 -0
- package/dist/es2019/pm-plugins/NodeViewSerializer.js +64 -8
- package/dist/es2019/pm-plugins/calculateDiff/attrAwareTokenEncoder.js +9 -7
- package/dist/es2019/pm-plugins/createEditorProxy.js +76 -0
- package/dist/es2019/pm-plugins/decorations/createContributorTagWidget.js +26 -8
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +35 -12
- package/dist/es2019/pm-plugins/decorations/utils/excerptIncludeAttrs.js +13 -0
- package/dist/es2019/pm-plugins/decorations/utils/getAttrChangeRanges.js +10 -1
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +36 -2
- package/dist/es2019/pm-plugins/markViews.js +61 -0
- package/dist/esm/pm-plugins/NodeViewSerializer.js +71 -7
- package/dist/esm/pm-plugins/calculateDiff/attrAwareTokenEncoder.js +9 -7
- package/dist/esm/pm-plugins/createEditorProxy.js +78 -0
- package/dist/esm/pm-plugins/decorations/createContributorTagWidget.js +27 -8
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +37 -12
- package/dist/esm/pm-plugins/decorations/utils/excerptIncludeAttrs.js +20 -0
- package/dist/esm/pm-plugins/decorations/utils/getAttrChangeRanges.js +7 -0
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +38 -2
- package/dist/esm/pm-plugins/markViews.js +60 -0
- package/dist/types/pm-plugins/NodeViewSerializer.d.ts +7 -2
- package/dist/types/pm-plugins/createEditorProxy.d.ts +18 -0
- package/dist/types/pm-plugins/decorations/createContributorTagWidget.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/utils/excerptIncludeAttrs.d.ts +6 -0
- package/dist/types/pm-plugins/markViews.d.ts +14 -0
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 21.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a302d2ba96967`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a302d2ba96967) -
|
|
8
|
+
Fix contributor tag placement so it no longer overflows onto the next line when a change wraps.
|
|
9
|
+
- [`6563a0ae0eb6f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6563a0ae0eb6f) -
|
|
10
|
+
[EDITOR-9212] Fix AI Suggested Edits diff rendering for a table nested inside an expand. Behind
|
|
11
|
+
`platform_editor_ai_show_diff_patch_2`, the diff preview now keeps the node's `breakout` mark, and
|
|
12
|
+
renders against its own document so node positions are resolved within the preview instead of the
|
|
13
|
+
live document — nested tables are no longer sized as top-level and pushed out of their cell, and a
|
|
14
|
+
preview can no longer write to the live document. The changed-node outline and the "Removed"
|
|
15
|
+
lozenge are both placed at the breakout width rather than the content column. Selecting a
|
|
16
|
+
suggestion that targets a collapsed expand now opens it in both the live document and the diff
|
|
17
|
+
preview, so the change is visible instead of hidden behind a title bar.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 20.0.11
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`d9cd5128c24dc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d9cd5128c24dc) -
|
|
25
|
+
Add gated Include excerpt attribute comparison for platform_editor_normalize_excerpt_diff without
|
|
26
|
+
changing source documents
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 20.0.10
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -8,8 +8,13 @@ exports.NodeViewSerializer = void 0;
|
|
|
8
8
|
exports.isEditorViewWithNodeViews = isEditorViewWithNodeViews;
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _expand = require("@atlaskit/editor-common/expand");
|
|
11
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
14
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
|
+
var _createEditorProxy = require("./createEditorProxy");
|
|
17
|
+
var _markViews = require("./markViews");
|
|
13
18
|
/**
|
|
14
19
|
* Utilities for working with ProseMirror node views and DOM serialization within the
|
|
15
20
|
* Show Diff editor plugin.
|
|
@@ -37,6 +42,16 @@ function isEditorViewWithNodeViews(view) {
|
|
|
37
42
|
return view.nodeViews !== undefined;
|
|
38
43
|
}
|
|
39
44
|
|
|
45
|
+
/** Expand-family nodes whose expanded state lives in a node-keyed WeakMap. */
|
|
46
|
+
var EXPAND_TYPES = new Set(['expand', 'nestedExpand']);
|
|
47
|
+
|
|
48
|
+
/** Tables are the only node views that read and write positions, so only they need a preview. */
|
|
49
|
+
var containsTable = function containsTable(node) {
|
|
50
|
+
var table = node.type.schema.nodes.table;
|
|
51
|
+
// `contains` only checks descendants, so the node itself is checked separately.
|
|
52
|
+
return !!table && (node.type === table || (0, _utils.contains)(node, table));
|
|
53
|
+
};
|
|
54
|
+
|
|
40
55
|
/**
|
|
41
56
|
* Encapsulates DOM serialization and node view access/creation.
|
|
42
57
|
*
|
|
@@ -82,11 +97,18 @@ var NodeViewSerializer = exports.NodeViewSerializer = /*#__PURE__*/function () {
|
|
|
82
97
|
key: "appendChildNodes",
|
|
83
98
|
value: function appendChildNodes(children, contentDOM) {
|
|
84
99
|
var _this = this;
|
|
100
|
+
var basePos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
101
|
+
var editorProxy = arguments.length > 3 ? arguments[3] : undefined;
|
|
102
|
+
// A node's first child sits one position inside it, and each subsequent
|
|
103
|
+
// child is offset by the previous child's `nodeSize`. Tracking this lets nested node
|
|
104
|
+
// views resolve to their real depth instead of every one of them seeing depth 0.
|
|
105
|
+
var childPos = basePos + 1;
|
|
85
106
|
children.forEach(function (child) {
|
|
86
|
-
var childNode = _this.
|
|
107
|
+
var childNode = _this.tryCreateNodeViewInner(child, childPos, editorProxy) || _this.serializeNode(child);
|
|
87
108
|
if (childNode) {
|
|
88
109
|
contentDOM === null || contentDOM === void 0 || contentDOM.append(childNode);
|
|
89
110
|
}
|
|
111
|
+
childPos += child.nodeSize;
|
|
90
112
|
});
|
|
91
113
|
}
|
|
92
114
|
|
|
@@ -95,11 +117,29 @@ var NodeViewSerializer = exports.NodeViewSerializer = /*#__PURE__*/function () {
|
|
|
95
117
|
*
|
|
96
118
|
* Returns `null` when there is no `EditorView`, no constructor for the node type,
|
|
97
119
|
* or the node type is blocklisted. Otherwise returns the constructed node view instance.
|
|
120
|
+
*
|
|
121
|
+
* `$sourcePos` is where the node sits in the doc it came from, so nested tables keep their depth.
|
|
98
122
|
*/
|
|
99
123
|
}, {
|
|
100
124
|
key: "tryCreateNodeView",
|
|
101
125
|
value: function tryCreateNodeView(targetNode) {
|
|
126
|
+
var _preview$rootPos;
|
|
127
|
+
var basePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
128
|
+
var $sourcePos = arguments.length > 2 ? arguments[2] : undefined;
|
|
129
|
+
if (!this.editorView) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
// The preview becomes the document every nested node view resolves its position against,
|
|
133
|
+
// so positions stay internally consistent.
|
|
134
|
+
var preview = (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && containsTable(targetNode) ? (0, _createEditorProxy.createEditorProxy)(this.editorView, targetNode, $sourcePos) : null;
|
|
135
|
+
return this.tryCreateNodeViewInner(targetNode, (_preview$rootPos = preview === null || preview === void 0 ? void 0 : preview.rootPos) !== null && _preview$rootPos !== void 0 ? _preview$rootPos : basePos, preview === null || preview === void 0 ? void 0 : preview.editorProxy);
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
key: "tryCreateNodeViewInner",
|
|
139
|
+
value: function tryCreateNodeViewInner(targetNode) {
|
|
102
140
|
var _this$nodeViews;
|
|
141
|
+
var basePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
142
|
+
var editorProxy = arguments.length > 2 ? arguments[2] : undefined;
|
|
103
143
|
if (!this.editorView) {
|
|
104
144
|
return null;
|
|
105
145
|
}
|
|
@@ -145,23 +185,47 @@ var NodeViewSerializer = exports.NodeViewSerializer = /*#__PURE__*/function () {
|
|
|
145
185
|
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_deleted_nodeview_content') && targetNode.type.name === 'paragraph' && targetNode.children.length === 1) {
|
|
146
186
|
return this.serializeFragment(targetNode.content);
|
|
147
187
|
}
|
|
148
|
-
this.appendChildNodes(targetNode.children, _contentDOM);
|
|
188
|
+
this.appendChildNodes(targetNode.children, _contentDOM, basePos, editorProxy);
|
|
149
189
|
}
|
|
150
|
-
return _dom;
|
|
190
|
+
return this.withMarkViews(targetNode, _dom, editorProxy);
|
|
151
191
|
}
|
|
152
|
-
|
|
153
|
-
|
|
192
|
+
|
|
193
|
+
// The expand node view reads `expandedState.get(node) ?? false`, never `attrs.__expanded`.
|
|
194
|
+
// Open the preview so its tables get real layout; an existing entry is the live expand's
|
|
195
|
+
// own state, so leave it alone.
|
|
196
|
+
if (EXPAND_TYPES.has(targetNode.type.name) && !_expand.expandedState.has(targetNode) && (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) {
|
|
197
|
+
_expand.expandedState.set(targetNode, true);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// `isTableNested` is `doc.resolve(pos).depth > 0`, so the old hardcoded `0` made nested
|
|
201
|
+
// tables size as top-level. Positions are resolved against the preview document, so
|
|
202
|
+
// they are only meaningful with an editor proxy.
|
|
203
|
+
var view = editorProxy !== null && editorProxy !== void 0 ? editorProxy : this.editorView;
|
|
204
|
+
var docSize = view.state.doc.content.size;
|
|
205
|
+
var resolvedPos = editorProxy ? Math.max(0, Math.min(basePos, docSize)) : 0;
|
|
206
|
+
var _constructor = constructor(targetNode, view, function () {
|
|
207
|
+
return resolvedPos;
|
|
154
208
|
}, [], {}),
|
|
155
209
|
dom = _constructor.dom,
|
|
156
210
|
contentDOM = _constructor.contentDOM;
|
|
157
211
|
// Iteratively populate children
|
|
158
|
-
this.appendChildNodes(targetNode.children, contentDOM);
|
|
159
|
-
return dom;
|
|
212
|
+
this.appendChildNodes(targetNode.children, contentDOM, basePos, editorProxy);
|
|
213
|
+
return this.withMarkViews(targetNode, dom, editorProxy);
|
|
160
214
|
} catch (_unused) {
|
|
161
215
|
return null;
|
|
162
216
|
}
|
|
163
217
|
}
|
|
164
218
|
|
|
219
|
+
/** Wraps rendered DOM in its marks, rendered against the editor proxy when there is one. */
|
|
220
|
+
}, {
|
|
221
|
+
key: "withMarkViews",
|
|
222
|
+
value: function withMarkViews(targetNode, nodeDom, editorProxy) {
|
|
223
|
+
return (0, _markViews.wrapInMarkViews)(targetNode, nodeDom, {
|
|
224
|
+
nodeViews: this.nodeViews,
|
|
225
|
+
view: editorProxy !== null && editorProxy !== void 0 ? editorProxy : this.editorView
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
165
229
|
/**
|
|
166
230
|
* Serializes a node to a DOM `Node` using the schema's `DOMSerializer`.
|
|
167
231
|
*/
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.attrAwareTokenEncoder = void 0;
|
|
7
7
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
8
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
9
|
var _diffableAttrs = require("../decorations/utils/diffableAttrs");
|
|
10
|
+
var _excerptIncludeAttrs = require("../decorations/utils/excerptIncludeAttrs");
|
|
9
11
|
var _encodeCharacterWithMarks = require("./encodeCharacterWithMarks");
|
|
10
12
|
/**
|
|
11
13
|
* Attribute-aware token encoder for `prosemirror-changeset`. The default encoder
|
|
@@ -16,14 +18,12 @@ var _encodeCharacterWithMarks = require("./encodeCharacterWithMarks");
|
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
// Stable composite token; attr names are pre-ordered by the caller.
|
|
19
|
-
var encodeNodeWithAttrs = function encodeNodeWithAttrs(
|
|
20
|
-
var _node$attrs;
|
|
21
|
-
var attrs = (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 ? _node$attrs : {};
|
|
21
|
+
var encodeNodeWithAttrs = function encodeNodeWithAttrs(nodeTypeName, attrs, attrNames) {
|
|
22
22
|
var parts = attrNames.map(function (name) {
|
|
23
23
|
var _attrs$name;
|
|
24
24
|
return "".concat(name, "=").concat(JSON.stringify((_attrs$name = attrs[name]) !== null && _attrs$name !== void 0 ? _attrs$name : null));
|
|
25
25
|
});
|
|
26
|
-
return "".concat(
|
|
26
|
+
return "".concat(nodeTypeName, "|").concat(parts.join('|'));
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
// Like the library default, but node types with a `diffableAttrs` rule fold their
|
|
@@ -34,11 +34,13 @@ var attrAwareTokenEncoder = exports.attrAwareTokenEncoder = {
|
|
|
34
34
|
return (0, _encodeCharacterWithMarks.encodeCharacterWithMarks)(char, marks);
|
|
35
35
|
},
|
|
36
36
|
encodeNodeStart: function encodeNodeStart(node) {
|
|
37
|
-
|
|
37
|
+
// A one-sided reference is not comparable from an isolated token. Attribute-step comparison
|
|
38
|
+
// checks the reference when both versions have one.
|
|
39
|
+
var attrs = (0, _fg.fg)('platform_editor_normalize_excerpt_diff') && node.type.name === 'extension' && (0, _excerptIncludeAttrs.isExcerptInclude)(node.attrs) ? (0, _excerptIncludeAttrs.getComparableExcerptIncludeAttrs)(node.attrs) : node.attrs;
|
|
38
40
|
// Normalise variants (e.g. `panel_c1` → `panel`) so `diffableAttrs` needs one entry.
|
|
39
|
-
var attrNames = (0, _diffableAttrs.getDiffableAttrNames)((0, _nodeTypeUtils.getBaseNodeTypeName)(node.type),
|
|
41
|
+
var attrNames = (0, _diffableAttrs.getDiffableAttrNames)((0, _nodeTypeUtils.getBaseNodeTypeName)(node.type), attrs !== null && attrs !== void 0 ? attrs : {});
|
|
40
42
|
if (attrNames && attrNames.length > 0) {
|
|
41
|
-
return encodeNodeWithAttrs(node, attrNames);
|
|
43
|
+
return encodeNodeWithAttrs(node.type.name, attrs, attrNames);
|
|
42
44
|
}
|
|
43
45
|
return node.type.name;
|
|
44
46
|
},
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createEditorProxy = createEditorProxy;
|
|
7
|
+
var _selection = require("@atlaskit/editor-common/selection/gap-cursor/selection");
|
|
8
|
+
/**
|
|
9
|
+
* A preview is rendered by the live view's own node views, which read `getPos()` against
|
|
10
|
+
* `view.state.doc` for both layout (`isTableNested`) and writes (`scaleTable` builds attribute
|
|
11
|
+
* steps at `getPos() + 1`). Handing them live positions makes the layout correct but points the
|
|
12
|
+
* writes at unrelated live nodes, so give them a view whose document *is* the preview instead.
|
|
13
|
+
*
|
|
14
|
+
* With `$sourcePos` (the node's position in the doc it came from) the node is swapped into a copy
|
|
15
|
+
* of its real top-level ancestor, so a table inside an expand still resolves as nested.
|
|
16
|
+
*
|
|
17
|
+
* Returns `null` when the node cannot be a top-level child (e.g. a bare `tableCell`), in which
|
|
18
|
+
* case the caller falls back to the live view and the previous stubbed positions.
|
|
19
|
+
*/
|
|
20
|
+
function createEditorProxy(liveView, rootNode, $sourcePos) {
|
|
21
|
+
var liveState = liveView.state;
|
|
22
|
+
var createDoc = function createDoc(topLevel) {
|
|
23
|
+
return liveState.schema.topNodeType.createChecked(null, topLevel);
|
|
24
|
+
};
|
|
25
|
+
var previewDoc;
|
|
26
|
+
var rootPos = 0;
|
|
27
|
+
try {
|
|
28
|
+
var _$sourcePos$nodeAfter;
|
|
29
|
+
if ($sourcePos && $sourcePos.depth > 0 && ((_$sourcePos$nodeAfter = $sourcePos.nodeAfter) === null || _$sourcePos$nodeAfter === void 0 ? void 0 : _$sourcePos$nodeAfter.type) === rootNode.type) {
|
|
30
|
+
var topLevel = rootNode;
|
|
31
|
+
for (var depth = $sourcePos.depth; depth > 0; depth--) {
|
|
32
|
+
var ancestor = $sourcePos.node(depth);
|
|
33
|
+
topLevel = ancestor.copy(ancestor.content.replaceChild($sourcePos.index(depth), topLevel));
|
|
34
|
+
}
|
|
35
|
+
previewDoc = createDoc(topLevel);
|
|
36
|
+
rootPos = $sourcePos.pos - $sourcePos.before(1);
|
|
37
|
+
} else {
|
|
38
|
+
previewDoc = createDoc(rootNode);
|
|
39
|
+
}
|
|
40
|
+
} catch (_unused) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// A gap cursor just before the node selects nothing, so the table's node view doesn't render
|
|
45
|
+
// as selected or show its controls.
|
|
46
|
+
var previewSelection = new _selection.GapCursorSelection(previewDoc.resolve(rootPos), _selection.Side.LEFT);
|
|
47
|
+
// Proxy rather than `EditorState.create` so plugin state is shared as-is: re-initialising
|
|
48
|
+
// every plugin per preview would be costly and re-runs their side effects.
|
|
49
|
+
var stateProxy = new Proxy(liveState, {
|
|
50
|
+
get: function get(target, prop, receiver) {
|
|
51
|
+
if (prop === 'doc') {
|
|
52
|
+
return previewDoc;
|
|
53
|
+
}
|
|
54
|
+
if (prop === 'selection') {
|
|
55
|
+
return previewSelection;
|
|
56
|
+
}
|
|
57
|
+
return Reflect.get(target, prop, receiver);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var editorProxy = new Proxy(liveView, {
|
|
61
|
+
get: function get(target, prop, receiver) {
|
|
62
|
+
if (prop === 'state') {
|
|
63
|
+
return stateProxy;
|
|
64
|
+
}
|
|
65
|
+
if (prop === 'dispatch') {
|
|
66
|
+
// Keep the transaction inside the preview. It was built against `previewDoc`, so
|
|
67
|
+
// applying it to the live state would corrupt the real document.
|
|
68
|
+
return function (tr) {
|
|
69
|
+
try {
|
|
70
|
+
stateProxy = stateProxy.apply(tr);
|
|
71
|
+
} catch (_unused2) {
|
|
72
|
+
// A preview is throwaway; a failed self-update is not worth surfacing.
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
var value = Reflect.get(target, prop, receiver);
|
|
77
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
editorProxy: editorProxy,
|
|
82
|
+
rootPos: rootPos
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -224,13 +224,14 @@ var resolveHoistedCodeBlockAnchor = exports.resolveHoistedCodeBlockAnchor = func
|
|
|
224
224
|
* highlights — or, with `anchorAtRangeStart`, at `from` itself. A host inside a code block is
|
|
225
225
|
* hoisted in front of it instead, anchored via `resolveHoistedCodeBlockAnchor` (EDITOR-9045).
|
|
226
226
|
*
|
|
227
|
-
* Returns one decoration
|
|
227
|
+
* Returns one decoration when a caller-supplied `anchorName` is used, two (marker + tag)
|
|
228
|
+
* otherwise — hoisted out of a code block, or anchored to its own point marker.
|
|
228
229
|
*
|
|
229
230
|
* The tag is mounted in `toDOM` and taken down in `destroy`, so it lives exactly as long as the host
|
|
230
231
|
* element ProseMirror drew it into — see `mountContributorTag`.
|
|
231
232
|
*/
|
|
232
233
|
var createContributorTagWidget = exports.createContributorTagWidget = function createContributorTagWidget(_ref4) {
|
|
233
|
-
var _hoisted$
|
|
234
|
+
var _hoisted$codeBlockSta, _ref5, _hoisted$anchorName;
|
|
234
235
|
var _ref4$anchorAtRangeSt = _ref4.anchorAtRangeStart,
|
|
235
236
|
anchorAtRangeStart = _ref4$anchorAtRangeSt === void 0 ? false : _ref4$anchorAtRangeSt,
|
|
236
237
|
anchorName = _ref4.anchorName,
|
|
@@ -250,15 +251,33 @@ var createContributorTagWidget = exports.createContributorTagWidget = function c
|
|
|
250
251
|
// A change inside a code block is hoisted out of it, anchored to its own marker; anything else
|
|
251
252
|
// keeps its own anchor.
|
|
252
253
|
var hoisted = resolveHoistedCodeBlockAnchor(doc, anchorPos, diffId);
|
|
253
|
-
|
|
254
|
+
// Keep the host out of the table row's grid (EDITOR-8442).
|
|
255
|
+
var hostPos = (0, _createAnchorDecorationWidgets.clampAnchorPosIntoCell)(doc, (_hoisted$codeBlockSta = hoisted === null || hoisted === void 0 ? void 0 : hoisted.codeBlockStart) !== null && _hoisted$codeBlockSta !== void 0 ? _hoisted$codeBlockSta : anchorPos, 1);
|
|
256
|
+
|
|
257
|
+
// Inline diffs pass no anchorName. Give them their own point anchor instead of the
|
|
258
|
+
// `position: relative` fallback, which drifts left once the range wraps a line (EDITOR-9286).
|
|
259
|
+
var ownAnchorName = (0, _decorationKeys.buildAnchorDecorationKey)({
|
|
260
|
+
diffId: diffId,
|
|
261
|
+
anchorType: _decorationKeys.AnchorTypeKey.tag
|
|
262
|
+
});
|
|
263
|
+
var effectiveAnchorName = (_ref5 = (_hoisted$anchorName = hoisted === null || hoisted === void 0 ? void 0 : hoisted.anchorName) !== null && _hoisted$anchorName !== void 0 ? _hoisted$anchorName : anchorName) !== null && _ref5 !== void 0 ? _ref5 : ownAnchorName;
|
|
254
264
|
var tagAnchorName = effectiveAnchorName && supportsAnchorPositioning() ? effectiveAnchorName : undefined;
|
|
255
265
|
var decorations = [];
|
|
256
266
|
if (hoisted) {
|
|
257
267
|
decorations.push(hoisted.marker);
|
|
268
|
+
} else if (!anchorName && tagAnchorName) {
|
|
269
|
+
decorations.push(_view.Decoration.widget(hostPos, function () {
|
|
270
|
+
return (0, _createAnchorDecorationWidgets.createAnchorNameSpan)(ownAnchorName);
|
|
271
|
+
}, _objectSpread(_objectSpread({}, (0, _decorationKeys.buildAnchorDecorationSpec)({
|
|
272
|
+
diffId: diffId,
|
|
273
|
+
anchorType: _decorationKeys.AnchorTypeKey.tag,
|
|
274
|
+
side: -1
|
|
275
|
+
})), {}, {
|
|
276
|
+
marks: [],
|
|
277
|
+
ignoreSelection: true
|
|
278
|
+
})));
|
|
258
279
|
}
|
|
259
|
-
decorations.push(_view.Decoration.widget(
|
|
260
|
-
// Keep the host out of the table row's grid (EDITOR-8442).
|
|
261
|
-
(0, _createAnchorDecorationWidgets.clampAnchorPosIntoCell)(doc, (_hoisted$codeBlockSta = hoisted === null || hoisted === void 0 ? void 0 : hoisted.codeBlockStart) !== null && _hoisted$codeBlockSta !== void 0 ? _hoisted$codeBlockSta : anchorPos, 1), function () {
|
|
280
|
+
decorations.push(_view.Decoration.widget(hostPos, function () {
|
|
262
281
|
var host = buildContributorTagHost(diffId, tagAnchorName);
|
|
263
282
|
mount = mountContributorTag({
|
|
264
283
|
anchorName: tagAnchorName,
|
|
@@ -24,6 +24,21 @@ var _tableDiffMode = require("./utils/tableDiffMode");
|
|
|
24
24
|
var _wrapBlockNodeView = require("./utils/wrapBlockNodeView");
|
|
25
25
|
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; }
|
|
26
26
|
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; }
|
|
27
|
+
/**
|
|
28
|
+
* Where a slice's `index`th child sits in `doc`: the children belong to the ancestor `openStart`
|
|
29
|
+
* levels above the change. `null` if out of range — `posAtIndex` throws past the last child.
|
|
30
|
+
*/
|
|
31
|
+
var getSourcePos = function getSourcePos(doc, $changeFrom, openStart, index) {
|
|
32
|
+
var depth = $changeFrom ? $changeFrom.depth - openStart : -1;
|
|
33
|
+
if (!$changeFrom || depth < 0) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
var childIndex = $changeFrom.index(depth) + index;
|
|
37
|
+
if (childIndex >= $changeFrom.node(depth).childCount) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return (0, _safeResolve.safeResolve)(doc, $changeFrom.posAtIndex(childIndex, depth));
|
|
41
|
+
};
|
|
27
42
|
var isHeadingLevel = function isHeadingLevel(level) {
|
|
28
43
|
return typeof level === 'number' && level >= 1 && level <= 6;
|
|
29
44
|
};
|
|
@@ -291,7 +306,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
291
306
|
* and if it's the first or last content, we go in however many the sliced Open
|
|
292
307
|
* or sliced End depth is and match only the entire node.
|
|
293
308
|
*/
|
|
294
|
-
slice.content.forEach(function (node) {
|
|
309
|
+
slice.content.forEach(function (node, _offset, index) {
|
|
295
310
|
var isFirst = firstReplacedNode === node;
|
|
296
311
|
var isLast = lastReplacedNode === node;
|
|
297
312
|
var isOpenAtSliceBoundary = isFirst && slice.openStart > 0 || isLast && slice.openEnd > 0;
|
|
@@ -362,7 +377,8 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
362
377
|
}
|
|
363
378
|
|
|
364
379
|
// Try to create node view, fallback to serialization
|
|
365
|
-
var
|
|
380
|
+
var $sourcePos = (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? getSourcePos(doc, $changeFromA, slice.openStart, index) : null;
|
|
381
|
+
var nodeView = serializer.tryCreateNodeView(node, 0, $sourcePos !== null && $sourcePos !== void 0 ? $sourcePos : undefined);
|
|
366
382
|
if (nodeView) {
|
|
367
383
|
if (node.isInline) {
|
|
368
384
|
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted, reveal);
|
|
@@ -465,18 +481,27 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
465
481
|
});
|
|
466
482
|
}
|
|
467
483
|
|
|
468
|
-
// Needed even
|
|
469
|
-
// widget.
|
|
484
|
+
// Needed even with the indicator bar off, since it anchors its top/bottom to the widget.
|
|
470
485
|
if (showIndicators || showContributorTags) {
|
|
471
486
|
dom.style.setProperty('anchor-name', "--".concat((0, _decorationKeys.buildAnchorDecorationKey)({
|
|
472
487
|
diffId: diffId
|
|
473
488
|
})));
|
|
474
|
-
//
|
|
475
|
-
//
|
|
476
|
-
if ((0, _fg.fg)('confluence_ncs_step_diffing_version_history')) {
|
|
477
|
-
|
|
478
|
-
diffId: diffId
|
|
489
|
+
// `dom` is inline, so its box fragments across a line wrap and `anchor()` resolves to the
|
|
490
|
+
// wrong edge. The tag anchors to its own point marker instead (EDITOR-9286).
|
|
491
|
+
if ((0, _fg.fg)('confluence_ncs_step_diffing_version_history') && !contributorTagAnchorName) {
|
|
492
|
+
var tagPointAnchorName = (0, _decorationKeys.buildAnchorDecorationKey)({
|
|
493
|
+
diffId: diffId,
|
|
494
|
+
anchorType: _decorationKeys.AnchorTypeKey.tag
|
|
479
495
|
});
|
|
496
|
+
contributorTagAnchorName = tagPointAnchorName;
|
|
497
|
+
decorations.push(_view.Decoration.widget(safeInsertPos, function () {
|
|
498
|
+
return (0, _createAnchorDecorationWidgets.createAnchorNameSpan)(tagPointAnchorName);
|
|
499
|
+
}, {
|
|
500
|
+
key: "contributor-tag-anchor-".concat(diffId),
|
|
501
|
+
side: -1,
|
|
502
|
+
marks: [],
|
|
503
|
+
ignoreSelection: true
|
|
504
|
+
}));
|
|
480
505
|
}
|
|
481
506
|
}
|
|
482
507
|
|
|
@@ -511,8 +536,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
511
536
|
}
|
|
512
537
|
})));
|
|
513
538
|
} else {
|
|
514
|
-
//
|
|
515
|
-
// the deleted content wraps its box is the union of its line fragments.
|
|
539
|
+
// Anchored to the point marker pushed above, not to `dom` (EDITOR-9286).
|
|
516
540
|
var tagHost = (0, _createContributorTagWidget.createContributorTagHost)({
|
|
517
541
|
anchorName: contributorTagAnchorName,
|
|
518
542
|
diffId: diffId,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isExcerptInclude = exports.getReferencedContentId = exports.getComparableExcerptIncludeAttrs = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
10
|
+
var asRecord = function asRecord(value) {
|
|
11
|
+
return value !== null && (0, _typeof2.default)(value) === 'object' && !Array.isArray(value) ? value : undefined;
|
|
12
|
+
};
|
|
13
|
+
var isExcerptInclude = exports.isExcerptInclude = function isExcerptInclude(attrs) {
|
|
14
|
+
return attrs.extensionKey === 'excerpt-include';
|
|
15
|
+
};
|
|
16
|
+
var getReferencedContentId = exports.getReferencedContentId = function getReferencedContentId(attrs) {
|
|
17
|
+
var _asRecord;
|
|
18
|
+
var parameters = asRecord(attrs.parameters);
|
|
19
|
+
var macroParams = asRecord(parameters === null || parameters === void 0 ? void 0 : parameters.macroParams);
|
|
20
|
+
var value = (_asRecord = asRecord(macroParams === null || macroParams === void 0 ? void 0 : macroParams._referencedContentId)) === null || _asRecord === void 0 ? void 0 : _asRecord.value;
|
|
21
|
+
return typeof value === 'string' ? value : undefined;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Compare macro identity and authored options, excluding publish-time rendering metadata. */
|
|
25
|
+
var getComparableExcerptIncludeAttrs = exports.getComparableExcerptIncludeAttrs = function getComparableExcerptIncludeAttrs(attrs) {
|
|
26
|
+
return (0, _pick.default)(attrs, ['extensionType', 'layout', 'parameters.macroMetadata.macroId.value', 'parameters.macroParams[""].value', 'parameters.macroParams.name.value', 'parameters.macroParams.nopanel.value', 'parameters.macroParams.inline.value']);
|
|
27
|
+
};
|
|
@@ -11,7 +11,9 @@ var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
|
11
11
|
var _setAttrs = require("@atlaskit/adf-schema/steps/set-attrs");
|
|
12
12
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
13
13
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
14
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
15
|
var _diffableAttrs = require("./diffableAttrs");
|
|
16
|
+
var _excerptIncludeAttrs = require("./excerptIncludeAttrs");
|
|
15
17
|
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; }
|
|
16
18
|
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; }
|
|
17
19
|
var filterUndefined = function filterUndefined(x) {
|
|
@@ -51,6 +53,11 @@ var getComparableExtensionAttrs = function getComparableExtensionAttrs(node) {
|
|
|
51
53
|
return (0, _omit.default)(node.attrs, transientExtensionAttrPaths);
|
|
52
54
|
};
|
|
53
55
|
var haveSameRelevantExtensionAttrs = function haveSameRelevantExtensionAttrs(beforeNode, afterNode) {
|
|
56
|
+
if ((0, _fg.fg)('platform_editor_normalize_excerpt_diff') && (0, _excerptIncludeAttrs.isExcerptInclude)(beforeNode.attrs) && (0, _excerptIncludeAttrs.isExcerptInclude)(afterNode.attrs)) {
|
|
57
|
+
var beforeReference = (0, _excerptIncludeAttrs.getReferencedContentId)(beforeNode.attrs);
|
|
58
|
+
var afterReference = (0, _excerptIncludeAttrs.getReferencedContentId)(afterNode.attrs);
|
|
59
|
+
return (0, _isEqual.default)((0, _excerptIncludeAttrs.getComparableExcerptIncludeAttrs)(beforeNode.attrs), (0, _excerptIncludeAttrs.getComparableExcerptIncludeAttrs)(afterNode.attrs)) && (beforeReference === undefined || afterReference === undefined || beforeReference === afterReference);
|
|
60
|
+
}
|
|
54
61
|
return (0, _isEqual.default)(getComparableExtensionAttrs(beforeNode), getComparableExtensionAttrs(afterNode));
|
|
55
62
|
};
|
|
56
63
|
var getStepAttrs = function getStepAttrs(step) {
|
|
@@ -321,6 +321,21 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref8)
|
|
|
321
321
|
/**
|
|
322
322
|
* Creates a content wrapper with deleted styles for a block node
|
|
323
323
|
*/
|
|
324
|
+
/**
|
|
325
|
+
* The element that spans breakout width, for nodes carrying a `breakout` mark. The wrapper divs
|
|
326
|
+
* stay at editor-column width, so anything that should align to the node's visible edges —
|
|
327
|
+
* outlines, absolutely positioned lozenges — has to attach here instead.
|
|
328
|
+
*/
|
|
329
|
+
var findBreakoutElement = function findBreakoutElement(targetNode, nodeView) {
|
|
330
|
+
var _targetNode$marks;
|
|
331
|
+
var hasBreakoutMark = (_targetNode$marks = targetNode.marks) === null || _targetNode$marks === void 0 ? void 0 : _targetNode$marks.some(function (mark) {
|
|
332
|
+
return mark.type.name === 'breakout';
|
|
333
|
+
});
|
|
334
|
+
if (!hasBreakoutMark || !(nodeView instanceof HTMLElement)) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
return nodeView.matches('[data-node-type]') ? nodeView : nodeView.querySelector('[data-node-type]');
|
|
338
|
+
};
|
|
324
339
|
var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref9) {
|
|
325
340
|
var nodeView = _ref9.nodeView,
|
|
326
341
|
targetNode = _ref9.targetNode,
|
|
@@ -338,7 +353,16 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref9
|
|
|
338
353
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
339
354
|
var shouldSkipContentStyle = isInserted && nodeStyle !== undefined;
|
|
340
355
|
var contentStyle = shouldSkipContentStyle ? '' : (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
341
|
-
|
|
356
|
+
|
|
357
|
+
// A `breakout` node renders wider than the editor column while the wrapper divs
|
|
358
|
+
// stay at column width, so paint the outline on the node element that spans that width.
|
|
359
|
+
var breakoutTarget = nodeStyle ? findBreakoutElement(targetNode, nodeView) : null;
|
|
360
|
+
if ((0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && breakoutTarget) {
|
|
361
|
+
appendStyleToElement(breakoutTarget, nodeStyle !== null && nodeStyle !== void 0 ? nodeStyle : '');
|
|
362
|
+
contentWrapper.setAttribute('style', contentStyle || '');
|
|
363
|
+
} else {
|
|
364
|
+
contentWrapper.setAttribute('style', "".concat(contentStyle).concat(nodeStyle || ''));
|
|
365
|
+
}
|
|
342
366
|
contentWrapper.append(nodeView);
|
|
343
367
|
return contentWrapper;
|
|
344
368
|
};
|
|
@@ -468,7 +492,19 @@ var wrapBlockNode = function wrapBlockNode(_ref10) {
|
|
|
468
492
|
})) {
|
|
469
493
|
return;
|
|
470
494
|
}
|
|
471
|
-
|
|
495
|
+
|
|
496
|
+
// `lozenge` is absolutely positioned, so it lands on the nearest positioned ancestor. For a
|
|
497
|
+
// breakout node that is the column-width wrapper, leaving the pill short of the node's
|
|
498
|
+
// right edge — host it on the breakout element, which must establish a containing block.
|
|
499
|
+
var breakoutHost = (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? findBreakoutElement(targetNode, nodeView) : null;
|
|
500
|
+
if (breakoutHost) {
|
|
501
|
+
appendStyleToElement(breakoutHost, (0, _lazyNodeView.convertToInlineCss)({
|
|
502
|
+
position: 'relative'
|
|
503
|
+
}));
|
|
504
|
+
breakoutHost.append(lozenge);
|
|
505
|
+
} else {
|
|
506
|
+
blockWrapper.append(lozenge);
|
|
507
|
+
}
|
|
472
508
|
}
|
|
473
509
|
var contentWrapper = createBlockNodeContentWrapper({
|
|
474
510
|
nodeView: nodeView,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.wrapInMarkViews = void 0;
|
|
7
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
9
|
+
/**
|
|
10
|
+
* `@atlaskit/editor-prosemirror/view` doesn't re-export prosemirror-view's `MarkViewConstructor`,
|
|
11
|
+
* so it's typed locally, as `EditorSSRRenderer` does.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Where to look up a mark's renderer, and the view to render it against. */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Renders a mark as ProseMirror does: `view.nodeViews` also holds mark views, keyed by mark name,
|
|
18
|
+
* so `breakout` resolves whether it's registered under `markViews` or `nodeViews`. Falls back to
|
|
19
|
+
* `toDOM` — they can differ: `breakout` renders `.fabric-editor-breakout-mark-dom`, which the width
|
|
20
|
+
* CSS targets.
|
|
21
|
+
*/
|
|
22
|
+
var renderMarkView = function renderMarkView(mark, inline, _ref) {
|
|
23
|
+
var nodeViews = _ref.nodeViews,
|
|
24
|
+
view = _ref.view;
|
|
25
|
+
try {
|
|
26
|
+
var markView = nodeViews === null || nodeViews === void 0 ? void 0 : nodeViews[mark.type.name];
|
|
27
|
+
if (markView && view) {
|
|
28
|
+
var rendered = markView(mark, view, inline);
|
|
29
|
+
return {
|
|
30
|
+
dom: rendered.dom,
|
|
31
|
+
contentDOM: rendered.contentDOM
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
var toDOM = mark.type.spec.toDOM;
|
|
35
|
+
if (!toDOM) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return _model.DOMSerializer.renderSpec(document, toDOM(mark, inline));
|
|
39
|
+
} catch (_unused) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Wraps rendered DOM in its marks, as ProseMirror does for the live document. Without this a
|
|
46
|
+
* block node loses `breakout`, whose wrapper supplies the width. Marks nest
|
|
47
|
+
* outside-in, so `marks[0]` is outermost.
|
|
48
|
+
*/
|
|
49
|
+
var wrapInMarkViews = exports.wrapInMarkViews = function wrapInMarkViews(targetNode, nodeDom, sources) {
|
|
50
|
+
if (targetNode.marks.length === 0 || !(0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) {
|
|
51
|
+
return nodeDom;
|
|
52
|
+
}
|
|
53
|
+
var wrapped = nodeDom;
|
|
54
|
+
for (var index = targetNode.marks.length - 1; index >= 0; index--) {
|
|
55
|
+
var _mark = targetNode.marks[index];
|
|
56
|
+
var rendered = renderMarkView(_mark, targetNode.isInline, sources);
|
|
57
|
+
// No content hole means nowhere to nest the node, so skip the mark, not the node.
|
|
58
|
+
if (!(rendered !== null && rendered !== void 0 && rendered.contentDOM)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
rendered.contentDOM.appendChild(wrapped);
|
|
62
|
+
wrapped = rendered.dom;
|
|
63
|
+
}
|
|
64
|
+
return wrapped;
|
|
65
|
+
};
|