mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 21:03:29 +03:00
fixed format and saving handling in markdown card
This commit is contained in:
parent
7e1c829df6
commit
b4b0921235
@ -69,6 +69,7 @@
|
|||||||
bottom:-9px;
|
bottom:-9px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
|
background-color:pink;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group:after {
|
.button-group:after {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import Component from 'ember-component';
|
import Component from 'ember-component';
|
||||||
|
import Object from 'ember-object';
|
||||||
import layout from '../../templates/components/card-markdown';
|
import layout from '../../templates/components/card-markdown';
|
||||||
import {formatMarkdown} from '../../lib/format-markdown';
|
import {formatMarkdown} from '../../lib/format-markdown';
|
||||||
import injectService from 'ember-service/inject';
|
import injectService from 'ember-service/inject';
|
||||||
import {invokeAction} from 'ember-invoke-action';
|
import {invokeAction} from 'ember-invoke-action';
|
||||||
import {isEmberArray} from 'ember-array/utils';
|
import {isEmberArray} from 'ember-array/utils';
|
||||||
import {isBlank} from 'ember-utils';
|
import {isBlank} from 'ember-utils';
|
||||||
import computed from 'ember-computed';
|
import computed, {alias} from 'ember-computed';
|
||||||
import observer from 'ember-metal/observer';
|
import observer from 'ember-metal/observer';
|
||||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||||
import run from 'ember-runloop';
|
import run from 'ember-runloop';
|
||||||
@ -25,17 +26,25 @@ export default Component.extend({
|
|||||||
ajax: injectService(),
|
ajax: injectService(),
|
||||||
|
|
||||||
editing: observer('isEditing', function () {
|
editing: observer('isEditing', function () {
|
||||||
// if (!this.isEditing) {
|
if (!this.isEditing) {
|
||||||
// this.set('preview', formatMarkdown([this.get('payload').markdown]));
|
this.set('preview', formatMarkdown([this.get('payload').markdown]));
|
||||||
// }
|
}
|
||||||
}),
|
}),
|
||||||
preview: computed('value', function() {
|
preview: computed('value', function() {
|
||||||
return formatMarkdown([this.get('payload').markdown]);
|
return formatMarkdown([this.get('payload').markdown]);
|
||||||
}),
|
}),
|
||||||
save: observer('doSave', function () {
|
save: observer('doSave', function () {
|
||||||
this.get('env').save(this.get('payload'), false);
|
let payload = this.get('payload');
|
||||||
|
payload.markdown = this.$('textarea').val();
|
||||||
|
this.set('value', this.$('textarea').val());
|
||||||
|
this.set('payload', payload);
|
||||||
|
this.get('env').save(payload, false);
|
||||||
|
this.set('isEditing', false);
|
||||||
}),
|
}),
|
||||||
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.set('value', this.get('payload').markdown);
|
||||||
|
},
|
||||||
_uploadStarted() {
|
_uploadStarted() {
|
||||||
invokeAction(this, 'uploadStarted');
|
invokeAction(this, 'uploadStarted');
|
||||||
},
|
},
|
||||||
@ -160,12 +169,6 @@ export default Component.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
updateValue() {
|
|
||||||
console.log("update value");
|
|
||||||
this.get('payload').markdown = this.$('textarea').val();
|
|
||||||
this.get('env').save(this.get('payload'), false);
|
|
||||||
this.set('preview', formatMarkdown([this.get('payload').markdown]));
|
|
||||||
},
|
|
||||||
|
|
||||||
fileSelected(fileList) {
|
fileSelected(fileList) {
|
||||||
// can't use array destructuring here as FileList is not a strict
|
// can't use array destructuring here as FileList is not a strict
|
||||||
|
Loading…
Reference in New Issue
Block a user