Bug 124752 - Copy/paste popup not working
Summary: Copy/paste popup not working
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: iOS Editor (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other iOS
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.3.0
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-15 10:41 UTC by Andreas Gruhler
Modified: 2019-08-30 09:59 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
pasting content is impossible (185.88 KB, image/png)
2019-04-15 10:46 UTC, Andreas Gruhler
Details
cut/copy/paste popup (205.56 KB, image/png)
2019-04-15 10:47 UTC, Andreas Gruhler
Details
copy visible but paste impossible (347.85 KB, image/png)
2019-04-15 10:49 UTC, Andreas Gruhler
Details
copy visible but paste impossible (220.99 KB, image/png)
2019-04-15 10:51 UTC, Andreas Gruhler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Gruhler 2019-04-15 10:41:18 UTC
Description:
The popup that appears when selecting text in the iOS App does not copy/paste text. The copy/paste functionality from the menu bar "Edit > Copy/paste" is greyed out. The only action that works is "cut", but it is impossible to "paste" this content again.

Steps to Reproduce:
1. Select text by tapping three times on a word
2. Choose the leftmost icon (scissor) from the cut/copy/clipboard popup to cut the text
3. Tap another position in the document and try to let the popup appear again by tapping three times.
4. Click on "Edit" ("Bearbeiten" in the German screenshot) in the menu bar 


Actual Results:
1. The cut/copy/clipboard popup appears
2. The selected text disappears as expected.
3. The cut/copy/clipboard popup does not appear, only when selecting multiple characters, which is not intended to paste contents.
4. Actions "Edit > Cut/copy/paste" are greyed out.

Expected Results:
1. The cut/copy/clipboard popup appears
2. The selected text disappears
3. The cut/copy/clipboard popup appears and lets me paste the contents. I would assume to paste in the same way I selected to cut/copy, but the popup does not appear.
4. The menu actions "Edit > Cut/copy/paste" should allow me to paste the content.


Reproducible: Always


User Profile Reset: No



Additional Info:
* Please see attached screenshots.
* Loolwsd 4.0.3 (git hash: 3b931560)
* Collabora Office 6.0-28 (git hash: 8286ce9)
Comment 1 Andreas Gruhler 2019-04-15 10:46:31 UTC
Created attachment 150763 [details]
pasting content is impossible
Comment 2 Andreas Gruhler 2019-04-15 10:47:11 UTC
Created attachment 150764 [details]
cut/copy/paste popup
Comment 3 Andreas Gruhler 2019-04-15 10:49:47 UTC
Created attachment 150765 [details]
copy visible but paste impossible
Comment 4 Andreas Gruhler 2019-04-15 10:51:21 UTC
Created attachment 150766 [details]
copy visible but paste impossible
Comment 5 Tor Lillqvist 2019-05-23 13:46:26 UTC
Looking at this bug now. Possibly this is simply caused by some code not being built for the non-desktop case, some #ifdef added many years ago. Anyway, tracing the code in the debugger to see what is going on. There is also, I think, the concept of an "internal" clipboard in LibreOffice core, while possibly in the iOS app we always want to put things onto the system clipboard and take them from there, right?
Comment 6 Andreas Gruhler 2019-05-23 14:13:56 UTC
(In reply to Tor Lillqvist from comment #5)
> Anyway, tracing the code in the debugger to see what is going on. There is
> also, I think, the concept of an "internal" clipboard in LibreOffice core,
> while possibly in the iOS app we always want to put things onto the system
> clipboard and take them from there, right?

Ack, one clipboard would be easier, see also the comment in 'online':
> commit aa1d9ce19644fd55f18635f0784225cb0bedb6e3
> Author: Jan Holesovsky <kendy@collabora.com>
> Date:   Mon May 20 18:50:41 2019 +0200
>
>     The Internal Copy / Internal Cut / Internal Paste is just confusing.
>   
>     Every user so far is confused of the existence of two clipboards - the
>     system one, and the Online internal one.
>   
>     We are able to detect that the copy / paste is happening inside the
>     document and perform the "internal copy / paste" accordingly, so let's
>     do what the other online office suites do, and just warn when the user
>     tries to access copy / paste from the menu.

However, I cannot see the consequences of having one clipboard only. 
Would it still be possible to copy/paste elements (e.g., shapes) from 
within the same document?
Comment 7 Tor Lillqvist 2019-05-23 16:35:49 UTC
One thing I noticed now (well, I *should* have known it, but did not remember) is that LibreOffice has no code for interfacing with the iOS system clipboard. There is code to interface with the macOS clipboard (NSPasteboard), but not the iOS one (UIPasteboard). Their APIs are not similar enough that it would be a case of changing NSPasteboard to UIPasteboard.

The fix for pasting text into the iOS app from the system clipboard that was implemented recently (bug #125410, commit 936f3a143520c5a8c72fd0976c88580d3393d034) was purely in JavaScript, I added handling of the "paste" event. But the copy/paste popup uses functionality inside LibreOffice core, that does not exist for iOS yet. Working on it.
Comment 8 Tor Lillqvist 2019-05-24 04:48:06 UTC
Note that kendy's commit was in the context of "normal" Online, where the JavaScript code that the user interacts with is running in the user's browser, while the LibreOffice core code is running on a server. The "internal" clipboard in that case would be inside the process on the server serving the document being edited. In the iOS app case both the JavaScript and the "server" code are part of the app.
Comment 9 Tor Lillqvist 2019-05-24 04:51:33 UTC
Anyway, last evening I worked on clipboard code for iOS, and hopefully today or early next week it will work, and then at least the Edit > Copy and Edit > Paste menu entries should work as expected, and hopefully be able to copy and paste also images and perhaps even other kinds of data (like HTML snippets) to/from the iOS clipboard. (The paste button on the on-screen keyboard, or the Cmd-C and Cmd-V shortcuts won't necessarily be able to copy or paste anything else than text, though. Will see.)
Comment 10 Commit Notification 2019-05-28 06:15:46 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/online/+/a494b4f8d50c179c19fa87cce87cdfc2eafdf14e%5E%21

tdf#124752: Do post the UNO clipboard commands in a mobile app
Comment 11 Commit Notification 2019-05-28 09:40:09 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/b8c1f54d67c5ae90a868f9b33747c43b97c23351%5E%21

tdf#124752: Add system clipboard interface for iOS

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Tor Lillqvist 2019-05-28 09:53:53 UTC
Now it works better, for text (even formatted). Still need to work on images and test more complex things like tables or formatted text with images and stuff included.
Comment 13 Commit Notification 2019-05-28 19:55:41 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/e1cd536edd2636d150ae50b0d44a5aee1b8d4e34%5E%21

tdf#124752: Use best speed for PNG encoding on iOS

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2019-05-28 19:55:51 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/edf1f755d40c5423ffb411ff17f024fbafeb02b3%5E%21

tdf#124752: Reduce number of formats offered on clipboard on mobile devices

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2019-05-28 19:55:58 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/12800a215102435b16fd0e3028f1fdfe8ebeb090%5E%21

tdf#124752: Simplify the iOS DataFlavorMapping thing a lot

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Tor Lillqvist 2019-05-28 19:57:31 UTC
Now copy/paste between the Collabora Office app and other apps works much better. Will provide a fresh build of the app tomorrow.
Comment 17 Commit Notification 2019-05-29 11:09:59 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/3f8ac50022215e53b592c1d630dd0609cab4e58e%5E%21

tdf#124752: We do need to accept text/html from the system clipboard

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Tor Lillqvist 2019-08-30 09:59:47 UTC
Marking as resolved.