Commit 0512f59a authored by Denys Mishunov's avatar Denys Mishunov Committed by Jacques Erasmus

Re-order the arguments list to onSetup

parent 08f06466
......@@ -16,11 +16,11 @@ export class MyFancyExtension {
* actions, keystrokes, update options, etc.
* Is called only once before the extension gets registered
*
* @param { Object } [setupOptions] The setupOptions object
* @param { Object } [instance] The Source Editor instance
* @param { Object } [setupOptions] The setupOptions object
*/
// eslint-disable-next-line class-methods-use-this,no-unused-vars
onSetup(setupOptions, instance) {}
onSetup(instance, setupOptions) {}
/**
* The first thing called after the extension is
......
......@@ -153,7 +153,7 @@ export default class EditorInstance {
const extensionInstance = new EditorExtension(extension);
const { setupOptions, obj: extensionObj } = extensionInstance;
if (extensionObj.onSetup) {
extensionObj.onSetup(setupOptions, this);
extensionObj.onSetup(this, setupOptions);
}
if (extensionsStore) {
this.registerExtension(extensionInstance, extensionsStore);
......
......@@ -31,7 +31,7 @@ export const SEConstExt = () => {
export function SEWithSetupExt() {
return {
onSetup: (setupOptions = {}, instance) => {
onSetup: (instance, setupOptions = {}) => {
if (setupOptions && !Array.isArray(setupOptions)) {
Object.entries(setupOptions).forEach(([key, value]) => {
Object.assign(instance, {
......
......@@ -424,7 +424,7 @@ describe('Source Editor Instance', () => {
definition: MyFullExtWithCallbacks,
setupOptions: defSetupOptions,
});
expect(onSetup).toHaveBeenCalledWith(defSetupOptions, seInstance);
expect(onSetup).toHaveBeenCalledWith(seInstance, defSetupOptions);
expect(onUse).toHaveBeenCalledWith(seInstance);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment