mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
This commit is contained in:
parent
475507d361
commit
8e5e46f532
1 changed files with 4 additions and 1 deletions
|
|
@ -89,7 +89,10 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false) =>
|
||||||
range.collapse(false);
|
range.collapse(false);
|
||||||
blockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
blockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
const trimStartText = editableElement ? editableElement.textContent.trimStart() : "";
|
const trimStartText = editableElement ? editableElement.textContent.trimStart() : "";
|
||||||
if (editableElement && (trimStartText.startsWith("```") || trimStartText.startsWith("~~~") || trimStartText.startsWith("···") ||
|
if (editableElement &&
|
||||||
|
// 引用内容为 ```test% 会导致错误
|
||||||
|
!editableElement.querySelector('[data-type="block-ref"]') &&
|
||||||
|
(trimStartText.startsWith("```") || trimStartText.startsWith("~~~") || trimStartText.startsWith("···") ||
|
||||||
trimStartText.indexOf("\n```") > -1 || trimStartText.indexOf("\n~~~") > -1 || trimStartText.indexOf("\n···") > -1)) {
|
trimStartText.indexOf("\n```") > -1 || trimStartText.indexOf("\n~~~") > -1 || trimStartText.indexOf("\n···") > -1)) {
|
||||||
if (editableElement.innerHTML.indexOf("\n") === -1 && trimStartText.replace(/·|~/g, "`").replace(/^`{3,}/g, "").indexOf("`") > -1) {
|
if (editableElement.innerHTML.indexOf("\n") === -1 && trimStartText.replace(/·|~/g, "`").replace(/^`{3,}/g, "").indexOf("`") > -1) {
|
||||||
// ```test` 不处理
|
// ```test` 不处理
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue