mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 15:36:18 +00:00
fix(catalog-admin): non re-includere ' (pageId)' nella caption editata
Il form di modifica pagina precompilava la caption con la localization che include il suffisso ' (id)' aggiunto dal server ai mod, e salvandola l'id si accumulava (Wired (1114) (1114) ...). Ora striscia quel suffisso.
This commit is contained in:
@@ -67,8 +67,14 @@ export const CatalogAdminPageEditView: FC<{}> = () =>
|
|||||||
{
|
{
|
||||||
if(!editingPageData || !targetNode) return;
|
if(!editingPageData || !targetNode) return;
|
||||||
|
|
||||||
setCaption(targetNode.localization || '');
|
// The server appends " (pageId)" to the caption for mods/admins (see
|
||||||
setCaptionSave(targetNode.pageName || targetNode.localization || '');
|
// CatalogPagesListComposer). Strip that exact suffix before seeding the
|
||||||
|
// edit field, otherwise saving folds the id back into the stored
|
||||||
|
// caption and it multiplies on every edit ("Wired (1114) (1114) ...").
|
||||||
|
const rawCaption = (targetNode.localization || '').replace(new RegExp(`\\s*\\(${ targetNode.pageId }\\)\\s*$`), '');
|
||||||
|
|
||||||
|
setCaption(rawCaption);
|
||||||
|
setCaptionSave(targetNode.pageName || rawCaption);
|
||||||
setCatalogMode(currentType === CatalogType.BUILDER ? 'BUILDER' : 'NORMAL');
|
setCatalogMode(currentType === CatalogType.BUILDER ? 'BUILDER' : 'NORMAL');
|
||||||
setPageLayout(currentPage?.layoutCode || 'default_3x3');
|
setPageLayout(currentPage?.layoutCode || 'default_3x3');
|
||||||
setIconImage(targetNode.iconId ?? 0);
|
setIconImage(targetNode.iconId ?? 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user