Allow more than one inline code per paragraph (#55) #57

Merged
miko merged 1 commit from feature/55-inline-code-tool into development 2026-11-03 14:49:18 +01:00
Owner

Fixes #55.

@editorjs/inline-code refuses to wrap a selection whenever the selection's parent element already contains any <code>, so after the first inline code in a paragraph no other word could be formatted.

  • src/richText/inlineCodeTool.ts: subclass of the upstream tool that overrides surround only. It now refuses to wrap only when the selection itself overlaps an existing inline code, which would nest them. Unwrapping still works as before.
  • RichTextEditor loads this subclass instead of the package tool, still through a dynamic import (ADR-0005). The stored format (<code class="inline-code">) is unchanged.
  • e2e: formats two words in one paragraph, saves, and expects two separate <code> elements on the guide page.

Known, unchanged behaviour: a selection that partly covers an existing inline code is a no-op.

🤖 Generated with Claude Code

Fixes #55. `@editorjs/inline-code` refuses to wrap a selection whenever the selection's parent element already contains *any* `<code>`, so after the first inline code in a paragraph no other word could be formatted. - `src/richText/inlineCodeTool.ts`: subclass of the upstream tool that overrides `surround` only. It now refuses to wrap only when the selection itself overlaps an existing inline code, which would nest them. Unwrapping still works as before. - `RichTextEditor` loads this subclass instead of the package tool, still through a dynamic import (ADR-0005). The stored format (`<code class="inline-code">`) is unchanged. - e2e: formats two words in one paragraph, saves, and expects two separate `<code>` elements on the guide page. Known, unchanged behaviour: a selection that partly covers an existing inline code is a no-op. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
@editorjs/inline-code refused to wrap a selection whenever the element
around it already contained any <code>, so after the first inline code
in a paragraph no other word could be formatted. A small subclass now
refuses only when the selection itself overlaps an inline code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miko merged commit 95b8dce7ca into development 2026-11-03 14:49:18 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MassiveDynamic/kataba!57
No description provided.