jquery.textarea-highlighter.js icon indicating copy to clipboard operation
jquery.textarea-highlighter.js copied to clipboard

CSS Styling & Positioning Issues

Open JamoCA opened this issue 9 years ago • 4 comments

I haven't been able to use this plugin in any projects due to the background highlighting color not aligning with the text in the textarea field. I believe it's due to font spacing, kerning or height issues with the hidden text wrapping consistently with the displayed text. I can only get it to function after sizing everything perfectly using a fixed-width textarea field... which I can't really use since we're using a responsive framework.

JamoCA avatar Dec 21 '15 16:12 JamoCA

@JamoCA do you have any screen shows or some code that you could share so I can understand the issue better? Btw, we at Gengo use this plugin in production with a responsive layout, and it works with no issue (there are some small issue with Japanese fonts... but don't think you are using that)

marexandre avatar Jan 26 '16 17:01 marexandre

@marexandre I have a demonstration for you that doesn't work. Seems to be the same as @JamoCA described. Also this will highlight the wrong things and when running $context.textareaHighlighter("destroy"); it will indefinitely unwrap elements. I don't want to put you under pressure, but please reply within 2 days, otherwise I need to switch over to a different plugin.

julkue avatar May 01 '16 09:05 julkue

I get that this is a tough nut to crack, but it really is unfortunate that this plugin only seems to work with static-sized content. If you go with a setup that tells the text area to fill the container, it will not position the highlight containers on any line except the first line.

The rules I am using for that textarea are: width: 100%; height: 100%; max-height: 100%; /* min-height: 500px; / display: block; position:absolute; top: 0; left:0; right:0; bottom:0; / padding:1em; / box-sizing: border-box; / For IE and modern versions of Chrome / -moz-box-sizing: border-box; / For Firefox / -webkit-box-sizing: border-box; / For Safari / And the rules for the parent are: width: 100%; height: calc(100% - 60px); display: block; position:absolute; top: 20px; left:0; right:0; bottom:0; box-sizing: border-box; / For IE and modern versions of Chrome / -moz-box-sizing: border-box; / For Firefox / -webkit-box-sizing: border-box; / For Safari */

Attached is a screen shot 2016-05-20 at 3 00 06 pm

zachrybaker avatar May 20 '16 20:05 zachrybaker

@zachrybaker For the time being, check out this article for an alternative.

julkue avatar May 20 '16 20:05 julkue