Compare commits

...
2 Commits
Author SHA1 Message Date
Timi fb654fdaa4 export support prismjs language 2026-08-29 23:23:07 +08:00
Timi 5be15c49f2 fix pass-time-label event stop propagation 2026-08-29 23:22:42 +08:00
3 changed files with 33 additions and 2 deletions
+3 -2
View File
@@ -6,7 +6,7 @@
role="button" role="button"
tabindex="0" tabindex="0"
v-text="content" v-text="content"
@click="toggle" @click.stop="toggle"
@keydown.enter.space.prevent="toggle" @keydown.enter.space.prevent="toggle"
/> />
</template> </template>
@@ -45,8 +45,9 @@ const content = computed(() => {
return Time.toDateTime(timestamp.value); return Time.toDateTime(timestamp.value);
}); });
function toggle(): void { function toggle(event: MouseEvent | KeyboardEvent): void {
showingDetail.value = !showingDetail.value; showingDetail.value = !showingDetail.value;
event.stopPropagation();
} }
</script> </script>
+2
View File
@@ -5,5 +5,7 @@ export * from "./tiptap/shared";
export * from "./tiptap/extensions"; export * from "./tiptap/extensions";
export * from "./tiptap/useTiptapEditor"; export * from "./tiptap/useTiptapEditor";
export * from "./tiptap/useTiptapView"; export * from "./tiptap/useTiptapView";
export { supportedCodeLanguages } from "../utils/Prism";
export type { CodeLanguageOption } from "../utils/Prism";
export { default as PrismCodeBlock } from "./tiptap/PrismCodeBlock"; export { default as PrismCodeBlock } from "./tiptap/PrismCodeBlock";
export { enhancePrismCodeBlock } from "./tiptap/PrismCodeBlockView"; export { enhancePrismCodeBlock } from "./tiptap/PrismCodeBlockView";
+28
View File
@@ -18,6 +18,34 @@ import "prismjs/components/prism-sql";
import "prismjs/components/prism-typescript"; import "prismjs/components/prism-typescript";
import "prismjs/components/prism-yaml"; import "prismjs/components/prism-yaml";
/** Prism 已加载并支持语法高亮的代码语言。 */
export type CodeLanguageOption = {
label: string;
value: string;
};
/** 编辑器可用的代码语言,按名称首字母排序。 */
export const supportedCodeLanguages: CodeLanguageOption[] = [
{ label: "Apache Config", value: "apacheconf" },
{ label: "Bash", value: "bash" },
{ label: "CSS", value: "css" },
{ label: "HTML", value: "html" },
{ label: "INI", value: "ini" },
{ label: "Java", value: "java" },
{ label: "JavaScript", value: "javascript" },
{ label: "JSON", value: "json" },
{ label: "Less", value: "less" },
{ label: "Nginx", value: "nginx" },
{ label: "PHP", value: "php" },
{ label: "Properties", value: "properties" },
{ label: "Shell", value: "sh" },
{ label: "SQL", value: "sql" },
{ label: "TypeScript", value: "typescript" },
{ label: "Vue", value: "vue" },
{ label: "XML", value: "xml" },
{ label: "YAML", value: "yaml" }
];
const prismLanguageAliasMap: Record<string, string> = { const prismLanguageAliasMap: Record<string, string> = {
html: "markup", html: "markup",
xml: "markup", xml: "markup",