Inline text editor invisible (0x0) for path/line shapes (callout, cloud, cylinder, parallelogram, cross) #211
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#211
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Inline text editor is invisible (0x0) for path/line-based shapes
Summary
Double-clicking a shape to type text works for most shapes, but for several shape types the inline text editor renders with zero size, so you cannot see what you are typing. The text is actually captured and saved (it shows after you click away), but during editing the editor is invisible. The callout shape is the most obvious case.
Affected shapes
Working shapes: rectangle, rounded rectangle (Konva.Rect), circle, ellipse (Konva.Ellipse), diamond, triangle, pentagon, hexagon (Konva.RegularPolygon), star (Konva.Star).
Root cause
The inline editor (
editMarkdownTextinstatic/web/js/whiteboard/objects.js) sizes its<textarea>from the shape's.bgnode insidecomputeGeom(). Fortype === 'shape'it runs:bg.widthis a method, so it is always truthy and the first branch is taken for every non-Ellipse shape. ForKonva.Path(callout, cloud, cylinder) andKonva.Line(parallelogram, cross), there is nowidth/heightattribute, sobg.width()andbg.height()return0. The textarea is therefore laid out at0 x 0and is effectively invisible.These shapes already store their real dimensions on the bg node as
_nominalWidth/_nominalHeight, and the rest of the codebase reads those values (e.g. objects.js:956, objects.js:1030, objects.js:1500).computeGeom()is the one place that does not.Expected behavior
Double-clicking any shape opens a correctly sized, visible inline editor that overlays the shape body, for all 14 shape types.
Proposed fix
In
computeGeom()(thetype === 'shape'branch), resolve the editor size robustly for every shape node type:bg._nominalWidth/bg._nominalHeightwhen present (Path/Line shapes).radiusX()*2/radiusY()*2for Ellipse.radius()*2for RegularPolygon andouterRadius()*2for Star.width()/height()only when greater than zero (Rect).scaleX()/scaleY()so non-uniform polygons/stars (which are built aroundmin(w,h)and stretched via scale) get the right box.Acceptance criteria
Fix implemented and verified
Change
crates/hero_whiteboard_admin/static/web/js/whiteboard/objects.js—editMarkdownText->computeGeom(), thetype === 'shape'branch.The branch previously sized the editor textarea via
bg.width()/height(), which return 0 forKonva.Path(callout, cloud, cylinder) andKonva.Line(parallelogram, cross) nodes, producing a 0x0 (invisible) editor. It now resolves the box per node type:_nominalWidth/_nominalHeightfor Path/Line shapes (the value the rest of the code already uses).radiusX()*2/radiusY()*2for Ellipse.outerRadius()*2for Star,radius()*2for RegularPolygon.width()/height()only when greater than zero (Rect).scaleX()/scaleY(), so non-uniform polygons/stars (built aroundmin(w,h)and stretched via scale) get the correct box.Verification
Rust workspace lib tests (no regression):
Geometry logic test — replicates the old vs new shape-sizing branch against a mock bg node for every shape type (stage scale 1):
The old logic returned 0x0 for the five path/line shapes (the reported invisible editor) and the wrong box for non-uniform diamond/star; the new logic returns the correct box for all 14 shape types with no change to rectangle/ellipse.
Deployed to the local environment (release build, installed, service restarted); the served
objects.jsnow contains the fix.