Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/crutchcorn/codewrapper. A modular, framework-agnostic library for building interactive code editors codewrapper.vercel.app
Something went wrong. Try again.
1234567891011121314151617181920212223242526<script setup lang="ts">import { onUnmounted, shallowRef } from "vue";import { setCodeEditorElement, getCodeEditorState } from "@codewrapper/core";import { EditorView } from "@codemirror/view";
const view = shallowRef<EditorView>();const callback = (el: HTMLElement) => { if (!el) { return; } view.value = setCodeEditorElement(el as HTMLElement, getCodeEditorState());};
onUnmounted(() => { if (view.value) { view.value.destroy(); }});
defineExpose({ view });</script>
<template> <div :ref="callback as never" /></template>