2022-07-03 23:47:08 -04:00
|
|
|
import { apiInitializer } from "discourse/lib/api";
|
2022-07-04 17:58:50 -04:00
|
|
|
import { action } from "@ember/object";
|
|
|
|
import showModal from "discourse/lib/show-modal";
|
2022-07-03 23:47:08 -04:00
|
|
|
|
2022-07-04 17:58:50 -04:00
|
|
|
export default apiInitializer("0.11.1", (api) => {
|
|
|
|
api.modifyClass("component:d-editor", {
|
|
|
|
pluginId: "discourse-table-builder",
|
|
|
|
|
|
|
|
@action
|
|
|
|
showTableBuilder(event) {
|
|
|
|
showModal("table-builder-modal").set("toolbarEvent", event);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
api.onToolbarCreate((toolbar) => {
|
|
|
|
toolbar.addButton({
|
|
|
|
id: "table-builder",
|
|
|
|
group: "insertions",
|
|
|
|
icon: "table",
|
|
|
|
sendAction: (event) => toolbar.context.send("showTableBuilder", event),
|
|
|
|
title: themePrefix("discourse_table_builder.composer.button"),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|