This commit is contained in:
Vanessa 2022-09-02 19:41:59 +08:00
parent a1f856676e
commit 8596905de7
4 changed files with 11 additions and 11 deletions

View file

@ -304,7 +304,7 @@ export const bazaar = {
</div>`; </div>`;
if (isDownloaded) { if (isDownloaded) {
const mdElement = readmeElement.querySelector(".item__readme"); const mdElement = readmeElement.querySelector(".item__readme");
mdElement.innerHTML = data.readme mdElement.innerHTML = data.readme;
highlightRender(mdElement); highlightRender(mdElement);
} else { } else {
fetchPost("/api/bazaar/getBazaarPackageREAME", { fetchPost("/api/bazaar/getBazaarPackageREAME", {
@ -340,7 +340,7 @@ export const bazaar = {
if (item.nodeType !== 3 && item.classList.contains("b3-button")) { if (item.nodeType !== 3 && item.classList.contains("b3-button")) {
item.classList.add("b3-button--outline"); item.classList.add("b3-button--outline");
} }
}) });
target.classList.remove("b3-button--outline"); target.classList.remove("b3-button--outline");
this._genMyHTML(type.replace("my", "").toLowerCase() + "s" as TBazaarType); this._genMyHTML(type.replace("my", "").toLowerCase() + "s" as TBazaarType);
} }

View file

@ -69,7 +69,7 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
// 是否匹配 ⇧⌘[] / ⌘[] // 是否匹配 ⇧⌘[] / ⌘[]
const hasShift = hotKeys.length > 2 && (hotKeys[0] === "⇧"); const hasShift = hotKeys.length > 2 && (hotKeys[0] === "⇧");
let key = (hasShift ? hotKeys[2] : hotKeys[1]); let key = (hasShift ? hotKeys[2] : hotKeys[1]);
let keyCode let keyCode;
// 更新 electron 后不需要判断 Mac但 Mac 下中英文有区别,需使用 keyCode 辅助 // 更新 electron 后不需要判断 Mac但 Mac 下中英文有区别,需使用 keyCode 辅助
if (hasShift) { if (hasShift) {
if (key === "-") { if (key === "-") {

View file

@ -10,7 +10,7 @@ import {focusByWbr, getEditorRange} from "./selection";
import {blockRender} from "../markdown/blockRender"; import {blockRender} from "../markdown/blockRender";
import * as dayjs from "dayjs"; import * as dayjs from "dayjs";
import {highlightRender} from "../markdown/highlightRender"; import {highlightRender} from "../markdown/highlightRender";
import {transaction, updateTransaction} from "../wysiwyg/transaction"; import {updateTransaction} from "../wysiwyg/transaction";
import {fetchPost, fetchSyncPost} from "../../util/fetch"; import {fetchPost, fetchSyncPost} from "../../util/fetch";
import {isDynamicRef, isFileAnnotation} from "../../util/functions"; import {isDynamicRef, isFileAnnotation} from "../../util/functions";
import {insertHTML} from "./insertHTML"; import {insertHTML} from "./insertHTML";

View file

@ -562,12 +562,12 @@ export const turnsIntoOneTransaction = (options: { protyle: IProtyle, selectsEle
}; };
const removeUnfoldRepeatBlock = (html:string, protyle:IProtyle) => { const removeUnfoldRepeatBlock = (html:string, protyle:IProtyle) => {
const temp = document.createElement("template") const temp = document.createElement("template");
temp.innerHTML = html temp.innerHTML = html;
Array.from(temp.content.children).forEach(item => { Array.from(temp.content.children).forEach(item => {
protyle.wysiwyg.element.querySelector(`:scope > [data-node-id="${item.getAttribute("data-node-id")}"]`)?.remove() protyle.wysiwyg.element.querySelector(`:scope > [data-node-id="${item.getAttribute("data-node-id")}"]`)?.remove();
}) });
} };
export const turnsIntoTransaction = (options: { export const turnsIntoTransaction = (options: {
protyle: IProtyle, protyle: IProtyle,
@ -578,11 +578,11 @@ export const turnsIntoTransaction = (options: {
isContinue?: boolean, isContinue?: boolean,
}) => { }) => {
let selectsElement: Element[] = options.selectsElement; let selectsElement: Element[] = options.selectsElement;
let range: Range let range: Range;
// 通过快捷键触发 // 通过快捷键触发
if (options.nodeElement) { if (options.nodeElement) {
range = getSelection().getRangeAt(0); range = getSelection().getRangeAt(0);
range.insertNode(document.createElement("wbr")) range.insertNode(document.createElement("wbr"));
selectsElement = Array.from(options.protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); selectsElement = Array.from(options.protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
if (selectsElement.length === 0) { if (selectsElement.length === 0) {
selectsElement = [options.nodeElement]; selectsElement = [options.nodeElement];