Skip to content

Node.js based forum software built for the modern web

added new hooks for rendering help messages in composer, removed markdown text from translation

Julian Lam44ac7ec2627b
diff --git a/package.json b/package.json
index fec5bc2bab..9024cc068b 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
"socket.io-wildcard": "~0.1.1",
"bcryptjs": "~0.7.10",
"nodebb-plugin-mentions": "~0.4",
- "nodebb-plugin-markdown": "~0.3",
+ "nodebb-plugin-markdown": "~0.4",
"nodebb-widget-essentials": "~0.0",
"nodebb-theme-vanilla": "~0.0.14",
"nodebb-theme-cerulean": "~0.0.13",
diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json
index 085f8df821..d92093720d 100644
--- a/public/language/en_GB/topic.json
+++ b/public/language/en_GB/topic.json
@@ -91,6 +91,5 @@
"composer.thumb_file_label": "Or upload a file",
"composer.thumb_remove": "Clear fields",
"composer.drag_and_drop_images": "Drag and Drop Images Here",
- "composer.content_is_parsed_with": "Content is parsed with",
"composer.upload_instructions": "Upload images by dragging & dropping them."
}
diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js
index 45b8c2b974..1862092834 100644
--- a/public/src/modules/composer.js
+++ b/public/src/modules/composer.js
@@ -638,6 +638,13 @@ define(['taskbar'], function(taskbar) {
}
});
+ socket.emit('modules.composer.renderHelp', function(err, html) {
+ if (html && html.length > 0) {
+ postContainer.find('.help').html(html);
+ postContainer.find('[data-pane=".tab-help"]').parent().removeClass('hidden');
+ }
+ });
+
$(window).trigger('action:composer.loaded', {
post_uuid: post_uuid
});
diff --git a/public/templates/composer.tpl b/public/templates/composer.tpl
index 584ba48153..7302c9a040 100644
--- a/public/templates/composer.tpl
+++ b/public/templates/composer.tpl
@@ -58,6 +58,7 @@
<ul class="nav nav-tabs">
<li class="active"><a data-pane=".tab-write" data-toggle="tab">[[topic:composer.write]]</a></li>
<li><a data-pane=".tab-preview" data-toggle="tab">[[topic:composer.preview]]</a></li>
+ <li class="hidden"><a data-pane=".tab-help" data-toggle="tab">[[topic:composer.help]]</a></li>
<li class="btn-group pull-right action-bar">
<button class="btn btn-default" data-action="discard" tabIndex="5"><i class="fa fa-times"></i> [[topic:composer.discard]]</button>
<button data-action="post" class="btn btn-default btn-primary" tabIndex="3"><i class="fa fa-check"></i> [[topic:composer.submit]]</button>
@@ -71,13 +72,15 @@
<div class="tab-pane tab-preview">
<div class="preview well"></div>
</div>
+ <div class="tab-pane tab-help">
+ <div class="help well"></div>
+ </div>
</div>
<div class="imagedrop"><div>[[topic:composer.drag_and_drop_images]]</div></div>
<div class="text-center instructions">
<span>
- <small>[[topic:composer.content_is_parsed_with]] <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>. </small>
<span class="upload-instructions hide"><small>[[topic:composer.upload_instructions]]</small></span>
</span>
diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js
index c5e23dc92b..a9d9d659be 100644
--- a/src/socket.io/modules.js
+++ b/src/socket.io/modules.js
@@ -68,7 +68,11 @@ SocketModules.composer.editCheck = function(socket, pid, callback) {
SocketModules.composer.renderPreview = function(socket, content, callback) {
plugins.fireHook('filter:post.parse', content, callback);
-}
+};
+
+SocketModules.composer.renderHelp = function(socket, data, callback) {
+ plugins.fireHook('filter:composer.help', '', callback);
+};
/* Chat */