whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: fix cancel, unindent, and scroll back to top
Date Sun, 12 Nov 2017 00:48:36 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 2acc45a  fix cancel, unindent, and scroll back to top
2acc45a is described below

commit 2acc45a2b8c9962707abfd211a69d808b51ed9b2
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Sat Nov 11 19:48:14 2017 -0500

    fix cancel, unindent, and scroll back to top
---
 www/board/agenda/views/buttons/post.js.rb | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/www/board/agenda/views/buttons/post.js.rb b/www/board/agenda/views/buttons/post.js.rb
index d2f5151..9ea35cd 100644
--- a/www/board/agenda/views/buttons/post.js.rb
+++ b/www/board/agenda/views/buttons/post.js.rb
@@ -76,6 +76,11 @@ class Post < Vue
       else
         document.getElementById("post-report-text").focus()
       end
+
+      # scroll to the top
+      setTimeout 0 do
+        document.getElementById("post-report-text").scrollTop = 0
+      end
     end
   end
 
@@ -118,13 +123,14 @@ class Post < Vue
       @digest = @@item.digest
       @alerted = false
       @edited = false
+      @base = @report
     elsif not @alerted and @edited and @digest != @@item.digest
       alert 'edit conflict'
       @alerted = true
+    else
+      @report = @base
     end
 
-    @base = @report
-
     if @@button.text == 'add resolution' or @@item.attach =~ /^[47]/
       @indent = '        '
     else
@@ -182,13 +188,15 @@ class Post < Vue
     report = @report
 
     # remove indentation
-    regex = RegExp.new('^( +)\S', 'gm')
-    indents = []
-    while (result = regex.exec(report))
-      indents.push result[1].length
-    end
-    unless indents.empty?
-      report.gsub!(RegExp.new('^' + ' ' * Math.min(*indents), 'gm'), '')
+    unless report =~ /^\S/
+      regex = RegExp.new('^( +)', 'gm')
+      indents = []
+      while (result = regex.exec(report))
+        indents.push result[1].length
+      end
+      unless indents.empty?
+        report.gsub!(RegExp.new('^' + ' ' * Math.min(*indents), 'gm'), '')
+      end
     end
 
     @report = Flow.text(report, @indent)

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message