3 Replies Latest reply: Sep 17, 2013 2:25 AM by jsmith RSS

    Rich Text Editor status

    NikitaLipsky

      I see on JavaFX roadmap that the new JavaFX version will have support for Rich Text. And there is the topic on OpenJFX project as well -- https://wiki.openjdk.java.net/display/OpenJFX/Rich+Text+API+Samples .

      I wonder what is the progress for this? Is theree any prototype available for Rich Text API and Rich Text Editor control? I cannot find it in OpenJFX repositories. I cannot use HTMLEditor as workaround as it is not customizable. And TextArea is just plain text editor.

      Thanx.

        • 1. Re: Rich Text Editor status
          jsmith

          The rich text api for JavaFX is implemented in the Java 8 developer preview release.

           

          I believe everything that you see in the OpenJFX Wiki is implemented in the Java 8 preview.

           

          Note that the rich text api for JavaFX is currently a display only control, i.e. there is no rich text editor control in the JavaFX platform (outside of the existing HTMLEditor).

           

          Perhaps a (non HTML based) rich text editor control will be included in a future Java update (post Java 8 initial release on March 2014) or perhaps a 3rd party will create such a rich text editor for JavaFX.

           

          > I cannot use HTMLEditor as workaround as it is not customizable.

           

          You can embed other html based editors into a JavaFX application if you require further customization (see for example, this CodeMirror based editor).

          Additionally there are feature requests in the JavaFX issue tracker to allow greater customization of the inbuilt HTML Editor, but those have not been actioned.

          Some limited customization of the existing HTMLEditor is also possible, see:

          Re: Customizing HTMLEditor element

          HTMLEditor customization Gist

          • 2. Re: Rich Text Editor status
            NikitaLipsky

            Thank you for the answer.

            jsmith wrote:

             

            Note that the rich text api for JavaFX is currently a display only control, i.e. there is no rich text editor control in the JavaFX platform (outside of the existing HTMLEditor).

             

            Perhaps a (non HTML based) rich text editor control will be included in a future Java update (post Java 8 initial release on March 2014) or perhaps a 3rd party will create such a rich text editor for JavaFX.

            Do you know someone who is working on the editor control now? Actually, Swing Stylepad-like control is enough for me, but I would like to have pure FX control.

            If I try to create my own editor control, will it be possible to contribute the control to somewhere?

            jsmith wrote:

             

            You can embed other html based editors into a JavaFX application if you require further customization (see for example, this CodeMirror based editor).

            Additionally there are feature requests in the JavaFX issue tracker to allow greater customization of the inbuilt HTML Editor, but those have not been actioned.

            Some limited customization of the existing HTMLEditor is also possible, see:

            Re: Customizing HTMLEditor element

            HTMLEditor customization Gist

             

            It looks like hacks, sorry. Actually I need better level of customization, embedding, for instance, arbitrary FX controls and having full control on the contents and behavior of the control.

            • 3. Re: Rich Text Editor status
              jsmith

              > Do you know someone who is working on the editor control now?

               

              No, not really in the sense of a general purpose styled text editor.  I am sure that there has been some consideration in the JavaFX team around such a control, but I don't think it is scheduled for implementation before Java 8 delivery.

               

              I'm not familiar with Stylepad, so I don't know exactly what type of editor you want to create, so some of the comments I write may not apply to your situation.

               

              There are a few JavaFX based Markdown editors out there (which I actually prefer to most HTML editors - e.g. compare StackOverflow editing style with this forum's editor), but those kind of things don't work for all audiences.

              https://github.com/eugener/markdown-pad-fx

              https://bitbucket.org/shemnon/flowdown/

               

              A syntax highlighting code editor for JavaFX:

              Build an intelligent code editor with JavaFX and JDT | Tomsondev Blog

               

              > It looks like hacks, sorry.

               

              The HTMLEditor based changes from my gist are hacks :-)

               

              Maybe one way to get the functionality you want without resorting to hacks is to implement your own HTMLEditor skin


              If you created your own rich text editor for JavaFX, the HTMLEditor implementation might serve as a useful reference point as presumably they would have much in common, just that the rendering would be performed by the rich text controls rather than the WebView control.

               

              The wrapping of 3rd party html based editors I do not call a hack.  There are lots of semi-reasonable html based editors out there, including things like Google Docs which are perfectly embeddable in JavaFX 8 via WebView.  Even the standard JavaFX HTMLEditor is just a WebView with content editable set to true and some fancy UI and logic for manipulating the WebView document.

               

              > If I try to create my own editor control, will it be possible to contribute the control to somewhere?

               

              Yes.

               

              There are various 3rd party projects that would likely accept a rich text editor (as they currently lack one), JFXtras 2, ControlsFX and JideFX.

               

              You can also create a specific project under your own account on somewhere like github or bitbucket.

               

              Contributions to open-jfx are possible, though contributing an all JavaFX rich text editor to open-jfx is a a pretty high bar to set yourself.

               

              As I previously mentioned, there are feature requests in the JavaFX issue tracker to allow greater customization of the in-built HTML Editor, but those have not been actioned.  Rather than creating a JavaFX only rich text editor, you could contribute to open-jfx implementations that provide a more customizable HTMLEditor.  Mainly I think those tasks are do with allowing an HTMLEditor which does not have the toolbars on it, but instead provides API for the user to provide their own editing controls.  Such an API would likely be provided by implementing the TextInputControl API in the HTMLEditor and making that public. 


              You may want to post on the OpenJFX mailing list first if you are interested in contributing code to OpenJFX.