2022-07-03 20:47:08 -07:00
|
|
|
import { apiInitializer } from "discourse/lib/api";
|
2023-08-30 13:36:22 -07:00
|
|
|
import SpreadsheetEditor from "../components/spreadsheet-editor";
|
2022-07-03 20:47:08 -07:00
|
|
|
|
2023-10-27 10:57:07 +08:00
|
|
|
export default apiInitializer("1.13.0", (api) => {
|
2023-10-23 08:08:36 +08:00
|
|
|
const modal = api.container.lookup("service:modal");
|
2022-07-04 14:58:50 -07:00
|
|
|
|
2023-10-23 08:08:36 +08:00
|
|
|
api.addComposerToolbarPopupMenuOption({
|
|
|
|
|
icon: "table",
|
|
|
|
|
label: themePrefix("discourse_table_builder.composer.button"),
|
|
|
|
|
action: (toolbarEvent) => {
|
|
|
|
|
modal.show(SpreadsheetEditor, {
|
2023-08-30 13:36:22 -07:00
|
|
|
model: {
|
2023-10-23 08:08:36 +08:00
|
|
|
toolbarEvent,
|
2023-08-30 13:36:22 -07:00
|
|
|
tableTokens: null,
|
|
|
|
|
},
|
2022-07-19 16:33:10 -07:00
|
|
|
});
|
2022-07-04 14:58:50 -07:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|