- htmlviewer: IEditor + Bridge + srcdoc iframe template + content controller - text app: open() bridges text/html to htmlviewer template - idempotent install.sh for re-deployment after app updates - iPhone-tested 2026-09-11
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* SPDX-FileCopyrightText: 2026 HtmlViewer / patch by Hermes Agent
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*
|
|
* DirectEditing template: renders the HTML file in a sandboxed iframe
|
|
* that fills the whole viewport (works in the iOS/Android WebView).
|
|
* The file content is embedded as srcdoc, so the iframe needs no
|
|
* session cookie (mobile WebViews do not share the app session).
|
|
*/
|
|
/** @var array $_ */
|
|
?>
|
|
<style>
|
|
html, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
background-color: var(--color-main-background, #ffffff);
|
|
}
|
|
#htmlviewer-frame {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
border: 0;
|
|
background: transparent;
|
|
}
|
|
</style>
|
|
|
|
<iframe
|
|
id="htmlviewer-frame"
|
|
title="<?php echo htmlspecialchars($_['fileName'] ?? 'HTML'); ?>"
|
|
srcdoc="<?php echo htmlspecialchars($_['fileContent'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8', false); ?>"
|
|
sandbox="allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-modals"
|
|
></iframe>
|