fix: entry.name mutation bug

This commit is contained in:
Felix Roos 2023-11-24 09:37:11 +01:00
parent ecc8e0a108
commit 4fd3e6e99c
2 changed files with 3 additions and 4 deletions

View File

@ -8,10 +8,10 @@ const getInnerText = (html) => {
return div.textContent || div.innerText || '';
};
export function Autocomplete({ doc }) {
export function Autocomplete({ doc, label }) {
return (
<div className="prose dark:prose-invert max-h-[400px] overflow-auto">
<h3 className="pt-0 mt-0">{getDocLabel(doc)}</h3>
<h3 className="pt-0 mt-0">{label || getDocLabel(doc)}</h3>
<div dangerouslySetInnerHTML={{ __html: doc.description }} />
<ul>
{doc.params?.map(({ name, type, description }, i) => (

View File

@ -55,7 +55,6 @@ export const strudelTooltip = hoverTooltip(
if (!entry) {
return null;
}
entry.name = word;
}
return {
@ -66,7 +65,7 @@ export const strudelTooltip = hoverTooltip(
create(view) {
let dom = document.createElement('div');
dom.className = 'strudel-tooltip';
createRoot(dom).render(<Autocomplete doc={entry} />);
createRoot(dom).render(<Autocomplete doc={entry} label={word} />);
return { dom };
},
};