From b8a224f87bf0cddab30ae544c6f2fed05ab3fc62 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 4 Aug 2015 11:41:47 +0930 Subject: [PATCH] Implement basic bio formatting. closes flarum/core#203 --- js/bower.json | 3 ++- js/forum/Gulpfile.js | 1 + js/lib/models/User.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/bower.json b/js/bower.json index 2f18ebadf..f80cf6d8e 100644 --- a/js/bower.json +++ b/js/bower.json @@ -9,6 +9,7 @@ "color-thief": "v2.0", "mithril": "lhorie/mithril.js#next", "es6-micro-loader": "caridy/es6-micro-loader#v0.2.1", - "fastclick": "~1.0.6" + "fastclick": "~1.0.6", + "autolink": "*" } } diff --git a/js/forum/Gulpfile.js b/js/forum/Gulpfile.js index c2ba146b1..eeb37cd96 100644 --- a/js/forum/Gulpfile.js +++ b/js/forum/Gulpfile.js @@ -14,6 +14,7 @@ gulp({ bowerDir + '/jquery.hotkeys/jquery.hotkeys.js', bowerDir + '/color-thief/js/color-thief.js', bowerDir + '/moment/moment.js', + bowerDir + '/autolink/autolink.js', bowerDir + '/bootstrap/js/affix.js', bowerDir + '/bootstrap/js/dropdown.js', diff --git a/js/lib/models/User.js b/js/lib/models/User.js index 5f3361316..0897f9d59 100644 --- a/js/lib/models/User.js +++ b/js/lib/models/User.js @@ -15,7 +15,7 @@ export default class User extends mixin(Model, { avatarUrl: Model.attribute('avatarUrl'), bio: Model.attribute('bio'), - bioHtml: computed('bio', bio => bio ? '

' + $('

').text(bio).html() + '

' : ''), + bioHtml: computed('bio', bio => bio ? '

' + $('

').text(bio).html().replace(/\n/g, '
').autoLink() + '

' : ''), preferences: Model.attribute('preferences'), groups: Model.hasMany('groups'),