Skip to content

使用 API 插入空代码块后在其中粘贴时会粘贴至其外部 #4143

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

Closed
Zuoqiu-Yingyi opened this issue Mar 3, 2022 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@Zuoqiu-Yingyi
Copy link
Contributor

描述问题 Describe the problem

使用 API 插入如下 markdown 语句生成的代码块在粘贴时会粘贴至代码块外部

```sql\n\n```

期待的结果 Expected result

生成的代码块在粘贴时粘贴至代码块内部

截屏或者录屏演示 Screenshot or screen recording presentation

思源笔记-bug反馈-08

版本环境 Version environment

  • Version: v1.8.6

更多信息 More information

  • 在该代码块中使用键盘输入一个字符后粘贴不会出现该异常
  • 在该代码块中使用键盘输入一个字符后删除该字符, 再粘贴不会出现该异常
  • 关闭插入代码块的文档再打开后粘贴不会出现该异常
@88250 88250 self-assigned this Mar 4, 2022
@88250
Copy link
Member

88250 commented Mar 6, 2022

v1.8.7 我这里测试了 prependBlockappendBlockinsertBlock,没有发现问题。

issue

@88250 88250 removed their assignment Mar 6, 2022
@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented Mar 6, 2022

@88250 我刚刚在 1.8.7 中使用 postman 测试了一下, 发现触发的条件为

  • API 为 /api/block/prependBlock
  • 请求体中 parentID 字段是一个文档块的 ID
  • 插入后光标自动移动至代码块内(触发步骤如下)
    • 插入一个不能输入内容的块级元素(换句话说, 光标无法聚焦的块, 这里使用 iframe 块进行演示)
    • 使用 /api/block/prependBlock 在文档块开头插入一次代码块
    • 在刚刚插入的代码块中输入随便几个字符后删除该代码块
    • 再次使用 /api/block/prependBlock 在文档块开头插入一次代码块
      思源笔记-bug反馈-14

@88250 88250 added the Bug label Mar 6, 2022
@88250 88250 added this to the 1.8.8 milestone Mar 6, 2022
@88250 88250 changed the title 使用 API 插入空代码块后在代码块中粘贴时会粘贴至代码块外部 使用 API 插入空代码块后在其中粘贴时会粘贴至其外部 Mar 6, 2022
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

3 participants