Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16239

Vanessabad5918cf480
diff --git a/app/src/assets/scss/component/_typography.scss b/app/src/assets/scss/component/_typography.scss
index fa8315ec9c..c1a2f73348 100644
--- a/app/src/assets/scss/component/_typography.scss
+++ b/app/src/assets/scss/component/_typography.scss
@@ -34,15 +34,6 @@
border: 0;
}
- iframe {
- border: 1px solid var(--b3-theme-surface-lighter);
- width: 765px;
- box-sizing: border-box;
- height: 256px;
- max-width: 100%;
- vertical-align: bottom;
- }
-
span[data-type~="sup"],
span[data-type~="sub"] {
position: relative;
@@ -415,6 +406,22 @@
text-align: center;
}
+ [data-subtype="NodeIFrame"],
+ [data-subtype="widget"] {
+ .iframe-content {
+ width: 100%;
+ height: 256px;
+ max-width: 100%;
+ }
+
+ iframe {
+ width: 100%;
+ height: 100%;
+ border: 1px solid var(--b3-theme-surface-lighter);
+ box-sizing: border-box;
+ }
+ }
+
[data-subtype="flowchart"] > [spin="1"],
[data-subtype="plantuml"] > [spin="1"],
[data-subtype="mermaid"] > [spin="1"] {
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index c13b551856..c3b37ee2b8 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -917,7 +917,7 @@ export class WYSIWYG {
};
return false;
}
- // 图片、iframe、video 缩放
+ // 图片、iframe、video、挂件缩放
if (!protyle.disabled && target.classList.contains("protyle-action__drag")) {
if (!nodeElement) {
return;
@@ -925,7 +925,7 @@ export class WYSIWYG {
let isCenter = true;
if (["NodeIFrame", "NodeWidget", "NodeVideo"].includes(nodeElement.getAttribute("data-type"))) {
nodeElement.classList.add("iframe--drag");
- if (nodeElement.style.textAlign === "left" || nodeElement.style.textAlign === "right") {
+ if (["left", "right", ""].includes(nodeElement.style.textAlign)) {
isCenter = false;
}
} else if (target.parentElement.parentElement.getAttribute("data-type") === "img") {
@@ -951,13 +951,19 @@ export class WYSIWYG {
const multiple = ((dragElement.tagName === "IMG" && !imgElement.style.minWidth && nodeElement.style.textAlign !== "center") || !isCenter) ? 1 : 2;
if (dragElement.tagName === "IMG") {
dragElement.parentElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";
+ } else if (dragElement.tagName === "IFRAME") {
+ dragElement.parentElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";
} else {
dragElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";
}
}
if (dragElement.tagName !== "IMG") {
if (moveEvent.clientY > y - dragHeight + 8 && moveEvent.clientY < mostBottom) {
- dragElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";
+ if (dragElement.tagName === "IFRAME") {
+ dragElement.parentElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";
+ } else {
+ dragElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";
+ }
}
}
};