diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-07-16 20:10:43 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-07-17 15:27:33 +0300 |
commit | b5d33f2dc81b09dfcfcb8ba2b7140d54432c1bd3 (patch) | |
tree | 525d98081ac624d236313730d4262cbcde4c697e | |
parent | b8b3401af4d72325b735035bde95839a0d442d95 (diff) |
Update documentationv3.7.3-frontendapi-1
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | docs/frontend-integration.md | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/docs/frontend-integration.md b/docs/frontend-integration.md index bab1782a..888a1a0b 100644 --- a/docs/frontend-integration.md +++ b/docs/frontend-integration.md @@ -35,15 +35,15 @@ The following two methods are exposed in order to manually trigger the Collabora Params requires the following properties: - fileId: (string) internal file id - path: (string) full path to the file -- shareOwnerId: (string) uid of share owner for shared files -- fileList: (object) optional file list object (see limitations below when not passing it) +- fileModel: (OCA.Files.FileInfoModel) model of the file that will be opened +- fileList: (object) optional file list object ```javascript OCA.RichDocuments.open({ fileId: 1234, path: '/path/to/file.odt', - shareOwnerId: 'admin@nextcloud', + fileModel: new OCA.Files.FileInfoModel({...}) fileList: FileList }) ``` @@ -55,15 +55,27 @@ OCA.RichDocuments.open({ Params requires the following properties: - fileId: (string) internal file id - path: (string) full path to the file -- shareOwnerId: (string) uid of share owner for shared files -- fileList: (object) optional file list object (see limitations below when not passing it) - templateId: (string) file id of the template +- fileModel: (OCA.Files.FileInfoModel) model of the file that will be opened +- fileList: (object) optional file list object ```javascript OCA.RichDocuments.openWithTemplate({ fileId: -1, path: '/path/to/file.odt, - templateId: templateId + templateId: templateId, + fileModel: new OCA.Files.FileInfoModel({...}) +}) +``` + +Changes to the fileModel should be propagated by triggering a backbone `change` event: + +```javascript +window.OCA.RichDocuments.FilesAppIntegration.registerHandler('actionFavorite', (filesAppIntegration) => { + // custom logic here + // make sure to trigger a change on the file info model object like this: + filesAppIntegration.getFileModel().trigger('change', newFileModel) + return true }) ``` @@ -81,6 +93,11 @@ The following handlers are currently supported: - rename: will be called before the default rename action is triggered (the new filename is available as a property of the filesAppIntegration parameter) - showRevHistory: will be called before the default show revision history action is triggered +In addition, the following handlers can be used to overwrite the handling of file actions that are rendered in the Nextcloud header bar: +- actionDetails +- actionDownload +- actionFavorite + The filesAppIntegration parameter can be used to extract the current context of the edited file. The following properties are available for that: - fileName - fileId |