@matrajs/vue
@matrajs/vue
Vue 3 bindings for Matra: useEditor, useEditorState, useEditorFocus and
EditorContent.
npm i @matrajs/core @matrajs/vue
<script setup lang="ts">
import { starterKit } from '@matrajs/core'
import { EditorContent, useEditor, useEditorState } from '@matrajs/vue'
const editor = useEditor({ extensions: starterKit, content: '<p>Hello</p>' })
const isBold = useEditorState(editor, (e) => e.getHTML().includes('<strong>'))
</script>
<template>
<button :aria-pressed="isBold" @mousedown.prevent="editor.commands.toggleBold()">
Bold
</button>
<EditorContent :editor="editor" />
</template>
The editor is markRaw-ed on purpose: it is a mutable object with its own
change events, and putting it in Vue's reactivity graph would trace every
document node on every keystroke. Read from it with useEditorState.
MIT.
Related Packages
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.1.8 | ^3.4.0 | MIT | |
| 1.1.7 | ^3.4.0 | MIT | |
| 1.1.6 | ^3.4.0 | MIT | |
| 1.1.5 | ^3.4.0 | MIT | |
| 1.1.1 | ^3.4.0 | MIT | |
| 1.1.0 | ^3.4.0 | MIT | |
| 1.0.3 | ^3.4.0 | MIT | |
| 1.0.2 | ^3.4.0 | MIT | |
| 1.0.1 | ^3.4.0 | MIT | |
| 1.0.0 | ^3.4.0 | MIT | |
| 0.15.0 | ^3.4.0 | MIT | |
| 0.12.0 | ^3.4.0 | MIT | |
| 0.11.0 | ^3.4.0 | MIT | |
| 0.10.0 | ^3.4.0 | MIT | |
| 0.9.0 | ^3.4.0 | MIT | |
| 0.8.0 | ^3.4.0 | MIT | |
| 0.7.0 | ^3.4.0 | MIT | |
| 0.6.0 | ^3.4.0 | MIT | |
| 0.5.0 | ^3.4.0 | MIT | |
| 0.4.1 | ^3.4.0 | MIT | |
| 0.4.0 | ^3.4.0 | MIT | |
| 0.3.0 | ^3.4.0 | MIT | |
| 0.2.0 | ^3.4.0 | MIT |