mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 03:23:39 +08:00
FEATURE: Add options to inject class / page into emoji toolbar (#4312)
* Add options to inject class / page into emoji toolbar * Fix options page setter
This commit is contained in:
parent
3b119dac6d
commit
3035d144c0
|
@ -132,7 +132,7 @@ function render(page, offset, options) {
|
|||
|
||||
for(let i=offset; i<max; i++){
|
||||
if(!icons[i]){ break; }
|
||||
if(row.length === PER_ROW){
|
||||
if(row.length === (options.perRow || PER_ROW)){
|
||||
rows.push(row);
|
||||
row = [];
|
||||
}
|
||||
|
@ -144,7 +144,8 @@ function render(page, offset, options) {
|
|||
toolbarItems: toolbarItems,
|
||||
rows: rows,
|
||||
prevDisabled: offset === 0,
|
||||
nextDisabled: (max + 1) > icons.length
|
||||
nextDisabled: (max + 1) > icons.length,
|
||||
modalClass: options.modalClass
|
||||
};
|
||||
|
||||
$('.emoji-modal', options.appendTo).remove();
|
||||
|
@ -162,7 +163,8 @@ function showSelector(options) {
|
|||
$('.emoji-modal-wrapper').click(() => closeSelector());
|
||||
|
||||
if (Discourse.Site.currentProp('mobileView')) { PER_ROW = 9; }
|
||||
const page = keyValueStore.getInt("emojiPage", 0);
|
||||
const page = options.page ? _.findIndex(groups, (g) => { return g.name === options.page; })
|
||||
: keyValueStore.getInt("emojiPage", 0);
|
||||
const offset = keyValueStore.getInt("emojiOffset", 0);
|
||||
|
||||
render(page, offset, options);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class='emoji-modal'>
|
||||
<div class='emoji-modal {{modalClass}}'>
|
||||
<ul class='toolbar'>
|
||||
{{#each toolbarItems as |item|}}<li><a title='{{item.title}}' {{#if item.selected}}class='selected'{{/if}} data-group-id='{{item.groupId}}'><img src='{{item.src}}' class='emoji'></a></li>{{/each}}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue
Block a user