You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/07/29 23:10:40 UTC
[40/41] allura git commit: [#7897] ticket:828 Update editor
initialization for new version
[#7897] ticket:828 Update editor initialization for new version
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/b89befe5
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/b89befe5
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/b89befe5
Branch: refs/heads/master
Commit: b89befe55c454aa496d9fc4bd3b9d855205ed541
Parents: 49ef241
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Jul 27 16:38:35 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Jul 27 16:38:35 2015 +0300
----------------------------------------------------------------------
.../lib/widgets/resources/js/sf_markitup.js | 44 +++++++++++++-------
1 file changed, 30 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/b89befe5/Allura/allura/lib/widgets/resources/js/sf_markitup.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/sf_markitup.js b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
index 6570d6a..4ca7e5d 100644
--- a/Allura/allura/lib/widgets/resources/js/sf_markitup.js
+++ b/Allura/allura/lib/widgets/resources/js/sf_markitup.js
@@ -27,29 +27,45 @@ $(window).load(function() {
var $help_area = $('div.markdown_help', $container);
var $help_contents = $('div.markdown_help_contents', $container);
- // Add "info" tool & override action "preview" tool
+ // Override action for "preview" & "guide" tools
var toolbar = [];
for (var i in SimpleMDE.toolbar) {
var tool = SimpleMDE.toolbar[i];
- if (tool !== null && typeof tool === 'object' && tool.name === 'preview') {
- toolbar.push({
- name: 'info',
- action: show_help,
- className: 'fa fa-info'
- });
- toolbar.push({
- name: 'preview',
- action: show_preview,
- className: 'fa fa-eye'
- });
- } else {
- toolbar.push(tool);
+ if (tool !== null && typeof tool === 'object') {
+ switch (tool.name) {
+ case 'guide':
+ tool = {
+ name: tool.name,
+ action: show_help,
+ className: tool.className
+ };
+ break;
+ case 'preview':
+ tool = {
+ name: tool.name,
+ action: show_preview,
+ className: tool.className
+ };
+ break;
+ }
}
+ toolbar.push(tool);
}
var editor = new SimpleMDE({
element: $textarea[0],
autofocus: false,
+ /*
+ * spellChecker: false is important!
+ * It's enabled by default and consumes a lot of memory and CPU
+ * if you have more than one editor on the page. In Allura we
+ * usually have a lot of (hidden) editors on the page (e.g.
+ * comments). On my machine it consumes ~1G of memory for a page
+ * with ~10 comments.
+ * We're using bleeding age 1.4.0, we might want to
+ * re-check when more stable version will be available.
+ */
+ spellChecker: false,
indentWithTabs: false,
tabSize: 4,
toolbar: toolbar