mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-10 20:43:45 +08:00
🎨
This commit is contained in:
parent
1b45bc002e
commit
93f623597f
@ -214,8 +214,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||||||
<span class="item__text">${item.name}</span>
|
<span class="item__text">${item.name}</span>
|
||||||
</div>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
e.firstElementChild.outerHTML = `<div class="av__container" style="--av-background:${e.style.backgroundColor || "var(--b3-theme-background)"}">
|
||||||
e.firstElementChild.outerHTML = `<div class="av__container" style="--av-background:${e.style.backgroundColor || "var(--b3-theme-background)"}">
|
|
||||||
<div class="av__header">
|
<div class="av__header">
|
||||||
<div class="fn__flex av__views">
|
<div class="fn__flex av__views">
|
||||||
<div class="layout-tab-bar fn__flex">
|
<div class="layout-tab-bar fn__flex">
|
||||||
@ -276,48 +275,47 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
e.setAttribute("data-render", "true");
|
e.setAttribute("data-render", "true");
|
||||||
// 历史兼容
|
// 历史兼容
|
||||||
e.style.margin = "";
|
e.style.margin = "";
|
||||||
if (left) {
|
if (left) {
|
||||||
e.querySelector(".av__scroll").scrollLeft = left;
|
e.querySelector(".av__scroll").scrollLeft = left;
|
||||||
}
|
}
|
||||||
|
|
||||||
const editRect = protyle.contentElement.getBoundingClientRect();
|
const editRect = protyle.contentElement.getBoundingClientRect();
|
||||||
if (headerTransform) {
|
if (headerTransform) {
|
||||||
(e.querySelector(".av__row--header") as HTMLElement).style.transform = headerTransform;
|
(e.querySelector(".av__row--header") as HTMLElement).style.transform = headerTransform;
|
||||||
} else {
|
} else {
|
||||||
stickyRow(e, editRect, "top");
|
stickyRow(e, editRect, "top");
|
||||||
|
}
|
||||||
|
if (footerTransform) {
|
||||||
|
(e.querySelector(".av__row--footer") as HTMLElement).style.transform = footerTransform;
|
||||||
|
} else {
|
||||||
|
stickyRow(e, editRect, "bottom");
|
||||||
|
}
|
||||||
|
if (selectCellId) {
|
||||||
|
const newCellElement = e.querySelector(`.av__row[data-id="${selectCellId.split(Constants.ZWSP)[0]}"] .av__cell[data-col-id="${selectCellId.split(Constants.ZWSP)[1]}"]`);
|
||||||
|
if (newCellElement) {
|
||||||
|
newCellElement.classList.add("av__cell--select");
|
||||||
}
|
}
|
||||||
if (footerTransform) {
|
if (!document.querySelector(".av__panel")) {
|
||||||
(e.querySelector(".av__row--footer") as HTMLElement).style.transform = footerTransform;
|
focusBlock(e);
|
||||||
} else {
|
|
||||||
stickyRow(e, editRect, "bottom");
|
|
||||||
}
|
}
|
||||||
if (selectCellId) {
|
}
|
||||||
const newCellElement = e.querySelector(`.av__row[data-id="${selectCellId.split(Constants.ZWSP)[0]}"] .av__cell[data-col-id="${selectCellId.split(Constants.ZWSP)[1]}"]`);
|
if (getSelection().rangeCount > 0) {
|
||||||
if (newCellElement) {
|
// 修改表头后光标重新定位
|
||||||
newCellElement.classList.add("av__cell--select");
|
const range = getSelection().getRangeAt(0);
|
||||||
}
|
if (!hasClosestByClassName(range.startContainer, "av__title")) {
|
||||||
if (!document.querySelector(".av__panel")) {
|
const blockElement = hasClosestBlock(range.startContainer);
|
||||||
|
if (blockElement && e.isSameNode(blockElement)) {
|
||||||
focusBlock(e);
|
focusBlock(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getSelection().rangeCount > 0) {
|
}
|
||||||
// 修改表头后光标重新定位
|
e.querySelector(".layout-tab-bar").scrollLeft = (e.querySelector(".layout-tab-bar .item--focus") as HTMLElement).offsetLeft;
|
||||||
const range = getSelection().getRangeAt(0);
|
if (cb) {
|
||||||
if (!hasClosestByClassName(range.startContainer, "av__title")) {
|
cb();
|
||||||
const blockElement = hasClosestBlock(range.startContainer);
|
}
|
||||||
if (blockElement && e.isSameNode(blockElement)) {
|
|
||||||
focusBlock(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e.querySelector(".layout-tab-bar").scrollLeft = (e.querySelector(".layout-tab-bar .item--focus") as HTMLElement).offsetLeft;
|
|
||||||
if (cb) {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
}, time ? 256 - (new Date().getTime() - time) : 0); // 为了让动画更好看,需延时到 256ms
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user