Skip to content

Commit

Permalink
🚨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 25, 2024
1 parent 23ee202 commit 11fd8f2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/src/block/Panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ export class BlockPanel {

this.element.querySelector(".block__content").addEventListener("scroll", () => {
this.editors.forEach(item => {
hideElements(["gutter"], item.protyle)
})
})
hideElements(["gutter"], item.protyle);
});
});
}
}
2 changes: 1 addition & 1 deletion app/src/layout/dock/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ export class Files extends Model {
}

private updateDocInfo(data: IWebSocketData) {
const liElement = this.element.querySelector(`li[data-node-id="${data.data.rootID}"]`)
const liElement = this.element.querySelector(`li[data-node-id="${data.data.rootID}"]`);
if (liElement) {
liElement.setAttribute("data-count", data.data.subFileCount);
liElement.querySelector(".ariaLabel")?.setAttribute("aria-label", this.genDocAriaLabel(data.data, escapeGreat));
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/util/compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const isInIOS = () => {

export const isInHarmony = () => {
return window.siyuan.config.system.container === "harmony" && window.JSHarmony;
}
};

// Mac,Windows 快捷键展示
export const updateHotkeyTip = (hotkey: string) => {
Expand Down
13 changes: 7 additions & 6 deletions app/src/protyle/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {openGlobalSearch} from "../../search/util";
import {popSearch} from "../../mobile/menu/search";
/// #endif
import {BlockPanel} from "../../block/Panel";
import {isInIOS, isOnlyMeta, readText} from "../util/compatibility";
import {isInIOS, isMac, isOnlyMeta, readText} from "../util/compatibility";
import {MenuItem} from "../../menus/Menu";
import {fetchPost} from "../../util/fetch";
import {onGet} from "../util/onGet";
Expand Down Expand Up @@ -2007,7 +2007,8 @@ export class WYSIWYG {

// 输入法测试点 https://github.com/siyuan-note/siyuan/issues/3027
let isComposition = false; // for iPhone
this.element.addEventListener("compositionstart", (event) => {isComposition = true;
this.element.addEventListener("compositionstart", (event) => {
isComposition = true;
event.stopPropagation();
});

Expand Down Expand Up @@ -2080,14 +2081,14 @@ export class WYSIWYG {
const range = getEditorRange(this.element).cloneRange();
const nodeElement = hasClosestBlock(range.startContainer);

if ( event.key !== "PageUp" && event.key !== "PageDown" && event.key !== "Home" && event.key !== "End" &&
if (event.key !== "PageUp" && event.key !== "PageDown" && event.key !== "Home" && event.key !== "End" &&
event.key.indexOf("Arrow") === -1 && event.key !== "Escape" && event.key !== "Shift" &&
event.key !== "Meta" && event.key !== "Alt" && event.key !== "Control" && event.key !== "CapsLock" &&
!event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey &&
!/^F\d{1,2}$/.test(event.key) ){
!/^F\d{1,2}$/.test(event.key)) {
// 搜狗输入法不走 keydown,需重新记录历史状态
if ( nodeElement &&
( typeof protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] === "undefined"||range.toString()!==""||!this.preventKeyup)) {
if (!isMac() && nodeElement &&
(typeof protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] === "undefined" || range.toString() !== "" || !this.preventKeyup)) {
range.insertNode(document.createElement("wbr"));
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = nodeElement.outerHTML;
nodeElement.querySelector("wbr").remove();
Expand Down
4 changes: 2 additions & 2 deletions app/src/protyle/wysiwyg/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// 有可能输入 shift+. ,因此需要使用 event.key 来进行判断
if (event.key !== "PageUp" && event.key !== "PageDown" && event.key !== "Home" && event.key !== "End" && event.key.indexOf("Arrow") === -1 &&
event.key !== "Escape" && event.key !== "Shift" && event.key !== "Meta" && event.key !== "Alt" && event.key !== "Control" && event.key !== "CapsLock" &&
!isNotEditBlock(nodeElement) &&!/^F\d{1,2}$/.test(event.key)) {
!isNotEditBlock(nodeElement) && !/^F\d{1,2}$/.test(event.key)) {
const cloneRange = range.cloneRange();
range.collapse(false);
range.insertNode(document.createElement("wbr"));
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = nodeElement.outerHTML;
nodeElement.querySelector("wbr").remove();
// 光标位于引用结尾后 ctrl+b 偶尔会失效
range = cloneRange;
focusByRange(cloneRange)
focusByRange(cloneRange);
protyle.toolbar.range = cloneRange;
protyle.wysiwyg.preventKeyup = true;
}
Expand Down

0 comments on commit 11fd8f2

Please sign in to comment.