Implement direct editing API
- Resolves: https://github.com/nextcloud/richdocuments/issues/721
- Target version: master
Summary
Implements the direct editing API for mimetypes supporrted by Collabora.
TODO
- [ ] Test on desktop client
- [ ] Test on mobile clients
Checklist
- [ ] Code is properly formatted
- [ ] Sign-off message is added to all commits
- [ ] Documentation (manuals or wiki) has been updated or is not required
- [ ] Test with desktop and android
- [ ] Ping Tobi about that we need to disable the old mechanism in android
- [ ] Check back with Marino about iOS
@Raudius I released and pushed a small typo fix for the namespace, but seems this is not in a functional state yet. Since you mentioned testing it locally, maybe you didn't push your recent changes? :)
@juliushaertl Looks like I messed up when pushing this :see_no_evil: Had to redo some of the changes but should be back to what I had before.
Seems to work on the desktop client for me, but still unable to get the direct edit view to load on Andorid.
I think we need a few more alignments for android/iOS.
Currently the server side direct editing uses different post messages for emitting a status, so we probably should unify, standardise and document what we use and what is expected.
For now only a writeup on what is currently there:
https://github.com/nextcloud/text/blob/master/src/views/DirectEditing.vue#L50-L83
Richdocuments direct editing (old) (emitted by the web app)
https://github.com/nextcloud/richdocuments/search?q=callMobileMessage
- documentLoaded
- downloadAs
- fileRename
- paste
- close ✅
- insertGraphic
- share ✅
- hyperlink(args)
Server direct editing (emitted by the web app)
https://github.com/nextcloud/text/blob/master/src/views/DirectEditing.vue#L107-L124
- loading
- loaded
- share
- close
Interfaces called by the clients
https://sourcegraph.com/search?q=context:global+OCA.RichDocuments.documentsMain.&patternType=standard
- OCA.RichDocuments.documentsMain.postAsset(filename, url)
- OCA.RichDocuments.documentsMain.postGrabFocus()
- OCA.RichDocuments.documentsMain.onClose()
Related text app issue https://github.com/nextcloud/text/issues/1170
- [ ] start by emitting loaded next to documentLoaded in richdocuments
- [ ] Create a npm package to standardise the postMessages that are exchanged between editor and mobile apps
- [ ] Migrate "Interfaces called by the clients" to post messages being triggered by the mobile apps through window.postMessage()
- For the client called methods we either require them (onClose) or they can be skipped by editors (OCA.RichDocuments.documentsMain.postGrabFocus / OCA.RichDocuments.documentsMain.postAsset)
- [ ] Move postMessage parsing from https://github.com/nextcloud/richdocuments/blob/81b09056fdcc7d3a845bf1ba0c2e7f4d179d1c10/src/helpers/mobile.js over to the library
- [ ] Library API would need methods to
- [ ] emit a message to mobile apps (callMobileMessage)
- [ ] register a listener for incoming messages from the mobile apps (listenForMobileMessage)
- [ ] List of supported messages is documented and validated in the library
- [ ] Migrate "Interfaces called by the clients" to post messages being triggered by the mobile apps through window.postMessage()