Skip to content

Edit a standalone image's Markdown through source projection instead of a detached input #313

Description

@Azganoth

Summary

A standalone image edits its Markdown through a detached <input> rendered above the image. Once #62 removes the sibling widget from markerPresentation.ts, this is the last surface of its kind: every other inline object edits its source in the document through the shared projection engine, including an image itself once it sits inside a link label.

The widget is not only an inconsistent surface. It carries its own miniature Markdown parser and serializer, parseImageMarkdown and serializeImageMarkdown, which restate rules the parser and the serializer already own and drift from them:

Replace it with projection over a standalone image.

Expected behavior

  • A standalone image enters source editing in the document through the shared projection engine, with no detached input widget. Reaching the image projects its complete Markdown source; a valid edit returns it to a rendered image.
  • Entry direction, selection, finalization, Undo and Redo, dirty state, and clipboard behavior follow the rules already specified for atomic inline projections rather than the widget's own.
  • An invalid or incomplete edit finalizes as the literal text the source spells, where a backslash escapes the character it precedes, on the same rule as a link.
  • An image inside a link label is unchanged: it becomes its own Markdown source within the label's projection and returns as its object when the label commits.
  • The authored form the file holds, destination and title delimiters alike, survives entering and leaving projection.
  • Rendering, the missing-image placeholder, outside-folder confirmation, and image resolution are unchanged.

Related context

Done when

  • A standalone image projects its complete Markdown source in the document, and the detached <input> in imageView.ts is removed along with parseImageMarkdown and serializeImageMarkdown.
  • Projection over a standalone image follows the specified atomic-inline rules for entry direction, selection, finalization, history, and clipboard.
  • An image inside a projected link label keeps its current behavior.
  • The authored destination and title forms survive a projection round trip.
  • docs/specification.md replaces its two descriptions of the raw-image-Markdown widget with the projection behavior.
  • Regression coverage asserts the above, replacing rather than dropping the widget's existing coverage.

Notes

Implementation direction

isLinkImage is the seam: projection admits an image only while it carries a link mark. The link adapter already builds image source segments and returns them through parseImageSource, so the work is widening that admission and giving a standalone image its own adapter, not building an image source path from nothing.

getTrailingTitle in imageMarkdown.ts is the only place today that reads all three title delimiter forms. Whatever replaces it must keep that, since the projection engine derives its source from the document serializer and has to read back what that serializer writes.

Out of scope

Metadata

Metadata

Assignees

Labels

FeatureNew feature or request

Projects

  • Status
    Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions