mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
0439966587
closes: https://github.com/TryGhost/Ghost/issues/8179 - previously all cards just had a `__mobiledoc-card` class on them, this update replaces them with a class `kg-card` and adds an additional class of `kg-{{card_name}}`
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
import Component from 'ember-component';
|
|
import layout from '../templates/components/koenig-card';
|
|
import run from 'ember-runloop';
|
|
|
|
export default Component.extend({
|
|
layout,
|
|
init() {
|
|
this._super(...arguments);
|
|
this.set('isEditing', false);
|
|
},
|
|
didRender() {
|
|
// add the classname to the wrapping card as generated by mobiledoc.
|
|
// for some reason `this` on did render actually refers to the editor object and not the card object, after render it seems okay.
|
|
run.schedule('afterRender', this,
|
|
() => {
|
|
let {env: {name}} = this.get('card');
|
|
let mobiledocCard = this.$().parents('.__mobiledoc-card');
|
|
|
|
mobiledocCard.removeClass('__mobiledoc-card');
|
|
mobiledocCard.addClass('kg-card');
|
|
mobiledocCard.addClass(name ? `kg-${name}` : '');
|
|
}
|
|
);
|
|
},
|
|
actions: {
|
|
save() {
|
|
this.set('doSave', Date.now());
|
|
},
|
|
|
|
toggleState() {
|
|
this.set('isEditing', !this.get('isEditing'));
|
|
}
|
|
}
|
|
});
|