How to use the CKFinder Javascript api?

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

Funny question, but i honestly can't acces (for example) the CKFinder.dataTypes.Folder: http://docs.cksource.com/ckfinder_2.x_api/symbols/CKFinder.dataTypes.Folder.html.

I have downloaded the CKFinder 2.x demo for asp.net to try the utility out and the only thing intellisense is giving me access to is the window.CKFinder object and some of its methods, but nothing else. I couldn't find Folder in ckfinder.js either.

回答1:

As stated in the Documentation you may not be able to access it directly, instead you should call any Folder API function once CKFinder object has been loaded.

Note: the CKFinder.dataTypes namespace is not directly accessible (CKFinder.dataTypes is undefined). Data types are used internally by CKFinder and returned by many functions, like CKFinderAPI#getSelectedFolder.


The following example is an initialization in javascript of the CKFinder component which shows how to access the Folder datatype.

<script type="text/javascript">     var finder = new CKFinder();     finder.basePath = '/js/ckfinder/'; // The path for the installation of CKFinder (default = "/ckfinder/").     // Setting custom width and user language.     finder.width = '99%';     finder.defaultLanguage = 'es';     finder.language = 'es';      finder.removePlugins = 'basket';     //finder.selectActionFunction = showFileInfo;     //finder.resourceType = 'Images';     //finder.tabIndex = 1;     //finder.startupPath = "Images:/";      finder.callback = function( api )      {         api.openMsgDialog( "", "Almost ready to go!" );         api.hideTool( "f2" );//hide flash folder         api.openFolder('Images', '/');         var folder = api.getSelectedFolder();         //console.debug(folder);         folder.createNewFolder( 'New Folder' );         //api.setUiColor('white');     };     var api = (finder).create();      //console.debug(api);     //api.openMsgDialog("Sample title","Sample message."); //doesnt work here, CKFinder still not loaded. </script> 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!