Comments (6)
Hi Maher,
yes, this does not work in InlineCssTextArea (or any other flavor of StyledTextArea), frankly because it's not implemented. The way it is implemented in TextArea doesn't translate to StyledTextArea, because we want to be able to set text color per range, not per the whole text area.
You can set the color of a range of text like this
area.setStyle(from, to, "-fx-fill: red;");
If you want to set a default text color for all text where the color is not given explicitly by the above method, you can do so by including the following in your application stylesheet:
.styled-text-area .text {
-fx-fill: purple;
}
from richtextfx.
Hi Thomas thanks for explaining. this makes sense. the reason why I just
tested it with a whole text for now was that I did not get to the point
where i implemented ranges yet. I spent the time rethinking the procedures
I used to have in my previous prototype. I'm almost there and should get
started on ranges soon.
I'll report back if I encounter other issues
Best regards
Maher
On Jan 26, 2014 3:45 PM, "TomasMikula" [email protected] wrote:
Hi Maher,
yes, this does not work in InlineCssTextArea (or any other flavor of
StyledTextArea), frankly because it's not implemented. The way it is
implemented in TextArea doesn't translate to StyledTextArea, because we
want to be able to set text color per range, not per the whole text area.You can set the color of a range of text like this
area.setStyle(from, to, "-fx-fill: red;");
If you want to set a default text color for all text where the color is
not given explicitly by the above method, you can do so by including the
following in your application stylesheet:.styled-text-area .text {
-fx-fill: purple;}—
Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-33334764
.
from richtextfx.
Hi Thomas,
Inline CSS does not seem to be working on ranges for me.
I did some debugging and noticed that
1 - getSelectedText() and getText() returned empty strings.
2 - range.getEnd() and range.getStart() both return 0.
Is this working for you?
Thanks,
Maher
from richtextfx.
Hi Maher, can you post a simple self-contained example that demonstrates the issue?
The ManualHighlighting example (gradle ManualHighlighting
to run) uses getSelection().getStart()/getEnd() and it works fine.
from richtextfx.
Hi Thomas, let see how to factor the code and post back.
Best
Maher
On Jan 28, 2014 3:03 AM, "TomasMikula" [email protected] wrote:
Hi Maher, can you post a simple self-contained example that demonstrates
the issue?
The ManualHighlighting example (gradle ManualHighlighting to run) uses
getSelection().getStart()/getEnd() and it works fine.Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-33468900
.
from richtextfx.
Hi @TomasMikula , i have two queries.
-
How to set different styles to words in same paragraph or line of
GenericStyledArea
? I am doing it like this ....area.setStyle(area.getText().lastIndexOf(text), area.getText().length(), TextStyle.EMPTY.updateTextColor(color));
This works only for first word, but when i append the second word with different style likearea.setStyle(area.getText().lastIndexOf(text), area.getText().length(), TextStyle.EMPTY.updateTextColor(color).updateBold(true);
It also changes the style of first text. Now how to do it ?
- How to add different objects in same
GenericStyledArea
. What i mean to say is if i define the area like this
final GenericStyledArea<ParStyle, Either<StyledText<TextStyle>, LinkedImage<TextStyle>>, TextStyle> area
.
I can insert onlyLinkedImage
objects into this. But if i have to add lets say anText
orHyperlink
Object then how to do it. I can manage the hyperlink with styling as you explained in some pull request but if i have to add Hyperlink and I mage in area then how to do it ?
Thank you.
from richtextfx.
Related Issues (20)
- 'Variables' in rich text HOT 2
- getTotalAreaWidthEstimate() HOT 1
- How to refresh/redraw the area? HOT 2
- Question: what is the best practice for frequently changed text? HOT 5
- Question: How to keep the selection when append text? HOT 2
- GenericStyledArea adding inappropriate character when using a different keyboard setup HOT 3
- Question: InlineCssTextArea for appending 100 000 lines HOT 2
- How to set the size of tab in CodeArea? HOT 2
- StyleClassedTextArea + PageUp/PageDown -> NoSuchElementException + IndexOutOfBoundsException HOT 3
- Question: xml highlighter gives StackOverflowError HOT 2
- Question: How to move selected code right/left using Tab/Shift+Tab? HOT 3
- Question: How to show vertical lines in CodeArea for indentations? HOT 6
- Question: How to set selection color via code or CSS? HOT 4
- Question: how I can use InlineCssTextField with multiple color and pattern text please HOT 3
- Question: codeArea.removeSelection delayed display HOT 1
- CodeArea seems to intercept the input method, preventing it from being passed to other TextFields.
- Remove null character at end of pasted string
- JDK8 project HOT 1
- Question: is it possible to disable scrolling to bottom on appending text? HOT 2
- Question: How to set background color for current line/paragraph using CSS? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from richtextfx.