Skip to content

Commit

Permalink
fix: support html in the document_block
Browse files Browse the repository at this point in the history
  • Loading branch information
danielo515 committed Jan 22, 2024
1 parent 5fefd8d commit 1717937
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/FormModal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Modal, Platform, Setting } from "obsidian";
import { App, Modal, Platform, Setting, sanitizeHTMLToDom } from "obsidian";
import * as R from "fp-ts/Record";
import MultiSelect from "./views/components/MultiSelect.svelte";
import FormResult, { type ModalFormData } from "./core/FormResult";
Expand Down Expand Up @@ -269,7 +269,7 @@ export class FormModal extends Modal {
console.error(error);
notifyError("Error in document block")(String(error));
},
(newText) => domNode.setText(newText),
(newText) => domNode.setText(sanitizeHTMLToDom(newText)),
),
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/exampleModalDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const exampleModalDefinition: FormDefinition = {
description: "Document block example",
input: {
type: "document_block",
body: "return `Hello ${form.name}!\n Your best friend is ${form.best_fried}`",
body: "return `Hello ${form.name}!<br> Your best friend is <b>${form.best_fried}</b>`",
},
},
],
Expand Down

0 comments on commit 1717937

Please sign in to comment.