4
I need to do a textual search on a set of data produced by Ckeditor. This editor converts text into HTML entities such as:
Serviços oferecidos ---> Serviços oferecidos
What I need, short term, is that when the user enters a input
with the value "services", I can convert this into serviços
in order to use that term in the search. At first I could do this on the client side (Javascript) or server side (Python), but my hope is that Ckeditor itself had some utility to help me in this...
I searched Google for something like this - both specific to Ckeditor and general to Javascript, but I couldn’t find anything (at most code that converts the basics - like <
for <
- but nothing more complete). There is a simple and "clean" way to do this? (Workaround: create an invisible editor, play the text there and pick up back using the getData
)
P.S. I am using Ckeditor 4.4.5, Full package. I suspect that the person responsible for the entity conversion is the plugin "Escape HTML Entities" (default in any installation, provided the Basic package), but I couldn’t find any more detailed documentation of it except the one shown on the download page (i.e. some settings, and only).
He came to see
CKEDITOR.tools.htmlEncode
?– bfavaretto
@bfavaretto Yes, but this method only makes the basic substitutions (at least called as
htmlEncode(texto)
, without any additional parameter).– mgibsonbr
You are right. It is even this plugin that you cited the responsible for Settings as
entities_latin
and similar. Its source code is on github: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/entities/plugin.js– bfavaretto
@bfavaretto Great, I really wanted to see the fonts of this plugin but I was not finding it! This explains why the
htmlEncode
did not work: the plugin acts at the editor level, not at the global level (i.e. two editors on the same page may have the plugin enabled and the other disabled). Unfortunately when seeing the fonts I did not find any utilitarian function, but I ended up finding a way to get to the desired function after a lot of trial and error... Thanks!– mgibsonbr