1
0
silverbullet/web/cm_plugins/clean.ts

47 lines
1.5 KiB
TypeScript
Raw Normal View History

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";
import { blockquotePlugin } from "./block_quote.ts";
import { admonitionPlugin } from "./admonition.ts";
import { directivePlugin } from "./directive.ts";
import { hideHeaderMarkPlugin, hideMarksPlugin } from "./hide_mark.ts";
import { cleanBlockPlugin } from "./block.ts";
import { linkPlugin } from "./link.ts";
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";
export function cleanModePlugins(editor: Editor) {
return [
linkPlugin(),
2022-12-19 11:35:58 +00:00
directivePlugin(),
blockquotePlugin(),
admonitionPlugin(editor),
hideMarksPlugin(),
hideHeaderMarkPlugin(),
cleanBlockPlugin(),
2022-12-22 15:20:05 +00:00
fencedCodePlugin(editor),
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(editor),
cleanWikiLinkPlugin(editor),
2022-11-29 08:11:23 +00:00
cleanCommandLinkPlugin(editor),
] as Extension[];
}