Skip to content

Commit 8b1faba

Browse files
committed
MC-3305: Architectural Review for MC-1416
Move events out to separate module and use camel case
1 parent 9c46fb7 commit 8b1faba

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/wysiwyg.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/wysiwyg.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import $ from "jquery";
77
import WysiwygSetup from "mage/adminhtml/wysiwyg/tiny_mce/setup";
8+
import wysiwygEvents from "mage/adminhtml/wysiwyg/events";
89
import events from "Magento_PageBuilder/js/events";
910
import _ from "underscore";
1011
import WysiwygInstance from "wysiwygAdapter";
@@ -111,7 +112,7 @@ export default class Wysiwyg {
111112
*/
112113
public onEdit(callback: () => void) {
113114
this.wysiwygAdapter.eventBus.attachEventHandler(
114-
this.wysiwygAdapter.EVENT.AFTER_CONTENT_CHANGE,
115+
wysiwygEvents.afterChangeContent,
115116
_.debounce(callback, 100),
116117
);
117118
}
@@ -121,7 +122,7 @@ export default class Wysiwyg {
121122
*/
122123
public onFocus(callback: () => void) {
123124
this.wysiwygAdapter.eventBus.attachEventHandler(
124-
this.wysiwygAdapter.EVENT.AFTER_FOCUS,
125+
wysiwygEvents.afterFocus,
125126
callback,
126127
);
127128
}
@@ -131,7 +132,7 @@ export default class Wysiwyg {
131132
*/
132133
public onBlur(callback: () => void) {
133134
this.wysiwygAdapter.eventBus.attachEventHandler(
134-
this.wysiwygAdapter.EVENT.AFTER_BLUR,
135+
wysiwygEvents.afterBlur,
135136
callback,
136137
);
137138
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
declare var wysiwygEvents: {
7+
afterInitialization: 'afterInitialization',
8+
afterChangeContent: 'afterChangeContent',
9+
afterUndo: 'afterUndo',
10+
afterPaste: 'afterPaste',
11+
beforeSetContent: 'beforeSetContent',
12+
afterSetContent: 'afterSetContent',
13+
afterSave: 'afterSave',
14+
afterOpenFileBrowser: 'afterOpenFileBrowser',
15+
afterFormSubmit: 'afterFormSubmit',
16+
afterBlur: 'afterBlur',
17+
afterFocus: 'afterFocus'
18+
};
19+
20+
declare module "mage/adminhtml/wysiwyg/events" {
21+
export = wysiwygEvents;
22+
}

0 commit comments

Comments
 (0)