FIX: LazyYT was not being applied when a post was edited

This commit is contained in:
Robin Ward
2014-12-18 12:28:14 -05:00
parent f21d34df24
commit 2d3a9b334d
2 changed files with 12 additions and 3 deletions

View File

@ -1,11 +1,15 @@
var _decorateId = 0;
function decorate(klass, evt, cb) {
var mixin = {};
mixin["_decorate_" + new Date().getTime().toString()] = function($elem) { cb($elem); }.on(evt);
mixin["_decorate_" + (_decorateId++)] = function($elem) { cb($elem); }.on(evt);
klass.reopen(mixin);
}
export function decorateCooked(container, cb) {
decorate(Discourse.PostView, 'postViewInserted', cb);
var postView = container.lookupFactory('view:post');
decorate(postView, 'postViewInserted', cb);
decorate(postView, 'postViewUpdated', cb);
decorate(container.lookupFactory('view:composer'), 'previewRefreshed', cb);
decorate(container.lookupFactory('view:embedded-post'), 'previewRefreshed', cb);
decorate(container.lookupFactory('view:user-stream'), 'didInsertElement', cb);