fix(client/ts): fix rest of build errors

This commit is contained in:
Elian Doran 2025-03-21 17:39:18 +02:00
parent 1ab87be0e6
commit b876f98d69
No known key found for this signature in database
5 changed files with 9 additions and 7 deletions

View File

@ -301,7 +301,7 @@ declare global {
});
removeMarker(name: string);
createRange(start: number, end: number): Range;
createElement(type: string, opts: Record<string, string>);
createElement(type: string, opts: Record<string, string | null | undefined>);
}
interface TextNode {
previousSibling?: TextNode;

View File

@ -80,13 +80,13 @@ export default class AddLinkDialog extends BasicWidget {
if (this.$autoComplete.getSelectedNotePath()) {
this.$widget.modal("hide");
const linkTitle = this.getLinkType() === "reference-link" ? null : this.$linkTitle.val();
const linkTitle = this.getLinkType() === "reference-link" ? null : this.$linkTitle.val() as string;
this.textTypeWidget?.addLink(this.$autoComplete.getSelectedNotePath()!, linkTitle);
} else if (this.$autoComplete.getSelectedExternalLink()) {
this.$widget.modal("hide");
this.textTypeWidget?.addLink(this.$autoComplete.getSelectedExternalLink()!, this.$linkTitle.val(), true);
this.textTypeWidget?.addLink(this.$autoComplete.getSelectedExternalLink()!, this.$linkTitle.val() as string, true);
} else {
logError("No link to add.");
}

View File

@ -103,7 +103,7 @@ export default class IncludeNoteDialog extends BasicWidget {
return;
}
const note = await froca.getNote(noteId);
const boxSize = $("input[name='include-note-box-size']:checked").val();
const boxSize = $("input[name='include-note-box-size']:checked").val() as string;
if (["image", "canvas", "mermaid"].includes(note?.type ?? "")) {
// there's no benefit to use insert note functionlity for images,

View File

@ -368,7 +368,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
this.addTextToEditor(text);
}
async addLink(notePath: string, linkTitle: string, externalLink: boolean = false) {
async addLink(notePath: string, linkTitle: string | null, externalLink: boolean = false) {
await this.initialized;
if (linkTitle) {
@ -459,7 +459,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
this.triggerCommand("showIncludeNoteDialog", { textTypeWidget: this });
}
addIncludeNote(noteId: string, boxSize: string) {
addIncludeNote(noteId: string, boxSize?: string) {
this.watchdog.editor.model.change((writer) => {
// Insert <includeNote>*</includeNote> at the current selection position
// in a way that will result in creating a valid model structure

View File

@ -114,7 +114,9 @@ export default class ReadOnlyTextTypeWidget extends AbstractTextTypeWidget {
this.$content.find("section").each((_, el) => {
const noteId = $(el).attr("data-note-id");
this.loadIncludedNote(noteId, $(el));
if (noteId) {
this.loadIncludedNote(noteId, $(el));
}
});
if (this.$content.find("span.math-tex").length > 0) {