Manage list indentation
This commit is contained in:
parent
458d849566
commit
5536ced7c8
@ -887,7 +887,10 @@ define([
|
|||||||
container: '.modal-settings',
|
container: '.modal-settings',
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
title: 'Thanks for supporting StackEdit by adding a backlink in your documents!'
|
title: [
|
||||||
|
'Thanks for supporting StackEdit by adding a backlink in your documents!<br/><br/>',
|
||||||
|
'<b class="text-danger">NOTE: Backlinks are not welcome in Stack Exchange Q/A.</b>'
|
||||||
|
].join('')
|
||||||
});
|
});
|
||||||
var tooltipOpen = false;
|
var tooltipOpen = false;
|
||||||
$(".tooltip-usercustom-extension").tooltip({
|
$(".tooltip-usercustom-extension").tooltip({
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
define([
|
define([
|
||||||
"jquery",
|
'underscore',
|
||||||
"classes/Extension",
|
'jquery',
|
||||||
"bootstrap-tour"
|
'classes/Extension',
|
||||||
], function($, Extension) {
|
'bootstrap-tour'
|
||||||
|
], function(_, $, Extension) {
|
||||||
|
|
||||||
var welcomeTour = new Extension("welcomeTour", "Welcome tour", false, true);
|
var welcomeTour = new Extension('welcomeTour', 'Welcome tour', false, true);
|
||||||
|
|
||||||
welcomeTour.onReady = function() {
|
welcomeTour.onReady = function() {
|
||||||
var tour = new Tour({
|
var tour = new Tour({
|
||||||
|
keyboard: false,
|
||||||
storage: {
|
storage: {
|
||||||
getItem: function() {
|
getItem: function() {
|
||||||
},
|
},
|
||||||
@ -17,66 +19,70 @@ define([
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onEnd: function(tour) {
|
onEnd: function(tour) {
|
||||||
localStorage.welcomeTour = "done";
|
localStorage.welcomeTour = 'done';
|
||||||
},
|
},
|
||||||
template: [
|
template: [
|
||||||
"<div class='popover tour'>",
|
'<div class="popover tour">',
|
||||||
" <div class='arrow'></div>",
|
' <div class="arrow"></div>',
|
||||||
" <h3 class='popover-title'></h3>",
|
' <h3 class="popover-title"></h3>',
|
||||||
" <div class='popover-content'></div>",
|
' <div class="popover-content"></div>',
|
||||||
" <nav class='popover-navigation'>",
|
' <nav class="popover-navigation">',
|
||||||
" <button class='btn btn-primary' data-role='next'>Next</button>",
|
' <button class="btn btn-primary" data-role="next">Next</button>',
|
||||||
" <button class='btn btn-default' data-role='end'>Got it!</button>",
|
' <button class="btn btn-default" data-role="end">Got it!</button>',
|
||||||
" </nav>",
|
' </nav>',
|
||||||
"</div>"
|
'</div>'
|
||||||
].join('')
|
].join("")
|
||||||
});
|
});
|
||||||
tour.addSteps([
|
tour.addSteps([
|
||||||
{
|
{
|
||||||
element: ".navbar-inner",
|
element: '.navbar-inner',
|
||||||
title: "Welcome to StackEdit!",
|
title: 'Welcome to StackEdit!',
|
||||||
content: "Please click <code>Next</code> to take a quick tour.",
|
|
||||||
placement: "bottom",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
element: ".navbar .action-create-file",
|
|
||||||
title: "New document",
|
|
||||||
content: "Click the <i class='icon-file'></i> <code>New document</code> button to create a new document.",
|
|
||||||
placement: "left",
|
|
||||||
reflex: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
element: ".document-panel .collapse-button",
|
|
||||||
title: "Toggle document",
|
|
||||||
content: [
|
content: [
|
||||||
"<p>Click the <i class='icon-folder-open'></i> <code>Select document</code> button to switch to another document.</p>",
|
'<i class="icon-lock pull-left"></i>',
|
||||||
"<b>NOTE: </b>Use <code>Ctrl+[</code> and <code>Ctrl+]</code> shortcuts to toggle quickly."
|
'<p><strong>You are using the new secured platform.</strong> If you want to recover your documents from the old platform, <a href="#">click here</a>.</p>',
|
||||||
].join(''),
|
'Please click <code>Next</code> to take a quick tour.'
|
||||||
placement: "left",
|
].join(""),
|
||||||
|
placement: 'bottom',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
element: '.navbar .action-create-file',
|
||||||
|
title: 'New document',
|
||||||
|
content: 'Click the <i class="icon-file"></i> <code>New document</code> button to create a new document.',
|
||||||
|
placement: 'left',
|
||||||
reflex: true,
|
reflex: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: ".menu-panel .collapse-button",
|
element: '.document-panel .collapse-button',
|
||||||
title: "Menu",
|
title: 'Toggle document',
|
||||||
content: [
|
content: [
|
||||||
"<p>Use the <i class='icon-provider-stackedit'></i> menu to synchronize your document on <i class='icon-provider-gdrive'></i> <code>Google Drive</code> or <i class='icon-provider-dropbox'></i> <code>Dropbox</code>.</p>",
|
'<p>Click the <i class="icon-folder-open"></i> <code>Select document</code> button to switch to another document.</p>',
|
||||||
"Use also this menu to publish your document on <i class='icon-provider-github'></i> <code>GitHub</code>, <i class='icon-provider-blogger'></i> <code>Blogger</code>..."
|
'<b>NOTE: </b>Use <code>Ctrl+[</code> and <code>Ctrl+]</code> shortcuts to toggle quickly.'
|
||||||
].join(''),
|
].join(""),
|
||||||
placement: "right",
|
placement: 'left',
|
||||||
reflex: true,
|
reflex: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: "#extension-buttons .button-synchronize",
|
element: '.menu-panel .collapse-button',
|
||||||
title: "Synchronize",
|
title: 'Menu',
|
||||||
content: "<p>Once imported/exported, use the <i class='icon-refresh'></i> <code>Synchronize</code> button to force the synchronization (this is done automatically every 3 minutes).</p>",
|
content: [
|
||||||
placement: "bottom",
|
'<p>Use the <i class="icon-provider-stackedit"></i> menu to synchronize your document on <i class="icon-provider-gdrive"></i> <code>Google Drive</code> or <i class="icon-provider-dropbox"></i> <code>Dropbox</code>.</p>',
|
||||||
|
'Use also this menu to publish your document on <i class="icon-provider-github"></i> <code>GitHub</code>, <i class="icon-provider-blogger"></i> <code>Blogger</code>...'
|
||||||
|
].join(""),
|
||||||
|
placement: 'right',
|
||||||
reflex: true,
|
reflex: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: "#extension-buttons .button-publish",
|
element: '#extension-buttons .button-synchronize',
|
||||||
title: "Update publications",
|
title: 'Synchronize',
|
||||||
content: "Once published, use the <i class='icon-share'></i> <code>Publish</code> button to update your publication.",
|
content: '<p>Once imported/exported, use the <i class="icon-refresh"></i> <code>Synchronize</code> button to force the synchronization (this is done automatically every 3 minutes).</p>',
|
||||||
placement: "bottom",
|
placement: 'bottom',
|
||||||
|
reflex: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
element: '#extension-buttons .button-publish',
|
||||||
|
title: 'Update publications',
|
||||||
|
content: 'Once published, use the <i class="icon-share"></i> <code>Publish</code> button to update your publication.',
|
||||||
|
placement: 'bottom',
|
||||||
reflex: true,
|
reflex: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
@ -282,7 +282,17 @@ exports.commands = [{
|
|||||||
}, {
|
}, {
|
||||||
name: "indent",
|
name: "indent",
|
||||||
bindKey: bindKey("Tab", "Tab"),
|
bindKey: bindKey("Tab", "Tab"),
|
||||||
exec: function(editor) { editor.indent(); },
|
exec: function(editor) {
|
||||||
|
var rowIndex = editor.$getSelectedRows().last;
|
||||||
|
var rowText = editor.session.getLine(rowIndex);
|
||||||
|
var rowState = editor.session.getState(rowIndex);
|
||||||
|
if((rowState == "listblock" || rowState == "listblock-start") && /^\s*(?:[-+*]|\d+\.)\s+$/.test(rowText)) {
|
||||||
|
editor.blockIndent();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
editor.indent();
|
||||||
|
}
|
||||||
|
},
|
||||||
multiSelectAction: "forEach"
|
multiSelectAction: "forEach"
|
||||||
}, {
|
}, {
|
||||||
name: "insertstring",
|
name: "insertstring",
|
||||||
|
@ -36,6 +36,12 @@ var TextMode = require("ace/mode/text").Mode;
|
|||||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||||
var MarkdownHighlightRules = require("./ace_mode_highlight_rules").MarkdownHighlightRules;
|
var MarkdownHighlightRules = require("./ace_mode_highlight_rules").MarkdownHighlightRules;
|
||||||
var MarkdownFoldMode = require("ace/mode/folding/markdown").FoldMode;
|
var MarkdownFoldMode = require("ace/mode/folding/markdown").FoldMode;
|
||||||
|
var eventMgr = require('eventMgr');
|
||||||
|
var Range = require('ace/range').Range
|
||||||
|
var editor = undefined;
|
||||||
|
eventMgr.addListener('onAceCreated', function(editorParam) {
|
||||||
|
editor = editorParam;
|
||||||
|
});
|
||||||
|
|
||||||
var Mode = function() {
|
var Mode = function() {
|
||||||
var highlighter = new MarkdownHighlightRules();
|
var highlighter = new MarkdownHighlightRules();
|
||||||
@ -43,15 +49,30 @@ var Mode = function() {
|
|||||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||||
this.$embeds = highlighter.getEmbeds();
|
this.$embeds = highlighter.getEmbeds();
|
||||||
|
|
||||||
this.foldingRules = new MarkdownFoldMode();
|
//this.foldingRules = new MarkdownFoldMode();
|
||||||
};
|
};
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
var isIndentingList = false;
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.type = "text";
|
this.type = "text";
|
||||||
this.lineCommentStart = ">";
|
this.lineCommentStart = ">";
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
if(isIndentingList === true && (state == "listblock" || state == "listblock-start") && /^\s*(?:[-+*]|\d+\.)\s+$/.test(line)) {
|
||||||
|
// When hitting enter twice in a listblock, remove the previous line
|
||||||
|
var rows = editor.$getSelectedRows();
|
||||||
|
if (rows.last > 2) {
|
||||||
|
var range = new Range(
|
||||||
|
rows.last - 2, editor.session.getLine(rows.last - 2).length,
|
||||||
|
rows.last - 1, editor.session.getLine(rows.last - 1).length);
|
||||||
|
editor.session.remove(range);
|
||||||
|
}
|
||||||
|
isIndentingList = false;
|
||||||
|
return this.$getIndent(line);
|
||||||
|
}
|
||||||
|
isIndentingList = false;
|
||||||
if (state == "listblock") {
|
if (state == "listblock") {
|
||||||
var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
|
var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
|
||||||
if (!match)
|
if (!match)
|
||||||
@ -59,11 +80,13 @@ oop.inherits(Mode, TextMode);
|
|||||||
var marker = match[2];
|
var marker = match[2];
|
||||||
if (!marker)
|
if (!marker)
|
||||||
marker = parseInt(match[3], 10) + 1 + ".";
|
marker = parseInt(match[3], 10) + 1 + ".";
|
||||||
|
isIndentingList = true;
|
||||||
return match[1] + marker + match[4];
|
return match[1] + marker + match[4];
|
||||||
} else {
|
} else {
|
||||||
return this.$getIndent(line);
|
return this.$getIndent(line);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
@ -155,7 +155,7 @@ var lightMode =
|
|||||||
viewerMode
|
viewerMode
|
||||||
|| /(\?|&)light($|&)/.test(location.search)
|
|| /(\?|&)light($|&)/.test(location.search)
|
||||||
|| (function(a) {
|
|| (function(a) {
|
||||||
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)
|
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i.test(a)
|
||||||
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i
|
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i
|
||||||
.test(a.substr(0, 4)))
|
.test(a.substr(0, 4)))
|
||||||
return true;
|
return true;
|
||||||
|
@ -1265,6 +1265,10 @@ input[type="file"] {
|
|||||||
font-weight: @headings-font-weight;
|
font-weight: @headings-font-weight;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
|
}
|
||||||
|
.icon-lock {
|
||||||
|
font-size: 38px;
|
||||||
|
margin: 5px;
|
||||||
}
|
}
|
||||||
.disabled {
|
.disabled {
|
||||||
display: none;
|
display: none;
|
||||||
|
Loading…
Reference in New Issue
Block a user