我有一个需要内联CKEditor但没有工具栏的应用程序。对于内联CKEditor部分,我有:
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline('editable', {on: {
instanceReady: function() {periodic();}
}});
var periodic = (function() {
var data, oldData;
return function() {
if ((data = editor.getData()) !== oldData) {
oldData = data;
$.post("update.php", {txt:data});
}
setTimeout(periodic, 1000);
};
})();
然后,对于工具栏隐藏部分,我发现了这个:CKEditor 4 Inline: How to hide toolbar on demand?
//Whenever CKEditor loses focus, We will hide the corresponding toolbar DIV.
function hideToolBarDiv(event) {
// Select the correct toolbar DIV and hide it.
//'event.editor.name' returns the name of the DIV receiving focus.
$('#'+event.editor.name+'TBdiv').hide();
}
问题是我不知道如何将这两者结合在一起:)我很欣赏任何提示。谢谢。
答案 0 :(得分:4)
我找到了另一个似乎可以解决我的问题的链接:Can I use CKEditor without a toolbar? 该脚本似乎工作正常,但我仍然不确定这是否是一种正确的方法:
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline('editable', {
removePlugins: 'toolbar',
allowedContent: 'p h1 h2 strong em; a[!href]; img[!src,width,height]'
on: {instanceReady: function() {periodic();}}
});
var periodic = (function() {
var data, oldData;
return function() {
if ((data = editor.getData()) !== oldData) {
oldData = data;
$.post("update.php", {txt:data});
}
setTimeout(periodic, 1000);
};
})();
答案 1 :(得分:0)
在我眼中,我以两种方式做到了:
1)使用H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(58) : error C2143: syntax error : missing ';' before 'const'
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(61) : error C2065: 'zString' : undeclared identifier
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(65) : error C2143: syntax error : missing ';' before 'const'
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(66) : error C2065: 'zReplacement' : undeclared identifier
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(89) : error C2065: 'zString' : undeclared identifier
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(89) : warning C4047: 'function' : 'const UChar *' differs in levels of indirection from 'int'
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(89) : warning C4024: 'uregex_setText_64' : different types for formal and actual parameter 2
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(105) : error C2065: 'zReplacement' : undeclared identifier
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(105) : warning C4047: 'function' : 'const UChar *' differs in levels of indirection from 'int'
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(105) : warning C4024: 'uregex_replaceAll_64' : different types for formal and actual parameter 2
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(117) : error C2065: 'zReplacement' : undeclared identifier
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(117) : warning C4047: 'function' : 'const UChar *' differs in levels of indirection from 'int'
H:\Carrier Relations\SQLite\Source Code\Modules\icu_replace.c(117) : warning C4024: 'uregex_replaceAll_64' : different types for formal and actual parameter 2
选项并删除工具栏:
removePlugins
在这里,您还可以使用CKEDITOR.inline( 'textarea', {
removePlugins: 'toolbar'
} );
允许ACF的内容
allowedContent
2)使用CSS-不是标准方法:(有点棘手)
只需将CSS移至CKEDITOR.inline( 'editable', {
removePlugins: 'toolbar',
allowedContent: 'p h1 h2 strong em; a[!href]; img[!src,width,height];'
} );
工具栏,如
display:none
希望它将对某人有所帮助。