2022-11-18 15:04:37 +00:00
|
|
|
import type { ClickEvent } from "../../plug-api/app_event.ts";
|
|
|
|
import type { Extension } from "../deps.ts";
|
2023-07-14 12:22:26 +00:00
|
|
|
import type { Editor } from "../editor.ts";
|
2022-11-18 15:04:37 +00:00
|
|
|
import { blockquotePlugin } from "./block_quote.ts";
|
2022-12-12 08:16:14 +00:00
|
|
|
import { admonitionPlugin } from "./admonition.ts";
|
2022-11-18 15:04:37 +00:00
|
|
|
import { directivePlugin } from "./directive.ts";
|
2022-12-09 15:09:53 +00:00
|
|
|
import { hideHeaderMarkPlugin, hideMarksPlugin } from "./hide_mark.ts";
|
2022-11-18 15:04:37 +00:00
|
|
|
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";
|
2022-11-29 08:11:23 +00:00
|
|
|
import { cleanCommandLinkPlugin } from "./command_link.ts";
|
2022-12-22 15:20:05 +00:00
|
|
|
import { fencedCodePlugin } from "./fenced_code.ts";
|
2022-11-18 15:04:37 +00:00
|
|
|
|
|
|
|
export function cleanModePlugins(editor: Editor) {
|
|
|
|
return [
|
2023-05-23 18:53:53 +00:00
|
|
|
linkPlugin(),
|
2022-12-19 11:35:58 +00:00
|
|
|
directivePlugin(),
|
2022-12-09 15:09:53 +00:00
|
|
|
blockquotePlugin(),
|
2022-12-12 08:16:14 +00:00
|
|
|
admonitionPlugin(editor),
|
2022-12-09 15:09:53 +00:00
|
|
|
hideMarksPlugin(),
|
|
|
|
hideHeaderMarkPlugin(),
|
|
|
|
cleanBlockPlugin(),
|
2022-12-22 15:20:05 +00:00
|
|
|
fencedCodePlugin(editor),
|
2022-11-18 15:04:37 +00:00
|
|
|
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);
|
|
|
|
},
|
|
|
|
}),
|
2022-12-09 15:09:53 +00:00
|
|
|
listBulletPlugin(),
|
|
|
|
tablePlugin(editor),
|
2022-11-28 15:42:54 +00:00
|
|
|
cleanWikiLinkPlugin(editor),
|
2022-11-29 08:11:23 +00:00
|
|
|
cleanCommandLinkPlugin(editor),
|
2022-11-18 15:04:37 +00:00
|
|
|
] as Extension[];
|
|
|
|
}
|