From 7c926f00afc48d53b572d46d7d26f3d75aea2c13 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:45:04 +0530 Subject: [PATCH 01/13] feat: add previewModal logic to advancedModal --- src/main.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.ts b/src/main.ts index 30fefa0..9348b9e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -176,6 +176,12 @@ export default class MediaDbPlugin extends Plugin { return; } + const proceed: boolean = await this.modalHelper.openPreviewModal(selectResults, async (result) => { + return true; + }) + if (!proceed) + return; + await this.createMediaDbNotes(selectResults); } From 3ceeb3c51cac0a0c3eda87709bee35124ffbea85 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:46:46 +0530 Subject: [PATCH 02/13] feat: add previewModal handler to ModalHelper --- src/utils/ModalHelper.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/utils/ModalHelper.ts b/src/utils/ModalHelper.ts index 2529679..a573e12 100644 --- a/src/utils/ModalHelper.ts +++ b/src/utils/ModalHelper.ts @@ -131,5 +131,42 @@ export class ModalHelper { return; } } + + async createPreviewModal(mediaTypeModel: MediaTypeModel[]): Promise<{ result: boolean, previewModal: MediaDbPreviewModal }> { + //todo: handle attachFile for existing files + const modal = new MediaDbPreviewModal(this.plugin, mediaTypeModel, { attachTemplate: true, attachFile: false }); + const booleanResult: boolean = await new Promise((resolve, reject) => { + modal.setSubmitCallback(res => resolve(res)); + modal.setCloseCallback(err => { + if (err) { + reject(err); + } + resolve(undefined); + }); + + modal.open(); + }); + return { result: booleanResult, previewModal: modal }; + } + + async openPreviewModal(mediaModels: MediaTypeModel[], submitCallback: (result: boolean) => Promise): Promise { + const { result, previewModal } = await this.createPreviewModal(mediaModels); + if (!result) { + previewModal.close(); + return; + } + + try { + let callbackRes: boolean; + callbackRes = await submitCallback(result); + previewModal.close(); + return callbackRes; + } catch (e) { + console.warn(e); + new Notice(e.toString()); + previewModal.close(); + return; + } + } } From e597da5609adb0299fd44ebd596c8a5abfcb8066 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:47:52 +0530 Subject: [PATCH 03/13] fix: spelling --- src/modals/MediaDbAdvancedSearchModal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modals/MediaDbAdvancedSearchModal.ts b/src/modals/MediaDbAdvancedSearchModal.ts index 52c9786..3db3235 100644 --- a/src/modals/MediaDbAdvancedSearchModal.ts +++ b/src/modals/MediaDbAdvancedSearchModal.ts @@ -36,7 +36,7 @@ export class MediaDbAdvancedSearchModal extends Modal { async search(): Promise { if (!this.query || this.query.length < 3) { - new Notice('MDB | Query to short'); + new Notice('MDB | Query too short'); return; } From 7fe9a7791fddea0da4938559980c7a66cb613a34 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:49:07 +0530 Subject: [PATCH 04/13] feat: add PreviewModal --- src/modals/MediaDbPreviewModal.ts | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/modals/MediaDbPreviewModal.ts diff --git a/src/modals/MediaDbPreviewModal.ts b/src/modals/MediaDbPreviewModal.ts new file mode 100644 index 0000000..0bc91b4 --- /dev/null +++ b/src/modals/MediaDbPreviewModal.ts @@ -0,0 +1,71 @@ +import { MarkdownRenderer, Modal, Setting, TFile } from "obsidian"; +import MediaDbPlugin from "src/main"; +import { MediaTypeModel } from "src/models/MediaTypeModel"; + +export class MediaDbPreviewModal extends Modal { + selectedSearchResults: MediaTypeModel[]; + options: { attachTemplate: boolean, attachFile: TFile}; + submitCallback: (res: boolean) => void; + closeCallback: (err?: Error) => void; + skipCallback: () => void; + plugin: MediaDbPlugin; + searchBtn: any; + cancelButton: any; + submitButton: any; + busy: any; + + constructor(plugin: MediaDbPlugin, mediaTypeModel: MediaTypeModel[], options: any) { + super(plugin.app); + this.plugin = plugin; + this.selectedSearchResults = mediaTypeModel; + this.options = options; + } + + setSubmitCallback(submitCallback: (res: boolean) => void): void { + this.submitCallback = submitCallback; + } + + setCloseCallback(closeCallback: (err?: Error) => void): void { + this.closeCallback = closeCallback; + } + + async preview(): Promise { + let { contentEl } = this; + for (let result of this.selectedSearchResults) { + let fileContent = await this.plugin.generateMediaDbNoteContents(result, { attachTemplate: this.options.attachTemplate, attachFile: this.options.attachFile }); + this.contentEl.createEl("h3", {text: result.englishTitle}); + const fileDiv = this.contentEl.createDiv(); + fileContent = `\n${fileContent}\n`; + MarkdownRenderer.renderMarkdown(fileContent, fileDiv, null, null); + } + + contentEl.createDiv({ cls: 'media-db-plugin-spacer' }); + + const bottomSettingRow = new Setting(contentEl); + bottomSettingRow.addButton(btn => { + btn.setButtonText('Cancel'); + btn.onClick(() => this.close()); + btn.buttonEl.addClass('media-db-plugin-button'); + this.cancelButton = btn; + }); + bottomSettingRow.addButton(btn => { + btn.setButtonText('Ok'); + btn.setCta(); + btn.onClick(() => this.submit()); + btn.buttonEl.addClass('media-db-plugin-button'); + this.submitButton = btn; + }) + } + + submit() { + if (!this.busy) { + this.busy = true; + this.submitButton.setButtonText('Creating entry...'); + this.submitCallback(true); + } + } + + onOpen(): void { + this.preview() + } +} \ No newline at end of file From 4de23fa9977bb2622f658388cb62f9097d94bffb Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:51:15 +0530 Subject: [PATCH 05/13] fix: add PreviewModal import --- src/utils/ModalHelper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/ModalHelper.ts b/src/utils/ModalHelper.ts index a573e12..fd44dbd 100644 --- a/src/utils/ModalHelper.ts +++ b/src/utils/ModalHelper.ts @@ -4,6 +4,7 @@ import {MediaTypeModel} from '../models/MediaTypeModel'; import {MediaDbSearchResultModal} from '../modals/MediaDbSearchResultModal'; import {Notice} from 'obsidian'; import MediaDbPlugin from '../main'; +import { MediaDbPreviewModal } from 'src/modals/MediaDbPreviewModal'; interface AdvancedSearchOptions { query: string, From c36fa0311a94778039ae6bc39e899759379215a0 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sun, 9 Oct 2022 11:35:50 +0530 Subject: [PATCH 06/13] fix: change method access level --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 9348b9e..511e083 100644 --- a/src/main.ts +++ b/src/main.ts @@ -229,7 +229,7 @@ export default class MediaDbPlugin extends Plugin { } } - private async generateMediaDbNoteContents(mediaTypeModel: MediaTypeModel, options: {attachTemplate?: boolean, attachFile?: TFile}) { + async generateMediaDbNoteContents(mediaTypeModel: MediaTypeModel, options: {attachTemplate?: boolean, attachFile?: TFile}) { let fileMetadata = this.modelPropertyMapper.convertObject(mediaTypeModel.toMetaDataObject()); let fileContent = ''; From 3c8d07e7de0716f63a6a334beea23093707c6310 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sun, 9 Oct 2022 15:57:07 +0530 Subject: [PATCH 07/13] fix: use correct callbacks --- src/modals/MediaDbPreviewModal.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modals/MediaDbPreviewModal.ts b/src/modals/MediaDbPreviewModal.ts index 0bc91b4..51268ca 100644 --- a/src/modals/MediaDbPreviewModal.ts +++ b/src/modals/MediaDbPreviewModal.ts @@ -7,7 +7,6 @@ export class MediaDbPreviewModal extends Modal { options: { attachTemplate: boolean, attachFile: TFile}; submitCallback: (res: boolean) => void; closeCallback: (err?: Error) => void; - skipCallback: () => void; plugin: MediaDbPlugin; searchBtn: any; cancelButton: any; @@ -44,14 +43,14 @@ export class MediaDbPreviewModal extends Modal { const bottomSettingRow = new Setting(contentEl); bottomSettingRow.addButton(btn => { btn.setButtonText('Cancel'); - btn.onClick(() => this.close()); + btn.onClick(() => this.closeCallback()); btn.buttonEl.addClass('media-db-plugin-button'); this.cancelButton = btn; }); bottomSettingRow.addButton(btn => { btn.setButtonText('Ok'); btn.setCta(); - btn.onClick(() => this.submit()); + btn.onClick(() => this.submitCallback(true)); btn.buttonEl.addClass('media-db-plugin-button'); this.submitButton = btn; }) From 0ae5063567fab96f9e94dcef647ecdea65fbbf54 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sun, 9 Oct 2022 15:57:45 +0530 Subject: [PATCH 08/13] feat: add retry logic if preview not satisfactory --- src/main.ts | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/src/main.ts b/src/main.ts index 511e083..6d93b9c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -58,7 +58,7 @@ export default class MediaDbPlugin extends Plugin { menu.addItem(item => { item.setTitle('Import folder as Media DB entries') .setIcon('database') - .onClick(() => this.createEntriesFromFolder(file as TFolder)); + .onClick(() => this.createEntriesFromFolder(file)); }); } })); @@ -165,33 +165,44 @@ export default class MediaDbPlugin extends Plugin { }); if (!apiSearchResults) { + // TODO: add new notice saying no results found? return; } - const selectResults: MediaTypeModel[] = await this.modalHelper.openSelectModal(apiSearchResults, async (selectedMediaTypeModels) => { - return await this.queryDetails(selectedMediaTypeModels); - }); + let selectResults: MediaTypeModel[]; + let proceed: boolean; - if (!selectResults) { - return; + while (!proceed) { + selectResults = await this.modalHelper.openSelectModal(apiSearchResults, async (selectedMediaTypeModels) => { + return await this.queryDetails(selectedMediaTypeModels); + }); + if (!selectResults) { + return; + } + + proceed = await this.modalHelper.openPreviewModal(selectResults, async () => { + return true; + }) } - const proceed: boolean = await this.modalHelper.openPreviewModal(selectResults, async (result) => { - return true; - }) - if (!proceed) - return; - await this.createMediaDbNotes(selectResults); } - async createEntryWithIdSearchModal() { - const idSearchResult: MediaTypeModel = await this.modalHelper.openIdSearchModal(async (idSearchOptions) => { - return await this.apiManager.queryDetailedInfoById(idSearchOptions.query, idSearchOptions.api); - }) + async createEntryWithIdSearchModal(): Promise { + let idSearchResult: MediaTypeModel; + let proceed: boolean; - if (!idSearchResult) { - return; + while (!proceed) { + idSearchResult = await this.modalHelper.openIdSearchModal(async (idSearchOptions) => { + return await this.apiManager.queryDetailedInfoById(idSearchOptions.query, idSearchOptions.api); + }) + if (!idSearchResult) { + return; + } + + proceed = await this.modalHelper.openPreviewModal([idSearchResult], async () => { + return true; + }) } await this.createMediaDbNoteFromModel(idSearchResult, {attachTemplate: true, openNote: true}); From 3a4b69717d3a008c015b773f0cd8de10f0f40a71 Mon Sep 17 00:00:00 2001 From: AB1908 <14124383+AB1908@users.noreply.github.com> Date: Sun, 9 Oct 2022 16:07:37 +0530 Subject: [PATCH 09/13] fix: properly merge this time --- src/main.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 6d9d2f2..5a175fa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -172,8 +172,8 @@ export default class MediaDbPlugin extends Plugin { let proceed: boolean; while (!proceed) { - selectResults = await this.modalHelper.openSelectModal(apiSearchResults, async (selectedMediaTypeModels) => { - return await this.queryDetails(selectedMediaTypeModels); + selectResults = await this.modalHelper.openSelectModal({elements: apiSearchResults}, async (selectModalData) => { + return await this.queryDetails(selectModalData.selected); }); if (!selectResults) { return; @@ -192,8 +192,8 @@ export default class MediaDbPlugin extends Plugin { let proceed: boolean; while (!proceed) { - idSearchResult = await this.modalHelper.openIdSearchModal(async (idSearchOptions) => { - return await this.apiManager.queryDetailedInfoById(idSearchOptions.query, idSearchOptions.api); + idSearchResult = await this.modalHelper.openIdSearchModal({}, async (idSearchModalData) => { + return await this.apiManager.queryDetailedInfoById(idSearchModalData.query, idSearchModalData.api); }) if (!idSearchResult) { return; From 918c5b6fd7fc10f83a5aa7fc65b0de87ac572ebf Mon Sep 17 00:00:00 2001 From: mProjectsCode Date: Sun, 9 Oct 2022 15:40:37 +0200 Subject: [PATCH 10/13] Cleanup and light changes --- src/main.ts | 28 ++-- src/modals/MediaDbPreviewModal.ts | 128 ++++++++++-------- src/modals/SelectModal.ts | 4 +- .../PropertyMappingModelComponent.svelte | 8 +- .../PropertyMappingModelsComponent.svelte | 5 +- src/utils/ModalHelper.ts | 102 ++++++++++---- src/utils/Utils.ts | 18 +++ styles.css | 10 ++ 8 files changed, 190 insertions(+), 113 deletions(-) diff --git a/src/main.ts b/src/main.ts index 5a175fa..5f87f9f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import {MarkdownView, Notice, parseYaml, Plugin, stringifyYaml, TFile, TFolder} import {getDefaultSettings, MediaDbPluginSettings, MediaDbSettingTab} from './settings/Settings'; import {APIManager} from './api/APIManager'; import {MediaTypeModel} from './models/MediaTypeModel'; -import {dateTimeToString, markdownTable, replaceIllegalFileNameCharactersInString} from './utils/Utils'; +import {CreateNoteOptions, dateTimeToString, markdownTable, replaceIllegalFileNameCharactersInString} from './utils/Utils'; import {OMDbAPI} from './api/apis/OMDbAPI'; import {MALAPI} from './api/apis/MALAPI'; import {WikipediaAPI} from './api/apis/WikipediaAPI'; @@ -179,9 +179,9 @@ export default class MediaDbPlugin extends Plugin { return; } - proceed = await this.modalHelper.openPreviewModal(selectResults, async () => { - return true; - }) + proceed = await this.modalHelper.openPreviewModal({elements: selectResults}, async (previewModalData) => { + return previewModalData.confirmed; + }); } await this.createMediaDbNotes(selectResults); @@ -194,14 +194,14 @@ export default class MediaDbPlugin extends Plugin { while (!proceed) { idSearchResult = await this.modalHelper.openIdSearchModal({}, async (idSearchModalData) => { return await this.apiManager.queryDetailedInfoById(idSearchModalData.query, idSearchModalData.api); - }) + }); if (!idSearchResult) { return; } - proceed = await this.modalHelper.openPreviewModal([idSearchResult], async () => { - return true; - }) + proceed = await this.modalHelper.openPreviewModal({elements: [idSearchResult]}, async (previewModalData) => { + return previewModalData.confirmed; + }); } await this.createMediaDbNoteFromModel(idSearchResult, {attachTemplate: true, openNote: true}); @@ -226,11 +226,11 @@ export default class MediaDbPlugin extends Plugin { return detailModels; } - async createMediaDbNoteFromModel(mediaTypeModel: MediaTypeModel, options: { attachTemplate?: boolean, attachFile?: TFile, openNote?: boolean }): Promise { + async createMediaDbNoteFromModel(mediaTypeModel: MediaTypeModel, options: CreateNoteOptions): Promise { try { console.debug('MDB | creating new note'); - let fileContent = await this.generateMediaDbNoteContents(mediaTypeModel, {attachTemplate: options.attachTemplate, attachFile: options.attachFile}); + let fileContent = await this.generateMediaDbNoteContents(mediaTypeModel, options); await this.createNote(this.mediaTypeManager.getFileName(mediaTypeModel), fileContent, options.openNote); } catch (e) { @@ -239,15 +239,13 @@ export default class MediaDbPlugin extends Plugin { } } - async generateMediaDbNoteContents(mediaTypeModel: MediaTypeModel, options: {attachTemplate?: boolean, attachFile?: TFile}) { + async generateMediaDbNoteContents(mediaTypeModel: MediaTypeModel, options: CreateNoteOptions) { let fileMetadata = this.modelPropertyMapper.convertObject(mediaTypeModel.toMetaDataObject()); let fileContent = ''; + const template = options.attachTemplate ? await this.mediaTypeManager.getTemplate(mediaTypeModel, this.app) : ''; ({fileMetadata, fileContent} = await this.attachFile(fileMetadata, fileContent, options.attachFile)); - ({ - fileMetadata, - fileContent, - } = await this.attachTemplate(fileMetadata, fileContent, options.attachTemplate ? await this.mediaTypeManager.getTemplate(mediaTypeModel, this.app) : '')); + ({fileMetadata, fileContent} = await this.attachTemplate(fileMetadata, fileContent, template)); fileContent = `---\n${this.settings.useCustomYamlStringifier ? YAMLConverter.toYaml(fileMetadata) : stringifyYaml(fileMetadata)}---\n` + fileContent; return fileContent; diff --git a/src/modals/MediaDbPreviewModal.ts b/src/modals/MediaDbPreviewModal.ts index 51268ca..6e4934d 100644 --- a/src/modals/MediaDbPreviewModal.ts +++ b/src/modals/MediaDbPreviewModal.ts @@ -1,70 +1,78 @@ -import { MarkdownRenderer, Modal, Setting, TFile } from "obsidian"; -import MediaDbPlugin from "src/main"; -import { MediaTypeModel } from "src/models/MediaTypeModel"; +import {ButtonComponent, MarkdownRenderer, Modal, Setting} from 'obsidian'; +import MediaDbPlugin from 'src/main'; +import {MediaTypeModel} from 'src/models/MediaTypeModel'; +import {PREVIEW_MODAL_DEFAULT_OPTIONS, PreviewModalData, PreviewModalOptions} from '../utils/ModalHelper'; +import {CreateNoteOptions} from '../utils/Utils'; export class MediaDbPreviewModal extends Modal { - selectedSearchResults: MediaTypeModel[]; - options: { attachTemplate: boolean, attachFile: TFile}; - submitCallback: (res: boolean) => void; - closeCallback: (err?: Error) => void; - plugin: MediaDbPlugin; - searchBtn: any; - cancelButton: any; - submitButton: any; - busy: any; + plugin: MediaDbPlugin; - constructor(plugin: MediaDbPlugin, mediaTypeModel: MediaTypeModel[], options: any) { - super(plugin.app); - this.plugin = plugin; - this.selectedSearchResults = mediaTypeModel; - this.options = options; - } + createNoteOptions: CreateNoteOptions; + elements: MediaTypeModel[]; + isBusy: boolean; + title: string; + cancelButton: ButtonComponent; + submitButton: ButtonComponent; - setSubmitCallback(submitCallback: (res: boolean) => void): void { - this.submitCallback = submitCallback; - } + submitCallback: (previewModalData: PreviewModalData) => void; + closeCallback: (err?: Error) => void; - setCloseCallback(closeCallback: (err?: Error) => void): void { - this.closeCallback = closeCallback; - } + constructor(plugin: MediaDbPlugin, previewModalOptions: PreviewModalOptions) { + previewModalOptions = Object.assign({}, PREVIEW_MODAL_DEFAULT_OPTIONS, previewModalOptions); - async preview(): Promise { - let { contentEl } = this; - for (let result of this.selectedSearchResults) { - let fileContent = await this.plugin.generateMediaDbNoteContents(result, { attachTemplate: this.options.attachTemplate, attachFile: this.options.attachFile }); - this.contentEl.createEl("h3", {text: result.englishTitle}); - const fileDiv = this.contentEl.createDiv(); - fileContent = `\n${fileContent}\n`; - MarkdownRenderer.renderMarkdown(fileContent, fileDiv, null, null); - } + super(plugin.app); - contentEl.createDiv({ cls: 'media-db-plugin-spacer' }); + this.plugin = plugin; + this.title = previewModalOptions.modalTitle; + this.elements = previewModalOptions.elements; + this.createNoteOptions = previewModalOptions.createNoteOptions; + } - const bottomSettingRow = new Setting(contentEl); - bottomSettingRow.addButton(btn => { - btn.setButtonText('Cancel'); - btn.onClick(() => this.closeCallback()); - btn.buttonEl.addClass('media-db-plugin-button'); - this.cancelButton = btn; - }); - bottomSettingRow.addButton(btn => { - btn.setButtonText('Ok'); - btn.setCta(); - btn.onClick(() => this.submitCallback(true)); - btn.buttonEl.addClass('media-db-plugin-button'); - this.submitButton = btn; - }) - } + setSubmitCallback(submitCallback: (previewModalData: PreviewModalData) => void): void { + this.submitCallback = submitCallback; + } - submit() { - if (!this.busy) { - this.busy = true; - this.submitButton.setButtonText('Creating entry...'); - this.submitCallback(true); - } - } + setCloseCallback(closeCallback: (err?: Error) => void): void { + this.closeCallback = closeCallback; + } - onOpen(): void { - this.preview() - } -} \ No newline at end of file + async preview(): Promise { + let {contentEl} = this; + contentEl.addClass('media-db-plugin-preview-modal'); + + contentEl.createEl('h2', {text: this.title}); + + const previewWrapper = contentEl.createDiv({cls: 'media-db-plugin-preview-wrapper'}); + + for (let result of this.elements) { + previewWrapper.createEl('h3', {text: result.englishTitle}); + const fileDiv = previewWrapper.createDiv(); + + let fileContent = await this.plugin.generateMediaDbNoteContents(result, this.createNoteOptions); + fileContent = `\n${fileContent}\n`; + + MarkdownRenderer.renderMarkdown(fileContent, fileDiv, null, null); + } + + contentEl.createDiv({cls: 'media-db-plugin-spacer'}); + + const bottomSettingRow = new Setting(contentEl); + bottomSettingRow.addButton(btn => { + btn.setButtonText('Cancel'); + btn.onClick(() => this.closeCallback()); + btn.buttonEl.addClass('media-db-plugin-button'); + this.cancelButton = btn; + }); + bottomSettingRow.addButton(btn => { + btn.setButtonText('Ok'); + btn.setCta(); + btn.onClick(() => this.submitCallback({confirmed: true})); + btn.buttonEl.addClass('media-db-plugin-button'); + this.submitButton = btn; + }); + } + + onOpen(): void { + this.preview(); + } +} diff --git a/src/modals/SelectModal.ts b/src/modals/SelectModal.ts index 5f726ee..b3a3a87 100644 --- a/src/modals/SelectModal.ts +++ b/src/modals/SelectModal.ts @@ -79,11 +79,11 @@ export abstract class SelectModal extends Modal { async onOpen() { const {contentEl} = this; + contentEl.addClass('media-db-plugin-select-modal'); + contentEl.createEl('h2', {text: this.title}); contentEl.createEl('p', {text: this.description}); - contentEl.addClass('media-db-plugin-select-modal'); - this.elementWrapper = contentEl.createDiv({cls: 'media-db-plugin-select-wrapper'}); this.elementWrapper.tabIndex = 0; diff --git a/src/settings/PropertyMappingModelComponent.svelte b/src/settings/PropertyMappingModelComponent.svelte index a0a3b68..6fe5227 100644 --- a/src/settings/PropertyMappingModelComponent.svelte +++ b/src/settings/PropertyMappingModelComponent.svelte @@ -46,16 +46,16 @@
- { /if } - { /if } + { /if } + { /if } - { /each } + { /each } { #if !validationResult?.res }
{validationResult?.err?.message}
- { /if } + { /if }