this.currentPage = Math.max(1,parseInt(window.location.hash.substring(1))) || 1;
this.editor = null;
this.contentMarkdown = null;
+ this.theme = false;
+ this.options = {};
this.init()
}
this.versions = new MarkdowneditorVersions(this);
this.zoom = new MarkdowneditorZoom(this);
+ this.options = {
+ el: document.querySelector('#editor'),
+ initialEditType: 'wysiwyg',
+ previewStyle: 'vertical',
+ theme: this.theme,
+ cursorToEnd: false,
+ autofocus: false,
+ toolbarItems: [
+ ['heading', 'bold', 'italic'],
+ ['hr', 'quote'],
+ ['ul'],
+ ['table', 'image', 'link'],
+ ['scrollSync'],
+ ]
+ }
+
this.open = false
this.savedScroll = null;
}
}, true);
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
+ $this.editor.destroy()
+ $this.editor = new Editor({ ...$this.options, theme: 'dark' })
+ $this.changePage($this.currentPage)
+ }
+
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
+ const newColorScheme = event.matches ? "dark" : "light";
+ $this.save.save()
+ $this.editor.destroy()
+ $this.editor = new Editor({ ...$this.options, theme: newColorScheme })
+ $this.changePage($this.currentPage)
+ });
+
$(window).on('hashchange', function () {
/*if ($this.maskHashEvent) {
return;
},
markdown: function() {
- this.editor = new Editor({
- el: document.querySelector('#editor'),
- initialEditType: 'wysiwyg',
- previewStyle: 'vertical',
- theme: 'dark',
- cursorToEnd: false,
- autofocus: false,
- toolbarItems: [
- ['heading', 'bold', 'italic'],
- ['hr', 'quote'],
- ['ul'],
- ['table', 'image', 'link'],
- ['scrollSync'],
- ]
- });
+ this.editor = new Editor(this.options);
this.editor.getMarkdown();
},
.ProseMirror,
.toastui-editor-md-preview
@include tinyscrollbars
+
+.toastui-editor-dark
+ .toastui-editor-defaultUI-toolbar
+ .scroll-sync.active::before
+ color: #bbb !important
+ input:checked + .switch::before
+ background-color: #bbb !important
+ .toastui-editor-defaultUI-toolbar,
+ .toastui-editor-md-container,
+ .toastui-editor-ww-container
+ @include dark-theme
+ background-color: #222 !important
+
+ .toastui-editor-mode-switch
+ @include dark-theme
+ background-color: #444 !important
+ .tab-item
+ @include dark-theme
+ background-color: transparent !important
+ color: #bbb !important
+ &.active
+ @include dark-theme
+ background-color: #222 !important
+ border-top-color: #222 !important