Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing a rich text field which contains a rango hint submits the hint contained when submitting the form #20

Closed
richardmcmillen opened this issue May 27, 2022 · 14 comments

Comments

@richardmcmillen
Copy link
Sponsor Contributor

I have only witnessed this in Jira but have not gone looking to replicate anywhere else yet.

If you are editing a rich text input area which has a link in it, it is marked up with a rango hint bq
image

If you then submit the form the hint letters end up in the saved content - bq
image

@richardmcmillen richardmcmillen changed the title Editing a rich text field which contains a rango hin submits the hint contained when submitting the form Editing a rich text field which contains a rango hint submits the hint contained when submitting the form May 27, 2022
@richardmcmillen
Copy link
Sponsor Contributor Author

Inspecting this HTML
image

We can see the whole content editable area is the body of an iframe 😬
image

I don't know how you got iframes working yet and if it would be possible to break out of them to place hints in the main viewport container. I know there are security settings for this but curious for your take on it.

@david-tejada
Copy link
Owner

This is a weird one 😅. I don't use Jira so I can't test. Would you mind trying to set the attribute readonly to the hints to see if the issue goes away? Maybe you can do it in the devtools to see if it works.

Making it work for iframes was just a matter of setting all_frames to true in the manifest so the content scripts get executed in all frames. Then I store the hints and to which frame it belongs in the background script. It's all a bit more convoluted now because I have to use local storage to support manifest v3. In theory I believe I could move all the hints to the main frame if I also stored the coordinates but it would not be trivial

@richardmcmillen
Copy link
Sponsor Contributor Author

You mean add readonly="true" on individual hints? I did that and they still ended up in the submitted content. :(
It's not a huge deal for me and I understand how much extra complexity this could add, so I am happy if you want to close this.

@david-tejada
Copy link
Owner

Could you try setting the div container to <div id="rango-hints-container" contenteditable="false" readonly="readonly">?

@richardmcmillen
Copy link
Sponsor Contributor Author

That doesn't change the behaviour either.

@david-tejada
Copy link
Owner

Ok. Thanks for trying. Let's leave this issue open for now. I'll see if I can come up with something.

@richardmcmillen
Copy link
Sponsor Contributor Author

richardmcmillen commented Jun 4, 2022 via email

@david-tejada
Copy link
Owner

I'm thinking a possible solution could be not to display hints in frames where the whole body is contenteditable.

@richardmcmillen
Copy link
Sponsor Contributor Author

Oh I like that nice and simple idea! Hopefully that wouldn't cause much confusion or oddness for anyone else.

@david-tejada
Copy link
Owner

I've tested it in this TinyMCE example page and seems to work nicely.

@david-tejada
Copy link
Owner

Will be available in v0.2.0 that I will release soon

@richardmcmillen
Copy link
Sponsor Contributor Author

This is working great!! Thanks heaps

image

@richardmcmillen
Copy link
Sponsor Contributor Author

richardmcmillen commented Oct 11, 2022 via email

@david-tejada
Copy link
Owner

From version 0.3.0 on this issue is not present. The hints are rendered but they will not be submitted or appear if you copy the text. Hints are rendered using shadow dom, what avoids the issue altogether.

david-tejada added a commit that referenced this issue Jan 18, 2023
…able for solving issue #20. Now that hints render using shadow dom this issue doesn't exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants