feat: hide ONLYOFFICE logo via direct CSS patch + iframe injection + init script for persistence
This commit is contained in:
@@ -50,6 +50,7 @@ services:
|
|||||||
- onlyoffice_data:/var/www/onlyoffice/Data
|
- onlyoffice_data:/var/www/onlyoffice/Data
|
||||||
- onlyoffice_logs:/var/log/onlyoffice
|
- onlyoffice_logs:/var/log/onlyoffice
|
||||||
- onlyoffice_cache:/var/lib/onlyoffice
|
- onlyoffice_cache:/var/lib/onlyoffice
|
||||||
|
- ./onlyoffice-init.sh:/app/ds/run-document-server-before.sh:ro
|
||||||
networks:
|
networks:
|
||||||
- cvnet
|
- cvnet
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
24
onlyoffice-init.sh
Normal file
24
onlyoffice-init.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ONLYOFFICE init script - runs before the document server starts
|
||||||
|
# Hides the ONLYOFFICE logo from the editor header
|
||||||
|
|
||||||
|
CSS_FILE=/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/main/resources/css/app.css
|
||||||
|
if [ -f "$CSS_FILE" ]; then
|
||||||
|
# Check if already patched
|
||||||
|
if ! grep -q 'display:none!important' <<< "$(grep '#header-logo{' "$CSS_FILE" | head -1)"; then
|
||||||
|
sed -i 's/#header-logo{/#header-logo{display:none!important;/g' "$CSS_FILE"
|
||||||
|
echo "[onlyoffice-init] Patched app.css to hide logo"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Also patch the spreadsheet and presentation editors if they exist
|
||||||
|
for CSS in \
|
||||||
|
/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/main/resources/css/app.css \
|
||||||
|
/var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/main/resources/css/app.css; do
|
||||||
|
if [ -f "$CSS" ]; then
|
||||||
|
if ! grep -q 'display:none!important' <<< "$(grep '#header-logo{' "$CSS" | head -1)"; then
|
||||||
|
sed -i 's/#header-logo{/#header-logo{display:none!important;/g' "$CSS"
|
||||||
|
echo "[onlyoffice-init] Patched $(basename $(dirname $(dirname $(dirname $(dirname $CSS))))) to hide logo"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
Binary file not shown.
@@ -6,6 +6,6 @@
|
|||||||
"originalName": "master_cv_template.docx",
|
"originalName": "master_cv_template.docx",
|
||||||
"path": "/root/workspace/cv-app/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx",
|
"path": "/root/workspace/cv-app/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx",
|
||||||
"uploadedAt": "2026-07-16T09:03:29.601Z",
|
"uploadedAt": "2026-07-16T09:03:29.601Z",
|
||||||
"updatedAt": "2026-07-16T12:09:36.709Z"
|
"updatedAt": "2026-07-16T18:59:36.503Z"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -359,6 +359,17 @@ async function openOnlyofficeEditor(templateId, templateName) {
|
|||||||
},
|
},
|
||||||
onDocumentReady: function() {
|
onDocumentReady: function() {
|
||||||
console.log('Document loaded in editor');
|
console.log('Document loaded in editor');
|
||||||
|
// Inject CSS into ONLYOFFICE iframe to hide the logo
|
||||||
|
try {
|
||||||
|
var iframe = document.getElementById(containerId).querySelector('iframe');
|
||||||
|
if (iframe && iframe.contentDocument) {
|
||||||
|
var style = iframe.contentDocument.createElement('style');
|
||||||
|
style.textContent = '#header-logo { display: none !important; }';
|
||||||
|
iframe.contentDocument.head.appendChild(style);
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
console.log('Could not inject CSS into iframe:', e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onSave: function(event) {
|
onSave: function(event) {
|
||||||
toast('Document saved successfully');
|
toast('Document saved successfully');
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
<!-- Modals -->
|
<!-- Modals -->
|
||||||
<div class="modal-overlay" id="modal-overlay"></div>
|
<div class="modal-overlay" id="modal-overlay"></div>
|
||||||
|
|
||||||
<script src="/static/app.js?v=9"></script>
|
<script src="/static/app.js?v=10"></script>
|
||||||
<script src="/static/carbone.js?v=9"></script>
|
<script src="/static/carbone.js?v=10"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user