mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
a721bbe6f0
commit
087aef84c4
4 changed files with 4 additions and 9 deletions
|
|
@ -404,6 +404,7 @@
|
|||
vertical-align: top; // https://ld246.com/article/1647522074722
|
||||
margin: 0 auto;
|
||||
max-width: 100%;
|
||||
user-select: none;
|
||||
|
||||
&:not([style]) {
|
||||
display: initial;
|
||||
|
|
|
|||
|
|
@ -320,8 +320,8 @@
|
|||
cursor: col-resize;
|
||||
transition: var(--b3-transition);
|
||||
position: absolute;
|
||||
top: 45%;
|
||||
right: 4px;
|
||||
top: 35%;
|
||||
margin-left: -8px;
|
||||
box-shadow: 0 0 1px 1px var(--b3-theme-on-surface);
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
|
|
|
|||
|
|
@ -889,7 +889,6 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
imgElement.setAttribute("title", value);
|
||||
titleElement.textContent = value;
|
||||
mathRender(titleElement);
|
||||
assetElement.style.maxWidth = (imgElement.clientWidth + 10) + "px";
|
||||
});
|
||||
textElements[2].value = imgElement.getAttribute("alt") || "";
|
||||
}
|
||||
|
|
@ -992,7 +991,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
alignImgLeft(protyle, nodeElement, [assetElement], id, html);
|
||||
}
|
||||
}).element);
|
||||
const width = parseInt(assetElement.style.width || "0");
|
||||
const width = assetElement.style.width.endsWith("%") ? parseInt(assetElement.style.width) : 0;
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.width,
|
||||
submenu: [genImageWidthMenu("25%", assetElement, imgElement, protyle, id, nodeElement, html),
|
||||
|
|
@ -1013,7 +1012,6 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
rangeElement.addEventListener("input", () => {
|
||||
assetElement.style.width = rangeElement.value + "%";
|
||||
imgElement.style.width = "10000px";
|
||||
assetElement.style.maxWidth = "";
|
||||
rangeElement.parentElement.setAttribute("aria-label", `${rangeElement.value}%`);
|
||||
});
|
||||
rangeElement.addEventListener("change", () => {
|
||||
|
|
@ -1384,14 +1382,12 @@ const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement:
|
|||
if (label === window.siyuan.languages.default) {
|
||||
if (assetElement.style.display === "block") {
|
||||
assetElement.style.width = "";
|
||||
assetElement.style.maxWidth = "";
|
||||
} else {
|
||||
assetElement.removeAttribute("style");
|
||||
}
|
||||
imgElement.removeAttribute("style");
|
||||
} else {
|
||||
assetElement.style.width = label;
|
||||
assetElement.style.maxWidth = "";
|
||||
imgElement.style.width = "10000px";
|
||||
}
|
||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||
|
|
|
|||
|
|
@ -453,8 +453,6 @@ export class WYSIWYG {
|
|||
}
|
||||
} else {
|
||||
dragElement.parentElement.parentElement.style.width = (parseInt(dragElement.style.width) + 10) + "px";
|
||||
// 历史兼容
|
||||
dragElement.parentElement.parentElement.style.maxWidth = "";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue