fix(assets): Review PR #26 – Upload unter Brew-Lock, inject per Ref, metadataEditor zurückgenommen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c57bef85c9
commit
1ff86709b8
4 files changed
+39
-23
No files matched your search
@@ -11,6 +11,8 @@ export const useAssetUpload = ({ editId, containerRef, inject, active = true })=
|
||||
const [linked, setLinked] = useState(false);
|
||||
const [state, setState] = useState({ busy: false, percent: null, name: '', errors: [], done: 0 });
|
||||
const busyRef = useRef(false);
|
||||
const injectRef = useRef(inject);
|
||||
injectRef.current = inject;
|
||||
|
||||
useEffect(()=>{
|
||||
let live = true;
|
||||
@@ -36,10 +38,10 @@ export const useAssetUpload = ({ editId, containerRef, inject, active = true })=
|
||||
const { markdown, errors } = await uploadFiles(editId, files, cfg, {
|
||||
onProgress : ({ percent, name })=>setState((s)=>({ ...s, percent, name }))
|
||||
});
|
||||
if(markdown.length) inject(`${markdown.join('\n')}\n`);
|
||||
if(markdown.length) injectRef.current(`${markdown.join('\n')}\n`);
|
||||
busyRef.current = false;
|
||||
setState({ busy: false, percent: null, name: '', errors, done: markdown.length });
|
||||
}, [available, editId, cfg, inject]);
|
||||
}, [available, editId, cfg]);
|
||||
|
||||
// Drag-and-drop und Einfügen im Text-Editor (Capture-Phase, vor CodeMirror). Nur Bilddateien, Text bleibt unberührt.
|
||||
useEffect(()=>{
|
||||
|
||||
Reference in new issue
Block a user