From 40d61d41468a94f6259d818e478acb0f606ad42c Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Sun, 5 Jun 2016 14:12:13 +0100 Subject: [PATCH] markdown s/s refactoring --- .../section/markdown/type-editor.js | 8 ++++---- app/app/styles/app.scss | 1 + app/app/styles/section/markdown.scss | 13 +++++++++++++ .../section/markdown/type-editor.hbs | 19 ++----------------- 4 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 app/app/styles/section/markdown.scss diff --git a/app/app/components/section/markdown/type-editor.js b/app/app/components/section/markdown/type-editor.js index 6912ecb5..93facefd 100644 --- a/app/app/components/section/markdown/type-editor.js +++ b/app/app/components/section/markdown/type-editor.js @@ -10,19 +10,19 @@ export default Ember.Component.extend({ didInsertElement() { let height = $(document).height() - $(".document-editor > .toolbar").height() - 130; - $("#markdown-editor, #markdown-preview").css("height", height); + $("#section-markdown-editor, #section-markdown-preview").css("height", height); this.renderPreview(); let self = this; - $("#markdown-editor").off("keyup").on("keyup", function() { + $("#section-markdown-editor").off("keyup").on("keyup", function() { self.renderPreview(); self.set('isDirty', true); }); }, willDestroyElement() { - $("#markdown-editor").off("keyup"); + $("#section-markdown-editor").off("keyup"); }, renderPreview() { @@ -30,7 +30,7 @@ export default Ember.Component.extend({ linkify: true }); let result = md.render(this.get("pageBody")); - $("#markdown-preview").html(result); + $("#section-markdown-preview").html(result); }, actions: { diff --git a/app/app/styles/app.scss b/app/app/styles/app.scss index 321a5207..33b78293 100644 --- a/app/app/styles/app.scss +++ b/app/app/styles/app.scss @@ -33,3 +33,4 @@ @import "section/trello.scss"; @import "section/gemini.scss"; @import "section/github.scss"; +@import "section/markdown.scss"; \ No newline at end of file diff --git a/app/app/styles/section/markdown.scss b/app/app/styles/section/markdown.scss new file mode 100644 index 00000000..19e0cb48 --- /dev/null +++ b/app/app/styles/section/markdown.scss @@ -0,0 +1,13 @@ +#section-markdown-editor { + width: 100%; + resize: none; + padding: 10px; + background-color: white; +} + +#section-markdown-preview { + width: 100%; + padding: 10px; + background-color: white; + overflow: auto; +} diff --git a/app/app/templates/components/section/markdown/type-editor.hbs b/app/app/templates/components/section/markdown/type-editor.hbs index 30a39071..3c53b789 100644 --- a/app/app/templates/components/section/markdown/type-editor.hbs +++ b/app/app/templates/components/section/markdown/type-editor.hbs @@ -1,26 +1,11 @@ - - {{#section/base-editor document=document folder=folder page=page isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
- {{focus-textarea value=pageBody id="markdown-editor" class="mousetrap bordered"}} + {{focus-textarea id="section-markdown-editor" class="mousetrap bordered" value=pageBody}}
-
+