// components/strict-readonly-editor.js import React, { useRef } from "react"; import { Editor } from "@tinymce/tinymce-react"; function StrictReadOnlyEditor(props) { const editorRef = useRef(null); const handleInit = (evt, editor) => { editorRef.current = editor; // Disable all possible editing events const disableEvents = ['keydown', 'keyup', 'keypress', 'input', 'paste', 'drop', 'cut', 'copy']; disableEvents.forEach(eventType => { editor.on(eventType, (e) => { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); return false; }); }); // Disable mouse events that might allow editing editor.on('mousedown mousemove mouseup click dblclick', (e) => { if (e.target.closest('.mce-content-body')) { e.preventDefault(); e.stopPropagation(); return false; } }); // Disable focus events editor.on('focus blur', (e) => { e.preventDefault(); e.stopPropagation(); return false; }); }; return ( ); } export default StrictReadOnlyEditor;