Skip to content

Commit

Permalink
Added full-width style, switched off of the "readableLineLength" conf…
Browse files Browse the repository at this point in the history
…ig option
  • Loading branch information
pjwebster committed Aug 5, 2023
1 parent 2c0a759 commit 928aec9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/cookView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
5 changes: 5 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 928aec9

Please sign in to comment.