Odoo18-Base/addons/html_editor/static/tests/_helpers/dispatch.js

16 lines
455 B
JavaScript
Raw Permalink Normal View History

2025-01-06 10:57:38 +07:00
function dispatchTo(editor, resourceId, ...args) {
(editor.resources[resourceId] || []).forEach((fn) => fn(...args));
}
export function dispatchNormalize(editor) {
dispatchTo(editor, "normalize_handlers", editor.editable);
}
export function dispatchClean(editor) {
dispatchTo(editor, "clean_handlers", editor.editable);
}
export function dispatchCleanForSave(editor, payload) {
dispatchTo(editor, "clean_for_save_handlers", payload);
}