digitalfabrik/integreat-cms

Inserting text using the context menu doesn't make the HIX value outdated

Opened this issue · 4 comments

Describe the Bug

When I paste some text from the clipboard to page using the context menu, the HIX value doesn't become outdated

Steps to Reproduce

  1. Copy any text to clipboard
  2. Go to any page without content
  3. Click right button on your mouse and choose "paste"
  4. See HIX value is up to date and refresh button is not shown

Expected Behavior

Message "HIX value is outdated" is shown and "Update" button is active

Actual Behavior

HIX value is displayed as "up-to-date" (which is not true) and "Update" button is not shown

Additional Information

This is not reproduced using keyboard shortcuts, e.g. Ctrl+V, Shift+Insert

UPD. The same defect applies to the "cut" action.

The problem is connected to a defect on the tinymce side:
tinymce/tinymce#9308

We can't get an actual content from the editor after pasting, because getContent() function returns the old content (the one before the pasting action).
I tried for a while but couldn't find a workaround for this and I'm not sure if it makes sense to spend more time given the priority of the issue?
Maybe we should mark this one as blocked and wait for a fix in tinymce?

UPD.
There is also a quick workaround for users if they encounter this problem:
After clicking paste or cut, to make the "update" button visible, they can e.g. add and then delete any character in the content.

@osmers hi Svenja, do you have an opinion on how critical this issue might be for the users?
Can we move it to the backlog until it's fixed in upstream?

@seluianova sounds reasonable to put it in the backlog - I think it was something we came across and not the municipalities. And we can always tell them the "trick" you mentioned :)

Found what I looked for in the Weekly: There is tinymce.triggerSave();, which might prompt tinyMCE to sync its internal state back to the form fields, if I remember correctly. Maybe try if calling this first works?

@PeterNerlich I tried tinymce.triggerSave(); but couldn't get it to help.
What I also found is that getContent() returns the correct (actual) content after some timeout.
This is not nice and probably not 100% stable, but can be used as a workaround basically 🤔