Skip to content

Commit

Permalink
🚨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Aug 16, 2024
1 parent 1a20840 commit 347d4c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/src/protyle/render/highlightRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =
const codeText = block.textContent;
if (!isPreview && (lineNumber === "true" || (lineNumber !== "false" && window.siyuan.config.editor.codeSyntaxHighlightLineNum))) {
// 需要先添加 class 以防止抖动 https://ld246.com/article/1648116585443
block.firstElementChild.classList.add("protyle-linenumber__rows")
block.firstElementChild.classList.add("protyle-linenumber__rows");
lineNumberRender(block);
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/search/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export const saveCriterion = (config: Config.IUILayoutTabSearchConfig,
saveDialog.destroy();
});
btnsElement[1].addEventListener("click", () => {
const inputElement = saveDialog.element.querySelector("input")
const inputElement = saveDialog.element.querySelector("input");
const value = inputElement.value.trim();
if (!value) {
showMessage(window.siyuan.languages["_kernel"]["142"]);
Expand Down
8 changes: 4 additions & 4 deletions app/src/util/highlightById.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {hasClosestBlock, hasClosestByAttribute} from "../protyle/util/hasClosest";
import {getEditorRange, getSelectionPosition} from "../protyle/util/selection";
import {getEditorRange} from "../protyle/util/selection";

export const bgFade = (element: Element) => {
element.classList.add("protyle-wysiwyg--hl");
Expand Down Expand Up @@ -40,12 +40,12 @@ export const highlightById = (protyle: IProtyle, id: string, top = false) => {

export const scrollCenter = (protyle: IProtyle, nodeElement?: Element, top = false, behavior: ScrollBehavior = "auto") => {
if (!protyle.disabled && !top && getSelection().rangeCount > 0) {
const range = getSelection().getRangeAt(0)
const range = getSelection().getRangeAt(0);
const blockElement = hasClosestBlock(range.startContainer);
if (blockElement) {
// https://github.com/siyuan-note/siyuan/issues/10769
if (blockElement.classList.contains("code-block")) {
const brElement = document.createElement('br');
const brElement = document.createElement("br");
range.insertNode(brElement);
brElement.scrollIntoView({block: "center", behavior});
brElement.remove();
Expand All @@ -57,7 +57,7 @@ export const scrollCenter = (protyle: IProtyle, nodeElement?: Element, top = fal
return;
}

const br2Element = document.createElement('br');
const br2Element = document.createElement("br");
range.insertNode(br2Element);
const editorElement = protyle.contentElement;
const cursorTop = br2Element.getBoundingClientRect().top - editorElement.getBoundingClientRect().top;
Expand Down

0 comments on commit 347d4c7

Please sign in to comment.