Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fancy-oranges-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@embedpdf/plugin-annotation': patch
---

Fix FreeText/CalloutFreeText losing typed text when edited after non-isEditing blur
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export function CalloutFreeText({
});
};

const handleInput = () => {
editingRef.current = true;
};

const width = rect.size.width * scale;
const height = rect.size.height * scale;
const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX / scale);
Expand Down Expand Up @@ -261,6 +265,7 @@ export function CalloutFreeText({
<span
ref={editorRef}
onBlur={handleBlur}
onInput={handleInput}
tabIndex={0}
style={{
position: 'absolute',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export function FreeText({
});
};

const handleInput = () => {
editingRef.current = true;
};

return (
<div
style={{
Expand All @@ -89,6 +93,7 @@ export function FreeText({
<span
ref={editorRef}
onBlur={handleBlur}
onInput={handleInput}
tabIndex={0}
style={{
color: annotation.object.fontColor,
Expand Down