Just always show the markup bar.
The focus behaviour was hateful I never want to experience it ever again.
This commit is contained in:
parent
319b90ea55
commit
afe5acd328
3 changed files with 2 additions and 65 deletions
|
@ -150,7 +150,6 @@ const MamiInit = async args => {
|
||||||
settings.define('marqueeAllNames').default(false).create();
|
settings.define('marqueeAllNames').default(false).create();
|
||||||
settings.define('dbgAnimDurationMulti').default(1).min(0).max(10).create();
|
settings.define('dbgAnimDurationMulti').default(1).min(0).max(10).create();
|
||||||
settings.define('newLineOnEnter').default(false).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('keepEmotePickerOpen').default(true).create();
|
||||||
settings.define('doNotMarkLinksAsVisited').default(false).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('autoEmbedPlay').title('Auto-play embedded media').done();
|
||||||
category.setting('keepEmotePickerOpen').title('Keep emoticon picker open').done();
|
category.setting('keepEmotePickerOpen').title('Keep emoticon picker open').done();
|
||||||
category.setting('newLineOnEnter').title('Swap Enter and Shift+Enter behaviour').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 => {
|
sbSettings.category(category => {
|
||||||
category.header('Notifications');
|
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;
|
let doUpload;
|
||||||
ctx.eeprom = new MamiEEPROM(futami.get('eeprom2'), MamiMisuzuAuth.getLine);
|
ctx.eeprom = new MamiEEPROM(futami.get('eeprom2'), MamiMisuzuAuth.getLine);
|
||||||
ctx.eeprom.init()
|
ctx.eeprom.init()
|
||||||
|
|
|
@ -22,18 +22,6 @@ Umi.UI.Hooks = (function() {
|
||||||
msgText.focus();
|
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 => {
|
msgForm.addEventListener('submit', ev => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
|
|
|
@ -3,43 +3,8 @@
|
||||||
|
|
||||||
Umi.UI.InputMenus = (function() {
|
Umi.UI.InputMenus = (function() {
|
||||||
const ids = [];
|
const ids = [];
|
||||||
let current = '';
|
|
||||||
|
|
||||||
const inputMenuActive = 'input__menu--active';
|
|
||||||
const inputButtonActive = 'input__button--active';
|
|
||||||
|
|
||||||
const createButtonId = id => `umi-msg-menu-btn-${id}`;
|
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) {
|
const createButton = function(id, title, onClick) {
|
||||||
return $e({
|
return $e({
|
||||||
tag: 'button',
|
tag: 'button',
|
||||||
|
@ -48,16 +13,12 @@ Umi.UI.InputMenus = (function() {
|
||||||
id: createButtonId(id),
|
id: createButtonId(id),
|
||||||
classList: ['input__button', 'input__button--' + id],
|
classList: ['input__button', 'input__button--' + id],
|
||||||
title: title,
|
title: title,
|
||||||
onclick: onClick || (function() {
|
onclick: onClick,
|
||||||
toggle(id);
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Current: () => current,
|
|
||||||
Toggle: toggle,
|
|
||||||
Add: function(baseId, title, beforeButtonId) {
|
Add: function(baseId, title, beforeButtonId) {
|
||||||
if(baseId !== 'markup')
|
if(baseId !== 'markup')
|
||||||
throw 'only baseId "markup" may be added';
|
throw 'only baseId "markup" may be added';
|
||||||
|
@ -77,7 +38,7 @@ Umi.UI.InputMenus = (function() {
|
||||||
$i('umi-msg-menu').appendChild(
|
$i('umi-msg-menu').appendChild(
|
||||||
$e({
|
$e({
|
||||||
attrs: {
|
attrs: {
|
||||||
'class': ['input__menu', 'input__menu--' + baseId],
|
'class': ['input__menu', 'input__menu--' + baseId, 'input__menu--active'],
|
||||||
id: 'umi-msg-menu-sub-' + baseId,
|
id: 'umi-msg-menu-sub-' + baseId,
|
||||||
tabindex: '0',
|
tabindex: '0',
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue