text icon indicating copy to clipboard operation
text copied to clipboard

Properly handle linked files with direct editing

Open juliusknorr opened this issue 5 years ago • 7 comments

ToDo

  • [ ] once done, pick https://github.com/nextcloud/files-clients/issues/13 again

Currently we have no special handling for linking files with direct editing, so this is not working as described in https://github.com/nextcloud/android/issues/7192.

I currently see two ways of implementing support for opening linked files:

  • We send a post message to the mobile clients with the path/file id so they can directly navigate to it and open it with direct editing
  • We open a browser with the private link of the file. This has less effort on the client side, but will need the user to be logged in in the browser of course.

In addition there is also no support for adding file links through direct editing, since the user is not authenticated via a session. To solve this we'd need to implement something similar to the Collabora insert image functionality where a postMessage is emitted by the text app. Then the mobile clients would show a file picker and pass the selected file to the webview again.

cc @tobiasKaminsky @marinofaggiana What do you think. Does that make sense?

juliusknorr avatar Nov 12 '20 16:11 juliusknorr

On web ui one is then simply redirected, right? Isn't the same possible? As we are already within a webview?

Regarding adding file link: Post message sounds good :+1:

tobiasKaminsky avatar Nov 13 '20 06:11 tobiasKaminsky

On web ui one is then simply redirected, right? Isn't the same possible? As we are already within a webview?

Yes, but on the web UI we have an authenticated session, while the direct editing uses a one-time token just for the file. Therefore we can only redirect to the normal files app, which might require the user to log in again.

juliusknorr avatar Nov 13 '20 06:11 juliusknorr

Hm. Then your first suggestion is good, I think.

So we have three new interface methods:

  • openFile(String remotePath) -> open new file in clients, needed for link handling
  • insertImage() -> client opens file picker and sends file to editor via
  • postImage(String filename, String linkToUploadedFile)

tobiasKaminsky avatar Nov 13 '20 08:11 tobiasKaminsky

In addition we would also need those two for inserting links to any file type:

  • insertFile() -> client opens file picker and sends file to editor via
  • postFile(String filename, String linkToUploadedFile)

juliusknorr avatar Nov 13 '20 10:11 juliusknorr

Any progress on this? Thanks

machiav3lli avatar Jun 10 '21 22:06 machiav3lli

Related to: https://github.com/nextcloud/text/issues/1169

In 1169 I suggest we handle the opening in the browser, as this would also work for direct editing from desktop. But we could additionally send a PostMessage to the clients in case they can handle the open request more gracefully.

Raudius avatar Nov 16 '22 11:11 Raudius

Yep, sounds like something for a openFile message that is emitted for that case :)

juliusknorr avatar Nov 16 '22 11:11 juliusknorr