diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index dc13c4f9..ebe8d9d8 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -56,7 +56,7 @@ module.exports = { test: /\.js$/, loader: 'babel', include: projectRoot, - exclude: /node_modules/ + exclude: /node_modules\/(?!tributejs)/ }, { test: /\.json$/, diff --git a/package.json b/package.json index b5163e82..38321134 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,13 @@ "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs" }, "dependencies": { + "babel-plugin-add-module-exports": "^0.2.1", "diff": "^3.0.1", "karma-mocha-reporter": "^2.2.1", "node-sass": "^3.10.1", "sanitize-html": "^1.13.0", "sass-loader": "^4.0.2", + "tributejs": "^2.1.0", "vue": "^2.0.1", "vue-router": "^2.0.1", "vue-timeago": "^3.1.2", diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index b17fdaa1..650a9264 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -1,8 +1,10 @@ import statusPoster from '../../services/status_poster/status_poster.service.js' import MediaUpload from '../media_upload/media_upload.vue' import fileTypeService from '../../services/file_type/file_type.service.js' +import Tribute from '../../../node_modules/tributejs/src/Tribute.js' +require('../../../node_modules/tributejs/scss/tribute.scss') -import { reject, map, uniqBy } from 'lodash' +import { merge, reject, map, uniqBy } from 'lodash' const buildMentionsString = ({user, attentions}, currentUser) => { let allAttentions = [...attentions] @@ -19,6 +21,51 @@ const buildMentionsString = ({user, attentions}, currentUser) => { return mentions.join(' ') + ' ' } +const defaultCollection = { + // symbol that starts the lookup + trigger: '@', + + // element to target for @mentions + iframe: null, + + // class added in the flyout menu for active item + selectClass: 'highlight', + + // function called on select that returns the content to insert + selectTemplate: function (item) { + return '@' + item.original.screen_name + }, + + // template for displaying item in menu + menuItemTemplate: function (item) { + return `