diff --git a/app/assets/javascripts/02-editor.js b/app/assets/javascripts/02-editor.js index c814896d..dfbb3f7a 100644 --- a/app/assets/javascripts/02-editor.js +++ b/app/assets/javascripts/02-editor.js @@ -479,6 +479,8 @@ function stringifyAllowedStyle (element) { document.addEventListener("turbolinks:load", () => { for (const editorEl of document.querySelectorAll(".editor")) { + if (!editorEl.querySelector('.editor-toolbar')) continue + setupEditor(editorEl) } }) diff --git a/app/assets/stylesheets/editor.scss b/app/assets/stylesheets/editor.scss index 3f60486a..4b89cf1a 100644 --- a/app/assets/stylesheets/editor.scss +++ b/app/assets/stylesheets/editor.scss @@ -50,14 +50,12 @@ } } - .editor-content { - word-wrap: break-word; - div[data-align="left"] { text-align: left; } - div[data-align="center"] { text-align: center; } - div[data-align="right"] { text-align: right; } + word-wrap: break-word; + div[data-align="left"] { text-align: left; } + div[data-align="center"] { text-align: center; } + div[data-align="right"] { text-align: right; } - min-height: 480px; - } + min-height: 480px; *[data-editor-loading] { opacity: 0.5; diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 405b9c7e..9b4fb8a0 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -33,5 +33,5 @@ - @post.attributes.each do |attr| - next if @post.send(attr).front_matter? - %section{ id: attr, dir: dir } + %section.editor{ id: attr, dir: dir } = @post.send(attr).to_s.html_safe