在 WordPress 编辑器中突出显示或下划线搜索词

Highlight or underline search words in WordPress Editor

我有一个插件可以警告用户 post 中的某些词可能不应该使用。目前,当他们正在编写或编辑他们的 post.

时,它只是在编辑器 window 的底部列出这些词

我想突出显示违规词,以便他们可以轻松找到它们(特别是如果他们只是粘贴了一大块文本)。我找到了几个 jquery 插件 (Highlight Textarea and Highlight Within Textarea),但在这种情况下它们似乎都不起作用(可能是由于文本区域的动态大小)。有任何想法吗?有没有办法通过 TinyMCE 做到这一点?

谷歌搜索它只是提出了一堆关于如何手动突出显示要在 post 中突出显示的文本的答案。我想要相反的东西:一个只在编辑器中突出显示的自动荧光笔,而不是 post。哦,它应该适用于视觉和文本视图...

这不是完整的代码答案,但听起来您应该看一下 mark.js https://markjs.io/ 并在 post 中定位编辑器 div WordPress 中的编辑器。

mark.js is a text highlighter written in JavaScript. It can be used to dynamically mark search terms or custom regular expressions and offers you built-in options like diacritics support, separate word search, custom synonyms, iframes support, custom filters, accuracy definition, custom element, custom class name and more.

该页面上有许多示例可供使用。