Enable Text to be used by Viewer outside Files app #732
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since Nextcloud 18.0.4 the Files app triggers the
LoadViewer
event, so that event can be used to register Text with Viewer instead of doing it through theOCA\Files::loadAdditionalScripts
event(although the previous way needs to be kept for now just in case Text is run on a previous Nextcloud 18 version).Besides being more correct for the Files app it also makes possible to use Text when opening files through Viewer in other apps, like Talk.
Note, however, that in public share pages Text is still opened using the fallback actions instead of through Viewer, as Viewer currently does not provide the share token of the public shared folder that contains the file to be opened. This will be addressed in a follow up pull request.
Also note that currently the stable18 branch of server still reports 18.0.2 as its version, so if tested on that branch Text is registered twice with Viewer. That will stop happening once the version is bumped in the stable18 branch of server to 18.0.4 and Text is registered only due to theLoadViewer
event.