From 928aec96368bdb7456e2a52535f272f78ebeb244 Mon Sep 17 00:00:00 2001 From: Paul Webster Date: Sat, 5 Aug 2023 23:22:39 +1000 Subject: [PATCH] Added full-width style, switched off of the "readableLineLength" config option --- src/cookView.ts | 16 ++++++++++++---- src/styles.scss | 5 +++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/cookView.ts b/src/cookView.ts index 5000c9b..39a8892 100644 --- a/src/cookView.ts +++ b/src/cookView.ts @@ -23,10 +23,18 @@ export class CookView extends TextFileView { this.alarmAudio = new Howl({ src: [alarmMp3], loop: false, preload: true }); this.timerAudio = new Howl({ src: [timerMp3], loop: true, preload: true }); - // Add Preview Mode Container - this.previewEl = this.contentEl.createDiv({ cls: 'cook-preview-view', attr: { 'style': 'display: none' } }); - // Add Source Mode Container - this.sourceEl = this.contentEl.createDiv({ cls: 'cook-source-view', attr: { 'style': 'display: block' } }); + if ((this.app.vault as any).getConfig('readableLineLength')) { + // Add Preview Mode Container + this.previewEl = this.contentEl.createDiv({ cls: 'cook-preview-view', attr: { 'style': 'display: none' } }); + // Add Source Mode Container + this.sourceEl = this.contentEl.createDiv({ cls: 'cook-source-view', attr: { 'style': 'display: block' } }); + } + else { + // Add Source Mode Container + this.previewEl = this.contentEl.createDiv({ cls: 'cook-preview-view-full', attr: { 'style': 'display: none' } }); + // Add Source Mode Container + this.sourceEl = this.contentEl.createDiv({ cls: 'cook-source-view-full', attr: { 'style': 'display: block' } }); + } // Create CodeMirror Editor with specific config this.editor = CodeMirror.fromTextArea(this.sourceEl.createEl('textarea', { cls: 'cook-cm-editor' }), { lineNumbers: (this.app.vault as any).getConfig('showLineNumber'), diff --git a/src/styles.scss b/src/styles.scss index 5dcd487..a80b215 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -9,6 +9,11 @@ margin-left: auto; margin-right: auto; } + .cook-preview-view-full, + .cook-source-view-full { + margin-left: auto; + margin-right: auto; + } .main-image { width: 100vw;