🎨 Clean code

This commit is contained in:
Daniel 2024-03-19 08:26:16 +08:00
parent 427bf25a88
commit b22a70cf65
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017
4 changed files with 12 additions and 10 deletions

View File

@ -339,7 +339,7 @@ export const bindCardEvent = async (options: {
deckID: Constants.QUICK_DECK_ID,
blockIDs: [currentCard.blockID],
}, () => {
const minLang = window.siyuan.languages._time["1m"].replace("%s", "")
const minLang = window.siyuan.languages._time["1m"].replace("%s", "");
currentCard.lapses = 0;
currentCard.lastReview = -62135596800000;
currentCard.reps = 0;

View File

@ -548,7 +548,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
iconElement.classList.add("b3-list-item__arrow--open");
let html = "";
response.data.items.forEach((docItem: { title: string, path: string, op: string }) => {
let chipClass = " b3-chip b3-chip--list "
let chipClass = " b3-chip b3-chip--list ";
if (docItem.op === "clean") {
chipClass += "b3-chip--primary ";
} else if (docItem.op === "update") {

View File

@ -2,11 +2,13 @@ import {Divider} from "./Divider";
import {Font, hasSameTextStyle, setFontStyle} from "./Font";
import {ToolbarItem} from "./ToolbarItem";
import {
fixTableRange, focusBlock,
fixTableRange,
focusBlock,
focusByRange,
focusByWbr,
getEditorRange,
getSelectionPosition, selectAll,
getSelectionPosition,
selectAll,
setFirstNodeRange,
setLastNodeRange
} from "../util/selection";
@ -1141,8 +1143,8 @@ export class Toolbar {
const editElement = getContenteditableElement(nodeElement);
if (Constants.SIYUAN_RENDER_CODE_LANGUAGES.includes(languageElement.textContent)) {
nodeElement.dataset.content = editElement.textContent.trim();
nodeElement.dataset.subtype = languageElement.textContent
nodeElement.className = "render-node"
nodeElement.dataset.subtype = languageElement.textContent;
nodeElement.className = "render-node";
nodeElement.innerHTML = `<div spin="1"></div><div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div>`;
processRender(nodeElement);
} else {

View File

@ -1,5 +1,5 @@
import {genEmptyElement, insertEmptyBlock} from "../../block/util";
import {getSelectionOffset, focusByWbr, setLastNodeRange, focusBlock, focusByRange} from "../util/selection";
import {focusBlock, focusByRange, focusByWbr, getSelectionOffset, setLastNodeRange} from "../util/selection";
import {
getContenteditableElement,
getTopEmptyElement,
@ -84,9 +84,9 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
setStorageVal(Constants.LOCAL_CODELANG, window.siyuan.storage[Constants.LOCAL_CODELANG]);
}
if (Constants.SIYUAN_RENDER_CODE_LANGUAGES.includes(languageElement.textContent)) {
blockElement.dataset.content = ""
blockElement.dataset.subtype = languageElement.textContent
blockElement.className = "render-node"
blockElement.dataset.content = "";
blockElement.dataset.subtype = languageElement.textContent;
blockElement.className = "render-node";
blockElement.innerHTML = `<div spin="1"></div><div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div>`;
protyle.toolbar.showRender(protyle, blockElement);
processRender(blockElement);