Restrict Shift+O edits to item-specific editable fields
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.22 R146";
|
window.CHGRID_WEB_VERSION = "2026.02.22 R147";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import {
|
|||||||
} from './state/gameState';
|
} from './state/gameState';
|
||||||
import {
|
import {
|
||||||
applyServerItemUiDefinitions,
|
applyServerItemUiDefinitions,
|
||||||
EDITABLE_ITEM_PROPERTY_KEYS,
|
|
||||||
getDefaultClockTimeZone,
|
getDefaultClockTimeZone,
|
||||||
getItemTypeGlobalProperties,
|
getItemTypeGlobalProperties,
|
||||||
getItemTypeSequence,
|
getItemTypeSequence,
|
||||||
@@ -794,6 +793,10 @@ function getFallbackInspectPropertyTooltip(key: string): string | undefined {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isItemPropertyEditable(item: WorldItem, key: string): boolean {
|
||||||
|
return getEditableItemPropertyKeys(item).includes(key);
|
||||||
|
}
|
||||||
|
|
||||||
function describeItemPropertyHelp(item: WorldItem, key: string): string {
|
function describeItemPropertyHelp(item: WorldItem, key: string): string {
|
||||||
const metadata = getItemPropertyMetadata(item.type, key);
|
const metadata = getItemPropertyMetadata(item.type, key);
|
||||||
const parts: string[] = [];
|
const parts: string[] = [];
|
||||||
@@ -823,7 +826,7 @@ function describeItemPropertyHelp(item: WorldItem, key: string): string {
|
|||||||
parts.push(`Max length: ${metadata.maxLength} characters.`);
|
parts.push(`Max length: ${metadata.maxLength} characters.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
parts.push(EDITABLE_ITEM_PROPERTY_KEYS.has(key) ? 'Editable.' : 'Read only.');
|
parts.push(isItemPropertyEditable(item, key) ? 'Editable.' : 'Read only.');
|
||||||
return parts.join(' ');
|
return parts.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2056,7 +2059,7 @@ function handleItemPropertiesModeInput(code: string, key: string): void {
|
|||||||
}
|
}
|
||||||
if (code === 'Enter') {
|
if (code === 'Enter') {
|
||||||
const key = state.itemPropertyKeys[state.itemPropertyIndex];
|
const key = state.itemPropertyKeys[state.itemPropertyIndex];
|
||||||
if (!EDITABLE_ITEM_PROPERTY_KEYS.has(key)) {
|
if (!isItemPropertyEditable(item, key)) {
|
||||||
updateStatus(`${itemPropertyLabel(key)} is not editable.`);
|
updateStatus(`${itemPropertyLabel(key)} is not editable.`);
|
||||||
audio.sfxUiCancel();
|
audio.sfxUiCancel();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user