简体   繁体   中英

How to make Dijit Editor keep  ?

Dijit Editor removes all   entities from user input.

With a Dijit Editor in hand, go into HTML mode, enter some text with some   inside. Go back to WYSIWYG mode, back to HTML mode, then see that your entity disappeared.

Is there any workaround?

HTML

<h1>Test file for Editor &amp;nbsp support</h1>
<div id="br" data-dojo-type="dijit.Editor" data-dojo-props='plugins:["viewsource"]'><p>a&nbsp;b</p></div>

Javascript

require(['dijit/dijit', 'dijit/Editor', 'dijit/_editor/plugins/ViewSource', 'dojo/parser'], function(dijit, editor, viewSource, parser){});

And the same here to play : http://jsfiddle.net/ABaYL/2/

I think this problem is not dojo related.

The entity did not disappear. It was converted to its character. The entity "&nbsp;" was converted to its representation as a character " ". So the entites respresentation is still there. If you want to display &nbsp;, write "& amp ; nbsp;" without the spaces, but i think you already know that since you managed to display &nbsp; in your post. Even the stackoverflow editors filters &nbsp; to its representation.

Take a look here:

http://www.web2generators.com/html/entities

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM