mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
🐛 子菜单位置
This commit is contained in:
parent
6652ac5352
commit
05958328f5
2 changed files with 10 additions and 9 deletions
|
|
@ -34,7 +34,8 @@ export class Menu {
|
||||||
const rect = subMenuElement.getBoundingClientRect();
|
const rect = subMenuElement.getBoundingClientRect();
|
||||||
let style = "";
|
let style = "";
|
||||||
const leftPosition = rect.left - this.element.clientWidth - rect.width
|
const leftPosition = rect.left - this.element.clientWidth - rect.width
|
||||||
if (rect.right > window.innerWidth && Math.abs(leftPosition) < (rect.right - window.innerWidth)) {
|
if (rect.right > window.innerWidth && (
|
||||||
|
leftPosition > 0 || Math.abs(leftPosition) < (rect.right - window.innerWidth))) {
|
||||||
if (leftPosition >= 0) {
|
if (leftPosition >= 0) {
|
||||||
style = "left:auto;right:100%;";
|
style = "left:auto;right:100%;";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -64,15 +64,15 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =
|
||||||
language = "plaintext";
|
language = "plaintext";
|
||||||
}
|
}
|
||||||
block.classList.add("hljs");
|
block.classList.add("hljs");
|
||||||
block.innerHTML = hljs.highlight(
|
// TODO 等待讨论是否需要渲染 if (!hasClosestByAttribute(block, "id", "searchPreview", true) || isPreview) {
|
||||||
block.textContent + (block.textContent.endsWith("\n") ? "" : "\n"), // https://github.com/siyuan-note/siyuan/issues/4609
|
block.innerHTML = hljs.highlight(
|
||||||
{
|
block.textContent + (block.textContent.endsWith("\n") ? "" : "\n"), // https://github.com/siyuan-note/siyuan/issues/4609
|
||||||
language,
|
{
|
||||||
ignoreIllegals: true
|
language,
|
||||||
}).value;
|
ignoreIllegals: true
|
||||||
|
}).value;
|
||||||
|
// }
|
||||||
block.setAttribute("data-render", "true");
|
block.setAttribute("data-render", "true");
|
||||||
|
|
||||||
const autoEnter = block.parentElement.getAttribute("linewrap");
|
const autoEnter = block.parentElement.getAttribute("linewrap");
|
||||||
const ligatures = block.parentElement.getAttribute("ligatures");
|
const ligatures = block.parentElement.getAttribute("ligatures");
|
||||||
const lineNumber = block.parentElement.getAttribute("linenumber");
|
const lineNumber = block.parentElement.getAttribute("linenumber");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue