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

API /api/block/updateBlock 更新文档块为空的问题 #4884

Closed
88250 opened this issue May 13, 2022 · 2 comments
Closed

API /api/block/updateBlock 更新文档块为空的问题 #4884

88250 opened this issue May 13, 2022 · 2 comments
Assignees
Labels
Milestone

Comments

@88250
Copy link
Member

88250 commented May 13, 2022

刚刚有朋友发现了一个问题 删除文档内容 · Issue #47, 使用该 API 更新文档块时, 如果请求体 data 字段设置为空字符串 "" 或者只有换行符 "\n" "\n\n" 的字符串, 如果该文档已经在编辑器中打开, 那么被更新的文档 DOM 会如下所示, 一个块都没有

<div class="protyle-wysiwyg protyle-wysiwyg--attr" spellcheck="false" contenteditable="true" style="padding: 16px 96px 380.5px;" data-doc-type="NodeDocument"></div>

关闭该文档后再重新打开又出现了两个空的段落块


但是空文档块应该存在一个空的段落块, 如下所示

<div class="protyle-wysiwyg protyle-wysiwyg--attr" spellcheck="false" contenteditable="true" data-doc-type="NodeDocument" style="padding: 16px 96px 380.5px;">
  <div data-node-id="20220513185535-5uuae2l" data-node-index="0" data-type="NodeParagraph" class="p" updated="20220513185535">
    <div contenteditable="true" spellcheck="false"></div>
    <div class="protyle-attr" contenteditable="false"></div>
  </div>
</div>

Originally posted by @Zuoqiu-Yingyi in #4165 (comment)

@88250 88250 self-assigned this May 13, 2022
@88250 88250 added this to the 2.0.9 milestone May 13, 2022
@88250 88250 closed this as completed May 14, 2022
@Zuoqiu-Yingyi
Copy link
Contributor

貌似这个问题没有完全修复

请求体:

{
    "id": "20201121212605-9td1a62",
    "dataType": "markdown",
    "data": ""
}

请求后显示正常(文档中只有一个空的段落), 但是关闭该文档后重新打开, 会出现两个空段落
image

@88250
Copy link
Member Author

88250 commented May 17, 2022

@Zuoqiu-Yingyi 下个版本处理,就不单独开 issue 了。

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

No branches or pull requests

2 participants