react-froala-wysiwyg icon indicating copy to clipboard operation
react-froala-wysiwyg copied to clipboard

Color picker hex value not applied to selected text

Open bajenaruandrei opened this issue 2 years ago • 6 comments

Current behaviour When selecting a chunk of text to apply a color on it, the HEX color input is not focused thus forcing me to click on the input which results in losing the selected text. The color is applied to the cursor and from there I can type using my color, but the cursor is also moved to the beginning of the input field, blocking me in adding a custom color wherever I need it.

Expected behaviour Input is focused and text selection is kept when applying a custom HEX value. The issue is not happening for already existent colors in the color palette.

Version: 4.1.3

From time to time, when the color picker is opened I receive the following error: Uncaught DOMException: Failed to execute 'querySelector' on 'Document': 'label[for="fr-color-hex-layer- 1"]' is not a valid selector.

Has someone else encountered such issues and has possible solutions? I tried to implement something custom on our end, but it's breaking the regular color selection.

bajenaruandrei avatar Jan 04 '24 12:01 bajenaruandrei

Has anyone encountered something similar or has any idea on how to fix it? Thank you!

bajenaruandrei avatar Jan 25 '24 07:01 bajenaruandrei

@andreibaje I just figured out that adding 'iframe: true' makes it work.

drilonhalili avatar Feb 13 '24 11:02 drilonhalili

Hei @drilonhalili ! Thank you for your answer, but I have a follow-up question: To what exactly should I add the iframe: true ? Thank you!

bajenaruandrei avatar Feb 13 '24 14:02 bajenaruandrei

Hey @andreibaje, it is in documentation site Froala Options: https://froala.com/wysiwyg-editor/docs/options/?tp_nonce=78b4a42bd4&_wp_http_referer=%2Fwysiwyg-editor%2Fdocs%2Foptions%2F%3F_gl%3D11xa20ha_gaMTY5MTE4MTIuMTcwNTA5NDY2NA.._ga_MKY1GLPRHT*MTcwNTA5NDY2NC4xLjAuMTcwNTA5NDY2NC42MC4wLjA.&s=iframe&post_type=page#iframe:~:text=%27font_awesome_5%27%0A%0A%7D)%3B-,iframe,-Type%3A

drilonhalili avatar Feb 13 '24 14:02 drilonhalili

Hey @drilonhalili ! Thanks, I'll have a look at that.

bajenaruandrei avatar Feb 13 '24 16:02 bajenaruandrei

@andreibaje this is fixed on V4.1.4 https://github.com/froala/wysiwyg-editor/issues/4663#issuecomment-1780082294

drilonhalili avatar Feb 14 '24 13:02 drilonhalili