diff --git a/ace_editor.js b/ace_editor.js index 2a51809..09abcaf 100644 --- a/ace_editor.js +++ b/ace_editor.js @@ -348,6 +348,19 @@ function insertLayoutAce() { var lId = 'L' + window.location.pathname.split("/").pop(); setupEditor(lId, $('#layout_content').prev(), $('#layout_content')); } +/** + * Inserts Ace elements into a File Manager's file view + */ +function insertFileManagerAce(){ + var fId = 'F' + window.location.pathname.split("/").pop(); + setupEditor(fId, $('#file_content').prev(), $('#file_content')); +} + +function removeFileManagerAce(){ + var fId = 'F' + window.location.pathname.split("/").pop(); + $('#aceeditor' + fId).remove(); + $('#aceoptions' + fId).remove(); +} /** * main initialization @@ -364,6 +377,11 @@ $(document).ready(function() { if ($('#body_snippet_edit').length > 0) { // we are in SNIPPET removeSnippetAce(); } + /* edit */ + if ($('#body_plugin_file_manager')){ // we are in PLUGIN FILE MANAGER + removeFileManagerAce(); + } + } }); @@ -376,6 +394,10 @@ $(document).ready(function() { if ($('#body_snippet_edit').length > 0) { // we are in SNIPPET insertSnippetAce(); } + /* edit */ + if ($('#body_plugin_file_manager')){ // we are in PLUGIN FILE MANAGER + insertFileManagerAce(); + } } }); diff --git a/index.php b/index.php index 089a7ce..4302ccd 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ Observer::observe('view_backend_list_plugin', 'ace_make_settings_div'); $uri = $_SERVER['QUERY_STRING']; - if ( preg_match('/(\/plugin\/ace|page\/edit|snippet\/edit|layout\/edit|page\/add|snippet\/add|layout\/add)/', $uri, $match) ) + if ( preg_match('/(\/plugin\/ace|\/plugin\/file_manager|page\/edit|snippet\/edit|layout\/edit|page\/add|snippet\/add|layout\/add)/', $uri, $match) ) ace_include_javascripts(); } @@ -72,4 +72,4 @@ function ace_include_javascripts() { Plugin::addJavascript('ace', 'ace_editor.js'); Plugin::addJavascript('ace', 'build/src-min/ace.js'); -} \ No newline at end of file +}