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/02 22:59:04 UTC
[15/25] allura git commit: Revert "[#7955] Work-in-progress testing a
code button"
Revert "[#7955] Work-in-progress testing a code button"
This reverts commit b6fd97aa5b963e237a3b17dac2d2124ca8916685.
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/196e3942
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/196e3942
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/196e3942
Branch: refs/heads/db/7955
Commit: 196e3942da83a074ff17fdab7ed2fd743ba68127
Parents: f9466c6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Sep 1 20:36:14 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Sep 2 18:27:52 2015 +0000
----------------------------------------------------------------------
.../lib/widgets/resources/js/sf_markitup.js | 50 ++------------------
1 file changed, 4 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/196e3942/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 f961562..153fed2 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -37,17 +37,11 @@ $(window).load(function() {
// keep the tool
toolbar.push(tool);
// and add our own after
- toolbar.push({
- name: 'comment-block',
- action: toggleCodeBlock,
- className: 'fa fa-code', // this is best for multi-line I think. Wish we had a better option for single line
- // maybe header (if not used for section headers soon), text-width, or medium (a logo)
- title: 'Code block'
- });
tool = {
name: 'comment', // means "code", really. CodeMirror's markdown.js uses 'comment' for unknown reason
action: toggleCode,
- className: 'fa fa-medium', // maybe header (if not used for section headers soon), text-width, or medium (a logo)
+ className: 'fa fa-code', // this is best for multi-line I think. Wish we had a better option for single line
+ // maybe header (if not used for section headers soon), text-width, or medium (a logo)
title: 'Inline code, monospaced'
}
break;
@@ -172,10 +166,9 @@ $(window).load(function() {
function toggleCode(editor) {
var cm = editor.codemirror;
- //pos = cm.getCursor('start');
- //stat = cm.getTokenAt(pos).state;
stat = getState(cm);
- //console.table(stat);
+ console.table(stat);
+ console.log(stat.name);
if (stat.name === 'comment') {
// todo remove
} else {
@@ -189,38 +182,3 @@ $(window).load(function() {
});
}
});
-
-
-function getState(cm, pos) {
- pos = pos || cm.getCursor('start');
- var stat = cm.getTokenAt(pos);
- if(!stat.type) return {};
-
- var types = stat.type.split(' ');
-
- var ret = {},
- data, text;
- for(var i = 0; i < types.length; i++) {
- data = types[i];
- if(data === 'strong') {
- ret.bold = true;
- } else if(data === 'variable-2') {
- text = cm.getLine(pos.line);
- if(/^\s*\d+\.\s/.test(text)) {
- ret['ordered-list'] = true;
- } else {
- ret['unordered-list'] = true;
- }
- } else if(data === 'atom') {
- ret.quote = true;
- } else if(data === 'em') {
- ret.italic = true;
- } else if(data === 'quote') {
- ret.quote = true;
- // ADDED THIS:
- } else if(data === 'comment') {
- ret.comment = true;
- }
- }
- return ret;
-}
\ No newline at end of file