diff --git a/web-next/components/ForumEditor.tsx b/web-next/components/ForumEditor.tsx index f96d6ae..7dc86a4 100644 --- a/web-next/components/ForumEditor.tsx +++ b/web-next/components/ForumEditor.tsx @@ -49,7 +49,7 @@ export function ForumEditor({ tooltip: es ? 'Insertar enlace de Wowhead' : 'Insert a Wowhead link', type: es ? 'Tipo' : 'Type', id: 'ID', - text: es ? 'Texto (opcional)' : 'Text (optional)', + text: es ? 'Texto (vacío = nombre automático)' : 'Text (empty = auto name)', insert: es ? 'Insertar' : 'Insert', cancel: es ? 'Cancelar' : 'Cancel', } @@ -107,11 +107,16 @@ export function ForumEditor({ return } const type = (data.wtype || 'item') as WowheadType - const label = data.wtext.trim() || `${type}=${id}` const href = wowheadUrl(type, id, locale) const wh = wowheadData(type, id, locale) + const custom = data.wtext.trim() + // Sin texto: wowhead pone el nombre real (y color+icono) gracias a + // data-wh-rename-link; el `type=id` es solo un marcador hasta que + // corre el script. Con texto: se respeta el que escriba el usuario. + const rename = custom ? '' : ' data-wh-rename-link="true"' + const label = esc(custom || `${type}=${id}`) editor.insertContent( - `${esc(label)} `, + `${label} `, ) api.close() }, diff --git a/web-next/lib/forum-sanitize.ts b/web-next/lib/forum-sanitize.ts index b057ea3..fd48780 100644 --- a/web-next/lib/forum-sanitize.ts +++ b/web-next/lib/forum-sanitize.ts @@ -35,7 +35,10 @@ export function cleanPostHtml(html: string): string { allowedAttributes: { // data-wowhead + class dejan que los enlaces de wowhead muestren tooltip, // color por calidad e icono (los pinta el script global tooltips.js del layout). - a: ['href', 'title', 'target', 'data-wowhead', 'class'], + // data-wh-rename-link deja que wowhead ponga el NOMBRE del ítem/misión/etc. + // automáticamente (sobrescribe el renameLinks:false global, que existe para no + // pisar los nombres en español de la tienda). data-wh-icon-size ajusta el icono. + a: ['href', 'title', 'target', 'data-wowhead', 'data-wh-rename-link', 'data-wh-icon-size', 'class'], img: ['src', 'alt', 'title', 'width', 'height'], span: ['style', 'data-wowhead'], div: ['style'],