Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Beta]: In the Content Completion example, the first undo after emptying a bold word restores one letter, and a click that changes nothing adds an undo step

Aperta
#5,271 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend, testing

Direzione di ricerca

Start by reading packages/plitejs/src/history/history-merge-policy.ts around line 311 and shouldMergeBatch around line 353, then inspect packages/plitejs/src/history/history-plugin.ts around shouldSaveCommit at line 582. Reproduce both cases in the Content Completion example and trace how its edits reach history. Done means deleting a bold word takes one undo step and repeated clicks that make no change add no undo steps.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug target:beta

Testing lane

  • Repository: udecode/plate
  • Branch: next
  • Release channel: Beta
  • Exact commit/package version: NOT_ENOUGH_INFO

Summary

On /examples/plite/content-completion, two edits leave extra undo steps on Beta:

  • Deleting a bold word letter by letter until its line is empty makes two undo steps, so the first ⌘Z brings back only the first letter.
  • A click on Remove the text node of line 2 that changes nothing still adds an undo step, so ⌘Z has to go through those empty steps first.

natamox judged both bugs, low priority, on 2026-10-22.

Reproduction

Repro 1: /examples/plite/content-completion, Chromium
  1. Open https://beta.platejs.org/examples/plite/content-completion.
  2. Click the end of the first bold line, bold.
  3. Press Backspace 4 times. The line is empty.
  4. Press ⌘Z.
  5. Press ⌘Z again.
  6. For comparison, click the end of the second bold line, press Backspace 3 times to leave b, and press ⌘Z.

Step 4 brings back only b, and step 5 brings back bold. The test script's readout counts 2 undo steps after the four Backspaces of step 3. In step 6 one ⌘Z brings back bold. Emptying Lead in the quote block behaves the same way: the first ⌘Z brings back only L. The run recorded that a plain text line comes back with one ⌘Z.

Repro 2: /examples/plite/content-completion, Chromium
  1. Open https://beta.platejs.org/examples/plite/content-completion.
  2. Click Remove the text node of line 2. Line 2, Remove my text node, becomes an empty line, and the line stays.
  3. Click the same button 2 more times. The page does not change.
  4. Click the end of Title to put the caret back in the editor. After a button click the editor has no focus, and ⌘Z does nothing until it has.
  5. Press ⌘Z three times.

The first two ⌘Z change nothing on the page. The third brings back Remove my text node. The readout's undo count goes from 1 to 3 during step 3.

Expected

  • Repro 1: one run of Backspaces is one undo step, so one ⌘Z brings back the whole word. The same page does this when one letter is left (step 6) and for a plain text line.
  • Repro 2: a click that changes nothing adds no undo step, so the first ⌘Z brings back Remove my text node. slatejs.org has no matching example. This is the tester's (natamox's) expectation, given when natamox judged it a bug.

Actual

  • Repro 1: the first ⌘Z brings back one letter, and a second ⌘Z is needed for the rest of the word.
  • Repro 2: each click that changes nothing adds an undo step, and each of those steps takes a ⌘Z that changes nothing on the page.

Environment

  • Exact next commit/Beta package version: NOT_ENOUGH_INFO. The recordings' step panel names the build as Beta, next 7f2eacb6eb, deployed 2026-10-22.
  • On 2026-10-24 an agent replayed both repros on the live Beta in headless Chromium 149, and both still fail.
  • Both repros: headless Chromium 149.0.7827.55 on macOS, driven by Playwright with real key presses and clicks. An agent found both in a manual pass in its own Chromium 152.0.7977.167 browser, then recorded them at natamox's request, on 2026-10-22 (PT).
  • Nobody has tried Firefox or Safari.

Caveat

  • From a reading of the code on next, not checked with a debugger:
    • Repro 1: when the last letter goes, content completion also removes the bold mark from the now empty text. In mixed content, such as the quote block, it removes the empty text instead. That commit then carries a property or structure change, so packages/plitejs/src/history/history-merge-policy.ts:311 classes it as document. shouldMergeBatch (:353) merges only text with text and properties with properties, so the commit becomes a step of its own.
    • Repro 2: the button removes the empty text, and content completion inserts an empty text back, so the commit's changes are not empty. shouldSaveCommit in packages/plitejs/src/history/history-plugin.ts:582 saves every commit whose changes.empty is false.
  • After each ⌘Z in Repro 2, the readout's Caret line reads none while the page still shows the caret at the end of Title. The run noted that undoing a step made while the editor had no selection leaves the model selection empty, and that typing still lands in the right place. It is not part of this issue.

Evidence

  • Repro 1: headless Chromium recording, 30 seconds, with an English step panel beside the page and a readout box drawn by the test script. The box shows the caret, the undo and redo counts and the keys just pressed. At 0:02 the click lands at the end of the first bold. From 0:05 to 0:06 four Backspaces empty the line, and the readout shows Undo steps: 2. At 0:08 ⌘Z brings back only b. At 0:11 the second ⌘Z brings back bold. At 0:13 the click lands at the end of the second bold, and by 0:15 three Backspaces leave b with Undo steps: 1. At 0:18 one ⌘Z brings back bold. From 0:21 the panel shows the result.
  • Repro 2: headless Chromium recording, 29 seconds, in the same layout. At 0:02 the first click empties line 2, and the readout shows Undo steps: 1. At 0:05 two more clicks leave the page as it is, and the count goes to 3. At 0:08 the click puts the caret at the end of Title. ⌘Z at 0:11 and at 0:13 changes nothing on the page while the count drops to 2 and then 1. ⌘Z at 0:16 brings back Remove my text node. From 0:19 the panel shows the result.
Repro 1 — headless Chromium, /examples/plite/content-completion

https://github.com/user-attachments/assets/1174dbe6-41c0-44d3-8fbc-9454a33c3ae2

Repro 2 — headless Chromium, /examples/plite/content-completion

https://github.com/user-attachments/assets/8f00de75-bbdd-4785-bf0c-ec1188daa726

Lingua principale
TypeScript
Stelle
16.6k
Fork
993
Merge medio
20h 1m
PR unite (30g)
60

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di udecode/plate

Tutte le issue di udecode/plate

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.