mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-13 07:56:14 +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
|
vertical-align: top; // https://ld246.com/article/1647522074722
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
&:not([style]) {
|
&:not([style]) {
|
||||||
display: initial;
|
display: initial;
|
||||||
|
|
|
||||||
|
|
@ -320,8 +320,8 @@
|
||||||
cursor: col-resize;
|
cursor: col-resize;
|
||||||
transition: var(--b3-transition);
|
transition: var(--b3-transition);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 45%;
|
top: 35%;
|
||||||
right: 4px;
|
margin-left: -8px;
|
||||||
box-shadow: 0 0 1px 1px var(--b3-theme-on-surface);
|
box-shadow: 0 0 1px 1px var(--b3-theme-on-surface);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
|
||||||
|
|
@ -889,7 +889,6 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
imgElement.setAttribute("title", value);
|
imgElement.setAttribute("title", value);
|
||||||
titleElement.textContent = value;
|
titleElement.textContent = value;
|
||||||
mathRender(titleElement);
|
mathRender(titleElement);
|
||||||
assetElement.style.maxWidth = (imgElement.clientWidth + 10) + "px";
|
|
||||||
});
|
});
|
||||||
textElements[2].value = imgElement.getAttribute("alt") || "";
|
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);
|
alignImgLeft(protyle, nodeElement, [assetElement], id, html);
|
||||||
}
|
}
|
||||||
}).element);
|
}).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({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.width,
|
label: window.siyuan.languages.width,
|
||||||
submenu: [genImageWidthMenu("25%", assetElement, imgElement, protyle, id, nodeElement, html),
|
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", () => {
|
rangeElement.addEventListener("input", () => {
|
||||||
assetElement.style.width = rangeElement.value + "%";
|
assetElement.style.width = rangeElement.value + "%";
|
||||||
imgElement.style.width = "10000px";
|
imgElement.style.width = "10000px";
|
||||||
assetElement.style.maxWidth = "";
|
|
||||||
rangeElement.parentElement.setAttribute("aria-label", `${rangeElement.value}%`);
|
rangeElement.parentElement.setAttribute("aria-label", `${rangeElement.value}%`);
|
||||||
});
|
});
|
||||||
rangeElement.addEventListener("change", () => {
|
rangeElement.addEventListener("change", () => {
|
||||||
|
|
@ -1384,14 +1382,12 @@ const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement:
|
||||||
if (label === window.siyuan.languages.default) {
|
if (label === window.siyuan.languages.default) {
|
||||||
if (assetElement.style.display === "block") {
|
if (assetElement.style.display === "block") {
|
||||||
assetElement.style.width = "";
|
assetElement.style.width = "";
|
||||||
assetElement.style.maxWidth = "";
|
|
||||||
} else {
|
} else {
|
||||||
assetElement.removeAttribute("style");
|
assetElement.removeAttribute("style");
|
||||||
}
|
}
|
||||||
imgElement.removeAttribute("style");
|
imgElement.removeAttribute("style");
|
||||||
} else {
|
} else {
|
||||||
assetElement.style.width = label;
|
assetElement.style.width = label;
|
||||||
assetElement.style.maxWidth = "";
|
|
||||||
imgElement.style.width = "10000px";
|
imgElement.style.width = "10000px";
|
||||||
}
|
}
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
|
|
|
||||||
|
|
@ -453,8 +453,6 @@ export class WYSIWYG {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dragElement.parentElement.parentElement.style.width = (parseInt(dragElement.style.width) + 10) + "px";
|
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