Switch to ACE editor

This commit is contained in:
benweet 2013-09-12 00:26:47 +01:00
parent 4a9b286fc0
commit 12888d20e6
19 changed files with 201 additions and 101 deletions

View File

@ -192,9 +192,9 @@ define([
function createAceEditor() {
aceEditor = ace.edit("wmd-input");
aceEditor.renderer.setShowGutter(false);
aceEditor.renderer.setShowPrintMargin(false);
//aceEditor.renderer.setShowPrintMargin(false);
aceEditor.renderer.setPrintMarginColumn(false);
aceEditor.renderer.setPadding(10);
aceEditor.renderer.setPadding(15);
aceEditor.session.setUseWrapMode(true);
aceEditor.session.setMode("libs/acemode");
// Make bold titles...
@ -309,12 +309,13 @@ define([
// We also move the north toggler to the east or south resizer as the
// north resizer is very small
$previewButtonsElt = $('<div class="extension-preview-buttons">');
$editorButtonsElt = $('<div class="extension-editor-buttons">');
if(settings.layoutOrientation == "horizontal") {
$('.ui-layout-resizer-north').append($previewButtonsElt);
$('.ui-layout-resizer-east').append($northTogglerElt);
$('.ui-layout-resizer-east').append($northTogglerElt).append($editorButtonsElt);
}
else {
$('.ui-layout-resizer-south').append($previewButtonsElt).append($northTogglerElt);
$('.ui-layout-resizer-south').append($previewButtonsElt).append($northTogglerElt).append($editorButtonsElt);
}
setPanelVisibility();

View File

@ -25,6 +25,7 @@ define([
"extensions/mathJax",
"extensions/emailConverter",
"extensions/scrollLink",
"extensions/focusMode",
"extensions/buttonSync",
"extensions/buttonPublish",
"extensions/buttonShare",
@ -270,7 +271,16 @@ define([
right: -previewButtonsWidth + $btnGroupElt.width() + $btnGroupElt.position().left
});
});
// Create extension editor buttons
logger.log("onCreateEditorButton");
var onCreateEditorButtonListenerList = getExtensionListenerList("onCreateEditorButton");
var extensionEditorButtonsFragment = document.createDocumentFragment();
_.each(onCreateEditorButtonListenerList, function(listener) {
extensionEditorButtonsFragment.appendChild(createBtn(listener));
});
var editorButtonsElt = document.querySelector('.extension-editor-buttons');
editorButtonsElt.appendChild(extensionEditorButtonsFragment);
}
// Call onReady listeners

View File

@ -0,0 +1,48 @@
define([
"jquery",
"underscore",
"crel",
"classes/Extension"
], function($, _, crel, Extension) {
var focusMode = new Extension("focusMode", "Focus Mode", true, true);
focusMode.settingsBlock = "Scrolls automatically the editor to have the caret verticaly centered";
var aceEditor = undefined;
focusMode.onAceCreated = function(aceEditorParam) {
aceEditor = aceEditorParam;
};
var isActive = false;
function doFocus() {
if(isActive === false) {
return;
}
var positionInDocument = aceEditor.selection.getCursor();
var positionInScreen = aceEditor.session.documentToScreenPosition(positionInDocument.row, positionInDocument.column);
aceEditor.session.setScrollTop((positionInScreen.row+0.5) * aceEditor.renderer.lineHeight - aceEditor.renderer.$size.scrollerHeight / 2);
}
focusMode.onReady = function() {
//aceEditor.getSession().on('change', doFocus);
aceEditor.getSession().selection.on('changeCursor', doFocus);
};
focusMode.onCreateEditorButton = function() {
var $button = $([
'<button class="btn btn-info" title="Focus Mode" data-toggle="button">',
' <i class="icon-target"></i>',
'</button>'
].join(''));
$button.click(function() {
_.defer(function() {
isActive = $button.is('.active');
aceEditor.focus();
doFocus();
});
});
return $button[0];
};
return focusMode;
});

View File

@ -34,14 +34,6 @@ define(function(require, exports, module) {
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
function github_embed(tag, prefix) {
return { // Github style block
token : "support.function",
regex : "^```" + tag + "\\s*$",
next : prefix + "start"
};
}
var MarkdownHighlightRules = function() {
// regexp must not have capturing parentheses
@ -52,7 +44,7 @@ var MarkdownHighlightRules = function() {
token : "constant.language.escape",
regex : /\\[\\`*_{}\[\]()#+\-.!]/
}, { // code span `
token : "support.function",
token : "code",
regex : "(`+)(.*?[^`])(\\1)"
}, { // reference
token : ["text", "reference", "text", "markup.underline", "description", "text"],
@ -85,7 +77,7 @@ var MarkdownHighlightRules = function() {
// code block
"allowBlock": [
{token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
{token : ["text", "code_block"], regex : "^( {4}|\\t)(.+)", next : "allowBlock"},
{token : "empty", regex : "", next : "start"}
],
@ -107,12 +99,12 @@ var MarkdownHighlightRules = function() {
next : "header"
},
{ // Github style block
token : "support.function",
token : "code_block",
regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
next : "githubblock"
}, { // block quote
token : "blockquote",
regex : "^>[ ].+$",
regex : "^\\s*>[ ].+$",
next : "blockquote"
}, { // HR * - _
token : "constant",
@ -121,7 +113,7 @@ var MarkdownHighlightRules = function() {
}, { // list
token : "markup.list",
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
next : "listblock-start"
next : "listblock"
}, {
include : "basic"
}],
@ -135,11 +127,13 @@ var MarkdownHighlightRules = function() {
defaultToken : "markup.heading"
} ],
/* don't need checkbox highlighting...
"listblock-start" : [{
token : "support.variable",
token : "checkbox",
regex : /(?:\[[ x]\])?/,
next : "listblock"
}],
*/
"listblock" : [ { // Lists only escape on completely blank lines.
token : "empty_line",
@ -148,7 +142,7 @@ var MarkdownHighlightRules = function() {
}, { // list
token : "markup.list",
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
next : "listblock-start"
next : "listblock"
}, {
include : "basic", noEscape: true
}, {
@ -165,11 +159,11 @@ var MarkdownHighlightRules = function() {
} ],
"githubblock" : [ {
token : "support.function",
token : "code_block",
regex : "^```",
next : "start"
}, {
token : "support.function",
token : "code_block",
regex : ".+"
} ]
};

View File

@ -1150,12 +1150,6 @@
"code": 59558,
"src": "fontawesome"
},
{
"uid": "e75c54c282c0bf22186c5c7ec4b03eac",
"css": "target",
"code": 59559,
"src": "fontawesome"
},
{
"uid": "d407a4707f719b042ed2ad28d2619d7e",
"css": "signal",
@ -1177,7 +1171,7 @@
{
"uid": "500fc1f109021e4b1de4deda2f7ed399",
"css": "laptop",
"code": 59739,
"code": 59662,
"src": "fontawesome"
},
{
@ -1852,6 +1846,12 @@
"code": 59661,
"src": "iconic"
},
{
"uid": "74ae46b1527f71bad40a91762f4190ef",
"css": "target",
"code": 59559,
"src": "iconic"
},
{
"uid": "d2c499942f8a7c037d5a94f123eeb478",
"css": "layers",

View File

@ -179,7 +179,7 @@
.icon-angle-up:before { content: '\e87f'; } /* '' */
.icon-angle-down:before { content: '\e880'; } /* '' */
.icon-desktop:before { content: '\e95a'; } /* '' */
.icon-laptop:before { content: '\e95b'; } /* '' */
.icon-laptop:before { content: '\e90e'; } /* '' */
.icon-tablet:before { content: '\e95c'; } /* '' */
.icon-mobile:before { content: '\e8a9'; } /* '' */
.icon-circle-empty:before { content: '\e8d2'; } /* '' */

File diff suppressed because one or more lines are too long

View File

@ -179,7 +179,7 @@
.icon-angle-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87f;&nbsp;'); }
.icon-angle-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe880;&nbsp;'); }
.icon-desktop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95a;&nbsp;'); }
.icon-laptop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95b;&nbsp;'); }
.icon-laptop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90e;&nbsp;'); }
.icon-tablet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95c;&nbsp;'); }
.icon-mobile { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a9;&nbsp;'); }
.icon-circle-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d2;&nbsp;'); }

View File

@ -190,7 +190,7 @@
.icon-angle-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87f;&nbsp;'); }
.icon-angle-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe880;&nbsp;'); }
.icon-desktop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95a;&nbsp;'); }
.icon-laptop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95b;&nbsp;'); }
.icon-laptop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90e;&nbsp;'); }
.icon-tablet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95c;&nbsp;'); }
.icon-mobile { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a9;&nbsp;'); }
.icon-circle-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d2;&nbsp;'); }

View File

@ -1,10 +1,10 @@
@font-face {
font-family: 'fontello';
src: url('../font/fontello.eot');
src: url('../font/fontello.eot#iefix') format('embedded-opentype'),
url('../font/fontello.woff') format('woff'),
url('../font/fontello.ttf') format('truetype'),
url('../font/fontello.svg#fontello') format('svg');
src: url('../font/fontello.eot?67080555');
src: url('../font/fontello.eot?67080555#iefix') format('embedded-opentype'),
url('../font/fontello.woff?67080555') format('woff'),
url('../font/fontello.ttf?67080555') format('truetype'),
url('../font/fontello.svg?67080555#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
@ -14,7 +14,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg#fontello') format('svg');
src: url('../font/fontello.svg?67080555#fontello') format('svg');
}
}
*/
@ -230,7 +230,7 @@
.icon-angle-up:before { content: '\e87f'; } /* '' */
.icon-angle-down:before { content: '\e880'; } /* '' */
.icon-desktop:before { content: '\e95a'; } /* '' */
.icon-laptop:before { content: '\e95b'; } /* '' */
.icon-laptop:before { content: '\e90e'; } /* '' */
.icon-tablet:before { content: '\e95c'; } /* '' */
.icon-mobile:before { content: '\e8a9'; } /* '' */
.icon-circle-empty:before { content: '\e8d2'; } /* '' */

View File

@ -527,7 +527,7 @@ body {
<div title="Code: 0xe95a" class="the-icons span3"><i class="icon-desktop"></i> <span class="i-name">icon-desktop</span><span class="i-code">0xe95a</span></div>
</div>
<div class="row">
<div title="Code: 0xe95b" class="the-icons span3"><i class="icon-laptop"></i> <span class="i-name">icon-laptop</span><span class="i-code">0xe95b</span></div>
<div title="Code: 0xe90e" class="the-icons span3"><i class="icon-laptop"></i> <span class="i-name">icon-laptop</span><span class="i-code">0xe90e</span></div>
<div title="Code: 0xe95c" class="the-icons span3"><i class="icon-tablet"></i> <span class="i-name">icon-tablet</span><span class="i-code">0xe95c</span></div>
<div title="Code: 0xe8a9" class="the-icons span3"><i class="icon-mobile"></i> <span class="i-name">icon-mobile</span><span class="i-code">0xe8a9</span></div>
<div title="Code: 0xe8d2" class="the-icons span3"><i class="icon-circle-empty"></i> <span class="i-name">icon-circle-empty</span><span class="i-code">0xe8d2</span></div>

Binary file not shown.

View File

@ -186,7 +186,7 @@
<glyph glyph-name="angle-up" unicode="&#xe87f;" d="M600 189q0-7-6-13l-28-28q-6-6-13-6t-13 6l-219 219-219-219q-6-6-13-6t-13 6l-28 28q-6 6-6 13t6 13l260 260q6 6 13 6t13-6l260-260q6-6 6-13z" horiz-adv-x="642.857" />
<glyph glyph-name="angle-down" unicode="&#xe880;" d="M600 439q0-7-6-13l-260-260q-6-6-13-6t-13 6l-260 260q-6 6-6 13t6 13l28 28q6 6 13 6t13-6l219-219 219 219q6 6 13 6t13-6l28-28q6-6 6-13z" horiz-adv-x="642.857" />
<glyph glyph-name="desktop" unicode="&#xe95a;" d="M1000 296l0 464q0 7-5 13t-13 5l-893 0q-7 0-13-5t-5-13l0-464q0-7 5-13t13-5l893 0q7 0 13 5t5 13z m71 464l0-607q0-37-26-63t-63-26l-304 0q0-21 9-43t18-40 9-24q0-15-11-25t-25-11l-286 0q-15 0-25 11t-11 25q0 8 9 25t18 39 9 44l-304 0q-37 0-63 26t-26 63l0 607q0 37 26 63t63 26l893 0q37 0 63-26t26-63z" horiz-adv-x="1071.429" />
<glyph glyph-name="laptop" unicode="&#xe95b;" d="M232 136q-37 0-63 26t-26 63l0 393q0 37 26 63t63 26l607 0q37 0 63-26t26-63l0-393q0-37-26-63t-63-26l-607 0z m-18 482l0-393q0-7 5-13t13-5l607 0q7 0 13 5t5 13l0 393q0 7-5 13t-13 5l-607 0q-7 0-13-5t-5-13z m768-518l89 0 0-54q0-22-26-38t-63-16l-893 0q-37 0-63 16t-26 38l0 54 982 0z m-402-54q9 0 9 9t-9 9l-89 0q-9 0-9-9t9-9l89 0z" horiz-adv-x="1071.429" />
<glyph glyph-name="laptop" unicode="&#xe90e;" d="M232 136q-37 0-63 26t-26 63l0 393q0 37 26 63t63 26l607 0q37 0 63-26t26-63l0-393q0-37-26-63t-63-26l-607 0z m-18 482l0-393q0-7 5-13t13-5l607 0q7 0 13 5t5 13l0 393q0 7-5 13t-13 5l-607 0q-7 0-13-5t-5-13z m768-518l89 0 0-54q0-22-26-38t-63-16l-893 0q-37 0-63 16t-26 38l0 54 982 0z m-402-54q9 0 9 9t-9 9l-89 0q-9 0-9-9t9-9l89 0z" horiz-adv-x="1071.429" />
<glyph glyph-name="tablet" unicode="&#xe95c;" d="M357 64q0 15-11 25t-25 11-25-11-11-25 11-25 25-11 25 11 11 25z m214 89l0 536q0 7-5 13t-13 5l-464 0q-7 0-13-5t-5-13l0-536q0-7 5-13t13-5l464 0q7 0 13 5t5 13z m71 536l0-607q0-37-26-63t-63-26l-464 0q-37 0-63 26t-26 63l0 607q0 37 26 63t63 26l464 0q37 0 63-26t26-63z" horiz-adv-x="642.857" />
<glyph glyph-name="mobile" unicode="&#xe8a9;" d="M259 64q0 18-13 32t-32 13-32-13-13-32 13-32 32-13 32 13 13 32z m116 89l0 393q0 7-5 13t-13 5l-286 0q-7 0-13-5t-5-13l0-393q0-7 5-13t13-5l286 0q7 0 13 5t5 13z m-107 473q0 9-9 9l-89 0q-9 0-9-9t9-9l89 0q9 0 9 9z m161 9l0-571q0-29-21-50t-50-21l-286 0q-29 0-50 21t-21 50l0 571q0 29 21 50t50 21l286 0q29 0 50-21t21-50z" horiz-adv-x="428.571" />
<glyph glyph-name="circle-empty" unicode="&#xe8d2;" d="M429 654q-83 0-152-41t-110-110-41-152 41-152 110-110 152-41 152 41 110 110 41 152-41 152-110 110-152 41z m429-304q0-117-57-215t-156-156-215-57-215 57-156 156-57 215 57 215 156 156 215 57 215-57 156-156 57-215z" horiz-adv-x="857.143" />
@ -286,7 +286,7 @@
<glyph glyph-name="videocam" unicode="&#xe811;" d="M1000 654l0-607q0-23-22-33-7-3-14-3-15 0-25 11l-225 225 0-93q0-66-47-114t-114-47l-393 0q-66 0-114 47t-47 114l0 393q0 66 47 114t114 47l393 0q66 0 114-47t47-114l0-92 225 224q10 11 25 11 7 0 14-3 22-9 22-33z" horiz-adv-x="1000" />
<glyph glyph-name="headphones" unicode="&#xe86b;" d="M929 356q0-93-33-175l-11-27-103-18q-12-46-50-76t-87-30l0-18q0-8-5-13t-13-5l-36 0q-8 0-13 5t-5 13l0 321q0 8 5 13t13 5l36 0q8 0 13-5t5-13l0-18q40 0 73-20t52-53l38 7q16 53 16 108 0 83-49 156t-132 117-176 44-176-44-132-117-49-156q0-55 16-108l38-7q19 33 52 53t73 20l0 18q0 8 5 13t13 5l36 0q8 0 13-5t5-13l0-321q0-8-5-13t-13-5l-36 0q-8 0-13 5t-5 13l0 18q-49 0-87 30t-50 76l-103 18-11 27q-33 83-33 175 0 84 37 162t100 135 148 91 179 34 179-34 148-91 100-135 37-162z" horiz-adv-x="928.571" />
<glyph glyph-name="video" unicode="&#xe810;" d="M214-43l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m0 214l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m0 214l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m571-429l0 286q0 15-11 25t-25 11l-429 0q-15 0-25-11t-11-25l0-286q0-15 11-25t25-11l429 0q15 0 25 11t11 25z m-571 643l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m786-643l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m-214 429l0 286q0 15-11 25t-25 11l-429 0q-15 0-25-11t-11-25l0-286q0-15 11-25t25-11l429 0q15 0 25 11t11 25z m214-214l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m0 214l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m0 214l0 71q0 15-11 25t-25 11l-71 0q-15 0-25-11t-11-25l0-71q0-15 11-25t25-11l71 0q15 0 25 11t11 25z m71 89l0-750q0-37-26-63t-63-26l-893 0q-37 0-63 26t-26 63l0 750q0 37 26 63t63 26l893 0q37 0 63-26t26-63z" horiz-adv-x="1071.429" />
<glyph glyph-name="target" unicode="&#xe8a7;" d="M668 279l-61 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l61 0q-18 60-63 105t-105 63l0-61q0-15-11-25t-25-11l-71 0q-15 0-25 11t-11 25l0 61q-60-18-105-63t-63-105l61 0q15 0 25-11t11-25l0-71q0-15-11-25t-25-11l-61 0q18-60 63-105t105-63l0 61q0 15 11 25t25 11l71 0q15 0 25-11t11-25l0-61q60 18 105 63t63 105z m189 107l0-71q0-15-11-25t-25-11l-80 0q-21-90-86-155t-155-86l0-80q0-15-11-25t-25-11l-71 0q-15 0-25 11t-11 25l0 80q-90 21-155 86t-86 155l-80 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l80 0q21 90 86 155t155 86l0 80q0 15 11 25t25 11l71 0q15 0 25-11t11-25l0-80q90-21 155-86t86-155l80 0q15 0 25-11t11-25z" horiz-adv-x="857.143" />
<glyph glyph-name="target" unicode="&#xe8a7;" d="M521 407l0 162q60-16 103-60t59-103l-162 0z m0-113l162 0q-16-59-59-103t-103-60l0 162z m-113 113l-162 0q16 59 59 103t103 60l0-162z m0-113l0-162q-60 16-103 60t-59 103l162 0z m113 390l0 113q152-19 261-128t130-263l-113 0q-18 107-95 183t-182 94z m-390-277l-113 0q19 152 128 262t263 129l0-113q-106-18-183-94t-95-183z m277-390l0-113q-154 19-263 129t-128 262l113 0q18-107 95-183t183-94z m390 277l113 0q-21-153-130-262t-261-128l0 113q105 18 182 94t95 183z" horiz-adv-x="928" />
<glyph glyph-name="award" unicode="&#xe959;" d="M256 357q-41 90-41 207l-143 0 0-54q0-44 53-90t131-63z m602 153l0 54-143 0q0-117-41-207 79 16 131 63t53 90z m71 71l0-71q0-40-23-80t-62-73-97-54-120-25q-23-30-53-53-21-19-29-40t-8-50q0-30 17-51t54-21q42 0 74-25t33-64l0-36q0-8-5-13t-13-5l-464 0q-8 0-13 5t-5 13l0 36q0 39 33 64t74 25q37 0 54 21t17 51q0 28-8 50t-29 40q-30 23-53 53-63 3-120 25t-97 54-62 73-23 80l0 71q0 22 16 38t38 16l161 0 0 54q0 37 26 63t63 26l321 0q37 0 63-26t26-63l0-54 161 0q22 0 38-16t16-38z" horiz-adv-x="928.571" />
<glyph glyph-name="thumbs-up" unicode="&#xe93f;" d="M143 100q0 15-11 25t-25 11-25-11-11-25 11-25 25-11 25 11 11 25z m643 321q0 28-22 50t-50 21l-196 0q0 32 27 89t27 90q0 55-18 81t-71 26q-15-15-21-47t-17-70-33-61q-12-13-43-51-2-3-13-17t-18-23-19-24-22-25-21-20-22-15-20-5l-18 0 0-357 18 0q7 0 18-2t18-4 21-6 20-6 20-7 16-6q118-41 191-41l68 0q107 0 107 93 0 15-3 31 17 9 27 29t10 41-10 39q30 28 30 66 0 14-6 31t-14 27q18 1 30 26t12 45z m71 1q0-50-27-91 5-18 5-39 0-43-21-80 2-12 2-24 0-56-33-99 1-78-47-122t-127-45l-72 0q-54 0-106 13t-121 37q-65 22-77 22l-161 0q-30 0-50 21t-21 50l0 357q0 30 21 50t50 21l153 0q20 13 76 86 32 42 60 71 13 14 20 48t17 71 35 60q22 21 50 21 47 0 84-18t57-57 20-104q0-52-27-107l98 0q58 0 100-42t42-100z" horiz-adv-x="857.143" />
<glyph glyph-name="thumbs-down" unicode="&#xe940;" d="M143 600q0 15-11 25t-25 11-25-11-11-25 11-25 25-11 25 11 11 25z m643-321q0 20-12 45t-30 26q8 9 14 27t6 31q0 39-30 66 10 18 10 39t-10 41-27 29q3 17 3 31 0 47-27 70t-76 23l-71 0q-73 0-191-41-3-1-16-6t-20-7-20-6-21-6-18-4-18-2l-18 0 0-357 18 0q9 0 20-5t22-15 21-20 22-25 19-24 18-23 13-17q31-38 43-51 23-24 33-61t17-70 21-47q54 0 71 26t18 81q0 33-27 90t-27 89l196 0q28 0 50 21t22 50z m71-1q0-57-42-100t-100-42l-98 0q27-55 27-107 0-66-20-104-20-39-57-57t-84-18q-28 0-50 21-19 18-30 46t-14 50-10 47-17 36q-27 28-60 71-56 73-76 86l-153 0q-30 0-50 21t-21 50l0 357q0 30 21 50t50 21l161 0q12 0 77 22 71 25 124 37t112 12l62 0q78 0 126-44t48-121l0-3q33-43 33-99 0-12-2-24 21-37 21-80 0-20-5-39 27-41 27-91z" horiz-adv-x="857.143" />

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Binary file not shown.

View File

@ -278,17 +278,14 @@ define([
var setUndoRedoButtonStates = undefined;
// Keep a link to the ACE editor
var aceEditor = undefined;
var isAceUpToDate = false;
var isAceUpToDate = true;
eventMgr.addListener('onAceCreated', function(aceEditorParam) {
aceEditor = aceEditorParam;
// Listen to editor's changes
aceEditor.session.on('change', function(e) {
if(realtimeString !== undefined) {
// Update the real time model]
// The flag is used to avoid replaying editor's own modifications (assuming it's synchronous)
isAceUpToDate = true;
// Update the real time model
realtimeString.setText(aceEditor.getValue());
isAceUpToDate = false;
}
});
});
@ -319,13 +316,12 @@ define([
// Listen to insert text events
realtimeString.addEventListener(gapi.drive.realtime.EventType.TEXT_INSERTED, function(e) {
if(isAceUpToDate === true) {
// Don't need to update ACE if modifications come from the editor
return;
if(isAceUpToDate === false || e.isLocal === false) {
// Update ACE editor
var position = aceEditor.session.doc.indexToPosition(e.index);
aceEditor.session.insert(position, e.text);
isAceUpToDate = true;
}
// Update ACE editor
var position = aceEditor.session.doc.indexToPosition(e.index);
aceEditor.session.insert(position, e.text);
// If modifications come down from a collaborator
if(e.isLocal === false) {
logger.log("Google Drive realtime document updated from server");
@ -334,15 +330,14 @@ define([
});
// Listen to delete text events
realtimeString.addEventListener(gapi.drive.realtime.EventType.TEXT_DELETED, function(e) {
if(isAceUpToDate === true) {
// Don't need to update ACE if modifications come from the editor
return;
if(isAceUpToDate === false || e.isLocal === false) {
// Update ACE editor
var range = (function(posStart, posEnd) {
return new Range(posStart.row, posStart.column, posEnd.row, posEnd.column);
})(aceEditor.session.doc.indexToPosition(e.index), aceEditor.session.doc.indexToPosition(e.index + e.text.length));
aceEditor.session.remove(range);
isAceUpToDate = true;
}
// Update ACE editor
var range = (function(posStart, posEnd) {
return new Range(posStart.row, posStart.column, posEnd.row, posEnd.column);
})(aceEditor.session.doc.indexToPosition(e.index), aceEditor.session.doc.indexToPosition(e.index + e.text.length));
aceEditor.session.remove(range);
// If modifications come down from a collaborator
if(e.isLocal === false) {
logger.log("Google Drive realtime document updated from server");
@ -389,10 +384,18 @@ define([
// Set new actions for undo/redo buttons
pagedownEditor.uiManager.buttons.undo.execute = function() {
model.canUndo && model.undo();
if(model.canUndo) {
// This flag is used to avoid replaying editor's own modifications (assuming it's synchronous)
isAceUpToDate = false;
model.undo();
}
};
pagedownEditor.uiManager.buttons.redo.execute = function() {
model.canRedo && model.redo();
if(model.canRedo) {
// This flag is used to avoid replaying editor's own modifications (assuming it's synchronous)
isAceUpToDate = false;
model.redo();
}
};
// Add event handler for model's UndoRedoStateChanged events

View File

@ -580,6 +580,7 @@ body {
margin: 0 0 0 1px;
.btn {
position: initial;
background-color: fade(@navbar-default-bg, 50%);
}
&.open .btn{
background-color: @primary-bg-light;
@ -617,6 +618,28 @@ body {
}
/********************
* Editor extensions buttons
********************/
.extension-editor-buttons {
position: absolute;
.ui-layout-resizer-east & {
bottom: 0;
& .btn {
width: 35px;
padding: 10px 7px;
}
}
.ui-layout-resizer-south & {
right: 0;
& .btn {
height: 35px;
}
}
}
/**************************
* Settings dialog
**************************/
@ -734,7 +757,6 @@ body {
overflow: visible !important;
font-size: 14px !important;
.btn {
background-color: fade(@navbar-default-bg, 50%);
float: none;
i {
color: fade(@btn-success-color, 30%);
@ -751,7 +773,6 @@ body {
}
.ui-layout-toggler {
font-size: 22px !important;
background-color: transparent;
&.ui-layout-toggler-east {
line-height: 55px;
&.ui-layout-toggler-east-open i:before {
@ -912,34 +933,51 @@ ul,ol {
color: @primary-color-light;
}
.ace-tm .ace_marker-layer .ace_active-line {
background-color: @primary-bg-lighter;
}
.ace-tm {
background-color: @input-bg;
.ace-tm .ace_markup.ace_heading {
color: @primary-color-light;
font-weight: bold;
}
.ace-tm .ace_markup.ace_list {
color: @primary-color-lightest;
}
.ace-tm .ace_strong {
font-weight: bold;
}
.ace-tm .ace_emphasis {
font-style: italic;
}
.ace-tm .ace_blockquote {
color: @primary-color-lightest;
font-style: italic;
}
.ace-tm .ace_description {
color: @primary-color-lightest;
.ace_marker-layer .ace_active-line {
background-color: @primary-bg-lighter;
}
.ace_print-margin {
background-color: @primary-bg-lighter;
}
.ace_markup.ace_heading {
color: @primary-color-light;
font-weight: bold;
}
.ace_markup.ace_list {
color: @primary-color-lightest;
}
.ace_strong {
font-weight: bold;
}
.ace_emphasis {
font-style: italic;
}
.ace_blockquote {
color: @primary-color-lightest;
font-style: italic;
}
.ace_code {
color: @primary-color-lighter;
background-color: fade(@secondary-bg, 10%);;
}
.ace_code_block {
color: @primary-color;
}
.ace_description {
color: @primary-color-lighter;
}
}
#wmd-input {

View File

@ -1,6 +1,6 @@
@import "../styles/main.less";
@primary-bg: #d5dde3;
@primary-bg: #d9dfe3;
.navbar .working-indicator.show {
.img-retina('../img/loader-blue-gray.gif', '../img/loader-blue-gray2x.gif', 50px, 17px);

View File

@ -9,6 +9,7 @@
@primary-color: #fff;
@primary-color-light: darken(@primary-color, 13%);
@primary-color-lighter: darken(@primary-color, 20%);
@primary-color-lightest: darken(@primary-color, 35%);
@primary-color-inv: #fff;
@disabled-color: #999;
@ -42,4 +43,9 @@
.navbar .working-indicator.show {
.img-retina('../img/loader-night.gif', '../img/loader-night2x.gif', 50px, 17px);
}
}
.ace-tm .ace_cursor {
border-left-color: #fff;
}