Compare commits
2
Commits
cf62eb2d41
...
fb654fdaa4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb654fdaa4 | ||
|
|
5be15c49f2 |
@@ -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>
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user