From 1310b81f8431516f1bfc652d5f465c7389d66ffb Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 19 Jun 2020 11:42:56 +0300 Subject: Fix problem where mobile.css did not get used for subsequent document edits The code in the onEdit function wants to take our stylesheet mobile.css into use, and the code in the onClose function correspondingly removes it from use. In onEdit, we used to call the OC.addStyle function to take the stylesheet into use. That function uses an internal cache of the pathnames of stylesheets in use. The way we remove the stylesheet from use in onClose does not affect that cache (the loadedStyles variable in Nextcloud server's core/src/OC/legacy-loader.js). Thus, after a Nextcloud document browsing page is loaded, when editing the first document, everything goes as planned: The stylesheet is taken into use and it works as expected: In narrow windows (i.e. mainly on mobile devices) the blue Nextcloud header is not displayed. When the document is closed, the stylesheet is removed. But when the next document is edited, the OC.addStyle function thinks that the stylesheet is in use and does nothing. This change avoids using OC.addStyle and instead adds the stylesheet using plain Javascript. Signed-off-by: Andras Timar --- src/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/files.js b/src/files.js index 180ba58c..c1e366e5 100644 --- a/src/files.js +++ b/src/files.js @@ -145,7 +145,7 @@ const odfViewer = { reloadForFederationCSP(fileName) } - OC.addStyle('richdocuments', 'mobile') + $('head').append($('')) var $iframe = $('