mirror of
https://github.com/discourse/discourse.git
synced 2025-04-03 05:39:41 +08:00
18 lines
667 B
JavaScript
18 lines
667 B
JavaScript
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);
|
|
klass.reopen(mixin);
|
|
}
|
|
|
|
export function decorateCooked(container, cb) {
|
|
const postView = container.lookupFactory('view:post');
|
|
decorate(postView, 'postViewInserted', cb);
|
|
decorate(postView, 'postViewUpdated', cb);
|
|
decorate(ComposerEditor, 'previewRefreshed', cb);
|
|
decorate(container.lookupFactory('view:embedded-post'), 'didInsertElement', cb);
|
|
decorate(container.lookupFactory('view:user-stream'), 'didInsertElement', cb);
|
|
}
|