mirror of
https://github.com/zadam/trilium.git
synced 2026-01-06 14:44:25 +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");
|
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", () => {
|
it("maintains launchers hidden, if they were shown by default but moved by the user", () => {
|
||||||
const launcher = becca.getNote("_lbLlmChat");
|
const launcher = becca.getNote("_lbLlmChat");
|
||||||
const branch = launcher?.getParentBranches()[0];
|
const branch = launcher?.getParentBranches()[0];
|
||||||
|
|||||||
@ -451,8 +451,16 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
|
|||||||
// Enforce attribute structure if needed.
|
// Enforce attribute structure if needed.
|
||||||
if (item.enforceAttributes) {
|
if (item.enforceAttributes) {
|
||||||
for (const attribute of note.getAttributes()) {
|
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();
|
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
|
// Handle web views
|
||||||
if (noteMeta.type === "webView") {
|
if (noteMeta.type === "webView") {
|
||||||
item.type = "webView";
|
item.type = "webView";
|
||||||
|
item.enforceAttributes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle children
|
// Handle children
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user