update autolinker, remove underscore
This commit is contained in:
parent
9a05014552
commit
67ca2262b1
3 changed files with 10 additions and 11 deletions
|
@ -3,13 +3,12 @@
|
||||||
import Backbone from 'backbone'
|
import Backbone from 'backbone'
|
||||||
import { Howl } from 'howler'
|
import { Howl } from 'howler'
|
||||||
import Autolinker from 'autolinker'
|
import Autolinker from 'autolinker'
|
||||||
import _ from 'lodash'
|
import { clone, template as lodashTemplate } from 'lodash'
|
||||||
import underscore from 'underscore'
|
|
||||||
import outdent from 'outdent'
|
import outdent from 'outdent'
|
||||||
// TODO is this line good or bad
|
// TODO is this line good or bad
|
||||||
// Backbone.$ = window.$
|
// 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 = {
|
var Private = {
|
||||||
messageHTML: outdent`
|
messageHTML: outdent`
|
||||||
|
@ -41,12 +40,13 @@ var Private = {
|
||||||
<div class='clearfloat'></div>
|
<div class='clearfloat'></div>
|
||||||
</div>`,
|
</div>`,
|
||||||
templates: function() {
|
templates: function() {
|
||||||
underscore.templateSettings = {
|
const templateSettings = {
|
||||||
interpolate: /\{\{(.+?)\}\}/g
|
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() {
|
createElements: function() {
|
||||||
this.$unread = $('<div class="chat-unread"></div>')
|
this.$unread = $('<div class="chat-unread"></div>')
|
||||||
|
@ -147,7 +147,7 @@ var Private = {
|
||||||
}
|
}
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
var m = _.clone(message.attributes)
|
var m = clone(message.attributes)
|
||||||
|
|
||||||
m.timestamp = new Date(m.created_at)
|
m.timestamp = new Date(m.created_at)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ var Private = {
|
||||||
$(document).trigger(ChatView.events.message + '-' + this.room, [message])
|
$(document).trigger(ChatView.events.message + '-' + this.room, [message])
|
||||||
},
|
},
|
||||||
addParticipant: function(participant) {
|
addParticipant: function(participant) {
|
||||||
var p = _.clone(participant.attributes)
|
var p = clone(participant.attributes)
|
||||||
if (p.self) {
|
if (p.self) {
|
||||||
p.selfClass = 'is-self'
|
p.selfClass = 'is-self'
|
||||||
p.selfName = '(me)'
|
p.selfName = '(me)'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// create global references
|
// create global references
|
||||||
import _ from 'underscore'
|
import _ from 'lodash'
|
||||||
import Metamaps from './Metamaps'
|
import Metamaps from './Metamaps'
|
||||||
|
|
||||||
window._ = _
|
window._ = _
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"homepage": "https://github.com/metamaps/metamaps#readme",
|
"homepage": "https://github.com/metamaps/metamaps#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"attachmediastream": "1.4.2",
|
"attachmediastream": "1.4.2",
|
||||||
"autolinker": "0.17.1",
|
"autolinker": "1.4.0",
|
||||||
"babel-cli": "6.18.0",
|
"babel-cli": "6.18.0",
|
||||||
"babel-loader": "6.2.9",
|
"babel-loader": "6.2.9",
|
||||||
"babel-plugin-lodash": "3.2.10",
|
"babel-plugin-lodash": "3.2.10",
|
||||||
|
@ -43,7 +43,6 @@
|
||||||
"redux": "3.6.0",
|
"redux": "3.6.0",
|
||||||
"simplewebrtc": "2.2.1",
|
"simplewebrtc": "2.2.1",
|
||||||
"socket.io": "1.3.7",
|
"socket.io": "1.3.7",
|
||||||
"underscore": "1.4.4",
|
|
||||||
"webpack": "1.14.0"
|
"webpack": "1.14.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue