Merge pull request #12 from Arkshine/user-new-api

DEV: Switch to new addComposerToolbarPopupMenuOption plugin API
This commit is contained in:
Steven (Mon-Discourse) 2023-11-07 13:31:56 +01:00 committed by GitHub
commit 3f167f5242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 23 deletions

1
.discourse-compatibility Normal file
View File

@ -0,0 +1 @@
< 3.2.0.beta2: 1cc5d51137652c3977640f064739a08b1d1fe1be

View File

@ -59,31 +59,20 @@ api.onToolbarCreate(toolbar => {
});
// EXTRAS
api.addToolbarPopupMenuOptionsCallback(() => {
return {
action: "floatleft",
icon: "indent",
label: "float_left_button"
};
});
api.addToolbarPopupMenuOptionsCallback(() => {
return {
action: "columns",
icon: "columns",
label: "columns_button"
};
api.addComposerToolbarPopupMenuOption({
action: (toolbarEvent) => {
toolbarEvent.applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text");
},
icon: 'indent',
label: 'float_left_button',
});
api.modifyClass("controller:composer", {
pluginId: 'md-composer-extras',
actions: {
floatleft() {
this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text");
api.addComposerToolbarPopupMenuOption({
action: (toolbarEvent) => {
toolbarEvent.applySurround('[wrap="columns"]\n', '\n[/wrap]', "columns_text");
},
columns() {
this.get("toolbarEvent").applySurround('[wrap="columns"]\n', '\n[/wrap]', "columns_text");
}
}
icon: 'columns',
label: 'columns_button',
});
// TEXTS