Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paragraphs may disappear when editing AI generated transcript #550

Closed
MrOrz opened this issue Oct 13, 2023 · 1 comment · Fixed by #552
Closed

Paragraphs may disappear when editing AI generated transcript #550

MrOrz opened this issue Oct 13, 2023 · 1 comment · Fixed by #552

Comments

@MrOrz
Copy link
Member

MrOrz commented Oct 13, 2023

From: https://g0v.hackmd.io/t9ypB87SQBuMjjW_PheZVg?both#Comm-crowd-sourced-transcript

我注意到 AI transcript 出來的文字
會有刪除一字之後 paragraph 就會爛掉的現象

paragraphs.mp4

我的直覺是
原本 AI 出來的文字單純以 \n 斷行
但 ProseMirror 要求以 <p> <br> 斷行
所以就會直接爛掉
老實講,我會希望 ProseMirror 可以是一個單純的文字編輯器更好
之後我頂多只會加上特殊符號的 syntax highlight 而已(例如約定 # 開頭的行爲註解,方便標記分區或 timestamp)之類
[name=mrorz]

We should fix ProseMirror so that it acts as a text editor that does not have such paragraph problem.

@MrOrz
Copy link
Member Author

MrOrz commented Oct 21, 2023

Seems that a Prosemirror schema as simple as this

const schema = new Schema({
  nodes: {
    doc: {
      content: "text*",
      code: true,
    },
    text: {}
  }
})

Already covers all scenario we want.

image

Demo: https://codesandbox.io/s/codemirror-vn88l4?file=/src/index.mjs:385-503

We just need to handle the case for existing schema with multiple paragraph blocks. Maybe run a database migration to merge all paragraph blocks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant