mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-13 22:35:15 -04:00
fix: entry.name mutation bug
This commit is contained in:
@@ -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) => (
|
||||
|
||||
@@ -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 };
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user