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
9026062a
Commit
9026062a
authored
Jun 26, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render chatbox message form via lit-html
parent
694e7abe
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
43 deletions
+46
-43
spec/spoilers.js
spec/spoilers.js
+11
-11
src/converse-chatview.js
src/converse-chatview.js
+3
-3
src/templates/chatbox_message_form.html
src/templates/chatbox_message_form.html
+0
-29
src/templates/chatbox_message_form.js
src/templates/chatbox_message_form.js
+32
-0
No files found.
spec/spoilers.js
View file @
9026062a
src/converse-chatview.js
View file @
9026062a
...
@@ -10,7 +10,7 @@ import "converse-modal";
...
@@ -10,7 +10,7 @@ import "converse-modal";
import
log
from
"
@converse/headless/log
"
;
import
log
from
"
@converse/headless/log
"
;
import
tpl_chatbox
from
"
templates/chatbox.js
"
;
import
tpl_chatbox
from
"
templates/chatbox.js
"
;
import
tpl_chatbox_head
from
"
templates/chatbox_head.js
"
;
import
tpl_chatbox_head
from
"
templates/chatbox_head.js
"
;
import
tpl_chatbox_message_form
from
"
templates/chatbox_message_form.
html
"
;
import
tpl_chatbox_message_form
from
"
templates/chatbox_message_form.
js
"
;
import
tpl_new_day
from
"
templates/new_day.html
"
;
import
tpl_new_day
from
"
templates/new_day.html
"
;
import
tpl_spinner
from
"
templates/spinner.html
"
;
import
tpl_spinner
from
"
templates/spinner.html
"
;
import
tpl_spoiler_button
from
"
templates/spoiler_button.html
"
;
import
tpl_spoiler_button
from
"
templates/spoiler_button.html
"
;
...
@@ -355,7 +355,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -355,7 +355,7 @@ converse.plugins.add('converse-chatview', {
renderMessageForm
()
{
renderMessageForm
()
{
const
form_container
=
this
.
el
.
querySelector
(
'
.message-form-container
'
);
const
form_container
=
this
.
el
.
querySelector
(
'
.message-form-container
'
);
form_container
.
innerHTML
=
tpl_chatbox_message_form
(
render
(
tpl_chatbox_message_form
(
Object
.
assign
(
this
.
model
.
toJSON
(),
{
Object
.
assign
(
this
.
model
.
toJSON
(),
{
'
__
'
:
__
,
'
__
'
:
__
,
'
message_limit
'
:
api
.
settings
.
get
(
'
message_limit
'
),
'
message_limit
'
:
api
.
settings
.
get
(
'
message_limit
'
),
...
@@ -366,7 +366,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -366,7 +366,7 @@ converse.plugins.add('converse-chatview', {
'
show_send_button
'
:
api
.
settings
.
get
(
'
show_send_button
'
),
'
show_send_button
'
:
api
.
settings
.
get
(
'
show_send_button
'
),
'
show_toolbar
'
:
api
.
settings
.
get
(
'
show_toolbar
'
),
'
show_toolbar
'
:
api
.
settings
.
get
(
'
show_toolbar
'
),
'
unread_msgs
'
:
__
(
'
You have unread messages
'
)
'
unread_msgs
'
:
__
(
'
You have unread messages
'
)
}));
}))
,
form_container
)
;
this
.
el
.
addEventListener
(
'
focusin
'
,
ev
=>
this
.
emitFocused
(
ev
));
this
.
el
.
addEventListener
(
'
focusin
'
,
ev
=>
this
.
emitFocused
(
ev
));
this
.
el
.
addEventListener
(
'
focusout
'
,
ev
=>
this
.
emitBlurred
(
ev
));
this
.
el
.
addEventListener
(
'
focusout
'
,
ev
=>
this
.
emitBlurred
(
ev
));
this
.
renderToolbar
();
this
.
renderToolbar
();
...
...
src/templates/chatbox_message_form.html
deleted
100644 → 0
View file @
694e7abe
<div
class=
"new-msgs-indicator hidden"
>
▼ {{{ o.unread_msgs }}} ▼
</div>
<form
class=
"setNicknameButtonForm hidden"
>
<input
type=
"submit"
class=
"btn btn-primary"
name=
"join"
value=
"Join"
/>
</form>
<form
class=
"sendXMPPMessage"
>
{[ if (o.show_toolbar || o.show_send_button) { ]}
<div
class=
"chat-toolbar--container"
>
{[ if (o.show_toolbar) { ]}
<ul
class=
"chat-toolbar no-text-select"
></ul>
{[ } ]}
{[ if (o.show_send_button) { ]}
<button
type=
"submit"
class=
"btn send-button fa fa-paper-plane"
title=
"{{{ o.__('Send the message') }}}"
></button>
{[ } ]}
</div>
{[ } ]}
<input
type=
"text"
placeholder=
"{{o.label_spoiler_hint}}"
value=
"{{ o.hint_value }}"
class=
"{[ if (!o.composing_spoiler) { ]} hidden {[ } ]} spoiler-hint"
/>
<div
class=
"suggestion-box"
>
<ul
class=
"suggestion-box__results suggestion-box__results--above"
hidden=
""
></ul>
<textarea
type=
"text"
class=
"chat-textarea suggestion-box__input
{[ if (o.show_send_button) { ]} chat-textarea-send-button {[ } ]}
{[ if (o.composing_spoiler) { ]} spoiler {[ } ]}"
placeholder=
"{{{o.label_message}}}"
>
{{ o.message_value }}
</textarea>
<span
class=
"suggestion-box__additions visually-hidden"
role=
"status"
aria-live=
"assertive"
aria-relevant=
"additions"
></span>
</div>
</form>
src/templates/chatbox_message_form.js
0 → 100644
View file @
9026062a
import
{
html
}
from
"
lit-html
"
;
import
{
__
}
from
'
@converse/headless/i18n
'
;
const
i18n_send_message
=
__
(
'
Send the message
'
);
export
default
(
o
)
=>
html
`
<div class="new-msgs-indicator hidden">▼
${
o
.
unread_msgs
}
▼</div>
<form class="setNicknameButtonForm hidden">
<input type="submit" class="btn btn-primary" name="join" value="Join"/>
</form>
<form class="sendXMPPMessage">
${
(
o
.
show_toolbar
||
o
.
show_send_button
)
?
html
`
<div class="chat-toolbar--container">
${
o
.
show_toolbar
?
html
`<ul class="chat-toolbar no-text-select"></ul>`
:
''
}
${
o
.
show_send_button
?
html
`<button type="submit" class="btn send-button fa fa-paper-plane" title="
${
i18n_send_message
}
"></button>`
:
''
}
</div>`
:
''
}
<input type="text" placeholder="
${
o
.
label_spoiler_hint
||
''
}
" value="
${
o
.
hint_value
||
''
}
" class="
${
o
.
composing_spoiler
?
''
:
'
hidden
'
}
spoiler-hint"/>
<div class="suggestion-box">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<textarea
type="text"
class="chat-textarea suggestion-box__input
${
o
.
show_send_button
?
'
chat-textarea-send-button
'
:
''
}
${
o
.
composing_spoile
?
'
spoiler
'
:
''
}
"
placeholder="
${
o
.
label_message
}
">
${
o
.
message_value
||
''
}
</textarea>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</form>
`
;
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