Skip to content
Snippets Groups Projects
Commit 46525f7c authored by Gabriel Engel's avatar Gabriel Engel
Browse files

Adding strike instruction

parent 08dab8e7
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,12 @@ Meteor.methods
message.u =
_id: Meteor.userId()
username: Meteor.user().username
message.html = message.msg
if _.trim(message.html) isnt ''
message.html = _.escapeHTML message.html
message = RocketChat.callbacks.run 'beforeSaveMessage', message
message.html = message.html.replace /\n/gm, '<br/>'
ChatMessage.upsert
rid: message.rid
......
......@@ -57,6 +57,18 @@ code {
}
}
q {
padding-left: 10px;
&:before {
content: ' ';
background-color: #ccc;
height: 22px;
width: 3px;
position: absolute;
left: 50px;
}
}
.text-center {
text-align: center;
}
......@@ -1698,11 +1710,21 @@ a.github-fork {
> .formatting-tips {
float: right;
height: 20px;
font-size: 12px;
font-size: 11px;
color: #888;
padding: 3px 0px 0px 5px;
padding: 4px 0px 0px 5px;
display: inline-block;
white-space: nowrap;
q {
padding: 0 0 0 3px;
border-left: 3px solid #ccc;
&:before {
content: none !important;
}
}
code {
color: #888;
}
}
}
.add-user-search {
......
......@@ -15,10 +15,12 @@ Template.chatMessageDashboard.helpers
return this._id is Session.get('editingMessageId')
preProcessingMessage: ->
this.html = this.msg
if _.trim(this.html) isnt ''
this.html = _.escapeHTML this.html
message = RocketChat.callbacks.run 'renderMessage', this
return message.html
this.html = message.html.replace /\n/gm, '<br/>'
return this.html
message: ->
switch this.t
......
......@@ -82,7 +82,7 @@
<div class="formatting-tips" aria-hidden="true">
<b>*bold*</b>
<i>_italics_</i>
<strike>~strike~</strike>
~<strike>strike</strike>~
<code class="inline">`inline code`</code>
<code class="inline">```multi-line```</code>
<q>&gt;quote</q>
......
......@@ -4,7 +4,7 @@
###
class Highlight
# If message starts with ```, replace it for text formatting
constructor: (message) ->
......@@ -18,7 +18,7 @@ class Highlight
if codeMatch?
# Process highlight if this part is code
lang = codeMatch[1]
code = codeMatch[2]
code = _.unescapeHTML codeMatch[2]
if lang not in hljs.listLanguages()
result = hljs.highlightAuto code
else
......@@ -26,8 +26,6 @@ class Highlight
msgParts[index] = "<pre><code class='hljs " + result.language + "'>" + result.value + "</code></pre>"
else
# Escape html and fix line breaks for non code blocks
part = _.escapeHTML part
part = part.replace /\n/g, '<br/>'
msgParts[index] = part
# Re-mount message
......@@ -35,4 +33,4 @@ class Highlight
return message
RocketChat.callbacks.add 'renderMessage', Highlight, RocketChat.callbacks.priority.HIGH
\ No newline at end of file
RocketChat.callbacks.add 'renderMessage', Highlight, RocketChat.callbacks.priority.HIGH
......@@ -10,11 +10,14 @@ Meteor.methods
console.log '[methods] sendMessage -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
message.u = Meteor.users.findOne Meteor.userId(), fields: username: 1
message.ts = new Date()
message = RocketChat.callbacks.run 'beforeSaveMessage', message
message.u = Meteor.users.findOne Meteor.userId(), fields: username: 1
# console.log "message", message
message.html = message.msg
if _.trim(message.html) isnt ''
message.html = _.escapeHTML message.html
message = RocketChat.callbacks.run 'beforeSaveMessage', message
message.html = message.html.replace /\n/gm, '<br/>'
###
Defer other updated as their return is not interesting to the user
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment