diff options
author | patdenice <patdenice@piwigo.org> | 2011-04-12 11:12:51 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2011-04-12 11:12:51 +0000 |
commit | a740ef91e6689f86011b70c7bbe2589abf78ae6b (patch) | |
tree | bb4a6deb7395b0f545bb760cf34f093e910f1cff /plugins/LocalFilesEditor/show_default.tpl | |
parent | bb7c28f86febddd376ee0400807507991a2d7b48 (diff) |
feature:2262
Replace editarea by Codemirror:
http://codemirror.net
git-svn-id: http://piwigo.org/svn/trunk@10307 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | plugins/LocalFilesEditor/show_default.tpl | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/plugins/LocalFilesEditor/show_default.tpl b/plugins/LocalFilesEditor/show_default.tpl index d5acfe438..bf35586d4 100644 --- a/plugins/LocalFilesEditor/show_default.tpl +++ b/plugins/LocalFilesEditor/show_default.tpl @@ -1,43 +1,56 @@ {html_head} -<link rel="stylesheet" type="text/css" href="{$LOCALEDIT_PATH}locfiledit.css"> <style type="text/css">#headbranch, #theHeader, #copyright {ldelim} display: none; }</style> {/html_head} -{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"} -{known_script id="editarea" src=$LOCALEDIT_PATH|@cat:"editarea/edit_area_full.js"} -<script type="text/javascript"> -var editarea = "{$LOAD_EDITAREA}"; - -function loadEditarea() {ldelim} - editAreaLoader.init({ldelim} - id: "text" - {foreach from=$EDITAREA_OPTIONS key=option item=value} - , {$option}: {$value|editarea_quote} - {/foreach} +{combine_script id="jquery"} + +{combine_script id="codemirror" path="plugins/LocalFilesEditor/codemirror/lib/codemirror.js"} +{combine_script id="codemirror.xml" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/xml/xml.js"} +{combine_script id="codemirror.javascript" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/javascript/javascript.js"} +{combine_script id="codemirror.css" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/css/css.js"} +{combine_script id="codemirror.clike" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/clike/clike.js"} +{combine_script id="codemirror.htmlmixed" require="codemirror.xml,codemirror.javascript,codemirror.css" path="plugins/LocalFilesEditor/codemirror/mode/htmlmixed/htmlmixed.js"} +{combine_script id="codemirror.php" require="codemirror.xml,codemirror.javascript,codemirror.css,codemirror.clike" path="plugins/LocalFilesEditor/codemirror/mode/php/php.js"} + +{combine_css path="plugins/LocalFilesEditor/codemirror/lib/codemirror.css"} +{combine_css path="plugins/LocalFilesEditor/codemirror/mode/xml/xml.css"} +{combine_css path="plugins/LocalFilesEditor/codemirror/mode/javascript/javascript.css"} +{combine_css path="plugins/LocalFilesEditor/codemirror/mode/css/css.css"} +{combine_css path="plugins/LocalFilesEditor/codemirror/mode/clike/clike.css"} +{combine_css path="plugins/LocalFilesEditor/locfiledit.css"} + +{footer_script} +function loadCodemirror() {ldelim} + editor = CodeMirror.fromTextArea(document.getElementById("text"), {ldelim} + matchBrackets: true, + readOnly: true, + mode: "{$CODEMIRROR_MODE}", + tabMode: "shift" }); jQuery("#showedit").hide(); jQuery("#hideedit").show(); + jQuery.post("update_config.php", {ldelim} editarea: "on"}); } -function unloadEditarea() {ldelim} - editAreaLoader.delete_instance("text"); +function unloadCodemirror() {ldelim} + editor.toTextArea(); jQuery("#hideedit").hide(); jQuery("#showedit").show(); + jQuery.post("update_config.php", {ldelim} editarea: "off"}); } -</script> + +{if $LOAD_CODEMIRROR == 'on'} +if (document.getElementById("text") != null) loadCodemirror(); +{/if} +{/footer_script} <div id="LocalFilesEditor"> -<h1>{$TITLE}</h1> +<div style="overflow:auto;"><b>{$TITLE}</b></div> <textarea id="text" rows="30" cols="90">{$DEFAULT_CONTENT}</textarea> <div id="editarea_buttons"> -<a href="javascript:loadEditarea();" id="showedit">[{'locfiledit_enable_editarea'|@translate}]</a> -<a href="javascript:unloadEditarea();" id="hideedit">[{'locfiledit_disable_editarea'|@translate}]</a> +<a href="javascript:loadCodemirror();" id="showedit">[{'locfiledit_enable_codemirror'|@translate}]</a> +<a href="javascript:unloadCodemirror();" id="hideedit">[{'locfiledit_disable_codemirror'|@translate}]</a> </div> </div> - -<script type="text/javascript"> -jQuery("#editarea_buttons").show(); -if (editarea == "on") loadEditarea(); -</script> |