From 0394521e1f32c928cef97b0d8ee2c83758b2cfd2 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 18 Jul 2025 18:35:46 +0800 Subject: [PATCH] :art: No longer add the `id` attribute to block elements after setting the attribute https://github.com/siyuan-note/siyuan/issues/15327 --- app/src/protyle/wysiwyg/transaction.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 8bd7d4e6d..9d4afa3b7 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -607,6 +607,11 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: data.new.style += ";animation:addCard 450ms linear"; } Object.keys(data.new).forEach(key => { + if ("id" === key) { + // 设置属性以后不应该给块元素添加 id 属性 No longer add the `id` attribute to block elements after setting the attribute https://github.com/siyuan-note/siyuan/issues/15327 + return; + } + item.setAttribute(key, data.new[key]); if (key === Constants.CUSTOM_RIFF_DECKS && data.new[Constants.CUSTOM_RIFF_DECKS] !== data.old[Constants.CUSTOM_RIFF_DECKS]) { item.style.animation = "addCard 450ms linear";