allura-commits mailing list archives

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


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

Branch: refs/heads/db/7955
Commit: 8bff665ed9e41ddd1a42227de2267694c344c3ba
Parents: fc49496
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Wed Sep 2 13:58:40 2015 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Sep 2 18:27:52 2015 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/js/sf_markitup.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/8bff665e/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 43f935b..f670437 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -68,6 +68,19 @@ $(window).load(function() {
             });
             editor.render();
 
+            cm = editor.codemirror;
+
+            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);
+                });
+            });
+
             function show_help(editor) {
               $help_contents.html('Loading...');
               $.get($help_contents.attr('data-url'), function (data) {


Mime
View raw message