Add option to collapse buttons in post menu
This commit is contained in:
parent
324b02a830
commit
4e9c4f0768
|
@ -219,6 +219,10 @@ function replaceButton(buttons, find, replace) {
|
||||||
export default createWidget('post-menu', {
|
export default createWidget('post-menu', {
|
||||||
tagName: 'section.post-menu-area.clearfix',
|
tagName: 'section.post-menu-area.clearfix',
|
||||||
|
|
||||||
|
settings: {
|
||||||
|
collapseButtons: true
|
||||||
|
},
|
||||||
|
|
||||||
defaultState() {
|
defaultState() {
|
||||||
return { collapsed: true, likedUsers: [], adminVisible: false };
|
return { collapsed: true, likedUsers: [], adminVisible: false };
|
||||||
},
|
},
|
||||||
|
@ -258,12 +262,17 @@ export default createWidget('post-menu', {
|
||||||
const button = this.attachButton(i, attrs);
|
const button = this.attachButton(i, attrs);
|
||||||
if (button) {
|
if (button) {
|
||||||
allButtons.push(button);
|
allButtons.push(button);
|
||||||
|
|
||||||
if ((attrs.yours && button.attrs.alwaysShowYours) || (hiddenButtons.indexOf(i) === -1)) {
|
if ((attrs.yours && button.attrs.alwaysShowYours) || (hiddenButtons.indexOf(i) === -1)) {
|
||||||
visibleButtons.push(button);
|
visibleButtons.push(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!this.settings.collapseButtons) {
|
||||||
|
visibleButtons = allButtons;
|
||||||
|
}
|
||||||
|
|
||||||
// Only show ellipsis if there is more than one button hidden
|
// Only show ellipsis if there is more than one button hidden
|
||||||
// if there are no more buttons, we are not collapsed
|
// if there are no more buttons, we are not collapsed
|
||||||
if (!state.collapsed || (allButtons.length <= visibleButtons.length + 1)) {
|
if (!state.collapsed || (allButtons.length <= visibleButtons.length + 1)) {
|
||||||
|
|
Loading…
Reference in New Issue