mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
This commit is contained in:
parent
b3f55ac3b4
commit
795d2e0c2a
1 changed files with 5 additions and 5 deletions
|
|
@ -927,7 +927,7 @@ export const zoomOut = (options: {
|
||||||
if (options.focusId) {
|
if (options.focusId) {
|
||||||
let focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.focusId}"]`);
|
let focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.focusId}"]`);
|
||||||
if (!focusElement) {
|
if (!focusElement) {
|
||||||
const unfoldResponse = await fetchSyncPost("/api/block/getUnfoldedParentID", {id:options.focusId})
|
const unfoldResponse = await fetchSyncPost("/api/block/getUnfoldedParentID", {id: options.focusId})
|
||||||
options.focusId = unfoldResponse.data.parentID
|
options.focusId = unfoldResponse.data.parentID
|
||||||
focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${unfoldResponse.data.parentID}"]`);
|
focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${unfoldResponse.data.parentID}"]`);
|
||||||
}
|
}
|
||||||
|
|
@ -1219,14 +1219,14 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
}, {
|
}, {
|
||||||
iconHTML: "",
|
iconHTML: "",
|
||||||
type: "readonly",
|
type: "readonly",
|
||||||
label: `<div style="margin: 4px 0;" aria-label="${imgElement.parentElement.style.width ? imgElement.parentElement.style.width.replace("vw", "%") : window.siyuan.languages.default}" class="b3-tooltips b3-tooltips__n${isMobile() ? "" : " fn__size200"}">
|
label: `<div style="margin: 4px 0;" aria-label="${imgElement.parentElement.style.width ? imgElement.parentElement.style.width.replace("vw", "%").replace("calc(", "").replace(" - 8px)", "") : window.siyuan.languages.default}" class="b3-tooltips b3-tooltips__n${isMobile() ? "" : " fn__size200"}">
|
||||||
<input style="box-sizing: border-box" value="${(imgElement.parentElement.style.width.endsWith("%")||imgElement.parentElement.style.width.endsWith("vw")) ? parseInt(imgElement.parentElement.style.width) : 0}" class="b3-slider fn__block" max="100" min="1" step="1" type="range">
|
<input style="box-sizing: border-box" value="${(imgElement.parentElement.style.width.indexOf("%") > -1 || imgElement.parentElement.style.width.endsWith("vw")) ? parseInt(imgElement.parentElement.style.width.replace("calc(", "")) : 0}" class="b3-slider fn__block" max="100" min="1" step="1" type="range">
|
||||||
</div>`,
|
</div>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
rangeElement = element.querySelector("input");
|
rangeElement = element.querySelector("input");
|
||||||
rangeElement.addEventListener("input", () => {
|
rangeElement.addEventListener("input", () => {
|
||||||
img3115(assetElement);
|
img3115(assetElement);
|
||||||
imgElement.parentElement.style.width = rangeElement.value + "%";
|
imgElement.parentElement.style.width = `calc(${rangeElement.value}% - 8px)`;
|
||||||
imgElement.style.height = "";
|
imgElement.style.height = "";
|
||||||
rangeElement.parentElement.setAttribute("aria-label", `${rangeElement.value}%`);
|
rangeElement.parentElement.setAttribute("aria-label", `${rangeElement.value}%`);
|
||||||
});
|
});
|
||||||
|
|
@ -1831,7 +1831,7 @@ const genImageWidthMenu = (label: string, imgElement: HTMLElement, protyle: IPro
|
||||||
click() {
|
click() {
|
||||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
img3115(imgElement.parentElement.parentElement);
|
img3115(imgElement.parentElement.parentElement);
|
||||||
imgElement.parentElement.style.width = label === window.siyuan.languages.default ? "" : label;
|
imgElement.parentElement.style.width = label === window.siyuan.languages.default ? "" : `calc(${label} - 8px)`;
|
||||||
imgElement.style.height = "";
|
imgElement.style.height = "";
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
focusBlock(nodeElement);
|
focusBlock(nodeElement);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue