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
86f3399d
Commit
86f3399d
authored
May 14, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also trigger 'chatboxFocused' when user manually focuses
parent
dd082107
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
23 deletions
+19
-23
spec/chatbox.js
spec/chatbox.js
+0
-3
src/converse-chatview.js
src/converse-chatview.js
+19
-20
No files found.
spec/chatbox.js
View file @
86f3399d
...
...
@@ -123,7 +123,6 @@
// Check that new chat boxes are created to the left of the
// controlbox (but to the right of all existing chat boxes)
expect
(
document
.
querySelectorAll
(
"
#conversejs .chatbox
"
).
length
).
toBe
(
2
);
expect
(
document
.
querySelectorAll
(
"
#conversejs .chatbox
"
)[
1
].
id
).
toBe
(
chatboxview
.
model
.
get
(
'
box_id
'
));
online_contacts
[
1
].
click
();
await
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxes
.
length
==
3
);
el
=
online_contacts
[
1
];
...
...
@@ -133,8 +132,6 @@
// Check that new chat boxes are created to the left of the
// controlbox (but to the right of all existing chat boxes)
expect
(
document
.
querySelectorAll
(
"
#conversejs .chatbox
"
).
length
).
toBe
(
3
);
expect
(
document
.
querySelectorAll
(
"
#conversejs .chatbox
"
)[
2
].
id
).
toBe
(
chatboxview
.
model
.
get
(
'
box_id
'
));
expect
(
document
.
querySelectorAll
(
"
#conversejs .chatbox
"
)[
1
].
id
).
toBe
(
new_chatboxview
.
model
.
get
(
'
box_id
'
));
done
();
}));
...
...
src/converse-chatview.js
View file @
86f3399d
...
...
@@ -366,13 +366,12 @@ converse.plugins.add('converse-chatview', {
},
render
()
{
// XXX: Is this still needed?
this
.
el
.
setAttribute
(
'
id
'
,
this
.
model
.
get
(
'
box_id
'
));
this
.
el
.
innerHTML
=
tpl_chatbox
(
Object
.
assign
(
this
.
model
.
toJSON
(),
{
'
unread_msgs
'
:
__
(
'
You have unread messages
'
)
}
));
Object
.
assign
(
this
.
model
.
toJSON
(),
{
'
unread_msgs
'
:
__
(
'
You have unread messages
'
)}
)
);
this
.
content
=
this
.
el
.
querySelector
(
'
.chat-content
'
);
this
.
renderMessageForm
();
this
.
insertHeading
();
...
...
@@ -402,17 +401,11 @@ converse.plugins.add('converse-chatview', {
},
renderMessageForm
()
{
let
placeholder
;
if
(
this
.
model
.
get
(
'
composing_spoiler
'
))
{
placeholder
=
__
(
'
Hidden message
'
);
}
else
{
placeholder
=
__
(
'
Message
'
);
}
const
form_container
=
this
.
el
.
querySelector
(
'
.bottom-panel
'
);
form_container
.
innerHTML
=
tpl_chatbox_message_form
(
Object
.
assign
(
this
.
model
.
toJSON
(),
{
'
hint_value
'
:
_
.
get
(
this
.
el
.
querySelector
(
'
.spoiler-hint
'
),
'
value
'
),
'
label_message
'
:
placeholder
,
'
label_message
'
:
this
.
model
.
get
(
'
composing_spoiler
'
)
?
__
(
'
Hidden message
'
)
:
__
(
'
Message
'
)
,
'
label_send
'
:
__
(
'
Send
'
),
'
label_spoiler_hint
'
:
__
(
'
Optional hint
'
),
'
message_value
'
:
_
.
get
(
this
.
el
.
querySelector
(
'
.chat-textarea
'
),
'
value
'
),
...
...
@@ -420,6 +413,8 @@ converse.plugins.add('converse-chatview', {
'
show_toolbar
'
:
_converse
.
show_toolbar
,
'
unread_msgs
'
:
__
(
'
You have unread messages
'
)
}));
const
textarea_el
=
this
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea_el
.
addEventListener
(
'
focus
'
,
()
=>
this
.
emitFocused
());
this
.
renderToolbar
();
},
...
...
@@ -1256,17 +1251,21 @@ converse.plugins.add('converse-chatview', {
}
},
emitFocused
:
_
.
debounce
(()
=>
{
/**
* Triggered when the focus has been moved to a particular chat.
* @event _converse#chatBoxFocused
* @type { _converse.ChatBoxView | _converse.ChatRoomView }
* @example _converse.api.listen.on('chatBoxFocused', view => { ... });
*/
_converse
.
api
.
trigger
(
'
chatBoxFocused
'
,
this
);
},
25
,
{
'
leading
'
:
true
}),
focus
()
{
const
textarea_el
=
this
.
el
.
querySelector
(
'
.chat-textarea
'
);
if
(
!
_
.
isNull
(
textarea_el
))
{
textarea_el
.
focus
();
/**
* Triggered when the focus has been moved to a particular chat.
* @event _converse#chatBoxFocused
* @type { _converse.ChatBoxView | _converse.ChatRoomView }
* @example _converse.api.listen.on('chatBoxFocused', view => { ... });
*/
_converse
.
api
.
trigger
(
'
chatBoxFocused
'
,
this
);
this
.
emitFocused
();
}
return
this
;
},
...
...
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