mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
* Move extensions Signed-off-by: Ryan Wang <i@ryanc.cc> * Refactor editor extensions to use explicit naming * Refactor attachment selector integration in editor * Remove vue-demi from Vite external dependencies * Add README for richtext-editor package * Refactor attachment composable and update upload permissions * Refactor editor i18n keys and move upload strings * Refactor AllExtensions to ExtensionsKit and update usage * Move heading id attribute to extension implementation * Refactor i18n usage to use i18n.global.t * Update README to reflect changes in editor extensions, replacing AllExtensions with ExtensionsKit --------- Signed-off-by: Ryan Wang <i@ryanc.cc>
1.3 KiB
1.3 KiB
@halo-dev/richtext-editor
The default editor for Halo, built with Tiptap + ProseMirror.
⚠️ This package is not suitable for general editor use cases, as it is tightly coupled with Halo and uses some of Halo's built-in tools and shared dependencies. However, you can use it in Halo plugins just like you would use it in Halo itself.
Installation
In Halo plugins:
pnpm install @halo-dev/richtext-editor
Usage
<script setup lang="ts">
import {
ExtensionsKit,
RichTextEditor,
VueEditor,
} from "@halo-dev/richtext-editor";
import { onMounted, ref, shallowRef } from "vue";
const editor = shallowRef<VueEditor>();
const content = ref("Hello World");
onMounted(() => {
editor.value = new VueEditor({
content: content.value,
extensions: [ExtensionsKit],
parseOptions: {
preserveWhitespace: true,
},
onUpdate: () => {
content.value = editor.value?.getHTML() || "";
},
});
});
</script>
<template>
<RichTextEditor v-if="editor" :editor="editor" />
</template>
Requirements
- Vue 3.5.x or higher
- Halo plugin environment
Links
License
GPL-3.0