JDK-8091043 : RichTextArea component (reading & editing)
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: fx2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2011-10-13
  • Updated: 2023-08-25
  • Resolved: 2023-08-25
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
Given suggestion of the following thread, I would describe some personal use-cases:
 https://forums.oracle.com/forums/thread.jspa?messageID=9931338&tstart=0#9931338

Context: I am interested in writing an editor for custom XML document format (using mixed content: text+markup). A generic HTML editor like webkit component does not match my expected behaviour because I want a specific format (allowing only my schema markup).

In this domain, you can find open source software like:
Lyx: http://www.lyx.org/Screenshots
Eclipse Vex: http://wiki.eclipse.org/Vex/NewAndNoteworthy
This domain may be known by the name WYSYWYM: http://en.wikipedia.org/wiki/WYSIWYM

For me, a rich text area need to be able of displaying text and image, using hyphenation for text. Some parts need to be editable, others need to be uneditable (like automatic numbering, or markers representing markup).

It would be useful to have two pseudo-classes CSS describing editability (like ":display" or ":edit"): by example for disabling marker display when component is uneditable (user currently reading even if, by clicking on a button, he can change mode to edit).

The caret displacement need to be fluid and follow editability. By example, supposing you are editing a text with some words putted in emphasis, and you are viewing the content with markers, and the markers are text (by example, the text value of tagname) with a border like an arrow:
.start { -fx-background-color: aqua; -fx-border-color: red; -fx-border-width: 1; -fx-border-style: solid; -fx-scale-shape: true; -fx-padding: 1 5 1 1; -fx-shape: "M -0.1,-0.1 L 1.1,-0.1 L 1.2,0.5 L 1.1,1.1 L -0.1,1.1 Z"; }
.stop { -fx-background-color: aqua; -fx-border-color: red; -fx-border-width: 1; -fx-border-style: solid; -fx-scale-shape: true; -fx-padding: 1 1 1 5; -fx-shape: "M -0.1,-0.1 L 1.1,-0.1 L 1.1,1.1 L -0.1,1.1 L -0.2,0.5 Z";}
Then when you are advancing horizontally your caret of one step from before the uneditable text "em" of marker of emphasis, you are not going between 'e' and 'm' but after "em" (because this text node is uneditable, then only one step for caret displacement, even if in some cases it can be a jump between multiple lines).

It is needed to be able of displaying popups (suggesting possible starting markup) on caret position or on selections (move selected text under new markup tags).

Selection crossing borders of items in rich text area is a big problem, but can probably be treated, at least at start, like multi-selection. A selection of items crossing structure is a collection of simple selections on some items of the structure.

As a developer, I need to be able of adding custom items in rich text area: by example, in my case, I would like to put directly my node modelling emphasis, or some other semantic content, in the rich text node. Then I would like to contribute a skin allowing it to be displayed as a text node with content between two others text node containing text "em" and borders like a start arrow and a stop arrow (this simple case can be made with CSS :before and :after pseudo-classes), with choice of possible or not of a linebreak between marker and content. Then a developer need to be able of specifying break points possible for hyphenation. I would appreciate if JavaFX give by default possibility to add at least text (with customizable hyphenation: like 0, 1, 2, 3, 4  or infinity letters at least before or after line-break) and image (no hyphenation support) for having an good base reusable.
In some cases, the developer will need to be able of adding complex content (like mathematics equation or vector graphics), even if no component will be provided by JavaFX. It is then needed to be able of adding custom component from the two manners: completely new component or component defined by reusing some components provided by JavaFX runtime.

Most of theses problems can be found symetrically for pagebreaks, like linebreaks (with some more edge cases like vertical movement of caret).

Thank you very much.

Comments
Closing as a duplicate of JDK-8301121.
25-08-2023