Use CSS.supports to determine auto-fit validity
This commit is contained in:
parent
8e1dad6800
commit
ac0c33eb76
|
@ -10577,9 +10577,6 @@ jQuery(async function () {
|
|||
stopScriptExecution();
|
||||
});
|
||||
|
||||
const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/');
|
||||
const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx));
|
||||
|
||||
$('.drawer-toggle').on('click', function () {
|
||||
var icon = $(this).find('.drawer-icon');
|
||||
var drawer = $(this).parent().find('.drawer-content');
|
||||
|
@ -10619,8 +10616,7 @@ jQuery(async function () {
|
|||
}
|
||||
|
||||
// Set the height of "autoSetHeight" textareas within the drawer to their scroll height
|
||||
|
||||
if (chromeUaIdx == -1 || Number(chromeVersion) < 123) {
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
$(this).closest('.drawer').find('.drawer-content textarea.autoSetHeight').each(async function () {
|
||||
await resetScrollHeight($(this));
|
||||
return;
|
||||
|
@ -10697,7 +10693,7 @@ jQuery(async function () {
|
|||
$(this).closest('.inline-drawer').find('.inline-drawer-content').stop().slideToggle();
|
||||
|
||||
// Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height
|
||||
if (chromeUaIdx == -1 || Number(chromeVersion) < 123) {
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
$(this).closest('.inline-drawer').find('.inline-drawer-content textarea.autoSetHeight').each(async function () {
|
||||
await resetScrollHeight($(this));
|
||||
return;
|
||||
|
|
|
@ -1491,9 +1491,11 @@ function select_group_chats(groupId, skipAnimation) {
|
|||
}
|
||||
|
||||
// Toggle textbox sizes, as input events have not fired here
|
||||
$('#rm_group_chats_block .autoSetHeight').each(element => {
|
||||
resetScrollHeight(element);
|
||||
});
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
$('#rm_group_chats_block .autoSetHeight').each(element => {
|
||||
resetScrollHeight(element);
|
||||
});
|
||||
}
|
||||
|
||||
eventSource.emit('groupSelected', { detail: { id: openGroupId, group: group } });
|
||||
}
|
||||
|
@ -1965,7 +1967,9 @@ function doCurMemberListPopout() {
|
|||
|
||||
jQuery(() => {
|
||||
$(document).on('input', '#rm_group_chats_block .autoSetHeight', function () {
|
||||
resetScrollHeight($(this));
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
resetScrollHeight($(this));
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.group_select', function () {
|
||||
|
|
|
@ -42,9 +42,6 @@ const controls = [
|
|||
{ id: 'instruct_system_same_as_user', property: 'system_same_as_user', isCheckbox: true, trigger: true },
|
||||
];
|
||||
|
||||
const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/');
|
||||
const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx));
|
||||
|
||||
/**
|
||||
* Migrates instruct mode settings into the evergreen format.
|
||||
* @param {object} settings Instruct mode settings.
|
||||
|
@ -103,7 +100,7 @@ export async function loadInstructMode(data) {
|
|||
|
||||
$element.on('input', async function () {
|
||||
power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this).val;
|
||||
if (chromeUaIdx == -1 || Number(chromeVersion) < 123) {
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
await resetScrollHeight($(this));
|
||||
}
|
||||
saveSettingsDebounced();
|
||||
|
|
|
@ -5281,9 +5281,11 @@ $(document).ready(async function () {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on('input', '#openai_settings .autoSetHeight', function () {
|
||||
resetScrollHeight($(this));
|
||||
});
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
$(document).on('input', '#openai_settings .autoSetHeight', function () {
|
||||
resetScrollHeight($(this));
|
||||
});
|
||||
}
|
||||
|
||||
if (!isMobile()) {
|
||||
$('#model_openrouter_select').select2({
|
||||
|
|
|
@ -105,9 +105,6 @@ export const persona_description_positions = {
|
|||
NONE: 9,
|
||||
};
|
||||
|
||||
const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/');
|
||||
const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx));
|
||||
|
||||
let power_user = {
|
||||
tokenizer: tokenizers.BEST_MATCH,
|
||||
token_padding: 64,
|
||||
|
@ -1757,7 +1754,7 @@ async function loadContextSettings() {
|
|||
power_user.context[control.property] = value;
|
||||
}
|
||||
console.log(`Setting ${$element.prop('id')} to ${value}`);
|
||||
if (chromeUaIdx == -1 || Number(chromeVersion) < 123) {
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
await resetScrollHeight($(this));
|
||||
}
|
||||
saveSettingsDebounced();
|
||||
|
|
|
@ -2027,11 +2027,8 @@ export function toggleDrawer(drawer, expand = true) {
|
|||
content.style.display = 'none';
|
||||
}
|
||||
|
||||
const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/');
|
||||
const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx));
|
||||
|
||||
// Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height
|
||||
if (chromeUaIdx == -1 || Number(chromeVersion) < 123) {
|
||||
if (!CSS.supports('field-sizing', 'content')) {
|
||||
content.querySelectorAll('textarea.autoSetHeight').forEach(resetScrollHeight);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue