"use client"; import { Editor } from "@tinymce/tinymce-react"; import React, { useRef } from "react"; const TinyEditor = () => { const editorRef = useRef(null); const handleEditorChange = (content, editor) => { console.log("Content was updated:", content); }; // 添加一个函数来以编程的方式插入文本 const insertTextAtCursor = (text) => { const editor = editorRef.current; if (editor) { editor.insertContent(text); // 使用 insertContent 方法插入文本 } }; return ( ); }; export default TinyEditor;