update autolinker, remove underscore

This commit is contained in:
Devin Howard 2016-12-08 11:02:26 -05:00
parent 9a05014552
commit 67ca2262b1
3 changed files with 10 additions and 11 deletions

View file

@ -3,13 +3,12 @@
import Backbone from 'backbone'
import { Howl } from 'howler'
import Autolinker from 'autolinker'
import _ from 'lodash'
import underscore from 'underscore'
import { clone, template as lodashTemplate } from 'lodash'
import outdent from 'outdent'
// TODO is this line good or bad
// Backbone.$ = window.$
const linker = new Autolinker({ newWindow: true, truncate: 50, email: false, phone: false, twitter: false })
const linker = new Autolinker({ newWindow: true, truncate: 50, email: false, phone: false })
var Private = {
messageHTML: outdent`
@ -41,12 +40,13 @@ var Private = {
<div class='clearfloat'></div>
</div>`,
templates: function() {
underscore.templateSettings = {
const templateSettings = {
interpolate: /\{\{(.+?)\}\}/g
}
this.messageTemplate = underscore.template(Private.messageHTML)
this.participantTemplate = underscore.template(Private.participantHTML)
this.messageTemplate = lodashTemplate(Private.messageHTML, templateSettings)
this.participantTemplate = lodashTemplate(Private.participantHTML, templateSettings)
},
createElements: function() {
this.$unread = $('<div class="chat-unread"></div>')
@ -147,7 +147,7 @@ var Private = {
}
return i
}
var m = _.clone(message.attributes)
var m = clone(message.attributes)
m.timestamp = new Date(m.created_at)
@ -176,7 +176,7 @@ var Private = {
$(document).trigger(ChatView.events.message + '-' + this.room, [message])
},
addParticipant: function(participant) {
var p = _.clone(participant.attributes)
var p = clone(participant.attributes)
if (p.self) {
p.selfClass = 'is-self'
p.selfName = '(me)'

View file

@ -1,5 +1,5 @@
// create global references
import _ from 'underscore'
import _ from 'lodash'
import Metamaps from './Metamaps'
window._ = _

View file

@ -19,7 +19,7 @@
"homepage": "https://github.com/metamaps/metamaps#readme",
"dependencies": {
"attachmediastream": "1.4.2",
"autolinker": "0.17.1",
"autolinker": "1.4.0",
"babel-cli": "6.18.0",
"babel-loader": "6.2.9",
"babel-plugin-lodash": "3.2.10",
@ -43,7 +43,6 @@
"redux": "3.6.0",
"simplewebrtc": "2.2.1",
"socket.io": "1.3.7",
"underscore": "1.4.4",
"webpack": "1.14.0"
},
"devDependencies": {