diff --git a/frontend/src/components/OnlyOfficeEditor.tsx b/frontend/src/components/OnlyOfficeEditor.tsx index 2e8e14c..122003b 100644 --- a/frontend/src/components/OnlyOfficeEditor.tsx +++ b/frontend/src/components/OnlyOfficeEditor.tsx @@ -101,6 +101,21 @@ export default function OnlyOfficeEditor({ file, type, onClose }: OnlyOfficeEdit const docServerUrl = 'https://office.elijahkuntz.com/'; + // Add a diagnostic check to ensure the browser can reach the OnlyOffice server + useEffect(() => { + if (!config) return; + + // We try to fetch the api.js script to see if it's blocked by DNS/SSL/Brave Shields + const scriptUrl = `${docServerUrl}web-apps/apps/api/documents/api.js`; + fetch(scriptUrl, { mode: 'no-cors' }) + .then(() => { + console.log("OnlyOffice API script is reachable."); + }) + .catch((err) => { + setLoadError(`Browser cannot reach ${scriptUrl}. This is usually caused by: 1) Missing DNS record for office.elijahkuntz.com, 2) Invalid SSL Certificate, or 3) Browser blocking the connection (Brave Shields). Please check your browser's Developer Console (F12) for the exact network error.`); + }); + }, [config]); + const onDocumentReady = function (event: any) { console.log("Document is loaded"); }; @@ -138,6 +153,8 @@ export default function OnlyOfficeEditor({ file, type, onClose }: OnlyOfficeEdit config={config} events_onDocumentReady={onDocumentReady} onLoadComponentError={onLoadComponentError} + height="100%" + width="100%" /> )}