2022-07-03 20:47:08 -07:00
|
|
|
import { apiInitializer } from "discourse/lib/api";
|
2022-07-04 14:58:50 -07:00
|
|
|
import { action } from "@ember/object";
|
|
|
|
|
import showModal from "discourse/lib/show-modal";
|
2022-07-03 20:47:08 -07:00
|
|
|
|
2022-07-04 14:58:50 -07:00
|
|
|
export default apiInitializer("0.11.1", (api) => {
|
2022-07-19 16:33:10 -07:00
|
|
|
api.modifyClass("controller:composer", {
|
2022-07-04 14:58:50 -07:00
|
|
|
pluginId: "discourse-table-builder",
|
|
|
|
|
|
|
|
|
|
@action
|
2022-07-19 16:33:10 -07:00
|
|
|
showTableBuilder() {
|
|
|
|
|
showModal("insert-table-modal").setProperties({
|
|
|
|
|
toolbarEvent: this.toolbarEvent,
|
|
|
|
|
tableHtml: null,
|
|
|
|
|
});
|
2022-07-04 14:58:50 -07:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2022-07-19 16:33:10 -07:00
|
|
|
api.addToolbarPopupMenuOptionsCallback(() => {
|
|
|
|
|
return {
|
2022-07-04 14:58:50 -07:00
|
|
|
id: "table-builder",
|
2022-07-19 16:33:10 -07:00
|
|
|
action: "showTableBuilder",
|
2022-07-04 14:58:50 -07:00
|
|
|
icon: "table",
|
2022-07-19 16:33:10 -07:00
|
|
|
label: themePrefix("discourse_table_builder.composer.button"),
|
|
|
|
|
};
|
2022-07-04 14:58:50 -07:00
|
|
|
});
|
|
|
|
|
});
|