突出显示HTMLEditor JavaFx中的文本 [英] Highlight text in HTMLEditor JavaFx

查看:364
本文介绍了突出显示HTMLEditor JavaFx中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在尝试制作一个搜索系统,它的工作原理如下:


  1. 按ctrl + f

  2. 显示文本对话框

  3. 您输入的文字对话框中的文字将在HTMLEditor中突出显示

所以我遇到了第三步的问题我找不到任何关于在Google上为HTMLEditor突出显示或查找任何内容的方法。



所以我的问题是,是否有可能在HTMLEditor中突出显示文本,如果是这样的话怎么样?

解决方案

可能的方法



那里是一个类似的问题搜索&突出显示 WebView中的功能





也许您可以使用该方法的调整(在内部,HTMLEditor是作为WebView实现的,我相信,尽管我可能错了) 。



您可以使用一些技术用于自定义现有的HTMLEditor 以获取用于执行搜索到HTMLEditor工具栏的UI控件。



替代



您可以使用<$ p>

    $ b而不是使用 HTMLEditor $ b
  • WebView with ContentEditable

  • 本机JavaFX富文本编辑器

  • 降价编辑器(如果您使用谷歌JavaFX降价,则有本机JavaFX解决方案)。

  • 运行嵌入式第三方基于JavaScript的HTMLEditor的WebView,其中包括搜索和替换功能(其中有许多,您可以运行谷歌搜索来评估备选方案)。



如果是我,我可能会选择Markdown编辑器方法,如果编辑器是半技术受众或WebView中的第三方JavaScript编辑器,如果受众是非技术性的并且需要带有功能区的WYSIWYG HTML编辑器。


Hello i'm trying to make a search system and it works like this:

  1. You press ctrl + f
  2. A text dialogue shows up
  3. The text in the text dialogue you entered will highlight in the HTMLEditor

So i'm having problems with the third step I can't find any method about highlighting or find anything on google for HTMLEditor.

So my question is, is it possible to highlight text in a HTMLEditor and if so how?

解决方案

Possible Approach

There is a similar question for search & highlight functionality in WebView:

Perhaps you could use an adjustment of that approach (internally the HTMLEditor is implemented as a WebView I believe, though I could be wrong).

You might be able to use some techniques for customizing the existing HTMLEditor to get UI controls for executing searches into the toolbar of the HTMLEditor.

Alternatives

Rather than using HTMLEditor you could either use:

  • A WebView with ContentEditable.
  • A native JavaFX rich text editor.
  • A markdown editor (there are native JavaFX solutions for this if you google JavaFX markdown).
  • A WebView running an embedded third party JavaScript based HTMLEditor which includes search and replace functionality (there are many of these, you can just run a google search to evaluate alternatives).

If it were me, I'd probably choose the Markdown editor approach if the editor was for a semi-technical audience or the third party JavaScript editor in WebView if the audience was non-technical and required a WYSIWYG HTML editor with a ribbon.

这篇关于突出显示HTMLEditor JavaFx中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆