我在asp.net的更新面板中遇到了CKEditor的问题.我在页面上有多个CKEditor的标签控件,即每个标签中有一个ckeditor.
string scriptAdd = @"var editor = CKEDITOR.instances['ctl00_ContentPlaceHolder1_faqeditor']; if (editor) { editor.destroy(true); } CKEDITOR.replace('ctl00_ContentPlaceHolder1_faqeditor');";
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", scriptAdd, true);
Run Code Online (Sandbox Code Playgroud)
上面的代码片段有助于在更新面板中呈现编辑器.但是当回发完成时,它仍然显示较早的值而不是更改的值,即编辑器不会反映更新面板中更改选项卡后所做的更改.
没有更新面板,同样的事情完全正常.
这个问题有什么解决方案吗?
Is there an option to paste always from the clipboard as plain text?
I tried it that way, but that does not work:
$(document).ready(function () {
ClassicEditor.create(document.querySelector('#text'), {
toolbar: [
'heading',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'blockQuote',
'undo',
'redo'
]
}).then(function (editor) {
this.listenTo(editor.editing.view, 'clipboardInput', function (event, data) {
// No log.
console.log('hello');
});
}).catch(function (error) {
});
});
Run Code Online (Sandbox Code Playgroud)
https://docs.ckeditor.com/ckeditor5/latest/api/module_clipboard_clipboard-Clipboard.html
https://docs.ckeditor.com/ckeditor5/latest/api/clipboard.html
当您在 CKEditor 5 classic 中添加长内容时,滚动时工具栏会固定在浏览器窗口的顶部。
但是我有一个固定位置的白色徽标区域,下方有一个菜单栏,工具栏出现在它们上方:

我怎样才能让它留在我的固定标题/导航下?
我想知道:当引用编辑器对象时,我如何获得该编辑器的实际底层源DOM元素 - 例如.textarea?
有点像editor.element?(不起作用)
谢谢.
我在 CKEditor 内联添加了一个自定义插件来执行粗体操作。该插件按预期工作,但按钮的开/关状态不起作用。
当命令执行时,其状态始终为TRISTATE_OFF。
CKEDITOR.plugins.add( 'customBold', {
requires: 'toolbar',
icons: 'bold',
hidpi: false,
init: function( editor ) {
var boldCommand = {
exec: function( editor ) {
document.execCommand('bold', false, null);
}
}
editor.addCommand( 'bold', boldCommand );
editor.ui.addButton && editor.ui.addButton( 'Bold', {
label: 'bold',
command: 'bold',
toolbar: 'basic,10'
});
editor.setKeystroke( [
[ CKEDITOR.CTRL + 66 /*B*/, 'bold' ]
]);
}
});
Run Code Online (Sandbox Code Playgroud)
当用户选择粗体文本时,我想在工具栏中切换粗体样式。
我正在从CKEditor 4.7迁移到5.
在CKE4中,我会做这样的事情:
CKEDITOR.replace('text_area');
然后在另一个JS函数中我可以得到数据
CKEDITOR.instances.text_area.getData().
但似乎CKE5没有功能ClassicEditor.instances或类似的功能.
我知道我可以将编辑器实例存储为全局JS变量,但我正在使用的代码在一般函数中创建编辑器,因此我不能只创建一个全局变量,因为我不知道编辑器的名称先验.屏幕上也可以同时激活多个编辑器.
CKE5中是否没有模拟旧版本instances,这样我就可以从id它替换的textarea中获取一个编辑器实例?
我想我可以创建自己的全局数组来保存编辑器实例,但是如果有内置的东西并且支持得更好,我宁愿不要
我想在CKEditor源代码中的<span>标签内添加标签<a>:
<a href="http://google.com"><span>Link here</span></a>
Run Code Online (Sandbox Code Playgroud)
但是当我在源模式下在CKEditor中添加HTML时,它会将其转换为:
<a href="http://google.com">Link Here</a>
Run Code Online (Sandbox Code Playgroud)
如何在内部允许HTML标记href?
我们正在尝试将 CKEditor 5 实施到我们的应用程序中,但我们在文档方面遇到了一些困难。
我们想禁用放置事件到编辑区域或以某种方式控制它。有活动吗?
我们正在尝试editor.model.document.on('clipboardInput')或editor.model.document.on('dragover')没有任何运气。这些事件不会被触发。
我正在尝试更新一些已初始化的 CKEditor,但它不起作用。
在 CKEditor 4 中,它是:
for(var instanceName in CKEDITOR.instances)
CKEDITOR.instances[instanceName].updateElement();
Run Code Online (Sandbox Code Playgroud)
不适用于 CKEditor 5。
我有这段代码可以从他们的网站启用 CKEditor,但我不知道如何与其交互。如何使用 javascript 或 jquery 从中获取数据?
ClassicEditor
.create(document.querySelector('#editor'))
.then(editor => {
console.log(editor);
})
.catch(error => {
console.error(error);
});Run Code Online (Sandbox Code Playgroud)
<script src="https://cdn.ckeditor.com/ckeditor5/10.0.1/classic/ckeditor.js"></script>
<textarea name="content" id="editor">
<p>Here goes the initial content of the editor.</p>
</textarea>Run Code Online (Sandbox Code Playgroud)
ckeditor ×8
ckeditor5 ×6
javascript ×4
html ×2
jquery ×2
asp.net ×1
css-position ×1
updatepanel ×1