allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [22/25] allura git commit: Cleanup paste-indent code
Date Wed, 02 Sep 2015 20:59:11 GMT
Cleanup paste-indent code


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/645fc864
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/645fc864
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/645fc864

Branch: refs/heads/db/7955
Commit: 645fc8643780b3a5aa9f8480e00dce69e02eb12b
Parents: 10af293
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Wed Sep 2 16:05:46 2015 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Sep 2 18:27:53 2015 +0000

----------------------------------------------------------------------
 .../lib/widgets/resources/js/sf_markitup.js       | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/645fc864/Allura/allura/lib/widgets/resources/js/sf_markitup.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/sf_markitup.js b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
index f670437..f91d697 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -70,15 +70,17 @@ $(window).load(function() {
 
             cm = editor.codemirror;
 
+            // https://github.com/codemirror/CodeMirror/issues/2120
             cm.on("change", function(cm, change) {
-
-                if (change.origin != "paste" || change.text.length < 2) return;
-                var tabs = 1;
-                var spaces = tabs * cm.options.tabSize;
-                cm.operation(function() {
-                    for (var line = change.from.line, end = CodeMirror.changeEnd(change).line;
line < end; ++line)
-                        cm.indentLine(line, spaces);
-                });
+              if (change.origin != "paste" || change.text.length < 2) {
+                return;
+              }
+              var spaces = cm.options.tabSize;
+              cm.operation(function() {
+                for (var line = change.from.line, end = CodeMirror.changeEnd(change).line;
line <= end; ++line) {
+                  cm.indentLine(line, spaces);
+                }
+              });
             });
 
             function show_help(editor) {


Mime
View raw message