3.0.0原版

This commit is contained in:
anian
2026-03-16 00:03:35 +08:00
commit ac569b2a57
105 changed files with 14437 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
<script lang="ts" setup>
import '@halo-dev/comment-widget';
defineProps<{
content: string;
}>();
</script>
<template>
<comment-content :content="content"></comment-content>
</template>
+33
View File
@@ -0,0 +1,33 @@
<script lang="ts" setup>
import '@halo-dev/comment-widget';
import type { CommentEditor } from '@halo-dev/comment-widget';
import { onMounted, ref } from 'vue';
const props = defineProps<{
autoFocus?: boolean;
}>();
const emit =
defineEmits<
(e: 'update', content: { content: string; characterCount: number }) => void
>();
const editorRef = ref<InstanceType<typeof CommentEditor>>();
onMounted(() => {
if (props.autoFocus) {
editorRef.value?.setFocus();
}
editorRef.value?.addEventListener('update', (e) => {
const detail = (e as CustomEvent).detail;
emit('update', {
content: detail.content,
characterCount: detail.characterCount ?? 0,
});
});
});
</script>
<template>
<comment-editor ref="editorRef" keep-alive></comment-editor>
</template>
+29
View File
@@ -0,0 +1,29 @@
import { VLoading } from '@halo-dev/components';
import { definePlugin } from '@halo-dev/console-shared';
import { defineAsyncComponent, markRaw } from 'vue';
export default definePlugin({
components: {},
routes: [],
extensionPoints: {
'comment:editor:replace': () => {
return {
component: markRaw(
defineAsyncComponent({
loader: () => import('./components/Editor.vue'),
loadingComponent: VLoading,
})
),
};
},
'comment:list-item:content:replace': () => {
return {
component: markRaw(
defineAsyncComponent({
loader: () => import('./components/Content.vue'),
})
),
};
},
},
});