Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[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

オープン
#5,271 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
53/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend, testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
16.6k
フォーク
993
平均マージ
20時間 21分
マージ済み PR(30日)
60

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

udecode/plate のほかの issue

udecode/plate の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。