Hey Andy and others,
from my perspective as an application developer, I would look for
providing an abstract but robust implementation that would allow anyone
to implement such a concrete rich text field without any roadblocks.
Maybe even going as far as going for a more abstract implementation than
text areas. I.e. allowing you to define any kind of data model class
which can be flexibly represented by a set of compound nodes and
controls and can update and reflect the model state dynamically.
I think that way you would also get a few more people on board who are
not currently longing for a rich text area because they are either
satisfied with the existing solutions or their applications that they
typically work with do not use them. If such a work effort could benefit
more areas of JavaFX than just rich text editing, people would be happy
to jump on board.
Instead of creating a RichParagraph.Builder, why not create a more
generic CompoundControlSegment.Builder, CompoundControl.Builder,
CompoundControl, etc.? I.e. being able to easily add arbitrary nodes and
controls in segments/lines, also allowing for an easy way to set style
classes and inline styles. Being able to bind each node's contents to
part of the data model, having some undo/redo functionality for this
model. The StyledAttribute and StyleHandlerRegistry concept can also be
applied to more than just text areas. And also the idea of the
ConfigurationParameters to allow for an easy but custom handling of
other things such as scrollbars for the resulting compound control. This
would allow developers to use these same principles for other
implementations as well, for example creating forms. And I can
definitely find some use for such a concept in other places far away
from text areas as well.
The proposed actual rich text area can then still be included as a
concrete implementation of this absraction.
Best
Christopher Schnick
On 21/02/2024 19:07, Andy Goryachev wrote:
Dear JavaFX developers:
We would like to propose a new feature - rich text control,
RichTextArea, intended to bridge the functional gap with Swing and its
StyledEditorKit/JEditorPane. The main design goal is to provide a
control that is complete enough to be useful out-of-the box, as well
as open to extension by the application developers.
This is a complex feature with a large API surface that would be
nearly impossible to get right the first time, even after an extensive
review. We are, therefore, introducing this in an incubating module,
*javafx.incubator.richtext*. This will allow us to evolve the API in
future releases without the strict compatibility constraints that
other JavaFX modules have.
Please take a look at the proposal [0], a list of discussion points
[1], and the API Specification (javadoc) [2]. While the proposed API
is ready for review, it isn't complete nor set in stone. We are
looking for feedback, and will update the proposal based on the
suggestions we receive from the community. We encourage you to
comment either in the mailing list, or by leaving comments inline in a
draft pull request [3]. For context, the links to the original RFE
[4] and a list of missing APIs related to rich text [5] are provided
below.
Sincerely,
Your friendly JavaFX development team.
References
[0] Proposal:
https://github.com/andy-goryachev-oracle/Test/blob/rich.jep.review/doc/RichTextArea/RichTextArea.md
[1] Discussion points:
https://github.com/andy-goryachev-oracle/Test/blob/rich.jep.review/doc/RichTextArea/RichTextAreaDiscussion.md
[2] API specification (javadoc):
https://cr.openjdk.org/~angorya/RichTextArea/javadoc
[3] Draft Pull Request for API comments and feedback:
https://github.com/openjdk/jfx/pull/1374
[4] RichTextArea RFE: https://bugs.openjdk.org/browse/JDK-8301121
[5] Missing APIs related to rich text control:
https://bugs.openjdk.org/browse/JDK-8300569