diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-06-19 11:42:56 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-06-19 16:51:40 +0300 |
commit | 1310b81f8431516f1bfc652d5f465c7389d66ffb (patch) | |
tree | 8b4d51a25d51447e67c1b71f9a6ed74fbadddbb0 /src/files.js | |
parent | ce3801d79d964a30c494329d203ef60ef14cc690 (diff) |
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 <andras.timar@collabora.com>
Diffstat (limited to 'src/files.js')
-rw-r--r-- | src/files.js | 2 |
1 files changed, 1 insertions, 1 deletions
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($('<link rel="stylesheet" type="text/css" href="' + OC.filePath('richdocuments', 'css', 'mobile.css') + '"/>')) var $iframe = $('<iframe id="richdocumentsframe" nonce="' + btoa(OC.requestToken) + '" scrolling="no" allowfullscreen src="' + documentUrl + '" />') odfViewer.loadingTimeout = setTimeout(function() { |