Hi i am using CKEditor in my laravel application . i am browsing my computer and upload images to server .
using this code
CKEDITOR.replace( 'messageArea',{
filebrowserUploadUrl: '/newseditor/imageupload'
});
after i submit the image i need to send the response back to my html page .i am doing it like this
echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');</script>"
;
but it is not executing it as a javascript function . in my source i can see it as
"<script type='text\/javascript'>window.parent.CKEDITOR.tools.callFunction(204, 'test\/test', '');<\/script>"
so the special characters are escaped :( . I tried to use
htmlspecialchars_decode
htmlspecialchars_encode
json_decode
json_encode
but still i cannot trigger it as a js function , is there anyway i can achieve this .
Thank you ...
UPDATE
this is the tutorial i am following
http://www.mixedwaves.com/2010/02/integrating-fckeditor-filemanager-in-ckeditor/
Unsure if your using blade,
but in the event you are using it the syntax for not escaping out characters is {!! $name !!}
I'd also try var_dump to insure the problem isn't in the ckeditor formatting.
Config settings for disabling ckeditor html formatting:
config.htmlEncodeOutput = false;
config.entities = false;
Docs:
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.entities
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.basicEntities
Actually i was not able to pass JS from the server . so i did a simple work around using jQuery . I will catch the response using jQuery and manually add it to the URL field . Up to now this works as expected , hope this helps to anyone . thanks .
i am using the click event of image submit button .
$(document).on('click',".cke_dialog_ui_button",function() {
var element = $(this).closest("tr").prev();
element.find("iframe").hide();
var checkExist = setInterval(function() {
var url_container = element.find("iframe").contents().find("body pre");
if ((typeof url_container != 'undefined') && (url_container.length > 0)) {
var url = $.trim(url_container.html());
url = url.replace(/[\\"]+/g,'');
if(url.length > 0)
{
url_container.html("");
$(".cke_dialog_page_contents:first").find("table tbody tr:first").find(":text").val(url);
}
element.find("iframe").show();
clearInterval(checkExist);
}
}, 200);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.