[RTE] Copying a formula as plain text leaves it out

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript, typescript
領域
frontend, testing

調査の方向性

Start with Math.js and useToolbarActions.js, then trace how TipTap serializes selections for text/plain and how toolbar Copy builds clipboard data. Check the existing Jest tests and add coverage for both copy paths, unchanged text/html, and typing a space after a formula beginning with -. Done means all acceptance criteria pass; the issue says the formula’s plain text representation is still undecided.

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

説明

bug

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: unstable

Observed behavior

  • Copying a selection that spans a formula puts no text for the formula in text/plain: A, the formula \frac{x}{y}, B copies as AB.
  • Ctrl+C and the toolbar's Copy both do this. The formula node defines no text (Math.js#L5-L49), and toolbar Copy reads textBetween (useToolbarActions.js#L127).
  • text/html holds the formula, so pasting into another rich text editor keeps it.
  • The fix for #6309 keeps formulas imported as MathML as formula nodes, so they copy the same way.

Expected behavior

text/plain holds each formula the selection spans. Which text stands for a formula is undecided, and the rich text editor's maintainers choose: its LaTeX (\frac{x}{y}), the $$\frac{x}{y}$$ the editor writes in Markdown, or the \(\frac{x}{y}\) toolbar Copy writes into its HTML.

User-facing consequences

An author who pastes question text into a plain-text field (a title, a search box, a chat message) gets the sentence with its formulas missing, and nothing marks the gaps.

Steps to reproduce

  1. Create an editor with editorExtensions() and the content <p>A<span data-latex="\frac{x}{y}"></span>B</p>.
  2. Run editor.commands.selectAll().
  3. Read editor.view.serializeForClipboard(editor.state.selection.content()).text: it is AB.
  4. Read editor.state.doc.textBetween(1, 4, '\n'): it is AB.

Context

unstable at 2713cbf33, Jest with jsdom.

Acceptance Criteria

  • Ctrl+C on A, the formula \frac{x}{y}, B puts the chosen text for the formula between A and B in text/plain.
  • Toolbar Copy puts the same text/plain on the clipboard for that selection.
  • text/html for that selection is what it was before the change.
  • A formula whose text starts with -, at the start of a paragraph, does not become a list when a space is typed after it. TipTap's typing shortcuts read a node's text through renderText (InlineChoiceNode.js#L159-L161).
  • Unit tests cover each criterion above.

AI usage

Claude Code found this while working on #6309, reproduced both copy paths with Jest on unstable, and drafted this issue.

主要言語
JavaScript
スター
214
フォーク
327
平均マージ
17時間 5分
マージ済み PR(30日)
25

環境構築

はじめの一歩

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

learningequality/studio のほかの issue

learningequality/studio の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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