mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🎨 https://github.com/siyuan-note/siyuan/issues/7536 gutter and resize
This commit is contained in:
parent
d74dbaa87e
commit
5cad47203a
3 changed files with 41 additions and 8 deletions
|
|
@ -3,10 +3,12 @@ import {setPadding} from "../ui/initUI";
|
|||
import {hasClosestBlock} from "./hasClosest";
|
||||
import {Constants} from "../../constants";
|
||||
|
||||
let resizeTimeout: number;
|
||||
export const resize = (protyle: IProtyle) => {
|
||||
hideElements(["gutter"], protyle);
|
||||
setPadding(protyle);
|
||||
setTimeout(() => {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = window.setTimeout(() => {
|
||||
if (typeof echarts !== "undefined") {
|
||||
protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => {
|
||||
const chartInstance = echarts.getInstanceById(chartItem.firstElementChild.nextElementSibling.getAttribute("_echarts_instance_"));
|
||||
|
|
@ -15,6 +17,19 @@ export const resize = (protyle: IProtyle) => {
|
|||
}
|
||||
});
|
||||
}
|
||||
protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => {
|
||||
item.style.width = item.parentElement.clientWidth + "px";
|
||||
if (item.getAttribute("data-render") === "true") {
|
||||
const paddingLeft = item.parentElement.style.paddingLeft;
|
||||
const paddingRight = item.parentElement.style.paddingRight;
|
||||
const avHeaderElement = item.firstElementChild.firstElementChild as HTMLElement;
|
||||
avHeaderElement.style.paddingLeft = paddingLeft;
|
||||
avHeaderElement.style.paddingRight = paddingRight;
|
||||
const avBodyElement = item.querySelector(".av__scroll").firstElementChild as HTMLElement
|
||||
avBodyElement.style.paddingLeft = paddingLeft;
|
||||
avBodyElement.style.paddingRight = paddingRight;
|
||||
}
|
||||
});
|
||||
// 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments
|
||||
if (!protyle.disabled && protyle.toolbar.range) {
|
||||
let rangeRect = protyle.toolbar.range.getBoundingClientRect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue