Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Allow cutting text inside embed blocks https://github.com/siyuan-note/siyuan/issues/19004

Danielff35feb2ab06
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 8cef073fa5..4456215025 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -2953,9 +2953,12 @@ export class WYSIWYG {
setInsertWbrHTML(nodeElement, range, protyle);
return;
}
- // https://github.com/siyuan-note/siyuan/issues/17800 不能删除
+ // 嵌入块内仅允许剪切同一内容块中的文本,避免触发块删除或跨块结构变更。
const embedElement = isInEmbedBlock(nodeElement);
- if (embedElement && !embedElement.classList.contains("protyle-wysiwyg--select")) {
+ const isSameBlockTextCut = !range.collapsed && range.toString() !== "" &&
+ hasClosestBlock(range.endContainer) === nodeElement;
+ if (embedElement && !embedElement.classList.contains("protyle-wysiwyg--select") &&
+ !isSameBlockTextCut) {
event.stopPropagation();
event.preventDefault();
return;