2022-11-18 15:04:37 +00:00
|
|
|
import type { ClickEvent } from "../../plug-api/app_event.ts";
|
|
|
|
import type { Extension } from "../deps.ts";
|
|
|
|
import { Editor } from "../editor.tsx";
|
|
|
|
import { blockquotePlugin } from "./block_quote.ts";
|
|
|
|
import { directivePlugin } from "./directive.ts";
|
|
|
|
import { hideHeaderMarkPlugin, hideMarks } from "./hide_mark.ts";
|
|
|
|
import { cleanBlockPlugin } from "./block.ts";
|
2022-11-28 15:42:54 +00:00
|
|
|
import { linkPlugin } from "./link.ts";
|
2022-11-18 15:04:37 +00:00
|
|
|
import { listBulletPlugin } from "./list.ts";
|
|
|
|
import { tablePlugin } from "./table.ts";
|
|
|
|
import { taskListPlugin } from "./task.ts";
|
|
|
|
import { cleanWikiLinkPlugin } from "./wiki_link.ts";
|
|
|
|
|
|
|
|
export function cleanModePlugins(editor: Editor) {
|
|
|
|
return [
|
2022-11-28 15:42:54 +00:00
|
|
|
linkPlugin(editor),
|
2022-11-18 15:04:37 +00:00
|
|
|
directivePlugin,
|
|
|
|
blockquotePlugin,
|
|
|
|
hideMarks(),
|
|
|
|
hideHeaderMarkPlugin,
|
|
|
|
cleanBlockPlugin,
|
|
|
|
taskListPlugin({
|
|
|
|
// TODO: Move this logic elsewhere?
|
|
|
|
onCheckboxClick: (pos) => {
|
|
|
|
const clickEvent: ClickEvent = {
|
|
|
|
page: editor.currentPage!,
|
|
|
|
altKey: false,
|
|
|
|
ctrlKey: false,
|
|
|
|
metaKey: false,
|
|
|
|
pos: pos,
|
|
|
|
};
|
|
|
|
// Propagate click event from checkbox
|
|
|
|
editor.dispatchAppEvent("page:click", clickEvent);
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
listBulletPlugin,
|
|
|
|
tablePlugin,
|
2022-11-28 15:42:54 +00:00
|
|
|
cleanWikiLinkPlugin(editor),
|
2022-11-18 15:04:37 +00:00
|
|
|
] as Extension[];
|
|
|
|
}
|