标签被附加到dojo编辑器内容

时间:2011-12-19 16:45:21

标签: dojo rich-text-editor

我在jsp页面上有一个dojo编辑器。 dojo编辑器是必需字段之一,我已经为它进行了验证。有一种情况会附加一些标签。当它被追加时我找不到特定的模式,但大多数时候它会在编辑器上选择并复制所有内容和粘贴后发生。所以这个案例中的编辑内容是

<div id="dijitEditorBody">content which user entered</div> 

问题:当用户删除所有输入的内容时,标签仍然存在并被提交。在这种情况下,至少可视化编辑器没有内容,但该字段包含以下值:

    <div id="dijitEditorBody"></div> 

   <div id="dijitEditorBody"><br /></div>

因此,当从数据库中检索数据时,它会跳过验证并显示一个空的编辑器?

我很困惑为什么要追加这些标签? Actual data entered

Editor Content

1 个答案:

答案 0 :(得分:1)

在RichText.js中,这个片段:

if(dojo.isIE || dojo.isWebKit || (!this.height && !dojo.isMoz)){
        // In auto-expand mode, need a wrapper div for AlwaysShowToolbar plugin to correctly
        // expand/contract the editor as the content changes.
        html = "<div id='dijitEditorBody'></div>";
        setBodyId = false;
    }else if(dojo.isMoz){
        // workaround bug where can't select then delete text (until user types something
        // into the editor)... and/or issue where typing doesn't erase selected text
        this._cursorToStart = true;
        html = "&nbsp;";
    }

解释添加该标签的原因...... 虽然您在警报框中看到它,但我相信它在发布的内容中不存在......对吗? 编辑器应该注意删除extra-tags =&gt;未经测试但非常确定...

相关问题