Skip to content

Astro

An .astro component that renders <owe-editor>. It works with plain form posts and needs no UI framework.

On this page

Install

Terminal
npm install @open-wysiwyg-editor/astro

Usage

---
import { RichTextEditor } from "@open-wysiwyg-editor/astro";
---

<form method="post" action="/api/save">
  <label for="body">Article</label>
  <RichTextEditor id="body" name="body" value="<p>Hello <strong>world</strong></p>" />
  <button>Save</button>
</form>

Good to know

  • The component imports its own script and styles, so there is nothing else to add.
  • The server renders only the <owe-editor> element, with the initial HTML in an escaped value attribute. The field works with a plain form post in static and server output.

Always sanitize on the server

The editor sanitizes what it loads and produces, but that is not a security boundary: anyone can post any string to your API. Sanitize the HTML again with a library you trust before you store it or render it for other users.

Edit this page on GitHub