Upgraded ACE library

This commit is contained in:
benweet 2013-10-22 23:12:38 +01:00
parent 618fd826d2
commit a4caa0e216
2 changed files with 19 additions and 16 deletions

View File

@ -18,7 +18,7 @@
"stacktrace": "~0.5.3", "stacktrace": "~0.5.3",
"requirejs-text": "~2.0.10", "requirejs-text": "~2.0.10",
"bootstrap-tour": "~0.6.0", "bootstrap-tour": "~0.6.0",
"ace": "#51b7cb67a63998c9c0b7d089a85c60e032a7cc17", "ace": "4bbe5346f2ae5ad35c0c47defa244ab27aedd451",
"pagedown-ace": "git@github.com:benweet/pagedown-ace.git#7805f240f343b5b2a05a5b9c0d4a3f5091e7a49b", "pagedown-ace": "git@github.com:benweet/pagedown-ace.git#7805f240f343b5b2a05a5b9c0d4a3f5091e7a49b",
"pagedown-extra": "git@github.com:jmcmanus/pagedown-extra.git#ae1547d1662e07d6530137bd3dff3a6e6c8aec3b", "pagedown-extra": "git@github.com:jmcmanus/pagedown-extra.git#ae1547d1662e07d6530137bd3dff3a6e6c8aec3b",
"crel": "git@github.com:KoryNunn/crel.git#8dbda04b129fc0aec01a2a080d1cab26816e11c1", "crel": "git@github.com:KoryNunn/crel.git#8dbda04b129fc0aec01a2a080d1cab26816e11c1",

View File

@ -212,15 +212,7 @@ define([
// Create ACE editor // Create ACE editor
var aceEditor = undefined; var aceEditor = undefined;
function createAceEditor() { function createAceEditor() {
if(lightMode) {
// In light mode, we replace ACE with a textarea
$('#wmd-input').replaceWith(function() {
return $('<textarea id="wmd-input">').addClass(this.className).addClass('form-control');
});
return;
}
aceEditor = ace.edit("wmd-input"); aceEditor = ace.edit("wmd-input");
require('ace/ext/spellcheck');
aceEditor.setOption("spellcheck", true); aceEditor.setOption("spellcheck", true);
aceEditor.renderer.setShowGutter(false); aceEditor.renderer.setShowGutter(false);
aceEditor.renderer.setPrintMarginColumn(false); aceEditor.renderer.setPrintMarginColumn(false);
@ -685,19 +677,30 @@ define([
} }
}); });
// ACE editor // Editor
createAceEditor(); if(lightMode) {
// In light mode, we replace ACE with a textarea
$('#wmd-input').replaceWith(function() {
return $('<textarea id="wmd-input">').addClass(this.className).addClass('form-control');
});
}
// Editor's element
$editorElt = $("#wmd-input").css({ $editorElt = $("#wmd-input").css({
// Apply editor font // Apply editor font
"font-family": settings.editorFontFamily, "font-family": settings.editorFontFamily,
"font-size": settings.editorFontSize + "px", "font-size": settings.editorFontSize + "px",
"line-height": Math.round(settings.editorFontSize * (20 / 12)) + "px" "line-height": Math.round(settings.editorFontSize * (20 / 12)) + "px"
}); });
$editorElt.find('.ace_content').css({
"background-size": "64px " + Math.round(settings.editorFontSize * (20 / 12)) + "px", if(!lightMode) {
}); // ACE editor
createAceEditor();
// Editor's element
$editorElt.find('.ace_content').css({
"background-size": "64px " + Math.round(settings.editorFontSize * (20 / 12)) + "px",
});
}
// UI layout // UI layout
createLayout(); createLayout();