hopefully fix #94

This commit is contained in:
Moritz Jung 2023-05-30 17:31:45 +02:00
parent b4d499e0e4
commit 15fc591b83
4 changed files with 16 additions and 6 deletions

View file

@ -112,7 +112,7 @@ export class OMDbAPI extends APIModel {
} }
const result = await fetchData.json(); const result = await fetchData.json();
console.debug(result); // console.debug(result);
if (result.Response === 'False') { if (result.Response === 'False') {
throw Error(`MDB | Received error from ${this.apiName}: ${result.Error}`); throw Error(`MDB | Received error from ${this.apiName}: ${result.Error}`);

View file

@ -47,16 +47,20 @@ export class MediaDbPreviewModal extends Modal {
const previewWrapper = contentEl.createDiv({ cls: 'media-db-plugin-preview-wrapper' }); const previewWrapper = contentEl.createDiv({ cls: 'media-db-plugin-preview-wrapper' });
this.markdownComponent.load();
for (const result of this.elements) { for (const result of this.elements) {
previewWrapper.createEl('h3', { text: result.englishTitle }); previewWrapper.createEl('h3', { text: result.englishTitle });
const fileDiv = previewWrapper.createDiv(); const fileDiv = previewWrapper.createDiv({ cls: 'media-db-plugin-preview'});
let fileContent = await this.plugin.generateMediaDbNoteContents(result, this.createNoteOptions); let fileContent = await this.plugin.generateMediaDbNoteContents(result, this.createNoteOptions);
fileContent = `\n${fileContent}\n`; fileContent = `\n${fileContent}\n`;
this.markdownComponent.load(); try {
await MarkdownRenderer.renderMarkdown(fileContent, fileDiv, "", this.markdownComponent);
MarkdownRenderer.renderMarkdown(fileContent, fileDiv, null, this.markdownComponent); } catch (e) {
console.warn(`mdb | error during rendering of preview`, e);
}
} }
contentEl.createDiv({ cls: 'media-db-plugin-spacer' }); contentEl.createDiv({ cls: 'media-db-plugin-spacer' });

View file

@ -78,7 +78,7 @@ export class MediaTypeManager {
if (!folderPath) { if (!folderPath) {
folderPath = `/`; folderPath = `/`;
} }
console.log(folderPath); // console.log(folderPath);
if (!(await app.vault.adapter.exists(folderPath))) { if (!(await app.vault.adapter.exists(folderPath))) {
await app.vault.createFolder(folderPath); await app.vault.createFolder(folderPath);

View file

@ -117,4 +117,10 @@ small.media-db-plugin-list-text {
/*outline: 1px solid white;*/ /*outline: 1px solid white;*/
} }
.media-db-plugin-preview {
border-radius: var(--modal-radius);
border: var(--modal-border-width) solid var(--modal-border-color);
padding: var(--size-4-4);
}
/* endregion */ /* endregion */