Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
cc3a158b
Commit
cc3a158b
authored
6 years ago
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial work on showing all options on @
parent
b6f5cd2c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
spec/autocomplete.js
spec/autocomplete.js
+13
-1
src/converse-autocomplete.js
src/converse-autocomplete.js
+9
-2
src/converse-core.js
src/converse-core.js
+1
-0
src/converse-muc-views.js
src/converse-muc-views.js
+2
-1
No files found.
spec/autocomplete.js
View file @
cc3a158b
...
...
@@ -100,7 +100,7 @@
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
stopPropagation
'
:
_
.
noop
,
'
keyCode
'
:
13
'
keyCode
'
:
13
// Enter
});
expect
(
textarea
.
value
).
toBe
(
'
hello s some2
'
);
...
...
@@ -123,6 +123,18 @@
view
.
keyPressed
(
tab_event
);
view
.
keyUp
(
tab_event
);
expect
(
textarea
.
value
).
toBe
(
'
hello z3r0
'
);
// Test that pressing @ brings up all options
const
at_event
=
{
'
target
'
:
textarea
,
'
preventDefault
'
:
_
.
noop
,
'
stopPropagation
'
:
_
.
noop
,
'
keyCode
'
:
50
};
view
.
keyPressed
(
at_event
);
view
.
keyUp
(
at_event
);
textarea
.
value
=
'
hello z3r0 and @
'
;
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
...
...
This diff is collapsed.
Click to expand it.
src/converse-autocomplete.js
View file @
cc3a158b
...
...
@@ -74,6 +74,7 @@
_
.
assignIn
(
this
,
{
'
match_current_word
'
:
false
,
// Match only the current word, otherwise all input is matched
'
match_on_tab
'
:
false
,
// Whether matching should only start when tab's pressed
'
trigger_on_at
'
:
false
,
// Whether @ should trigger autocomplete
'
min_chars
'
:
2
,
'
max_items
'
:
10
,
'
auto_evaluate
'
:
true
,
...
...
@@ -294,6 +295,8 @@
if
(
this
.
match_on_tab
&&
ev
.
keyCode
===
_converse
.
keycodes
.
TAB
)
{
ev
.
preventDefault
();
this
.
auto_completing
=
true
;
}
else
if
(
this
.
trigger_on_at
&&
ev
.
keyCode
===
_converse
.
keycodes
.
AT
)
{
this
.
auto_completing
=
true
;
}
}
...
...
@@ -309,10 +312,14 @@
let
value
=
this
.
input
.
value
;
if
(
this
.
match_current_word
)
{
value
=
u
.
getCurrentWord
(
this
.
input
);
}
}
const
list
=
typeof
this
.
_list
===
"
function
"
?
this
.
_list
()
:
this
.
_list
;
if
(
value
.
length
>=
this
.
min_chars
&&
list
.
length
>
0
)
{
if
(
list
.
length
>
0
&&
(
(
value
.
length
>=
this
.
min_chars
)
||
(
this
.
trigger_on_at
&&
ev
.
keyCode
===
value
.
startsWith
(
'
@
'
))
))
{
this
.
index
=
-
1
;
// Populate list with options that match
this
.
ul
.
innerHTML
=
""
;
...
...
This diff is collapsed.
Click to expand it.
src/converse-core.js
View file @
cc3a158b
...
...
@@ -117,6 +117,7 @@
UP_ARROW
:
38
,
DOWN_ARROW
:
40
,
FORWARD_SLASH
:
47
,
AT
:
50
,
META
:
91
,
META_RIGHT
:
93
};
...
...
This diff is collapsed.
Click to expand it.
src/converse-muc-views.js
View file @
cc3a158b
...
...
@@ -618,7 +618,8 @@
'
match_current_word
'
:
true
,
'
match_on_tab
'
:
true
,
'
list
'
:
()
=>
this
.
model
.
occupants
.
map
(
o
=>
({
'
label
'
:
o
.
get
(
'
nick
'
),
'
value
'
:
o
.
get
(
'
nick
'
)})),
'
filter
'
:
_converse
.
FILTER_STARTSWITH
'
filter
'
:
_converse
.
FILTER_STARTSWITH
,
'
trigger_on_at
'
:
true
});
this
.
auto_complete
.
on
(
'
suggestion-box-selectcomplete
'
,
()
=>
(
this
.
auto_completing
=
false
));
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment