From 69a27a1ab264b3c23b383cfb592281b5792e9640 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Tue, 5 Nov 2019 19:06:06 +0300 Subject: [PATCH 01/28] select document for comparing --- js/editor.js | 28 ++++++++++++++++++++++++++++ l10n/de.js | 3 ++- l10n/de.json | 3 ++- l10n/de_DE.js | 3 ++- l10n/de_DE.json | 3 ++- l10n/es.js | 3 ++- l10n/es.json | 3 ++- l10n/fr.js | 3 ++- l10n/fr.json | 3 ++- l10n/pl.js | 3 ++- l10n/pl.json | 3 ++- l10n/pt_BR.js | 3 ++- l10n/pt_BR.json | 3 ++- l10n/ru.js | 3 ++- l10n/ru.json | 3 ++- l10n/sv.js | 1 + l10n/sv.json | 1 + 17 files changed, 58 insertions(+), 14 deletions(-) diff --git a/js/editor.js b/js/editor.js index f1687a80..480bdf25 100644 --- a/js/editor.js +++ b/js/editor.js @@ -113,6 +113,7 @@ config.events.onRequestSaveAs = OCA.Onlyoffice.onRequestSaveAs; config.events.onRequestInsertImage = OCA.Onlyoffice.onRequestInsertImage; config.events.onRequestMailMergeRecipients = OCA.Onlyoffice.onRequestMailMergeRecipients; + config.events.onRequestCompareFile = OCA.Onlyoffice.onRequestCompareFile; } OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor("iframeEditor", config); @@ -213,6 +214,33 @@ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select recipients"), setRecipient, false, recipientMimes); }; + OCA.Onlyoffice.onRequestCompareFile = function() { + + var setRevised = function(filePath) { + $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/url?filePath={filePath}", + { + filePath: filePath + }), + function onSuccess(response) { + if (response.error) { + OC.Notification.show(response.error, { + type: "error", + timeout: 3 + }); + return; + } + + OCA.Onlyoffice.docEditor.setRevisedFile(response); + }); + }; + + var revisedMimes = [ + "application/vnd.openxmlformats-officedocument.wordprocessingml.document" + ]; + + OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select file to compare"), setRevised, false, revisedMimes); + }; + $(document).ready(OCA.Onlyoffice.InitEditor); })(jQuery, OCA); diff --git a/l10n/de.js b/l10n/de.js index 29e5c29c..4543d760 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -66,6 +66,7 @@ OC.L10N.register( "Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwende beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Du kannst keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten.", + "Select file to compare" : "Datei zum Vergleich auswählen" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 1a5b2b48..708cbc6e 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -64,6 +64,7 @@ "Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwende beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Du kannst keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten.", + "Select file to compare" : "Datei zum Vergleich auswählen" },"pluralForm" :"nplurals=2; plural=(n != 1);" } \ No newline at end of file diff --git a/l10n/de_DE.js b/l10n/de_DE.js index e2571095..66c812fe 100644 --- a/l10n/de_DE.js +++ b/l10n/de_DE.js @@ -66,6 +66,7 @@ OC.L10N.register( "Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwenden Sie beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Sie können keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten.", + "Select file to compare" : "Datei zum Vergleich auswählen" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de_DE.json b/l10n/de_DE.json index 2d298959..ce055b93 100644 --- a/l10n/de_DE.json +++ b/l10n/de_DE.json @@ -64,6 +64,7 @@ "Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwenden Sie beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Sie können keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten.", + "Select file to compare" : "Datei zum Vergleich auswählen" },"pluralForm" :"nplurals=2; plural=(n != 1);" } \ No newline at end of file diff --git a/l10n/es.js b/l10n/es.js index 360a775c..ee54123f 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -62,6 +62,7 @@ OC.L10N.register( "Save as" : "Guardar como", "File saved" : "El archivo ha sido guardado", "Insert image" : "Insertar imagen", - "Select recipients" : "Seleccionar destinatarios" + "Select recipients" : "Seleccionar destinatarios", + "Select file to compare" : "Seleccione un archivo para comparar" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index 1d48c1b2..ab05f6d2 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -60,6 +60,7 @@ "Save as" : "Guardar como", "File saved" : "El archivo ha sido guardado", "Insert image" : "Insertar imagen", - "Select recipients" : "Seleccionar destinatarios" + "Select recipients" : "Seleccionar destinatarios", + "Select file to compare" : "Seleccione un archivo para comparar" },"pluralForm" :"nplurals=2; plural=(n != 1);" } \ No newline at end of file diff --git a/l10n/fr.js b/l10n/fr.js index fe0e15f6..def654e7 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -62,6 +62,7 @@ OC.L10N.register( "Save as" : "Enregistrer sous", "File saved" : "Le fichier a été enregistré", "Insert image" : "Insérer une image", - "Select recipients" : "Sélectionner les destinataires" + "Select recipients" : "Sélectionner les destinataires", + "Select file to compare" : "Sélectionner fichier à comparer" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index add34f70..99bd9654 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -60,6 +60,7 @@ "Save as" : "Enregistrer sous", "File saved" : "Le fichier a été enregistré", "Insert image" : "Insérer une image", - "Select recipients" : "Sélectionner les destinataires" + "Select recipients" : "Sélectionner les destinataires", + "Select file to compare" : "Sélectionner fichier à comparer" },"pluralForm" :"nplurals=2; plural=(n != 1);" } diff --git a/l10n/pl.js b/l10n/pl.js index 7a04645d..208e5dca 100644 --- a/l10n/pl.js +++ b/l10n/pl.js @@ -61,6 +61,7 @@ OC.L10N.register( "Connect to demo ONLYOFFICE Document Server" : "Połącz się z serwerem demo ONLYOFFICE", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "To jest publiczny testowy serwer, proszę nie używać go do prywatnych danych. Serwer będzie dostępny przez 30 dni.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Upłyneło 30 dni, nie możesz się już łączyć z serwerem demo.", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych.", + "Select tag" : "Wybierz tag" }, "nplurals=2; plural=(n != 1);"); \ No newline at end of file diff --git a/l10n/pl.json b/l10n/pl.json index 72871e54..ed0ee596 100644 --- a/l10n/pl.json +++ b/l10n/pl.json @@ -59,6 +59,7 @@ "Connect to demo ONLYOFFICE Document Server" : "Połącz się z serwerem demo ONLYOFFICE", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "To jest publiczny testowy serwer, proszę nie używać go do prywatnych danych. Serwer będzie dostępny przez 30 dni.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Upłyneło 30 dni, nie możesz się już łączyć z serwerem demo.", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych.", + "Select tag" : "Wybierz tag" },"pluralForm" :"nplurals=2; plural=(n != 1);" } \ No newline at end of file diff --git a/l10n/pt_BR.js b/l10n/pt_BR.js index b9974bad..bd0a26f1 100644 --- a/l10n/pt_BR.js +++ b/l10n/pt_BR.js @@ -63,6 +63,7 @@ OC.L10N.register( "Save as" : "Salvar como", "File saved" : "O arquivo foi salvo", "Insert image" : "Inserir imagem", - "Select recipients" : "Selecione os destinatários" + "Select recipients" : "Selecione os destinatários", + "Select file to compare" : "Selecionar arquivo para comparar" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/pt_BR.json b/l10n/pt_BR.json index c2c7dd58..6d985c31 100644 --- a/l10n/pt_BR.json +++ b/l10n/pt_BR.json @@ -61,6 +61,7 @@ "Save as" : "Salvar como", "File saved" : "O arquivo foi salvo", "Insert image" : "Inserir imagem", - "Select recipients" : "Selecione os destinatários" + "Select recipients" : "Selecione os destinatários", + "Select file to compare" : "Selecionar arquivo para comparar" },"pluralForm" :"nplurals=2; plural=(n != 1);" } diff --git a/l10n/ru.js b/l10n/ru.js index c23b733d..76d16412 100644 --- a/l10n/ru.js +++ b/l10n/ru.js @@ -67,6 +67,7 @@ OC.L10N.register( "Connect to demo ONLYOFFICE Document Server" : "Подключиться к демонстрационному Серверу Документов ONLYOFFICE", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Это публичный тестовый сервер, пожалуйста, не используйте его для личных конфиденциальных данных. Сервер будет доступен в течение 30 дней.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "30-дневный тестовый период закончен, вы больше не можете подключаться к демонстрационному Серверу Документов ONLYOFFICE", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные.", + "Select file to compare" : "Выбрать файл для сравнения" }, "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"); diff --git a/l10n/ru.json b/l10n/ru.json index 63009300..1e174c23 100644 --- a/l10n/ru.json +++ b/l10n/ru.json @@ -65,6 +65,7 @@ "Connect to demo ONLYOFFICE Document Server" : "Подключиться к демонстрационному Серверу Документов ONLYOFFICE", "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Это публичный тестовый сервер, пожалуйста, не используйте его для личных конфиденциальных данных. Сервер будет доступен в течение 30 дней.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "30-дневный тестовый период закончен, вы больше не можете подключаться к демонстрационному Серверу Документов ONLYOFFICE", - "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные." + "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные.", + "Select file to compare" : "Выбрать файл для сравнения" },"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" } \ No newline at end of file diff --git a/l10n/sv.js b/l10n/sv.js index f7f22b0b..8d53de0f 100644 --- a/l10n/sv.js +++ b/l10n/sv.js @@ -66,5 +66,6 @@ OC.L10N.register( "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Detta är en offentlig testserver, använd den inte för privat känslig information. Servern kommer att finnas tillgänglig under en 30-dagarsperiod.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "När 30-dagars testperioden är över, kan du inte längre ansluta till demo ONLYOFFICE Dokumentserver.", "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du använder en offentlig demo ONLYOFFICE Dokumentserver. Lagra inte privat känslig information.", + "Select tag" : "Välj tagg" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/sv.json b/l10n/sv.json index 67aeea77..2a033320 100644 --- a/l10n/sv.json +++ b/l10n/sv.json @@ -64,5 +64,6 @@ "This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Detta är en offentlig testserver, använd den inte för privat känslig information. Servern kommer att finnas tillgänglig under en 30-dagarsperiod.", "The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "När 30-dagars testperioden är över, kan du inte längre ansluta till demo ONLYOFFICE Dokumentserver.", "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du använder en offentlig demo ONLYOFFICE Dokumentserver. Lagra inte privat känslig information.", + "Select tag" : "Välj tagg" },"pluralForm" :"nplurals=2; plural=(n != 1);" } \ No newline at end of file From 3939323cc3ee84b150312afafcb788793d455e0f Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Wed, 25 Dec 2019 11:13:56 +0300 Subject: [PATCH 02/28] customization.zoom --- controller/editorcontroller.php | 5 +++++ lib/appconfig.php | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index ffe413ed..e9abe4ed 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -878,6 +878,11 @@ private function setCustomization($params) { $params["editorConfig"]["customization"]["logo"] = $logo; } + $zoom = $this->config->GetSystemValue($this->config->_customization_zoom); + if (isset($zoom)) { + $params["editorConfig"]["customization"]["zoom"] = $zoom; + } + return $params; } diff --git a/lib/appconfig.php b/lib/appconfig.php index 7be88560..b2e3ee89 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -224,6 +224,13 @@ class AppConfig { */ public $_customization_logo = "customization_logo"; + /** + * The config key for the zoom + * + * @var string + */ + public $_customization_zoom = "customization_zoom"; + /** * @param string $AppName - application name */ From 039eb5264fc69b103d40838de4f9127b9d0b63c6 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Wed, 25 Dec 2019 11:14:56 +0300 Subject: [PATCH 03/28] customization.autosave --- controller/editorcontroller.php | 5 +++++ lib/appconfig.php | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index e9abe4ed..a8efc83c 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -883,6 +883,11 @@ private function setCustomization($params) { $params["editorConfig"]["customization"]["zoom"] = $zoom; } + $autosave = $this->config->GetSystemValue($this->config->_customization_autosave); + if (isset($autosave)) { + $params["editorConfig"]["customization"]["autosave"] = $autosave; + } + return $params; } diff --git a/lib/appconfig.php b/lib/appconfig.php index b2e3ee89..b459bf42 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -231,6 +231,13 @@ class AppConfig { */ public $_customization_zoom = "customization_zoom"; + /** + * The config key for the autosave + * + * @var string + */ + public $_customization_autosave = "customization_autosave"; + /** * @param string $AppName - application name */ From 84e7499e3418a240eab4a9cae606303e29bd1608 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Thu, 26 Dec 2019 15:12:40 +0300 Subject: [PATCH 04/28] antivirus error handling (#288) --- controller/editorcontroller.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index a8efc83c..df46c5ea 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -38,6 +38,7 @@ use OCP\Files\FileInfo; use OCP\Files\File; use OCP\Files\Folder; +use OCP\Files\ForbiddenException; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\IL10N; @@ -238,6 +239,9 @@ public function create($name, $dir, $shareToken = NULL) { } catch (NotPermittedException $e) { $this->logger->error("Can't create file: $name", array("app" => $this->appName)); return ["error" => $this->trans->t("Can't create file")]; + } catch (ForbiddenException $e) { + $this->logger->error("Can't put file: $name", array("app" => $this->appName)); + return ["error" => $this->trans->t("Can't create file")]; } $fileInfo = $file->getFileInfo(); @@ -350,6 +354,9 @@ public function convert($fileId, $shareToken = NULL) { } catch (NotPermittedException $e) { $this->logger->error("Can't create file: $newFileName", array("app" => $this->appName)); return ["error" => $this->trans->t("Can't create file")]; + } catch (ForbiddenException $e) { + $this->logger->error("Can't put file: $newFileName", array("app" => $this->appName)); + return ["error" => $this->trans->t("Can't create file")]; } $fileInfo = $file->getFileInfo(); @@ -410,6 +417,9 @@ public function save($name, $dir, $url) { } catch (NotPermittedException $e) { $this->logger->error("Can't save file: $name", array("app" => $this->appName)); return ["error" => $this->trans->t("Can't create file")]; + } catch (ForbiddenException $e) { + $this->logger->error("Can't put file: $name", array("app" => $this->appName)); + return ["error" => $this->trans->t("Can't create file")]; } $fileInfo = $file->getFileInfo(); From 456580d33f68590a3f8adb14bb47af7de6020a58 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Thu, 9 Jan 2020 12:37:25 +0300 Subject: [PATCH 05/28] format --- controller/callbackcontroller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/callbackcontroller.php b/controller/callbackcontroller.php index a0799c4e..f3ed0763 100644 --- a/controller/callbackcontroller.php +++ b/controller/callbackcontroller.php @@ -140,7 +140,7 @@ class CallbackController extends Controller { * @param OCA\Onlyoffice\Crypt $crypt - hash generator * @param IManager $shareManager - Share manager */ - public function __construct($AppName, + public function __construct($AppName, IRequest $request, IRootFolder $root, IUserSession $userSession, From 5178edc0e2dd6e816b23aa07c6de4a5aab30373b Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Fri, 6 Dec 2019 17:19:24 +0300 Subject: [PATCH 06/28] Use iframe for displaying the editor inline --- controller/editorcontroller.php | 6 +++++- css/editor.css | 3 +++ css/main.css | 10 ++++++++++ js/main.js | 13 ++++++++++++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index ffe413ed..abd66227 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -506,7 +506,11 @@ public function index($fileId, $shareToken = NULL, $filePath = NULL) { "shareToken" => $shareToken ]; - $response = new TemplateResponse($this->appName, "editor", $params); + if ($this->config->GetSameTab() && empty($shareToken)) { + $response = new TemplateResponse($this->appName, "editor", $params, "plain"); + } else { + $response = new TemplateResponse($this->appName, "editor", $params); + } $csp = new ContentSecurityPolicy(); $csp->allowInlineScript(true); diff --git a/css/editor.css b/css/editor.css index 21f52fd9..925388b2 100644 --- a/css/editor.css +++ b/css/editor.css @@ -30,6 +30,9 @@ position: absolute; vertical-align: top; } +#body-public #content { + height: 100%; +} .AscDesktopEditor #header { display: none; diff --git a/css/main.css b/css/main.css index d08922cd..c3f1f0cb 100644 --- a/css/main.css +++ b/css/main.css @@ -40,6 +40,16 @@ background-image: url("../img/app-dark.svg"); } +#onlyofficeFrame { + background-color: #fff; + width: 100%; + height: calc(100vh - 45px); + display: block; + position: absolute; + top: 0; + z-index: 110; +} + .AscDesktopEditor #header { display: none; } diff --git a/js/main.js b/js/main.js index 658cf0fb..a9c49ae1 100644 --- a/js/main.js +++ b/js/main.js @@ -98,8 +98,19 @@ winEditor.location.href = url; } else if (!OCA.Onlyoffice.setting.sameTab || OCA.Onlyoffice.Desktop) { winEditor = window.open(url, "_blank"); - } else { + } else if ($("#isPublic").val()) { location.href = url; + } else { + var $iframe = $("