başıma çözüm buldu jQuery dahil sonra bu dosyanın sonuna: Ben CKEditor kullanmak için basit bir eklenti geliştirdik
<script type="text/javascript">
$(".chooseThis").live("click", function (e) {
parent.triggerUploadImages($(this).children('.url').html());
});
</script>
:
CKEDITOR.plugins.add('fileUpload',
{
init: function (editor) {
editor.addCommand('OpenDialog',new CKEDITOR.dialogCommand('OpenDialog'));
editor.ui.addButton('FileUpload',
{
label: 'Upload images',
command: 'OpenDialog',
icon: CKEDITOR.plugins.getPath('fileUpload') + 'icon.gif'
});
editor.contextMenu.addListener(function(element){
return { 'My Dialog' : CKEDITOR.TRISTATE_OFF };
});
CKEDITOR.dialog.add('OpenDialog', function(api){
var dialogDefinition =
{
title : 'Gestisci immagini',
minWidth : 700,
minHeight : 500,
contents : [
{
expand : true,
padding : 0,
elements :
[
{
type : 'html',
html : ' <iframe src="../../includes/fileUpload/index.php" style="width:100%;height:490px" />'
}
]
}
],
buttons : []
};
return dialogDefinition;
});
}
});
Düğmeye araç çubuğuna eklemek için gerekli olan configure.js'yi de değiştirin. Sonra
Ben CKEditor oluşturmak için fonksiyonu var "FileUpload": düğmenin adıdır
var editor, html = '';
function createEditor() {
if (editor) return;
var config = {};
editor = CKEDITOR.replace("editor",
{
extraPlugins : 'fileUpload',
});
}
Ve bu tetiği yönetmek fonksiyonudur:
function triggerUploadImages(url){
if(editor){
CKEDITOR.dialog.getCurrent().hide();
editor.insertHtml('<img src='+url+' />');
}
}
sen denedi neler şimdiye kadar? Mevcut kodunuzu bize gösterir misiniz yoksa başka birinin sizin için kodu yazmasını mı bekliyorsunuz? – AlfonsoML