From 5ef7d224501f08febb8a6d5cd6c89f342cf4095d Mon Sep 17 00:00:00 2001 From: benweet Date: Tue, 4 Mar 2014 00:30:55 +0100 Subject: [PATCH] Tweaked ACE for performance --- public/res/core.js | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/public/res/core.js b/public/res/core.js index 40c89e5c..d756887d 100644 --- a/public/res/core.js +++ b/public/res/core.js @@ -28,7 +28,7 @@ define([ ], function($, _, crel, ace, constants, utils, storage, settings, eventMgr, shortcutMgr, mousetrap, bodyIndexHTML, bodyViewerHTML, settingsTemplateTooltipHTML, settingsUserCustomExtensionTooltipHTML) { var core = {}; - + // Used for periodic tasks var intervalId; @@ -53,7 +53,7 @@ define([ } return userActive && windowUnique; } - + // Used to only have 1 window of the application in the same browser var windowId; function checkWindowUnique() { @@ -147,7 +147,7 @@ define([ utils.setInputValue("#input-settings-pdf-page-size", settings.pdfPageSize); // SSH proxy utils.setInputValue("#input-settings-ssh-proxy", settings.sshProxy); - + // Load shortcuts settings shortcutMgr.loadSettings(); @@ -250,6 +250,14 @@ define([ aceEditor.session.setNewLineMode("unix"); aceEditor.session.setMode("libs/ace_mode"); aceEditor.session.$selectLongWords = true; + aceEditor.setHighlightActiveLine(true); + aceEditor.setHighlightGutterLine(false); + aceEditor.setHighlightSelectedWord(false); + aceEditor.setDisplayIndentGuides(false); + aceEditor.setShowFoldWidgets(false); + aceEditor.setWrapBehavioursEnabled(false); + // Hack to disable bracket highlighting + aceEditor.$highlightBrackets = function() {}; // Make bold titles... (function(self) { @@ -454,7 +462,7 @@ define([ } layout.resizeAll(); } - + // Create the PageDown editor var editor; var $editorElt; @@ -551,7 +559,7 @@ define([ } documentContent = newDocumentContent; } - + var previewWrapper; if(window.lightMode) { editor = new Markdown.EditorLight(converter); @@ -578,7 +586,7 @@ define([ $(".modal-insert-image").modal(); return true; }); - + if(settings.lazyRendering === true) { previewWrapper = function(makePreview) { var debouncedMakePreview = _.debounce(makePreview, 500); @@ -658,7 +666,7 @@ define([ $("#wmd-undo-button").append($('')).appendTo($btnGroupElt); $("#wmd-redo-button").append($('')).appendTo($btnGroupElt); }; - + // Initialize multiple things and then fire eventMgr.onReady var isDocumentPanelShown = false; var isMenuPanelShown = false; @@ -675,13 +683,13 @@ define([ $leftBtnDropdown = $navbarElt.find('.left-buttons-dropdown'); $rightBtnDropdown = $navbarElt.find('.right-buttons-dropdown'); $(window).bind("resize", adjustWindow); - + // Initialize utils library utils.init(); - + // Populate shortcuts in settings shortcutMgr.addSettingEntries(); - + // Hide shortcuts settings if light mode if(window.lightMode) { $('.tab-settings-shortcuts').hide(); @@ -773,14 +781,14 @@ define([ return $('