You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/07/14 17:03:10 UTC
[29/50] [abbrv] allura git commit: [#7897] ticket:804 Hide "code"
from toolbar, since it's syntax is not matching Allura's
[#7897] ticket:804 Hide "code" from toolbar, since it's syntax is not matching Allura's
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/0f018b3c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0f018b3c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0f018b3c
Branch: refs/heads/ib/7897
Commit: 0f018b3c6175ae28bff8d32aa527e0135fa977ba
Parents: f15a12f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Jun 18 18:10:41 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Jul 14 11:46:01 2015 +0300
----------------------------------------------------------------------
.../lib/widgets/resources/js/sf_markitup.js | 31 +++++++++++++++-----
1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/0f018b3c/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 b10e331..266d77a 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -27,16 +27,31 @@ $(window).load(function() {
var $help_area = $('div.markdown_help', $container);
var $help_contents = $('div.markdown_help_contents', $container);
- var toolbar = Editor.toolbar;
- toolbar[11] = {name: 'info', action: show_help};
- toolbar[12] = {name: 'preview', action: show_preview};
- var editor = new Editor({
+ var toolbar = [];
+ // Exclude "code" tool from toolbar, since it's syntax not matching Allura's
+ // Override actions for "info" & "preview" tools
+ for (var i in Editor.toolbar) {
+ var tool = Editor.toolbar[i];
+ if (tool !== null && typeof tool === 'object') {
+ switch(tool.name) {
+ case 'code':
+ continue;
+ case 'info':
+ tool = {name: 'info', action: show_help};
+ break;
+ case 'preview':
+ tool = {name: 'preview', action: show_preview};
+ break;
+ }
+ }
+ toolbar.push(tool);
+ }
+ new Editor({
element: $textarea[0],
toolbar: toolbar
- });
- editor.render();
+ }).render();
- function show_help() {
+ function show_help(editor) {
$help_contents.html('Loading...');
$.get($help_contents.attr('data-url'), function (data) {
$help_contents.html(data);
@@ -56,7 +71,7 @@ $(window).load(function() {
$help_area.lightbox_me();
}
- function show_preview() {
+ function show_preview(editor) {
/*
* This is pretty much the same as original Editor.togglePreview,
* but rendered text is fetched from the server.