1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-05 05:25:27 +02:00

improved markdown editing experience

This commit is contained in:
Harvey Kandola 2017-03-14 06:15:35 +00:00
parent bbf115b9b1
commit 0b51608383
7 changed files with 619 additions and 647 deletions

View file

@ -31,8 +31,6 @@ export default Ember.Component.extend(TooltipMixin, {
this._super(...arguments);
let self = this;
CodeMirror.modeURL = "/codemirror/mode/%N/%N.js";
let rawBody = this.get('meta.rawBody');
let cleanBody = rawBody.replace("</pre>", "");
@ -135,8 +133,9 @@ export default Ember.Component.extend(TooltipMixin, {
onAction(title) {
let page = this.get('page');
let meta = this.get('meta');
page.set('title', title);
meta.set('rawBody', this.getPRE());
page.set('title', title);
page.set('body', meta.get('rawBody'));
this.attrs.onAction(page, meta);
}

View file

@ -17,12 +17,11 @@ export default Ember.Component.extend({
didReceiveAttrs() {
this._super(...arguments);
if (this.get('isDestroyed') || this.get('isDestroying')) {
return;
}
CodeMirror.modeURL = "/codemirror/mode/%N/%N.js";
let page = this.get('page');
let rawBody = page.get('body');
let cleanBody = rawBody.replace("</pre>", "").replace('<pre class="code-mirror cm-s-solarized cm-s-dark" data-lang="', "");
@ -44,6 +43,7 @@ export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
if (this.get('isDestroyed') || this.get('isDestroying')) {
return;
}

View file

@ -34,36 +34,7 @@ export default Ember.Component.extend(TooltipMixin, {
init() {
this._super(...arguments);
// let self = this;
CodeMirror.modeURL = "/codemirror/mode/%N/%N.js";
this.set('pageBody', this.get('meta.rawBody').trim());
// let opts = [];
// let syntax = {
// mode: "markdown",
// name: "Markdown"
// };
// _.each(_.sortBy(CodeMirror.modeInfo, 'name'), function(item) {
// let i = {
// mode: item.mode,
// name: item.name
// };
// opts.pushObject(i);
// if (item.mode === syntax) {
// self.set('codeSyntax', i);
// }
// });
// this.set('syntaxOptions', opts);
// // default check
// if (is.null(this.get("codeSyntax"))) {
// this.set("codeSyntax", opts.findBy("mode", "markdown"));
// }
},
didInsertElement() {