diff --git a/app/src/assets/scss/component/_typography.scss b/app/src/assets/scss/component/_typography.scss index 4dbff4e11..77cb1d638 100644 --- a/app/src/assets/scss/component/_typography.scss +++ b/app/src/assets/scss/component/_typography.scss @@ -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; diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scss index 14339beac..e9b64fe63 100644 --- a/app/src/assets/scss/protyle/_wysiwyg.scss +++ b/app/src/assets/scss/protyle/_wysiwyg.scss @@ -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; diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 02659f167..0973b0dc4 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -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); diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 9c2f4905a..41bf99e87 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -453,8 +453,6 @@ export class WYSIWYG { } } else { dragElement.parentElement.parentElement.style.width = (parseInt(dragElement.style.width) + 10) + "px"; - // 历史兼容 - dragElement.parentElement.parentElement.style.maxWidth = ""; } };