From 035f6d2dfd47de908d21ea2709c81ca5b62f9587 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 6 Aug 2012 06:05:57 -0400 Subject: [PATCH] setted readOnly mode, when directory opened in CodeMirror --- lib/client/editor.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/client/editor.js b/lib/client/editor.js index 69e5f618..281c6993 100644 --- a/lib/client/editor.js +++ b/lib/client/editor.js @@ -75,7 +75,13 @@ CloudCommander.Editor.CodeMirror.show = (function(){ if(this.loading) return; - var lParent = this; + /* when folder view + * is no need to edit + * data + */ + var lReadOnly = false; + + var lParent = this; var initCodeMirror_f = function(pValue){ CodeMirror(lCloudEditor,{ mode : 'javascript', @@ -84,11 +90,12 @@ CloudCommander.Editor.CodeMirror.show = (function(){ lineNumbers : true, //переносим длинные строки lineWrapping: false, - autofocus : true, + autofocus : true, extraKeys: { //Сохранение "Esc": lParent.hide(lParent) - } + }, + readOnly : lReadOnly }); }; @@ -123,8 +130,10 @@ CloudCommander.Editor.CodeMirror.show = (function(){ */ if (lSize === ''){ if (lA.indexOf(CloudFunc.NOJS) === - CloudFunc.FS.length){ - lA = lA.replace(CloudFunc.NOJS, ''); + CloudFunc.FS.length) { + + lA = lA.replace(CloudFunc.NOJS, ''); + lReadOnly = true; } } }