mirror of
https://github.com/zadam/trilium.git
synced 2025-12-28 02:04:26 +01:00
fix(help): webview source not updating
This commit is contained in:
parent
1d259aab9d
commit
4526455486
2
apps/server/src/assets/doc_notes/en/User Guide/!!!meta.json
generated
vendored
2
apps/server/src/assets/doc_notes/en/User Guide/!!!meta.json
generated
vendored
File diff suppressed because one or more lines are too long
@ -98,6 +98,21 @@ describe("Hidden Subtree", () => {
|
||||
expect(updatedBoardTemplate?.title).not.toBe("My renamed board");
|
||||
});
|
||||
|
||||
it("enforces webviewSrc of templates", () => {
|
||||
const apiRefNote = becca.getNote("_help_9qPsTWBorUhQ");
|
||||
expect(apiRefNote).toBeDefined();
|
||||
|
||||
cls.init(() => {
|
||||
apiRefNote!.setAttribute("label", "webViewSrc", "foo");
|
||||
apiRefNote!.save();
|
||||
hiddenSubtreeService.checkHiddenSubtree(true);
|
||||
});
|
||||
|
||||
const updatedApiRefNote = becca.getNote("_help_9qPsTWBorUhQ");
|
||||
expect(updatedApiRefNote).toBeDefined();
|
||||
expect(updatedApiRefNote?.getLabelValue("webViewSrc")).not.toBe("foo");
|
||||
});
|
||||
|
||||
it("maintains launchers hidden, if they were shown by default but moved by the user", () => {
|
||||
const launcher = becca.getNote("_lbLlmChat");
|
||||
const branch = launcher?.getParentBranches()[0];
|
||||
|
||||
@ -451,8 +451,16 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
|
||||
// Enforce attribute structure if needed.
|
||||
if (item.enforceAttributes) {
|
||||
for (const attribute of note.getAttributes()) {
|
||||
if (!attrs.some(a => a.name === attribute.name)) {
|
||||
// Remove unwanted attributes.
|
||||
const attrDef = attrs.find(a => a.name === attribute.name);
|
||||
if (!attrDef) {
|
||||
attribute.markAsDeleted();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ensure value is consistent.
|
||||
if (attribute.value !== attrDef.value) {
|
||||
note.setAttributeValueById(attribute.attributeId, attrDef.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,6 +78,7 @@ export function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSu
|
||||
// Handle web views
|
||||
if (noteMeta.type === "webView") {
|
||||
item.type = "webView";
|
||||
item.enforceAttributes = true;
|
||||
}
|
||||
|
||||
// Handle children
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user