perf: More decoration caching

This commit is contained in:
Tom Moor
2022-03-31 19:51:30 -07:00
parent f457bf2019
commit 4c0cd3d893
2 changed files with 23 additions and 11 deletions

View File

@@ -171,11 +171,17 @@ export default class Table extends Node {
if (shadowRight) {
decorations.push(
Decoration.widget(pos + 1, () => {
const shadow = document.createElement("div");
shadow.className = "scrollable-shadow right";
return shadow;
})
Decoration.widget(
pos + 1,
() => {
const shadow = document.createElement("div");
shadow.className = "scrollable-shadow right";
return shadow;
},
{
key: "table-shadow-right",
}
)
);
}
index++;

View File

@@ -124,12 +124,18 @@ export default class BlockMenuTrigger extends Extension {
if (isTopLevel) {
if (isEmpty) {
decorations.push(
Decoration.widget(parent.pos, () => {
button.addEventListener("click", () => {
this.editor.events.emit(EventType.blockMenuOpen, "");
});
return button;
})
Decoration.widget(
parent.pos,
() => {
button.addEventListener("click", () => {
this.editor.events.emit(EventType.blockMenuOpen, "");
});
return button;
},
{
key: "block-trigger",
}
)
);
decorations.push(