mobile: ability to display hidden toolbar buttons

This commit is contained in:
Sebastian Castro 2020-04-04 11:08:05 +02:00 committed by muxator
parent d6aec95684
commit 1d927854a4
3 changed files with 57 additions and 5 deletions

View file

@ -24,6 +24,7 @@ var hooks = require('./pluginfw/hooks');
var padutils = require('./pad_utils').padutils;
var padeditor = require('./pad_editor').padeditor;
var padsavedrevs = require('./pad_savedrevs');
var _ = require('ep_etherpad-lite/static/js/underscore');
var ToolbarItem = function (element) {
this.$el = element;
@ -155,6 +156,12 @@ var padeditbar = (function()
bodyKeyEvent(evt);
});
$('.show-more-icon-btn').click(function() {
$('.toolbar').toggleClass('full-icons');
});
self.checkAllIconsAreDisplayedInToolbar();
$(window).resize(_.debounce( self.checkAllIconsAreDisplayedInToolbar, 100 ) );
registerDefaultCommands(self);
hooks.callAll("postToolbarInit", {
@ -278,6 +285,15 @@ var padeditbar = (function()
$('#embedinput').val('<iframe name="embed_readwrite" src="' + padurl + '?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false" width=600 height=400></iframe>');
$('#linkinput').val(padurl);
}
},
checkAllIconsAreDisplayedInToolbar: function()
{
// reset style
$('.toolbar').removeClass('cropped')
var menu_left = $('.toolbar .menu_left')[0];
if (menu_left && menu_left.scrollWidth > $('.toolbar').width()) {
$('.toolbar').addClass('cropped');
}
}
};