我在mvc应用程序中工作并使用ckeditor 3.6.2版本.我使用以下代码从ckeditor获取选定的html.
CKEDITOR.editor.prototype.getSelectedHtml = function () {
if (CKEDITOR.env.ie) {
this.focus();
selection = this.getSelection();
} else {
selection = this.getSelection();
}
if (selection) {
var bookmarks = selection.createBookmarks(),
range = selection.getRanges()[0],
fragment = range.clone().cloneContents();
selection.selectBookmarks(bookmarks);
var retval = "",
childList = fragment.getChildren(),
childCount = childList.count();
for (var i = 0; i < childCount; i++) {
var child = childList.getItem(i);
console.log(child);
retval += (child.getOuterHtml ?
child.getOuterHtml() : child.getText());
}
return retval;
}
};
Run Code Online (Sandbox Code Playgroud)
当我选择文本并调用CKEDITOR.instances.editor1.getSelectedHtml()时,我在chrome浏览器中遇到问题.
例如,假设在我的编辑器中有一个内容<span style ="color:red;"> Welcome Note </ span>.如果我选择"欢迎注意"并调用getSelectedHtml()方法firefox,safari,IE8返回带有span标记的"Welcome …
我在一个mvc 2 Rc项目工作.它工作正常,直到今天早上.早上我收到一条错误信息.
分析器错误消息:类型'System.Web.Mvc.ViewMasterPage'是不明确的:它可能来自程序集'C:\ Intersight\IntersightWeb\bin\IntersightWeb.DLL'或来自程序集'C:\ WINDOWS\assembly\GAC_MSIL\System.Web.Mvc\2.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll程序".请在类型名称中明确指定程序集.

但在之前的执行中它还可以.我试图以多种方式解决上述问题.请帮我继续.
我遇到了CKEditor自动增长插件的问题:
按下返回(自动生长超过最小高度后),文本内容会抖动(向上跳一行并向下跳),垂直滚动条会闪烁.自动增长工作,但用户体验是生涩的.
我可以通过指定scrolling ="no"和overflow ="hidden"隐藏垂直滚动条,但文本内容仍然会抖动.
我在ckeditor.js中禁用滚动:
<iframe scrolling="no" style="width:100%;height:100%;overflow:hidden;" frameBorder="0" title="'+E+'"'+' src="'+W+'"'+' tabIndex="'+(b.webkit?-1:C.tabIndex)+'"'+' allowTransparency="true"'+'></iframe>
Run Code Online (Sandbox Code Playgroud)
CKEditor初始化代码:
CKEDITOR.replace('Description',
{
sharedSpaces:
{
top: 'topSpace',
bottom: 'bottomSpace'
},
extraPlugins: 'autogrow,tableresize',
removePlugins: 'maximize,resize,elementspath',
skin: 'kama',
toolbar: [['Format', 'Font', 'FontSize'], ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'], ['TextColor', 'BGColor'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['NumberedList', 'BulletedList'], ['Outdent', 'Indent'],
'/', ['Link', 'Unlink', 'Anchor'], ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar'], ['PasteText', 'PasteFromWord'],['Cut','Copy','Paste'], ['Undo', 'Redo'], ['Find', 'Replace'], ['SpellChecker']],
toolbarCanCollapse: false,
pasteFromWordRemoveFontStyles: false,
enterMode: CKEDITOR.ENTER_BR,
shiftEnterMode: CKEDITOR.ENTER_P,
autoGrow_minHeight: 300
})
Run Code Online (Sandbox Code Playgroud)
有没有办法避免文本内容在按下回车键时跳转/移动(在自动增长超过最小高度后)?
我在我的MVC应用程序中使用CKEditor ver.3.6.
我的要求是使用ckEditor中的新文本更新所选文本.我可以找到方法editor.getSelection().getSelectedText(); 从编辑器中获取所选文本.当按下工具栏按钮时,我需要添加一些带有所选文本的标签,并使用javascript更新所选内容.
例如 :
ckEditor中的内容是
<span>Edit content in the editor</span>
我从ckEditor中选择了"编辑器"这个词.我必须使用javascript代码用"ckEditor"更新所选单词"editor".
请提出正确的解决方案.