/** * Registers Webuploader assets */ protected function registerClientScript() { $view = $this->getView(); CropperAsset::register($view); $js = "\nvar container = \$('.uploader-container');\nUploader.init(function( src ) {\n Croper.setSource( src );\n // 隐藏选择按钮。\n container.addClass('webuploader-element-invisible');\n // 当用户选择上传的时候,开始上传。\n Croper.setCallback(function( data ) {\n Uploader.crop(data);\n Uploader.upload();\n });\n});\n"; $view->registerJs($js, $view::POS_READY); }
/** * Registers Umeditor plugin */ protected function registerPlugin() { $view = $this->getView(); CropperAsset::register($view); }