@hakulex/plugin-slash-menu
v0.4.0
Published
Slash command menu plugin for hakulex
Maintainers
Readme
@hakulex/plugin-slash-menu
在空白處打 / 插入區塊,繼續打字可以篩選。
hakulex 的一部分:給 Vue 3 的富文本編輯器,建立在 Lexical 上。這個套件的說明和可以操作的範例在 hakulex.dev/plugins/slash-menu。
安裝
pnpm add @hakulex/plugin-slash-menu @hakulex/editor lexical vue樣式
套件的程式不會自己載入樣式。在應用程式的進入點引入一次,放在 @hakulex/editor/style.css 之後。
import '@hakulex/plugin-slash-menu/style.css'使用
<script setup lang="ts">
import type { SerializedEditorState } from 'lexical'
import { RichEditor } from '@hakulex/editor'
import { SlashMenuPlugin } from '@hakulex/plugin-slash-menu'
import { shallowRef } from 'vue'
const doc = shallowRef<SerializedEditorState | null>(null)
</script>
<template>
<RichEditor v-model="doc" placeholder="打 / 插入區塊">
<SlashMenuPlugin />
</RichEditor>
</template>