FIX: Have the preview refreshed event fire by decorateCooked

This commit is contained in:
Robin Ward 2015-11-10 13:26:12 -05:00
parent f85d848649
commit 395d01c5f9
3 changed files with 5 additions and 4 deletions

View File

@ -89,7 +89,6 @@ export default Ember.Component.extend({
_renderUnseen: function($preview, unseen) {
fetchUnseenMentions($preview, unseen, this.siteSettings).then(() => {
linkSeenMentions($preview, this.siteSettings);
this.trigger('previewRefreshed', $preview);
});
},
@ -349,6 +348,7 @@ export default Ember.Component.extend({
// Paint oneboxes
$('a.onebox', $preview).each((i, e) => Discourse.Onebox.load(e, refresh));
this.trigger('previewRefreshed', $preview);
},
}
});

View File

@ -1,5 +1,6 @@
let _decorateId = 0;
import ComposerEditor from 'discourse/components/composer-editor';
let _decorateId = 0;
function decorate(klass, evt, cb) {
const mixin = {};
mixin["_decorate_" + (_decorateId++)] = function($elem) { cb($elem); }.on(evt);
@ -10,7 +11,7 @@ export function decorateCooked(container, cb) {
const postView = container.lookupFactory('view:post');
decorate(postView, 'postViewInserted', cb);
decorate(postView, 'postViewUpdated', cb);
decorate(container.lookupFactory('view:composer'), 'previewRefreshed', cb);
decorate(ComposerEditor, 'previewRefreshed', cb);
decorate(container.lookupFactory('view:embedded-post'), 'didInsertElement', cb);
decorate(container.lookupFactory('view:user-stream'), 'didInsertElement', cb);
}

View File

@ -4,7 +4,7 @@ import { headerHeight } from 'discourse/views/header';
import { default as computed, on, observes } from 'ember-addons/ember-computed-decorators';
import Composer from 'discourse/models/composer';
const ComposerView = Ember.View.extend(Ember.Evented, {
const ComposerView = Ember.View.extend({
_lastKeyTimeout: null,
elementId: 'reply-control',
classNameBindings: ['composer.creatingPrivateMessage:private-message',