summaryrefslogtreecommitdiffstats
path: root/client/components/main/editor.js
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-10-31 10:27:20 +0100
committerMaxime Quandalle <maxime@quandalle.com>2015-10-31 12:49:58 +0100
commit2b134ff7a986eb97f8ec360321be284a7a8ea11e (patch)
tree0ff579909b402db5916b66ec7bc7469534881a15 /client/components/main/editor.js
parent3507c6565bb16b5f45c6f269f7376902f8b1ff37 (diff)
parent41b23f88aea0f421226f92b081cdb1b61c64bde4 (diff)
downloadwekan-2b134ff7a986eb97f8ec360321be284a7a8ea11e.tar.gz
wekan-2b134ff7a986eb97f8ec360321be284a7a8ea11e.tar.bz2
wekan-2b134ff7a986eb97f8ec360321be284a7a8ea11e.zip
Merge branch 'devel' into minicard-editor
Conflicts: client/components/lists/listBody.js
Diffstat (limited to 'client/components/main/editor.js')
-rw-r--r--client/components/main/editor.js36
1 files changed, 6 insertions, 30 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js
index 1d88fe74..82fce641 100644
--- a/client/components/main/editor.js
+++ b/client/components/main/editor.js
@@ -1,17 +1,15 @@
-let dropdownMenuIsOpened = false;
-
Template.editor.onRendered(() => {
const $textarea = this.$('textarea');
autosize($textarea);
- $textarea.textcomplete([
+ $textarea.escapeableTextComplete([
// Emojies
{
match: /\B:([\-+\w]*)$/,
search(term, callback) {
- callback($.map(Emoji.values, (emoji) => {
- return emoji.indexOf(term) === 0 ? emoji : null;
+ callback(Emoji.values.map((emoji) => {
+ return emoji.includes(term) ? emoji : null;
}));
},
template(value) {
@@ -30,9 +28,9 @@ Template.editor.onRendered(() => {
match: /\B@(\w*)$/,
search(term, callback) {
const currentBoard = Boards.findOne(Session.get('currentBoard'));
- callback($.map(currentBoard.members, (member) => {
+ callback(currentBoard.members.map((member) => {
const username = Users.findOne(member.userId).username;
- return username.indexOf(term) === 0 ? username : null;
+ return username.includes(term) ? username : null;
}));
},
template(value) {
@@ -44,30 +42,8 @@ Template.editor.onRendered(() => {
index: 1,
},
]);
-
- // Since commit d474017 jquery-textComplete automatically closes a potential
- // opened dropdown menu when the user press Escape. This behavior conflicts
- // with our EscapeActions system, but it's too complicated and hacky to
- // monkey-pach textComplete to disable it -- I tried. Instead we listen to
- // 'open' and 'hide' events, and create a ghost escapeAction when the dropdown
- // is opened (and rely on textComplete to execute the actual action).
- $textarea.on({
- 'textComplete:show'() {
- dropdownMenuIsOpened = true;
- },
- 'textComplete:hide'() {
- Tracker.afterFlush(() => {
- dropdownMenuIsOpened = false;
- });
- },
- });
});
-EscapeActions.register('textcomplete',
- () => {},
- () => dropdownMenuIsOpened
-);
-
// XXX I believe we should compute a HTML rendered field on the server that
// would handle markdown, emojies and user mentions. We can simply have two
// fields, one source, and one compiled version (in HTML) and send only the
@@ -78,7 +54,7 @@ const at = HTML.CharRef({html: '&commat;', str: '@'});
Blaze.Template.registerHelper('mentions', new Template('mentions', function() {
const view = this;
const currentBoard = Boards.findOne(Session.get('currentBoard'));
- const knowedUsers = _.map(currentBoard.members, (member) => {
+ const knowedUsers = currentBoard.members.map((member) => {
member.username = Users.findOne(member.userId).username;
return member;
});