You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/09/14 20:30:40 UTC

[06/13] allura git commit: [#7955] button to insert a table

[#7955] button to insert a table


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

Branch: refs/heads/db/7955
Commit: 9caf8b7b24734c592ebaa67d737811808d56f072
Parents: b1e4c9d
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Sep 2 18:26:57 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Sep 14 18:29:39 2015 +0000

----------------------------------------------------------------------
 .../lib/widgets/resources/js/sf_markitup.js       | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9caf8b7b/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 ba5c853..81d1305 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -30,7 +30,14 @@ $(window).load(function() {
             // Override action for "preview" & "guide" tools
             var toolbar = [
               "bold", "italic", "heading", "|",
-              "quote", "unordered-list", "ordered-list", "horizontal-rule", "|",
+              "quote", "unordered-list", "ordered-list",
+              {
+                name: 'table',
+                action: drawTable,
+                className: 'fa fa-table',
+                title: 'Insert Table'
+              },
+              "horizontal-rule", "|",
               "link", "image", "|",
               {
                   name: 'preview',
@@ -68,6 +75,15 @@ $(window).load(function() {
             });
             editor.render();
 
+            function drawTable(editor) {
+              var cm = editor.codemirror;
+              _replaceSelection(cm, false, '',
+                'First Header  | Second Header | Third Header\n' +
+                '------------- | ------------- | ------------- \n' +
+                'Content Cell  | Content Cell  | Content Cell \n' +
+                'Content Cell  | Content Cell  | Content Cell ');
+            }
+
             function show_help(editor) {
               $help_contents.html('Loading...');
               $.get($help_contents.attr('data-url'), function (data) {