#javascript #ckeditor #editor #ckfinder
Вопрос:
Я использую ckeditor 5 и ckfinder 3.4.2 и php 5.6 O. S — Ubuntu, а браузер на моем сервере-chrome и firefox.Загрузка изображений работает нормально, но при нажатии на ckfinder btn с панели инструментов ckeditor появляется следующая ошибка :
SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at s (ckfinder.js:7) at Object.execCb (ckfinder.js:5) at y.check (ckfinder.js:5)
at y.<anonymous> (ckfinder.js:5) at ckfinder.js:5 at ckfinder.js:5 at each (ckfinder.js:5) at y.emit (ckfinder.js:5) at y.check (ckfinder.js:5)
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
finishLoad @ ckfinder.js:9
(anonymous) @ ckfinder.js:9
execCb @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
g @ ckfinder.js:5
completeLoad @ ckfinder.js:5
onScriptLoad @ ckfinder.js:5
load (async)
req.load @ ckfinder.js:6
load @ ckfinder.js:5
load @ ckfinder.js:5
fetch @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
enable @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
setTimeout (async)
req.nextTick @ ckfinder.js:6
o @ ckfinder.js:5
load @ ckfinder.js:9
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
l @ ckfinder.js:5
callPlugin @ ckfinder.js:5
fetch @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
enable @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
setTimeout (async)
req.nextTick @ ckfinder.js:6
o @ ckfinder.js:5
requirejs @ ckfinder.js:5
i @ ckfinder.js:7
init @ ckfinder.js:8
start @ ckfinder.js:20
(anonymous) @ ckfinder.js:21
execCb @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
f @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
f @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
f @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
f @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
f @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
f @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
f @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
h @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
setTimeout (async)
req.nextTick @ ckfinder.js:6
o @ ckfinder.js:5
requirejs @ ckfinder.js:5
(anonymous) @ ckfinder.js:21
execCb @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
g @ ckfinder.js:5
completeLoad @ ckfinder.js:5
onScriptLoad @ ckfinder.js:5
load (async)
req.load @ ckfinder.js:6
load @ ckfinder.js:5
load @ ckfinder.js:5
fetch @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
enable @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
setTimeout (async)
req.nextTick @ ckfinder.js:6
o @ ckfinder.js:5
requirejs @ ckfinder.js:5
a @ ckfinder.js:21
(anonymous) @ ckfinder.js:21
execCb @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
g @ ckfinder.js:5
completeLoad @ ckfinder.js:5
onScriptLoad @ ckfinder.js:5
load (async)
req.load @ ckfinder.js:6
load @ ckfinder.js:5
load @ ckfinder.js:5
fetch @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
enable @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
setTimeout (async)
req.nextTick @ ckfinder.js:6
o @ ckfinder.js:5
requirejs @ ckfinder.js:5
s @ ckfinder.js:21
o @ ckfinder.js:21
(anonymous) @ ckfinder.js:21
execCb @ ckfinder.js:5
check @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
emit @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
g @ ckfinder.js:5
completeLoad @ ckfinder.js:5
onScriptLoad @ ckfinder.js:5
load (async)
req.load @ ckfinder.js:6
load @ ckfinder.js:5
load @ ckfinder.js:5
fetch @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
enable @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
each @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
setTimeout (async)
req.nextTick @ ckfinder.js:6
o @ ckfinder.js:5
requirejs @ ckfinder.js:5
(anonymous) @ ckfinder.js:21
execCb @ ckfinder.js:5
check @ ckfinder.js:5
enable @ ckfinder.js:5
init @ ckfinder.js:5
(anonymous) @ ckfinder.js:5
setTimeout (async)
req.nextTick @ ckfinder.js:6
o @ ckfinder.js:5
requirejs @ ckfinder.js:5
window.CKFinder.start @ ckfinder.js:20
(anonymous) @ VM171:1
internalCKFinderInit @ ckfinder.js:5
r.attachEvent.r.onload @ ckfinder.js:5
widget @ ckfinder.js:5
open @ ckfinder.js:5
modal @ ckfinder.js:5
execute @ ckeditor.js:5
(anonymous) @ ckeditor.js:5
fire @ ckeditor.js:5
<computed> @ ckeditor.js:5
execute @ ckeditor.js:5
execute @ ckeditor.js:5
(anonymous) @ ckeditor.js:5
fire @ ckeditor.js:5
(anonymous) @ ckeditor.js:5
o @ ckeditor.js:5
fire @ ckeditor.js:5
n @ ckeditor.js:5
load (async)
widget @ ckfinder.js:5
open @ ckfinder.js:5
modal @ ckfinder.js:5
execute @ ckeditor.js:5
(anonymous) @ ckeditor.js:5
fire @ ckeditor.js:5
<computed> @ ckeditor.js:5
execute @ ckeditor.js:5
execute @ ckeditor.js:5
(anonymous) @ ckeditor.js:5
fire @ ckeditor.js:5
(anonymous) @ ckeditor.js:5
o @ ckeditor.js:5
fire @ ckeditor.js:5
n @ ckeditor.js:5
This is what I have coded to integrate ckfinder in ckeditor in my php file :
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Standalone Ckeditor</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://example.com/ckeditor5/build/ckeditor.js"></script>
<script src="https://example.com/ckfinder/ckfinder.js"></script>
<!-- <script src="https://ckeditor.com/apps/ckfinder/3.5.0/ckfinder.js"></script> -->
<script>
var myEditor;
$(document).ready(function(){
ClassicEditor.create( document.querySelector( '#editor_ovrview' ), {
ckfinder: {
uploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUploadamp;type=Imagesamp;responseType=json'
},
toolbar: [ 'bold', 'italic','underline', 'subscript', 'superscript', '|',
'bulletedList', 'numberedList', '|', 'alignment', '|', 'undo',
'redo', '|', 'link', '|', 'ckfinder', 'imageUpload', '|',
'pagebreak', 'insertTable', '|', 'SourceEditing', '|' ]
} )
.then(editor=>{
myEditor=editor;
})
.catch( error => {
console.error( error );
} );
});
function clearData()
{
var retval=confirm('Clear');
if(retval==true)
{
myEditor.setData('');
}
else
{
return(false);
}
}
</script>
</head>
<body>
<form id="edfrm" name="edfrm" method="post" action="">
<div id="dpd1"> <!-- dpd => Detailed property description -->
<textarea id="editor_ovrview" name="editor_ovrview"><?php echo $rsval;?>
</textarea>
</div>
<div class="rbtn">
<button type="button" class="subtn" id="sub" name="sub" >Submit</button>
<button type="button" class="subtn" id="clr" name="clr" >Clear</button>
</div>
</form>
</body>
</html>
I am banging my head for couple of days to solve it, but in vain. Where am I doing wrong?