From 199d61cce9cc8a1dd390e160fe969ac447bbe4e3 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 11 Mar 2013 09:45:39 -0400 Subject: [PATCH] added update of size on file changing in editor --- ChangeLog | 4 +++- lib/client/dom.js | 15 ++++++++++++++- lib/client/editor/_codemirror.js | 10 +++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5df33ab2..681e9818 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,7 +26,9 @@ and get them out to file system. * If create directory command executed - loading spinner would be on top. -* Refactored getShortSize +* Refactored getShortSize. + +* Added update of size on file changing in editor. 2012.03.01, Version 0.1.9 diff --git a/lib/client/dom.js b/lib/client/dom.js index bd6c05be..c13c4943 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -970,7 +970,7 @@ var CloudCommander, Util, }; /** - * + * get size * @pCurrentFile */ DOM.getCurrentSize = function(pCurrentFile){ @@ -984,6 +984,19 @@ var CloudCommander, Util, return lRet; }; + /** + * set size + * @pCurrentFile + */ + DOM.setCurrentSize = function(pSize, pCurrentFile){ + var lCurrent = pCurrentFile || DOM.getCurrentFile(), + lSizeElement = DOM.getByClass('size', lCurrent), + lSize = CloudFunc.getShortSize(pSize); + + lSizeElement[0].textContent = lSize; + + }; + /** * * @pCurrentFile diff --git a/lib/client/editor/_codemirror.js b/lib/client/editor/_codemirror.js index a180a810..b0d39576 100644 --- a/lib/client/editor/_codemirror.js +++ b/lib/client/editor/_codemirror.js @@ -55,7 +55,8 @@ var CloudCommander, Util, DOM, CodeMirror; FM = DOM.getFM(); var lCSS = setCSS(), - lPath = DOM.getCurrentPath(); + lCurrent = DOM.getCurrentFile(), + lPath = DOM.getCurrentPath( lCurrent ); CodeMirrorElement = DOM.anyload({ name : 'div', @@ -78,8 +79,11 @@ var CloudCommander, Util, DOM, CodeMirror; Util.exec(pParams); DOM.remove(lCSS, document.head); }, - 'Ctrl-S': function(){ - DOM.RESTfull.save(lPath, lEditor.getValue()); + 'Ctrl-S': function(){ + var lValue = lEditor.getValue(); + + DOM.setCurrentSize( lValue.length, lCurrent ); + DOM.RESTfull.save( lPath, lValue ); } }, readOnly : ReadOnly