Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
solid-xmpp-chat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Components
solid-xmpp-chat
Commits
0bb99f1a
Commit
0bb99f1a
authored
3 years ago
by
ubermanu
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/245_mention_autocomplete' into beta
parents
dbe7c5d1
9be3b4c3
No related branches found
Branches containing commit
Tags
v5.3.0-beta.10
Tags containing commit
1 merge request
!136
Reactions, Retract upload...
Pipeline
#10949
passed
3 years ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/sib-mention-autocomplete.js
+116
-0
116 additions, 0 deletions
src/plugins/sib-mention-autocomplete.js
src/solid-xmpp-chat.js
+2
-0
2 additions, 0 deletions
src/solid-xmpp-chat.js
src/styles/index.scss
+28
-12
28 additions, 12 deletions
src/styles/index.scss
with
146 additions
and
12 deletions
src/plugins/sib-mention-autocomplete.js
0 → 100644
+
116
−
0
View file @
0bb99f1a
/**
* Custom mention autocomplete list.
*/
converse
.
plugins
.
add
(
'
sib-mention-autocomplete
'
,
{
overrides
:
{
ChatRoom
:
{
/**
* Move the `all` mention at the bottom.
* @returns {*}
*/
getAllKnownNicknames
()
{
const
nicknames
=
this
.
__super__
.
getAllKnownNicknames
.
apply
(
this
,
arguments
);
if
(
nicknames
.
indexOf
(
'
all
'
)
>=
0
)
{
return
nicknames
.
filter
(
n
=>
n
!==
'
all
'
).
concat
([
'
all
'
]);
}
return
nicknames
;
},
},
ChatRoomView
:
{
/**
* Disable sort so the `all` mention stays at the bottom.
*/
initMentionAutoComplete
()
{
this
.
__super__
.
initMentionAutoComplete
.
apply
(
this
,
arguments
);
this
.
mention_auto_complete
.
sort
=
false
;
},
/**
* Show a custom icon for `all`
* Render the full name on top of the nickname
*
* @param text
* @param input
* @returns {HTMLLIElement}
*/
getAutoCompleteListItem
(
text
,
input
)
{
const
_converse
=
this
.
__super__
.
_converse
;
const
{
api
}
=
_converse
;
input
=
input
.
trim
();
const
element
=
document
.
createElement
(
'
li
'
);
element
.
setAttribute
(
'
aria-selected
'
,
'
false
'
);
const
is_mention_all
=
text
.
toString
()
===
'
all
'
;
let
vcard
=
null
;
// Get the vcard for the current user
if
(
_converse
.
vcards
&&
!
is_mention_all
)
{
vcard
=
_converse
.
vcards
.
findWhere
({
'
nickname
'
:
text
,
});
}
// Update the `@all` mention with a custom label
// Update the label with the user full name if available
// TODO: Add translation support
if
(
is_mention_all
)
{
text
.
title
=
'
Notifier tous les utilisateurs du cercle
'
;
}
else
if
(
vcard
&&
vcard
.
get
(
'
fullname
'
))
{
text
.
title
=
vcard
.
get
(
'
fullname
'
)
||
text
.
toString
();
}
else
{
text
.
title
=
text
.
toString
();
}
// Update mention item with the avatar
if
(
api
.
settings
.
get
(
'
muc_mention_autocomplete_show_avatar
'
))
{
const
ALL_IMAGE_TYPE
=
'
image/png
'
;
const
ALL_IMAGE
=
'
iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/Tih9UFOwg4pChdrJQVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIm5uToouU+L+k0CLWg+N+vLv3uHsHCPUy06xADNB020wl4mImuyp2vyKAQfQihojMLGNOkpLoOL7u4ePrXZRndT735+hXcxYDfCLxLDNMm3iDeHrTNjjvE4dYUVaJz4nHTbog8SPX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WUE73Zw1ar7++mTukEXs1QNRth4c4AntBvlHCS9LlWtFONhwuqnItSN/6VhbsDe64NjM5iSyJr17sLN6mzgSqUSJKuWy/2PllJJHz7wn/NMMH5KDogB+SAHJAD2l/8AVdEzx8qjlPAAAAAAElFTkSuQmCC
'
;
const
img
=
document
.
createElement
(
'
img
'
);
let
dataUri
=
'
data:
'
+
_converse
.
DEFAULT_IMAGE_TYPE
+
'
;base64,
'
+
_converse
.
DEFAULT_IMAGE
;
if
(
vcard
)
{
dataUri
=
'
data:
'
+
vcard
.
get
(
'
image_type
'
)
+
'
;base64,
'
+
vcard
.
get
(
'
image
'
);
}
if
(
is_mention_all
)
{
dataUri
=
'
data:
'
+
ALL_IMAGE_TYPE
+
'
;base64,
'
+
ALL_IMAGE
;
}
img
.
setAttribute
(
'
src
'
,
dataUri
);
img
.
setAttribute
(
'
width
'
,
'
32
'
);
img
.
setAttribute
(
'
class
'
,
'
avatar avatar-autocomplete
'
);
element
.
appendChild
(
img
);
}
const
label
=
document
.
createElement
(
'
span
'
);
label
.
appendChild
(
document
.
createTextNode
(
text
.
title
));
const
val
=
document
.
createElement
(
'
small
'
);
val
.
appendChild
(
document
.
createTextNode
(
'
@
'
));
const
regex
=
new
RegExp
(
'
(
'
+
input
+
'
)
'
,
'
ig
'
);
const
parts
=
input
?
text
.
split
(
regex
)
:
[
text
];
parts
.
forEach
(
txt
=>
{
if
(
input
&&
txt
.
match
(
regex
))
{
const
match
=
document
.
createElement
(
'
mark
'
);
match
.
textContent
=
txt
;
val
.
appendChild
(
match
);
}
else
{
val
.
appendChild
(
document
.
createTextNode
(
txt
));
}
});
label
.
appendChild
(
val
);
element
.
appendChild
(
label
);
return
element
;
},
},
},
});
This diff is collapsed.
Click to expand it.
src/solid-xmpp-chat.js
+
2
−
0
View file @
0bb99f1a
...
...
@@ -12,6 +12,7 @@ import './plugins/sib-custom-hats.js';
import
'
./plugins/sib-disconnected.js
'
;
import
'
./plugins/sib-emoji-picker.js
'
;
import
'
./plugins/sib-history-improved.js
'
;
import
'
./plugins/sib-mention-autocomplete.js
'
;
import
'
./plugins/sib-mention-mobile.js
'
;
import
'
./plugins/sib-reactions.js
'
;
import
'
./plugins/sib-remove-notifications.js
'
;
...
...
@@ -239,6 +240,7 @@ export const SolidXMPPChat = {
'
sib-disconnected
'
,
'
sib-emoji-picker
'
,
'
sib-history-improved
'
,
'
sib-mention-autocomplete
'
,
'
sib-mention-mobile
'
,
'
sib-reactions
'
,
'
sib-remove-notifications
'
,
...
...
This diff is collapsed.
Click to expand it.
src/styles/index.scss
+
28
−
12
View file @
0bb99f1a
...
...
@@ -589,21 +589,45 @@
.suggestion-box
.suggestion-box__results
,
.suggestion-box
>
ul
{
box-shadow
:
0
0
5px
0
rgba
(
133
,
140
,
148
,
0
.
09
);
box-shadow
:
0
0
5px
0
rgba
(
133
,
140
,
148
,
0
.
25
);
}
&
.converse-fullscreen
.chatroom
.sendXMPPMessage
.suggestion-box__results--above
,
.chatroom
.sendXMPPMessage
.suggestion-box__results--above
{
border
:
none
;
position
:
absolute
;
top
:
-3px
;
transform
:
translateY
(
-100%
);
bottom
:
unset
;
li
{
display
:
flex
;
align-items
:
center
;
color
:
var
(
--
color-chat-suggestion
);
font-size
:
13px
;
font-weight
:
600
;
border-bottom
:
1px
solid
#E4E8ED
;
small
:before
{
content
:
"\a"
;
white-space
:
pre
;
}
}
@media
(
min-width
:
768px
)
{
max-width
:
30rem
;
min-width
:
unset
;
}
}
.suggestion-box
{
position
:
unset
;
}
.sendXMPPMessage
{
position
:
relative
;
}
&
.converse-fullscreen
.chatroom
.sendXMPPMessage
.chat-toolbar
,
.chatroom
.sendXMPPMessage
.chat-toolbar
{
border-top
:
1px
solid
var
(
--
chat-head-color
);
...
...
@@ -846,23 +870,15 @@
}
.suggestion-box
mark
{
background
:
var
(
--
hd-hightlight-color
);
background
:
transparent
!
important
;
font-weight
:
bold
;
}
.suggestion-box
>
ul
>
li
[
aria-selected
=
true
]
{
background
:
transpare
nt
;
background
:
#f6f6f6
!
importa
nt
;
color
:
var
(
--
chat-suggestion-selected-true
)
!
important
;
}
.suggestion-box
li
:hover
mark
{
background
:
var
(
--
hd-hightlight-color
);
}
.suggestion-box
li
[
aria-selected
=
true
]
mark
{
background
:
inherit
;
font-weight
:
bold
;
}
.modal-backdrop
{
z-index
:
1030
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment