-
Notifications
You must be signed in to change notification settings - Fork 236
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
Feature request: set text range background #4
Comments
Hi Maher, I'm planning on adding a different, more general feature, that would enable you to do this. It is setting and getting multiple style ranges at once. There would be a class like class StyleRanges<S> {
int start;
int[] ends;
S[] styles;
} where You would have these additional methods on text area: void setStyleRanges(StyleRanges ranges);
StyleRanges getStyleRanges(int from, int to); Using these, you would set the background for a range StyleRanges ranges = area.getStyleRanges(from, to);
for(int i = 0; i < ranges.styles.length; ++i) {
ranges.styles[i] = ranges.styles[i] + "-fx-background-color: #abcdef;";
}
area.setStyleRanges(ranges); Let me know if this would work for you. I should be able to add this early next year. Regards, |
Hi Tomas, A question: What does the Feedback: I think (and this might be my personal approach to things), I Thanks a lot for your help! and have great holiday! On Mon, Dec 23, 2013 at 7:51 PM, TomasMikula notifications@github.comwrote:
|
The Let's just make sure we are on the same page. You already can set the background of a text range using But then you might want the same for, say, bold face: Set bold font for a given range, without affecting any other style properties in that range. So we add Best, |
Hi Tomas, The way I am going about handling my CSS styles and ranges is as follows: make a range object which will store the selected range, the text strings For the CSS, I'll store color values, sizes, weight, etc into fields, which And then construct a CSS style string by concatenating slider values as in: Then have a wrapping method to manage the updating of the CSS style string that's my poor man way of doing it I guess :D On Mon, Dec 23, 2013 at 9:24 PM, TomasMikula notifications@github.comwrote:
|
I don't quite understand when you construct your ranges and why you keep track of them by yourself. If you are working on a rich text editor, what happens (in terms of your ranges) when you select text between 0 and 10 and click bold, and then select text between 5 and 15 and choose yellow background color? How do you handle overlapping ranges? |
Hi Tomas, There is a different concept in the prototype I am working on,
|
Alright, I'm looking forward to your working example ;). As for this issue, On Tue, Dec 24, 2013 at 12:51 PM, melkhaldi notifications@github.comwrote:
|
Yes. I do sir :D I'll report back!
|
Hi Tomas,
Would it be possible to look into adding a couple of method to set and apply a background color to selected ranges within text?
The functionality I am hoping to achieve is to store the ranges selected by the user for a given text string and give them the option to show/hide background color for those ranges.
For example:
myRange = textAreaCSS.getSelection();
myRange.setBackground(Color c);
myRange.showBackground(true);
Thanks for your help with this.
Best regards,
Maher
The text was updated successfully, but these errors were encountered: