parent
d102b926f0
commit
792cf18b4b
@ -0,0 +1,25 @@ |
||||
### |
||||
# Hilights is a named function that will process Highlights |
||||
# @param {Object} message - The message object |
||||
### |
||||
|
||||
class HighlightWordsClient |
||||
constructor: (message) -> |
||||
msg = message |
||||
|
||||
if not _.isString message |
||||
if _.trim message.html |
||||
msg = message.html |
||||
else |
||||
return message |
||||
|
||||
to_highlight = Meteor.user()?.settings?.preferences?['highlights'] |
||||
|
||||
_.forEach to_highlight, (highlight) -> |
||||
if not _.isBlank(highlight) |
||||
msg = msg.replace(new RegExp("(#{highlight})", 'gmi'), '<span class="highlight-text">$1</span>') |
||||
|
||||
message.html = msg |
||||
return message |
||||
|
||||
RocketChat.callbacks.add 'renderMessage', HighlightWordsClient |
@ -0,0 +1,22 @@ |
||||
Package.describe({ |
||||
name: 'rocketchat:highlight-words', |
||||
version: '0.0.1', |
||||
// Brief, one-line summary of the package.
|
||||
summary: '', |
||||
// URL to the Git repository containing the source code for this package.
|
||||
git: '', |
||||
// By default, Meteor will default to using README.md for documentation.
|
||||
// To avoid submitting documentation, set this field to null.
|
||||
documentation: '' |
||||
}); |
||||
|
||||
Package.onUse(function(api) { |
||||
api.versionsFrom('1.2.1'); |
||||
|
||||
api.use([ |
||||
'coffeescript', |
||||
'rocketchat:lib' |
||||
]); |
||||
|
||||
api.addFiles('client.coffee', 'client'); |
||||
}); |
Loading…
Reference in new issue