diff options
author | Patrik Kernstock <info@pkern.at> | 2017-06-14 03:39:17 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-06-15 13:59:33 +0300 |
commit | d76740bc758f1104fb0e61ff1b5bb531e9b88bb3 (patch) | |
tree | a137a3947709f41d6c9d3718eb7bb7b547dff562 | |
parent | 5855b7de9e4e141b8fb8528d6fe3c8fcbfeb6ce5 (diff) |
only edit textfiles when texteditorapp is disabled
Signed-off-by: Patrik Kernstock <info@pkern.at>
(cherry picked from commit 4db76d6f015bd3efd0ef35a4ebba2372828dd76e)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | js/viewer/viewer.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/js/viewer/viewer.js b/js/viewer/viewer.js index e054cfbd..a188f93a 100644 --- a/js/viewer/viewer.js +++ b/js/viewer/viewer.js @@ -109,7 +109,6 @@ var odfViewer = { $('#app-content').append($iframe); }, - onClose: function() { if(typeof FileList !== "undefined") { FileList.setViewerMode(false); @@ -206,6 +205,14 @@ $(document).ready(function() { && typeof OCA.Files !== 'undefined' && typeof OCA.Files.fileActions !== 'undefined' ) { + // check if texteditor app is enabled and loaded... + if (_.isUndefined(OCA.Files_Texteditor)) { + // it is not, so we do open text files with this app too. + odfViewer.supportedMimes.push('text/plain'); + } + + // notice: when changing 'supportedMimes' interactively (e.g. dev console), + // register() needs to be re-run to re-register the fileActions. odfViewer.register(); $.get( @@ -218,7 +225,7 @@ $(document).ready(function() { // FIXME: Hack for single public file view since it is not attached to the fileslist $(document).ready(function(){ - // FIXME: FIlter compatible mime types + // FIXME: Filter compatible mime types if ($('#isPublic').val() && odfViewer.supportedMimes.indexOf($('#mimetype').val()) !== -1) { odfViewer.onEdit($('#filename').val()); } |