discourse-table-builder/javascripts/discourse/api-initializers/table-builder.js

25 lines
702 B
JavaScript
Raw Permalink Normal View History

2022-07-03 23:47:08 -04:00
import { apiInitializer } from "discourse/lib/api";
import { action } from "@ember/object";
import showModal from "discourse/lib/show-modal";
2022-07-03 23:47:08 -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"),
});
});
});