@threadlabs/looma 0.31.4 → 0.31.5
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/editor/chunks/extensions.js +23 -13
- package/package.json +1 -1
- package/vue/editor/index.js +7 -7
|
@@ -631,17 +631,17 @@ function appendBackLinks(item, label, number, count) {
|
|
|
631
631
|
paragraph.append(" ", link);
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
634
|
+
function installSerializer(schema) {
|
|
635
|
+
const serializer = DOMSerializer.fromSchema(schema);
|
|
636
|
+
if (Object.prototype.hasOwnProperty.call(serializer, "serializeFragment")) return;
|
|
637
|
+
const serializeFragment = serializer.serializeFragment;
|
|
638
|
+
serializer.serializeFragment = function(fragment, options = {}, target) {
|
|
639
|
+
const dom = serializeFragment.call(this, fragment, options, target);
|
|
637
640
|
fragment.forEach((node, _offset, index) => {
|
|
638
641
|
if (node.type.name === NOTE) appendBackLinks(dom.childNodes[index], String(node.attrs.label), index + 1, Number(node.attrs.count) || 1);
|
|
639
642
|
});
|
|
640
643
|
return dom;
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
function installSerializer(schema) {
|
|
644
|
-
if (!(schema.cached.domSerializer instanceof FootnoteSerializer)) schema.cached.domSerializer = new FootnoteSerializer(DOMSerializer.nodesFromSchema(schema), DOMSerializer.marksFromSchema(schema));
|
|
644
|
+
};
|
|
645
645
|
}
|
|
646
646
|
/**
|
|
647
647
|
* A footnote reference, `[^label]`, saved as `<sup><a data-footnote-ref>`. Typing or pasting
|
|
@@ -11155,21 +11155,31 @@ var TableHeader = Node$1.create({
|
|
|
11155
11155
|
});
|
|
11156
11156
|
//#endregion
|
|
11157
11157
|
//#region src/editor/extensions/table-formatting.ts
|
|
11158
|
-
/**
|
|
11159
|
-
|
|
11158
|
+
/**
|
|
11159
|
+
* Table chrome lives outside the horizontal scroller, within the table's document block.
|
|
11160
|
+
* @invariant It holds Tiptap's TableView rather than extending it: a bundler that lowers classes
|
|
11161
|
+
* calls the base as a function, which a native class rejects.
|
|
11162
|
+
*/
|
|
11163
|
+
var LoomaTableView = class {
|
|
11164
|
+
table;
|
|
11165
|
+
dom;
|
|
11166
|
+
contentDOM;
|
|
11160
11167
|
toolbarHost;
|
|
11161
11168
|
constructor(node, cellMinWidth) {
|
|
11162
|
-
|
|
11163
|
-
|
|
11169
|
+
this.table = new TableView(node, cellMinWidth);
|
|
11170
|
+
this.contentDOM = this.table.contentDOM;
|
|
11164
11171
|
this.dom = document.createElement("div");
|
|
11165
11172
|
this.dom.dataset.loomaTableBlock = "";
|
|
11166
11173
|
this.toolbarHost = document.createElement("div");
|
|
11167
11174
|
this.toolbarHost.dataset.loomaTableToolbarHost = "";
|
|
11168
11175
|
this.toolbarHost.contentEditable = "false";
|
|
11169
|
-
this.dom.append(
|
|
11176
|
+
this.dom.append(this.table.dom, this.toolbarHost);
|
|
11177
|
+
}
|
|
11178
|
+
update(node) {
|
|
11179
|
+
return this.table.update(node);
|
|
11170
11180
|
}
|
|
11171
11181
|
ignoreMutation(mutation) {
|
|
11172
|
-
return mutation.type !== "selection" && this.toolbarHost.contains(mutation.target) ||
|
|
11182
|
+
return mutation.type !== "selection" && this.toolbarHost.contains(mutation.target) || this.table.ignoreMutation(mutation);
|
|
11173
11183
|
}
|
|
11174
11184
|
stopEvent(event) {
|
|
11175
11185
|
return event.target instanceof globalThis.Node && this.toolbarHost.contains(event.target);
|
package/package.json
CHANGED
package/vue/editor/index.js
CHANGED
|
@@ -1836,17 +1836,17 @@ function appendBackLinks(item, label, number, count) {
|
|
|
1836
1836
|
paragraph.append(" ", link);
|
|
1837
1837
|
}
|
|
1838
1838
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1839
|
+
function installSerializer(schema) {
|
|
1840
|
+
const serializer = DOMSerializer.fromSchema(schema);
|
|
1841
|
+
if (Object.prototype.hasOwnProperty.call(serializer, "serializeFragment")) return;
|
|
1842
|
+
const serializeFragment = serializer.serializeFragment;
|
|
1843
|
+
serializer.serializeFragment = function(fragment, options = {}, target) {
|
|
1844
|
+
const dom = serializeFragment.call(this, fragment, options, target);
|
|
1842
1845
|
fragment.forEach((node, _offset, index) => {
|
|
1843
1846
|
if (node.type.name === NOTE) appendBackLinks(dom.childNodes[index], String(node.attrs.label), index + 1, Number(node.attrs.count) || 1);
|
|
1844
1847
|
});
|
|
1845
1848
|
return dom;
|
|
1846
|
-
}
|
|
1847
|
-
};
|
|
1848
|
-
function installSerializer(schema) {
|
|
1849
|
-
if (!(schema.cached.domSerializer instanceof FootnoteSerializer)) schema.cached.domSerializer = new FootnoteSerializer(DOMSerializer.nodesFromSchema(schema), DOMSerializer.marksFromSchema(schema));
|
|
1849
|
+
};
|
|
1850
1850
|
}
|
|
1851
1851
|
Node$1.create({
|
|
1852
1852
|
name: REFERENCE,
|