lexical-vue
Version:
An extensible Vue 3 web text-editor based on Lexical.
15 lines (14 loc) • 565 B
JavaScript
import { registerLexicalTextEntity } from "@lexical/text";
import { mergeRegister } from "@lexical/utils";
import { onMounted, onUnmounted } from "vue";
import { useLexicalComposer } from "./LexicalComposer.vine.js";
function useLexicalTextEntity(getMatch, targetNode, createNode) {
const editor = useLexicalComposer();
onMounted(()=>{
const unregister = mergeRegister(...registerLexicalTextEntity(editor, getMatch, targetNode, createNode));
onUnmounted(()=>{
unregister();
});
});
}
export { useLexicalTextEntity };