diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-05-09 15:22:48 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-05-09 15:22:48 +0300 |
commit | 7650dd68cc5c3d8f78b8ee28d1df678131ea8d87 (patch) | |
tree | 207b0b864c2c90be57964319b90efc45b698c19e /src/files.js | |
parent | a872e65325ddb3b4693905e73e234d2c14191a29 (diff) |
Code style and remove jQuery usage
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/files.js')
-rw-r--r-- | src/files.js | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/files.js b/src/files.js index c08e7629c..ee936bc6f 100644 --- a/src/files.js +++ b/src/files.js @@ -20,14 +20,16 @@ * */ -const newFileMenuPlugin = { +import Editor from './components/Editor' +import { documentReady } from './helpers' - attach: function (menu) { - var fileList = menu.fileList; +const newFileMenuPlugin = { + attach: function(menu) { + var fileList = menu.fileList // only attach to main file list, public view is not supported yet if (fileList.id !== 'files') { - return; + return } // register the new menu entry @@ -37,23 +39,22 @@ const newFileMenuPlugin = { templateName: t('text', 'New text document.md'), iconClass: 'icon-filetype-text', fileType: 'file', - actionHandler: function (name) { - fileList.createFile(name).then(function (status, data) { - let fileInfoModel = new OCA.Files.FileInfoModel(data); - OCA.Files.fileActions.triggerAction('view', fileInfoModel, fileList); - }); + actionHandler: function(name) { + fileList.createFile(name).then(function(status, data) { + let fileInfoModel = new OCA.Files.FileInfoModel(data) + OCA.Files.fileActions.triggerAction('view', fileInfoModel, fileList) + }) } - }); + }) } -}; -OC.Plugins.register('OCA.Files.NewFileMenu', newFileMenuPlugin); +} -import Editor from './components/Editor' -$(document).ready(function() { +OC.Plugins.register('OCA.Files.NewFileMenu', newFileMenuPlugin) +documentReady(() => { OCA.Viewer.registerHandler({ id: 'text', mimes: ['text/markdown'], component: Editor, group: null - }); -}); + }) +}) |