Just always show the markup bar.

The focus behaviour was hateful I never want to experience it ever again.
This commit is contained in:
flash 2024-06-27 19:12:52 +00:00
parent 319b90ea55
commit afe5acd328
3 changed files with 2 additions and 65 deletions

View file

@ -150,7 +150,6 @@ const MamiInit = async args => {
settings.define('marqueeAllNames').default(false).create();
settings.define('dbgAnimDurationMulti').default(1).min(0).max(10).create();
settings.define('newLineOnEnter').default(false).create();
settings.define('showMarkupSelector').type(['always', 'focus', 'never']).default('focus').create();
settings.define('keepEmotePickerOpen').default(true).create();
settings.define('doNotMarkLinksAsVisited').default(false).create();
@ -463,13 +462,6 @@ const MamiInit = async args => {
category.setting('autoEmbedPlay').title('Auto-play embedded media').done();
category.setting('keepEmotePickerOpen').title('Keep emoticon picker open').done();
category.setting('newLineOnEnter').title('Swap Enter and Shift+Enter behaviour').done();
category.setting('showMarkupSelector').title('Show markup buttons').type('select').options(() => {
return {
'always': 'Always show',
'focus': 'Show when focussed',
'never': 'Never show',
};
}).done();
});
sbSettings.category(category => {
category.header('Notifications');
@ -698,10 +690,6 @@ const MamiInit = async args => {
}
});
settings.watch('showMarkupSelector', ev => {
Umi.UI.InputMenus.Toggle('markup', ev.detail.value === 'always');
});
let doUpload;
ctx.eeprom = new MamiEEPROM(futami.get('eeprom2'), MamiMisuzuAuth.getLine);
ctx.eeprom.init()

View file

@ -22,18 +22,6 @@ Umi.UI.Hooks = (function() {
msgText.focus();
});
msgForm.addEventListener('focusin', ev => {
if(mami.settings.get('showMarkupSelector') === 'focus' && Umi.UI.InputMenus.Current() === '')
Umi.UI.InputMenus.Toggle('markup', true);
});
msgForm.addEventListener('focusout', ev => {
if(msgForm.contains(ev.relatedTarget))
return;
if(mami.settings.get('showMarkupSelector') === 'focus' && Umi.UI.InputMenus.Current() === 'markup')
Umi.UI.InputMenus.Toggle('markup', false);
});
msgForm.addEventListener('submit', ev => {
ev.preventDefault();

View file

@ -3,43 +3,8 @@
Umi.UI.InputMenus = (function() {
const ids = [];
let current = '';
const inputMenuActive = 'input__menu--active';
const inputButtonActive = 'input__button--active';
const createButtonId = id => `umi-msg-menu-btn-${id}`;
const toggle = function(baseId, force) {
if(typeof force === 'boolean' && (current === baseId) === force)
return;
const buttonId = createButtonId(baseId);
const menuId = 'umi-msg-menu-sub-' + baseId;
const isScrolledToBottom = Umi.UI.Messages.IsScrolledToBottom();
const activeMenus = Array.from($qa(`.${inputMenuActive}`));
if(activeMenus.length > 0)
for(const menu of activeMenus)
menu.classList.remove(inputMenuActive);
const activeButtons = Array.from($qa(`.${inputButtonActive}`));
if(activeButtons.length > 0)
for(const button of activeButtons)
button.classList.remove(inputButtonActive);
if(current !== baseId) {
$i(`umi-msg-menu-sub-${baseId}`)?.classList.add(inputMenuActive);
$i(createButtonId(baseId))?.classList.add(inputButtonActive);
current = baseId;
} else {
current = '';
}
if(isScrolledToBottom)
Umi.UI.Messages.ScrollIfNeeded();
};
const createButton = function(id, title, onClick) {
return $e({
tag: 'button',
@ -48,16 +13,12 @@ Umi.UI.InputMenus = (function() {
id: createButtonId(id),
classList: ['input__button', 'input__button--' + id],
title: title,
onclick: onClick || (function() {
toggle(id);
}),
onclick: onClick,
},
});
};
return {
Current: () => current,
Toggle: toggle,
Add: function(baseId, title, beforeButtonId) {
if(baseId !== 'markup')
throw 'only baseId "markup" may be added';
@ -77,7 +38,7 @@ Umi.UI.InputMenus = (function() {
$i('umi-msg-menu').appendChild(
$e({
attrs: {
'class': ['input__menu', 'input__menu--' + baseId],
'class': ['input__menu', 'input__menu--' + baseId, 'input__menu--active'],
id: 'umi-msg-menu-sub-' + baseId,
tabindex: '0',
}