mirror of
https://github.com/discourse/discourse-table-builder.git
synced 2026-10-01 13:03:55 -04:00
DEV: Switch to new addComposerToolbarPopupMenuOption plugin API (#66)
Why this change? `api.addToolbarPopupMenuOptionsCallback` has been deprecated in https://github.com/discourse/discourse/commit/913fd3a7b392b492f6344102577960a6eada00ce
This commit is contained in:
@@ -1,30 +1,19 @@
|
||||
import { apiInitializer } from "discourse/lib/api";
|
||||
import SpreadsheetEditor from "../components/spreadsheet-editor";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default apiInitializer("0.11.1", (api) => {
|
||||
api.modifyClass("controller:composer", {
|
||||
pluginId: "discourse-table-builder",
|
||||
modal: service(),
|
||||
export default apiInitializer("1.15.0", (api) => {
|
||||
const modal = api.container.lookup("service:modal");
|
||||
|
||||
@action
|
||||
showTableBuilder() {
|
||||
this.modal.show(SpreadsheetEditor, {
|
||||
api.addComposerToolbarPopupMenuOption({
|
||||
icon: "table",
|
||||
label: themePrefix("discourse_table_builder.composer.button"),
|
||||
action: (toolbarEvent) => {
|
||||
modal.show(SpreadsheetEditor, {
|
||||
model: {
|
||||
toolbarEvent: this.toolbarEvent,
|
||||
toolbarEvent,
|
||||
tableTokens: null,
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
api.addToolbarPopupMenuOptionsCallback(() => {
|
||||
return {
|
||||
id: "table-builder",
|
||||
action: "showTableBuilder",
|
||||
icon: "table",
|
||||
label: themePrefix("discourse_table_builder.composer.button"),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user