mirror of
https://github.com/discourse/discourse-table-builder.git
synced 2026-09-16 23:02:13 -04:00
FEATURE: Ability to build a table in the composer
- Adds a button to the composer tools which triggers a modal window for a table builder - Table builder contains fields to add table contents, as well as buttons to align contents, and add additional tables/rows
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
import { apiInitializer } from "discourse/lib/api";
|
||||
import { action } from "@ember/object";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
|
||||
export default apiInitializer("0.11.1", (api) => {});
|
||||
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"),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user