Files
halo/ui/packages/editor/README.md
Ryan Wang a204fbc86a Refactor editor package (#7968)
* 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>
2025-11-28 13:02:34 +08:00

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

License

GPL-3.0