mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
c0a3635809
commit
2d1f12ec33
4 changed files with 26 additions and 10 deletions
|
|
@ -408,10 +408,13 @@
|
|||
|
||||
[data-subtype="NodeIFrame"],
|
||||
[data-subtype="widget"] {
|
||||
height: 256px;
|
||||
width: 100%;
|
||||
|
||||
.iframe-content {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
height: 256px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
iframe {
|
||||
|
|
|
|||
|
|
@ -513,11 +513,6 @@
|
|||
-webkit-user-modify: read-only;
|
||||
}
|
||||
|
||||
.iframe-content {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&--drag {
|
||||
.iframe-content::after {
|
||||
content: "";
|
||||
|
|
|
|||
|
|
@ -2102,6 +2102,8 @@ export class Gutter {
|
|||
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
||||
if (e.classList.contains("av")) {
|
||||
e.style.justifyContent = "";
|
||||
} else if (["NodeIFrame", "widget"].includes(e.getAttribute("data-subtype"))) {
|
||||
e.style.margin = "";
|
||||
} else {
|
||||
e.style.textAlign = "left";
|
||||
}
|
||||
|
|
@ -2116,6 +2118,8 @@ export class Gutter {
|
|||
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
||||
if (e.classList.contains("av")) {
|
||||
e.style.justifyContent = "center";
|
||||
} else if (["NodeIFrame", "widget"].includes(e.getAttribute("data-subtype"))) {
|
||||
e.style.margin = "0 auto";
|
||||
} else {
|
||||
e.style.textAlign = "center";
|
||||
}
|
||||
|
|
@ -2130,6 +2134,8 @@ export class Gutter {
|
|||
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
||||
if (e.classList.contains("av")) {
|
||||
e.style.justifyContent = "flex-end";
|
||||
} else if (["NodeIFrame", "widget"].includes(e.getAttribute("data-subtype"))) {
|
||||
e.style.margin = "0 0 0 auto";
|
||||
} else {
|
||||
e.style.textAlign = "right";
|
||||
}
|
||||
|
|
@ -2180,6 +2186,8 @@ export class Gutter {
|
|||
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
||||
if (e.classList.contains("av")) {
|
||||
e.style.justifyContent = "";
|
||||
} else if (["NodeIFrame", "widget"].includes(e.getAttribute("data-subtype"))) {
|
||||
e.style.margin = "";
|
||||
} else {
|
||||
e.style.textAlign = "";
|
||||
e.style.direction = "";
|
||||
|
|
|
|||
|
|
@ -923,11 +923,16 @@ export class WYSIWYG {
|
|||
return;
|
||||
}
|
||||
let isCenter = true;
|
||||
if (["NodeIFrame", "NodeWidget", "NodeVideo"].includes(nodeElement.getAttribute("data-type"))) {
|
||||
if ("NodeVideo" === nodeElement.dataset.type) {
|
||||
nodeElement.classList.add("iframe--drag");
|
||||
if (["left", "right", ""].includes(nodeElement.style.textAlign)) {
|
||||
isCenter = false;
|
||||
}
|
||||
} else if (["NodeIFrame", "NodeWidget"].includes(nodeElement.dataset.type)) {
|
||||
nodeElement.classList.add("iframe--drag");
|
||||
if (!nodeElement.style.margin) {
|
||||
isCenter = false;
|
||||
}
|
||||
} else if (target.parentElement.parentElement.getAttribute("data-type") === "img") {
|
||||
target.parentElement.parentElement.classList.add("img--drag");
|
||||
}
|
||||
|
|
@ -943,6 +948,11 @@ export class WYSIWYG {
|
|||
if (dragElement.tagName === "IMG") {
|
||||
img3115(imgElement);
|
||||
}
|
||||
// 3.4.1 以前历史数据兼容
|
||||
if (dragElement.tagName === "IFRAME") {
|
||||
dragElement.style.height = "";
|
||||
dragElement.style.width = "";
|
||||
}
|
||||
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
|
||||
if (dragElement.tagName === "IMG") {
|
||||
dragElement.style.height = "";
|
||||
|
|
@ -952,7 +962,7 @@ export class WYSIWYG {
|
|||
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";
|
||||
nodeElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";
|
||||
} else {
|
||||
dragElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * multiple) + "px";
|
||||
}
|
||||
|
|
@ -960,7 +970,7 @@ export class WYSIWYG {
|
|||
if (dragElement.tagName !== "IMG") {
|
||||
if (moveEvent.clientY > y - dragHeight + 8 && moveEvent.clientY < mostBottom) {
|
||||
if (dragElement.tagName === "IFRAME") {
|
||||
dragElement.parentElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";
|
||||
nodeElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";
|
||||
} else {
|
||||
dragElement.style.height = (dragHeight + (moveEvent.clientY - y)) + "px";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue