0

你能告诉我编辑完成后如何隐藏或关闭 dijit 编辑器.. 我使用了自动扩展 dijit.editor.. 所以当我点击 div 时,编辑器会打开.. 所以在编辑我的内容后我无法关闭/隐藏编辑器以再次取回包含更新/编辑内容的 div。你能帮我发布隐藏或关闭编辑器的代码吗?

enter code here
<script>
dojo.addOnLoad(function(){
var editor = dijit.byId("myEditor");
editor .onLoadDeferred.addCallback(function(){
editor.attr("value", "<b>This is new content.</b>");
});
});
4

1 回答 1

0

I don't think you can really "close" the editor to get back to a plain div. I suggest that when the user is "done editing" (using onBlur or whatever), you extract the value as HTML, destroy the editor, and re-insert the extracted HTML. Something like this:

var parentNode = editor.domNode.parentNode;
var updatedContent = editor.get("value");
editor.destroyRecursive();
dojo.place(updatedContent, parentNode);
于 2013-03-12T15:43:52.013 回答