2024-02-29 22:23:05 +08:00
|
|
|
import type { ClickEvent } from "../../plug-api/types.ts";
|
2024-03-16 22:29:24 +08:00
|
|
|
import type { Extension } from "@codemirror/state";
|
2023-07-14 22:56:20 +08:00
|
|
|
import type { Client } from "../client.ts";
|
2022-11-18 23:04:37 +08:00
|
|
|
import { blockquotePlugin } from "./block_quote.ts";
|
2022-12-12 16:16:14 +08:00
|
|
|
import { admonitionPlugin } from "./admonition.ts";
|
2022-12-09 23:09:53 +08:00
|
|
|
import { hideHeaderMarkPlugin, hideMarksPlugin } from "./hide_mark.ts";
|
2022-11-18 23:04:37 +08:00
|
|
|
import { cleanBlockPlugin } from "./block.ts";
|
2022-11-28 23:42:54 +08:00
|
|
|
import { linkPlugin } from "./link.ts";
|
2022-11-18 23:04:37 +08: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 16:11:23 +08:00
|
|
|
import { cleanCommandLinkPlugin } from "./command_link.ts";
|
2022-12-22 23:20:05 +08:00
|
|
|
import { fencedCodePlugin } from "./fenced_code.ts";
|
2024-01-05 03:08:12 +08:00
|
|
|
import { frontmatterPlugin } from "./frontmatter.ts";
|
2024-06-26 21:55:56 +08:00
|
|
|
import { cleanEscapePlugin } from "./escapes.ts";
|
2024-10-05 21:37:36 +08:00
|
|
|
import { luaDirectivePlugin } from "./lua_directive.ts";
|
2024-12-14 16:57:46 +08:00
|
|
|
import { hashtagPlugin } from "./hashtag.ts";
|
2022-11-18 23:04:37 +08:00
|
|
|
|
2024-01-05 03:08:12 +08:00
|
|
|
export function cleanModePlugins(client: Client) {
|
2022-11-18 23:04:37 +08:00
|
|
|
return [
|
2024-01-05 03:08:12 +08:00
|
|
|
linkPlugin(client),
|
2022-12-09 23:09:53 +08:00
|
|
|
blockquotePlugin(),
|
2024-07-30 21:17:34 +08:00
|
|
|
admonitionPlugin(),
|
2022-12-09 23:09:53 +08:00
|
|
|
hideMarksPlugin(),
|
|
|
|
hideHeaderMarkPlugin(),
|
|
|
|
cleanBlockPlugin(),
|
2024-01-08 16:21:19 +08:00
|
|
|
frontmatterPlugin(),
|
2024-01-05 03:08:12 +08:00
|
|
|
fencedCodePlugin(client),
|
2022-11-18 23:04:37 +08:00
|
|
|
taskListPlugin({
|
|
|
|
// TODO: Move this logic elsewhere?
|
|
|
|
onCheckboxClick: (pos) => {
|
|
|
|
const clickEvent: ClickEvent = {
|
2024-01-24 21:44:39 +08:00
|
|
|
page: client.currentPage,
|
2022-11-18 23:04:37 +08:00
|
|
|
altKey: false,
|
|
|
|
ctrlKey: false,
|
|
|
|
metaKey: false,
|
|
|
|
pos: pos,
|
|
|
|
};
|
|
|
|
// Propagate click event from checkbox
|
2024-01-05 03:08:12 +08:00
|
|
|
client.dispatchAppEvent("page:click", clickEvent);
|
2022-11-18 23:04:37 +08:00
|
|
|
},
|
|
|
|
}),
|
2022-12-09 23:09:53 +08:00
|
|
|
listBulletPlugin(),
|
2024-01-05 03:08:12 +08:00
|
|
|
tablePlugin(client),
|
|
|
|
cleanWikiLinkPlugin(client),
|
|
|
|
cleanCommandLinkPlugin(client),
|
2024-06-26 21:55:56 +08:00
|
|
|
cleanEscapePlugin(),
|
2024-10-05 21:37:36 +08:00
|
|
|
luaDirectivePlugin(client),
|
2024-12-14 16:57:46 +08:00
|
|
|
hashtagPlugin(),
|
2022-11-18 23:04:37 +08:00
|
|
|
] as Extension[];
|
|
|
|
}
|