Git Product home page Git Product logo

Comments (9)

TomasMikula avatar TomasMikula commented on May 18, 2024

To confirm, a paragraph is collection of styled texts that is separated
from others by a new line before it and after it. right?

Yes, basically. More precisely, a paragraph is a sequence of styled texts
and an optional line terminator. All paragraphs in a StyledDocument except
the last one do have a line terminator.

Would it be possible to provide a method to get Paragraph at caret?

You can already do that:

area.getParagraphs().get(area.getCurrentParagraph());

Probably outside your scope, not sure. but do you plan to provide
paragraph alignment options?

I don't have any concrete plans, but this falls under issue #6.

from richtextfx.

 avatar commented on May 18, 2024

Thanks. How about the start and end of a paragraph? or set style for a
whole paragraph?

On Wed, Apr 16, 2014 at 11:36 AM, TomasMikula [email protected]:

Closed #41 #41.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41
.

from richtextfx.

 avatar commented on May 18, 2024

just found a "restyle" ! thanks that shoul ddo it :)

On Wed, Apr 16, 2014 at 11:46 AM, Maher Elkhaldi [email protected]:

Thanks. How about the start and end of a paragraph? or set style for a
whole paragraph?

On Wed, Apr 16, 2014 at 11:36 AM, TomasMikula [email protected]:

Closed #41 #41.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41
.

from richtextfx.

TomasMikula avatar TomasMikula commented on May 18, 2024

Just note that paragraph.restyle(newStyle) doesn't change the paragraph in the text area. It creates and returns a new one. To change the style of a paragraph in a text area, you use area.setStyle(paragraphIndex, newStyle).

from richtextfx.

 avatar commented on May 18, 2024

Hmm OK. And to get the index of the paragraph at caret I would do indexOf
right?
On Apr 16, 2014 11:53 AM, "TomasMikula" [email protected] wrote:

Just note that paragraph.restyle(newStyle) doesn't change the paragraph
in the text area. It creates and returns a new one. To change a style of a
paragraph in a text area, you use area.setStyle(paragraphIndex, newStyle).


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-40637475
.

from richtextfx.

 avatar commented on May 18, 2024

I got the paragraph with currentParagrapht.
Is there a way to get its indexRange from the area?

from richtextfx.

 avatar commented on May 18, 2024

The reason I need this is that I am applying a size change to a paragraph, but it it has different styled texts. so I only want to update the size. so I am using the styles.map method. for that, I need to set styleSpans to the range, where the paragraph starts and ends.

I found a full length method, but trying to figure out a way to get the start location of a paragraph.

from richtextfx.

 avatar commented on May 18, 2024

moved this to another issue an enhancement request :)

from richtextfx.

TomasMikula avatar TomasMikula commented on May 18, 2024

Per-paragraph alignment is now supported with the latest SNAPSHOT.

from richtextfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.