mirror of
https://github.com/documize/community.git
synced 2025-08-08 06:55:28 +02:00
markdown s/s refactoring
This commit is contained in:
parent
9fca266423
commit
40d61d4146
4 changed files with 20 additions and 21 deletions
|
@ -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: {
|
||||
|
|
|
@ -33,3 +33,4 @@
|
|||
@import "section/trello.scss";
|
||||
@import "section/gemini.scss";
|
||||
@import "section/github.scss";
|
||||
@import "section/markdown.scss";
|
13
app/app/styles/section/markdown.scss
Normal file
13
app/app/styles/section/markdown.scss
Normal file
|
@ -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;
|
||||
}
|
|
@ -1,26 +1,11 @@
|
|||
<style>
|
||||
#markdown-editor {
|
||||
width: 100%;
|
||||
resize: none;
|
||||
padding: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
#markdown-preview {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background-color: white;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
{{#section/base-editor document=document folder=folder page=page isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
{{focus-textarea value=pageBody id="markdown-editor" class="mousetrap bordered"}}
|
||||
{{focus-textarea id="section-markdown-editor" class="mousetrap bordered" value=pageBody}}
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div id="markdown-preview" class="mousetrap bordered wysiwyg">
|
||||
<div id="section-markdown-preview" class="mousetrap bordered wysiwyg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue