From 5ef7d224501f08febb8a6d5cd6c89f342cf4095d Mon Sep 17 00:00:00 2001 From: benweet Date: Tue, 4 Mar 2014 00:30:55 +0100 Subject: [PATCH 01/14] 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 $(' @@ -927,8 +913,8 @@
- -
+ +
- -
+ +
-
-
+
+
-
-
+
+
- -
+
@@ -1013,69 +999,69 @@
- -
+
- -
+
px px Only monospaced fonts are supported.
- -
+
px + class="form-control col-sm-3"> px
- -
+
- -
+
- -
+
- -
+ +
@@ -1098,8 +1084,8 @@
-
-
+
+
-
-
+
+
- -
+
- -
+
From 7a25b4aeac31aa665c955f50e09d9148510d6d52 Mon Sep 17 00:00:00 2001 From: benweet Date: Mon, 10 Mar 2014 23:53:36 +0000 Subject: [PATCH 07/14] Highlight document comments --- public/res/libs/ace_mode_highlight_rules.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/res/libs/ace_mode_highlight_rules.js b/public/res/libs/ace_mode_highlight_rules.js index ff35cc1e..ec1a1bbe 100644 --- a/public/res/libs/ace_mode_highlight_rules.js +++ b/public/res/libs/ace_mode_highlight_rules.js @@ -81,6 +81,10 @@ var MarkdownHighlightRules = function() { token : ["keyword", "text"], regex : "(\\\\?\\\\begin)(\\{[a-z]*\\*?\\})", next : "latexblock" + }, { + token : "doccomment", + regex : "<\\!---", next : + "doccomment" }, { include : "basic" }); @@ -218,7 +222,13 @@ var MarkdownHighlightRules = function() { // the end of the line token : "comment", regex : "%.*$" - }] + }], + + doccomment : [ + {token : "doccomment", regex : "-->", next : "start"}, + {defaultToken : "doccomment"} + ], + }); this.normalizeRules(); From 4e5a264279ac3e6814d3e9b8ac199432899a3676 Mon Sep 17 00:00:00 2001 From: benweet Date: Mon, 10 Mar 2014 23:54:15 +0000 Subject: [PATCH 08/14] Dynamic preview panels size --- public/res/eventMgr.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/res/eventMgr.js b/public/res/eventMgr.js index bfb66e79..631b7f60 100644 --- a/public/res/eventMgr.js +++ b/public/res/eventMgr.js @@ -323,6 +323,9 @@ define([ $btnGroupElt.find('.dropdown-menu').css({ right: -previewButtonsWidth + $btnGroupElt.width() + $btnGroupElt.position().left }); + $btnGroupElt.find('.markdown-syntax, .table-of-contents').css({ + 'max-height': $(document).height() - $btnGroupElt.offset().top - 190 + }); }); }); From f7cf64eea1f7720835ad0a82cd64232503ef5bca Mon Sep 17 00:00:00 2001 From: benweet Date: Mon, 10 Mar 2014 23:55:01 +0000 Subject: [PATCH 09/14] Fixed modal responsiveness --- .../res/html/buttonHtmlCodeSettingsBlock.html | 4 +- public/res/html/buttonMarkdownSyntax.html | 2 + public/res/html/buttonStat.html | 1 + public/res/html/buttonStatSettingsBlock.html | 12 ++--- public/res/html/buttonSyncSettingsBlock.html | 10 ++--- public/res/html/buttonToc.html | 2 + .../html/documentSelectorSettingsBlock.html | 12 ++--- .../res/html/markdownExtraSettingsBlock.html | 44 +++++++++---------- public/res/html/mathJaxSettingsBlock.html | 8 ++-- .../res/html/notificationsSettingsBlock.html | 6 +-- public/res/html/settingsShortcutEntry.html | 10 ++--- public/res/html/spellCheckSettingsBlock.html | 4 +- public/res/html/tocSettingsBlock.html | 16 +++---- public/res/html/userCustomSettingsBlock.html | 4 +- 14 files changed, 70 insertions(+), 65 deletions(-) diff --git a/public/res/html/buttonHtmlCodeSettingsBlock.html b/public/res/html/buttonHtmlCodeSettingsBlock.html index f1725e8c..02b5b086 100644 --- a/public/res/html/buttonHtmlCodeSettingsBlock.html +++ b/public/res/html/buttonHtmlCodeSettingsBlock.html @@ -1,10 +1,10 @@

Adds a "HTML code" button over the preview.

-