带有uploadImage插件的CKEditor返回salesforce中的整个VF页面

时间:2017-11-30 14:35:04

标签: ckeditor salesforce visualforce

我的VF页面上有一个带有uploadimage的ckEditor。我已将其配置为

config.extraPlugins = 'uploadimage';
config.imageUploadUrl = 'apex/SiteFileUploaderBackup';

我还没有完全开发SiteFileUploaderBackup页面和控制器。刚尝试使用虚拟代码。

这是我的VF页面:

<apex:page sidebar="false" showHeader="false" controller="SiteFileUploadControllerbackup">

    <script>
        function getUrlParam(paramName){
          var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i') ;
          var match = window.location.search.match(reParam) ;
          return (match && match.length > 1) ? match[1] : '' ;
        }

        var funcNum = getUrlParam('CKEditorFuncNum');
        console.log('***  funcNum=' + funcNum);

        var str = '{"fileName":"kingston-visitor-chair-black-med.jpg","uploaded":1,"error":{"number":201,"message":"A file with the same name already exists. The uploaded file was renamed to \u0022kingston-visitor-chair-black-med(3).jpg\u0022."},"url":"https:\/\/cadence--cos2--c.cs14.content.force.com\/servlet\/servlet.ImageServer?id=015c00000003hQm&oid=00Dc0000003w9jE&lastMod=1511435219000"}';
        if(funcNum == null)
                window.opener.CKEDITOR.tools.callFunction(funcNum,str);                     
        else                    
            window.opener.CKEDITOR.tools.callFunction('{!funcNumber}', str );               
        window.close() ;
    </script>    

控制器只有构造函数

public class SiteFileUploadControllerbackup {
public String funcNumber {get; set;} 
public SiteFileUploadControllerBackup()
{
    string ckEditorFunc = ApexPages.currentPage().getParameters().get('CKEditorFuncNum'); 
    if(funcNumber == null)
        funcNumber = ckEditorFunc; 
   } 

}

由于这是一个存根代码,我只是在寻找正确的ResponseText,它应该是我在VF页面中使用的json。但是我总是得到     错误代码:filetools-response-error。而responseText包含VF页面的整个HTML。

我搜索了很多,但找不到任何可以帮助的样本VF -apex代码。任何有关如何在responseText中获取json的帮助将不胜感激。

0 个答案:

没有答案