ckeditor4使用动态创建的编辑器insantces访问focusmanager
ckeditor 4 accessing focusmanager with dynamically created editor insantces
我目前有一个编辑器,当它加载时,它将始终在页面上,该页面具有通过单击添加按钮添加多个编辑器的功能。
我的代码只适用于与页面一起加载的第一个编辑器,即使是在页面加载后动态创建的,我如何调整它以适用于页面上的所有编辑器?(动态创建的编辑器)
$(document).ready(function(){
$.each(CKEDITOR.instances, function(instance){
var editor = CKEDITOR.instances[instance];
if (editor) {
editor.on( 'focus', function( e ) {
$('.hint').show();
});
editor.on( 'blur', function( e ) {
$('.hint').hide();
});
}
});
});
eidt 1-完整代码减去html
$(document).ready(function(){
$('textarea').each(function(i) {
var editorId = $(this).attr('id');
if(editorId != 'master'){
if( $(this).hasClass('main') ){
ckeditor_simple_toolbar(editorId);
}
if( $(this).hasClass('extras') ){
ckeditor_advanced_toolbar(editorId);
}
}
});
$.each(CKEDITOR.instances, function(instance){
var editor = CKEDITOR.instances[instance];
if (editor) {
editor.on( 'focus', function( e ) {
$('.hint').show();
});
editor.on( 'blur', function( e ) {
$('.hint').hide();
});
}
});
$('.add_extra').live('click',function(){
ckeditor_advanced_toolbar(this.id);
});
});
function ckeditor_simple_toolbar(textA_id){
CKEDITOR.replace(textA_id,{
tabSpaces : 4
});
}
function ckeditor_advanced_toolbar(textA_id){
CKEDITOR.replace(textA_id,{
emailProtection : 'encode',
tabSpaces : 4,
extraPlugins : 'autogrow',
height : 100,
autoGrow_minHeight : 100,
autoGrow_maxHeight : 400,
removePlugins : 'resize',
toolbarLocation : 'bottom',
});
}
编辑2这是一个正在发生的事情的测试设置,焦点和模糊在动态添加的编辑器上不起作用
http://elhalawa.net/editor/index.html
刚刚添加了oninstanceReady代码,它的效果很好
CKEDITOR.replace(textA_id,{
emailProtection : 'encode',
tabSpaces : 4,
extraPlugins : 'autogrow',
height : 100,
autoGrow_minHeight : 100,
autoGrow_maxHeight : 400,
removePlugins : 'resize',
toolbarLocation : 'bottom',
}).on("instanceReady", function (e) {
this.on("focus", function () {
});
this.on("blur", function () {
});
this.on( 'change', function() {
});
});
相关文章:
- ExtJS网格单元格编辑器,防止焦点松动问题
- 可以't使用PHP使用Froala编辑器上传图像URL
- 如何在corona sdk中从CK编辑器中检索数据
- Eclipse编辑器中无法访问的代码
- 如何将拼写检查集成到密文编辑器
- 一个页面上有多个Ace编辑器,没有预先设置元素
- ACE编辑器正在删除模块,因为define是't一根绳子
- 如何从DOM中删除Aloha编辑器
- 用于用户内容的简单代码编辑器/文本格式化程序(在Rails中)
- 在plone 5中将自定义的灵活性内容类型插入到tinymce编辑器中
- 如何在tinymce编辑器中将点击事件绑定到html标签
- 扩展 ACE 编辑器,如何导入自定义文件
- dhtmlx添加新行并启动单元格编辑器
- 为现有Roslyn语言lexer/parser选择基于javascript的代码编辑器
- THRE.js编辑器中的鼠标问题
- 用于 Eclipse 的 JavaScript 编辑器插件
- 无法加载Ace.js编辑器模式和主题(命名空间项目&AMD require.js&grunt
- 使两个编辑器在自动绘制时大小相同
- 如何在tinymce编辑器中启用字体系列和颜色选项
- ckeditor4使用动态创建的编辑器insantces访问focusmanager