Compare commits

...

4 Commits

Author SHA1 Message Date
525d09dc4f Add changie 2025-12-11 13:51:24 +01:00
3bd101c1eb Migrate editor script to TypeScript and enhance iframe configuration
- Renamed `index.js` to `index.ts` and updated references in the webpack configuration.
- Introduced TypeScript-specific improvements, including type annotations and stricter null checks.
- Enhanced iframe `allow` attributes to support clipboard and fullscreen permissions.
- Improved error handling for message data parsing.
2025-12-11 13:50:21 +01:00
f60ef696de Inject NullProofValidator implementation for ProofValidatorInterface in the dev environment
- Added a service definition for `ChampsLibres\WopiLib\Contract\Service\ProofValidatorInterface` in `services.yaml` to use `Chill\WopiBundle\Service\Wopi\NullProofValidator` exclusively in the dev environment.
2025-12-11 13:49:45 +01:00
6e1c9b6f29 Remove chill-project/chill-zimbra-bundle from composer dependencies
- This package provoke failures on build in the CI
2025-12-09 15:38:24 +01:00
5 changed files with 36 additions and 12 deletions

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: Tentatively fix usage of CTRL+C in collabora editor with chrome / edge browser
time: 2025-12-11T13:51:11.425545012+01:00
custom:
Issue: "483"
SchemaChange: No schema change

View File

@@ -21,7 +21,6 @@
"ext-openssl": "*",
"ext-redis": "*",
"ext-zlib": "*",
"chill-project/chill-zimbra-bundle": "@dev",
"champs-libres/wopi-bundle": "dev-symfony-v5@dev",
"champs-libres/wopi-lib": "dev-master@dev",
"doctrine/data-fixtures": "^1.8",

View File

@@ -11,3 +11,6 @@ services:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
when@dev:
services:
ChampsLibres\WopiLib\Contract\Service\ProofValidatorInterface: '@Chill\WopiBundle\Service\Wopi\NullProofValidator'

View File

@@ -2,7 +2,7 @@
module.exports = function (encore, entries) {
encore.addEntry(
"page_wopi_editor",
__dirname + "/src/Resources/public/page/editor/index.js",
__dirname + "/src/Resources/public/page/editor/index.ts",
);
encore.addEntry(
"mod_reload_page",

View File

@@ -1,8 +1,11 @@
require("./index.scss");
import "./index.scss";
// Provided by the server-side template
declare const editor_url: string;
window.addEventListener("DOMContentLoaded", function () {
let frameholder = document.getElementById("frameholder");
let office_frame = document.createElement("iframe");
const frameholder = document.getElementById("frameholder");
const office_frame = document.createElement("iframe");
office_frame.name = "office_frame";
office_frame.id = "office_frame";
@@ -18,19 +21,32 @@ window.addEventListener("DOMContentLoaded", function () {
"sandbox",
"allow-downloads allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-top-navigation allow-popups-to-escape-sandbox",
);
frameholder.appendChild(office_frame);
document.getElementById("office_form").submit();
office_frame.setAttribute(
"allow",
"clipboard-read *; clipboard-write *; fullscreen *"
);
if (frameholder) {
frameholder.appendChild(office_frame);
}
const officeForm = document.getElementById("office_form") as HTMLFormElement | null;
officeForm?.submit();
const url = new URL(editor_url);
const editor_domain = url.origin;
window.addEventListener("message", function (message) {
window.addEventListener("message", function (message: MessageEvent) {
if (message.origin !== editor_domain) {
return;
}
let data = JSON.parse(message.data);
let data: any;
try {
data = typeof message.data === "string" ? JSON.parse(message.data) : message.data;
} catch (_e) {
return;
}
if ("UI_Close" === data.MessageId) {
closeEditor();
@@ -38,9 +54,9 @@ window.addEventListener("DOMContentLoaded", function () {
});
});
function closeEditor() {
let params = new URLSearchParams(window.location.search),
returnPath = params.get("returnPath");
function closeEditor(): void {
const params = new URLSearchParams(window.location.search);
const returnPath = params.get("returnPath") ?? "/";
window.location.assign(returnPath);
}