mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/13713] Set mention-list class if needed
PHPBB3-13713
This commit is contained in:
parent
643bab44ea
commit
6eeb22cdb5
3 changed files with 26 additions and 11 deletions
|
@ -1676,7 +1676,7 @@ fieldset.submit-buttons legend {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.mention-container { /* mention-container */
|
||||
.mention-container {
|
||||
text-align: left;
|
||||
background-color: #ffffff;
|
||||
border-radius: 2px;
|
||||
|
@ -1691,11 +1691,11 @@ fieldset.submit-buttons legend {
|
|||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.rtl .mention-container { /* mention-container */
|
||||
.rtl .mention-container {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.mention-container ul { /* mention-list */
|
||||
.mention-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
|
|
|
@ -626,6 +626,26 @@ function getCaretPosition(txtarea) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate menu item HTML representation. Also ensures that mention-list
|
||||
* class is set for unordered list in mention container
|
||||
*
|
||||
* @param {object} data Item data
|
||||
* @returns {string} HTML representation of menu item
|
||||
*/
|
||||
function menuItemTemplate(data) {
|
||||
const itemData = data;
|
||||
const avatar = getAvatar(itemData.avatar, itemData.type);
|
||||
const rank = (itemData.rank) ? "<span class='mention-rank'>" + itemData.rank + "</span>" : '';
|
||||
const $mentionContainer = $('.' + tribute.current.collection.containerClass);
|
||||
|
||||
if (typeof $mentionContainer !== 'undefined' && $mentionContainer.children('ul').hasClass('mention-list') === false) {
|
||||
$mentionContainer.children('ul').addClass('mention-list');
|
||||
}
|
||||
|
||||
return "<span class='mention-media'>" + avatar + "</span><span class='mention-name'>" + itemData.name + rank + "</span>";
|
||||
}
|
||||
|
||||
this.isEnabled = function() {
|
||||
return $mentionDataContainer.length;
|
||||
};
|
||||
|
@ -637,12 +657,7 @@ function getCaretPosition(txtarea) {
|
|||
containerClass: 'mention-container',
|
||||
selectClass: 'is-active',
|
||||
itemClass: 'mention-item',
|
||||
menuItemTemplate: function (data) {
|
||||
const itemData = data;
|
||||
let avatar = getAvatar(itemData.avatar, itemData.type);
|
||||
let rank = (itemData.rank) ? "<span class='mention-rank'>" + itemData.rank + "</span>" : '';
|
||||
return "<span class='mention-media'>" + avatar + "</span><span class='mention-name'>" + itemData.name + rank + "</span>";
|
||||
},
|
||||
menuItemTemplate: menuItemTemplate,
|
||||
selectTemplate: function (item) {
|
||||
return '[mention=' + item.type + ':' + item.id + ']' + item.name + '[/mention]';
|
||||
},
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
/* Mention dropdown
|
||||
---------------------------------------- */
|
||||
.mention-container { /* mention-container */
|
||||
.mention-container {
|
||||
text-align: left;
|
||||
border-radius: 2px;
|
||||
position: absolute;
|
||||
|
@ -23,7 +23,7 @@
|
|||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.mention-container ul { /* mention-list */
|
||||
.mention-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
|
|
Loading…
Add table
Reference in a new issue