UploadFile callback is not being triggered in CKEditor

前端 未结 1 1149
清歌不尽
清歌不尽 2021-01-23 07:01

I am using latest Full CKEditor (4.5.3) with Office2013 style enabled.

I added filebrowserImageUploadUrl option here:

CKEDITOR.replace(         


        
相关标签:
1条回答
  • As it was guessed by @Wiktor the issue was in setting proper headers. I was almost there, setting wrong headers.

    Right headers are obviously: "text/html" (not "plain/text", it recognizes it just as a text in this case)

        $uploadResponse = new Response();
        $uploadResponse->headers->set('Content-type', 'text/html');
    
        $content = "<script type=\"text/javascript\">\n";
        $content .= "window.parent.CKEDITOR.tools.callFunction(" . $funcNum . ", '/uploads/news_image/" . $response['uploadedName'] . "', '');\n";
        $content .= "</script>";
    
        $uploadResponse->setContent($content);
    
    0 讨论(0)
提交回复
热议问题