Commits

Bogdan Savluk committed 8bc210e

fix to work with tinymce 4.x

Comments (0)

Files changed (1)

TinyMceElFinder.php

         $this->assetsDir = Yii::app()->assetManager->publish($dir);
         $cs = Yii::app()->getClientScript();
 
-        if(Yii::app()->getRequest()->enableCsrfValidation){
+        if (Yii::app()->getRequest()->enableCsrfValidation) {
             $csrfTokenName = Yii::app()->request->csrfTokenName;
             $csrfToken = Yii::app()->request->csrfToken;
             Yii::app()->clientScript->registerMetaTag($csrfToken, 'csrf-token');
             'title' => "Files",
         );
         $settings['editorCallback'] = 'js:function(url) {
-                        aWin.document.forms[0].elements[aFieldName].value = url;
+                        aWin.document.getElementById(field_name).value = url;
                         if (type == "image" && aFieldName=="src" && aWin.ImageDialog.showPreviewImage)
                             aWin.ImageDialog.showPreviewImage(url);
                     }';
         $settings['closeOnEditorCallback'] = true;
 
         $settings = CJavaScript::encode($settings);
-        $script=<<<JS
+        $script = <<<JS
         function(field_name, url, type, win) {
             var aFieldName = field_name, aWin = win;
             var el = $("#$id");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.