🚨
This commit is contained in:
parent
9a1c02e7e4
commit
8c36764686
17 changed files with 37 additions and 38 deletions
|
@ -251,7 +251,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||
let target = event.target as HTMLElement;
|
||||
while (target && !target.isSameNode(element)) {
|
||||
if (target.classList.contains("b3-list-item__action")) {
|
||||
const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index]
|
||||
const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index];
|
||||
editDialog(subItem.name, subItem.memo);
|
||||
menu.close();
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -139,7 +139,7 @@ export const initBlockPopover = (app: App) => {
|
|||
|
||||
const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => {
|
||||
// pad 端点击后 event.target 不会更新。
|
||||
const target = isTouchDevice() ? document.elementFromPoint(event.clientX, event.clientY) : event.target as HTMLElement
|
||||
const target = isTouchDevice() ? document.elementFromPoint(event.clientX, event.clientY) : event.target as HTMLElement;
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -673,7 +673,7 @@ const emitEvent = (app: App, card: ICard, type: string) => {
|
|||
|
||||
export const openCard = (app: App) => {
|
||||
if (window.siyuan.config.readonly) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/riff/getRiffDueCards", {deckID: ""}, (cardsResponse) => {
|
||||
openCardByData(app, cardsResponse.data, "all");
|
||||
|
|
|
@ -295,10 +295,10 @@ export const refreshFileTree = (cb?: () => void) => {
|
|||
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]);
|
||||
fetchPost("/api/filetree/refreshFiletree", {}, () => {
|
||||
if (cb) {
|
||||
cb()
|
||||
cb();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let statusTimeout: number;
|
||||
export const progressStatus = (data: IWebSocketData) => {
|
||||
|
|
|
@ -139,10 +139,10 @@ export const renameAsset = (assetPath: string) => {
|
|||
if (item.path === assetPath) {
|
||||
item.parent.updateTitle(getDisplayName(response.data.newPath));
|
||||
}
|
||||
})
|
||||
});
|
||||
getAllEditor().forEach(item => {
|
||||
item.reload(false);
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -518,7 +518,7 @@ export const getEmojiDesc = (emoji: IEmojiItem) => {
|
|||
return emoji.description_ja_jp;
|
||||
}
|
||||
return emoji.description;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const getEmojiTitle = (index: number) => {
|
||||
|
|
|
@ -322,11 +322,11 @@ export class Graph extends Model {
|
|||
this.searchGraph(false, undefined, true);
|
||||
} else if (dataType === "fullscreen") {
|
||||
fullscreen(this.element, target);
|
||||
const minElement = this.element.querySelector('.block__icons .block__icon[data-type="min"]')
|
||||
const minElement = this.element.querySelector('.block__icons .block__icon[data-type="min"]');
|
||||
if (this.element.className.includes("fullscreen")) {
|
||||
minElement.classList.add("fn__none")
|
||||
minElement.classList.add("fn__none");
|
||||
} else {
|
||||
minElement.classList.remove("fn__none")
|
||||
minElement.classList.remove("fn__none");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -379,7 +379,7 @@ export class Outline extends Model {
|
|||
if ((item.action === "update" || item.action === "insert") &&
|
||||
(item.data.indexOf('data-type="NodeHeading"') > -1 || item.data.indexOf(`<div contenteditable="true" spellcheck="${window.siyuan.config.editor.spellcheck}"><wbr></div>`) > -1)) {
|
||||
needReload = true;
|
||||
return true
|
||||
return true;
|
||||
} else if (item.action === "delete" || item.action === "move") {
|
||||
needReload = true;
|
||||
return true;
|
||||
|
|
|
@ -455,7 +455,7 @@ export class Dock {
|
|||
return;
|
||||
}
|
||||
// 关系图全屏不应该退出 & https://github.com/siyuan-note/siyuan/issues/11775
|
||||
const fullscreenElement = this.layout.element.querySelector(".fullscreen")
|
||||
const fullscreenElement = this.layout.element.querySelector(".fullscreen");
|
||||
if (fullscreenElement && fullscreenElement.clientHeight > 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -654,7 +654,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
protyle.toolbar.showContent(protyle, range, nodeElement);
|
||||
/// #else
|
||||
const oldHTML = nodeElement.outerHTML;
|
||||
const id = nodeElement.getAttribute("data-node-id")
|
||||
const id = nodeElement.getAttribute("data-node-id");
|
||||
if (range.toString() !== "" || (range.cloneContents().childNodes[0] as HTMLElement)?.classList?.contains("emoji")) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconCopy",
|
||||
|
@ -1632,7 +1632,7 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
|
|||
y: rect.top + 26,
|
||||
h: 26
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement: HTMLElement, protyle: IProtyle, id: string, nodeElement: HTMLElement, html: string) => {
|
||||
return {
|
||||
|
@ -1874,7 +1874,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
});
|
||||
const menus: IMenu[] = [];
|
||||
menus.push(...otherMenus)
|
||||
menus.push(...otherMenus);
|
||||
menus.push({
|
||||
type: "separator"
|
||||
});
|
||||
|
@ -1950,7 +1950,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
return true;
|
||||
}
|
||||
});
|
||||
const insertMenus = []
|
||||
const insertMenus = [];
|
||||
insertMenus.push({
|
||||
icon: "iconBefore",
|
||||
label: window.siyuan.languages.insertRowAbove,
|
||||
|
@ -1989,8 +1989,8 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
}
|
||||
});
|
||||
}
|
||||
menus.push(...insertMenus)
|
||||
const other2Menus: IMenu[] = []
|
||||
menus.push(...insertMenus);
|
||||
const other2Menus: IMenu[] = [];
|
||||
if (((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&
|
||||
(!previousHasNone || (previousHasNone && !previousHasRowSpan && previousHasColSpan))) ||
|
||||
((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&
|
||||
|
@ -2052,7 +2052,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:
|
|||
type: "separator"
|
||||
});
|
||||
}
|
||||
const removeMenus = []
|
||||
const removeMenus = [];
|
||||
if (cellElement.parentElement.parentElement.tagName !== "THEAD" &&
|
||||
((!hasNone && !hasRowSpan) || (hasNone && !hasRowSpan && hasColSpan))) {
|
||||
removeMenus.push({
|
||||
|
|
|
@ -23,7 +23,6 @@ import {focusBlock, focusByRange, getEditorRange} from "../util/selection";
|
|||
import {hideElements} from "../ui/hideElements";
|
||||
import {highlightRender} from "../render/highlightRender";
|
||||
import {blockRender} from "../render/blockRender";
|
||||
import {removeEmbed} from "../wysiwyg/removeEmbed";
|
||||
import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";
|
||||
import * as dayjs from "dayjs";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
|
@ -90,24 +89,24 @@ export class Gutter {
|
|||
selectElements.push(item);
|
||||
});
|
||||
} else {
|
||||
const gutterId = buttonElement.getAttribute("data-node-id")
|
||||
const gutterId = buttonElement.getAttribute("data-node-id");
|
||||
selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||
let selectedIncludeGutter = false;
|
||||
selectElements.forEach((item => {
|
||||
const itemId = item.getAttribute("data-node-id")
|
||||
const itemId = item.getAttribute("data-node-id");
|
||||
if (itemId === gutterId) {
|
||||
selectedIncludeGutter = true
|
||||
selectedIncludeGutter = true;
|
||||
}
|
||||
selectIds.push(itemId);
|
||||
}))
|
||||
}));
|
||||
if (!selectedIncludeGutter) {
|
||||
const gutterNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${gutterId}"]`)
|
||||
const gutterNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${gutterId}"]`);
|
||||
if (gutterNodeElement) {
|
||||
selectElements.forEach((item => {
|
||||
item.classList.remove("protyle-wysiwyg--select")
|
||||
item.classList.remove("protyle-wysiwyg--select");
|
||||
}));
|
||||
gutterNodeElement.classList.add("protyle-wysiwyg--select")
|
||||
selectElements = [gutterNodeElement]
|
||||
gutterNodeElement.classList.add("protyle-wysiwyg--select");
|
||||
selectElements = [gutterNodeElement];
|
||||
selectIds = [gutterId];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ export class Title {
|
|||
event.stopPropagation();
|
||||
}
|
||||
} else if (event.key === "Enter") {
|
||||
const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild)
|
||||
const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild);
|
||||
if (editElment && editElment.textContent === "" && !protyle.wysiwyg.element.firstElementChild.classList.contains("av")) {
|
||||
// 配合提示文本使用,避免提示文本挤压到第二个块中
|
||||
focusBlock(protyle.wysiwyg.element.firstElementChild, protyle.wysiwyg.element);
|
||||
|
|
|
@ -132,7 +132,7 @@ ${getTypeByCellElement(item) === "block" ? ' data-detached="true"' : ""}><span c
|
|||
});
|
||||
let html = "";
|
||||
srcIDs.forEach((id) => {
|
||||
const blockCellElement = blockElement.querySelector(`[data-block-id="${id}"]`)
|
||||
const blockCellElement = blockElement.querySelector(`[data-block-id="${id}"]`);
|
||||
if (!blockCellElement) {
|
||||
html += `<div class="av__row" data-type="ghost" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
|
||||
${colHTML}
|
||||
|
|
|
@ -750,7 +750,7 @@ export class WYSIWYG {
|
|||
this.element.querySelectorAll("iframe").forEach(item => {
|
||||
item.style.pointerEvents = "none";
|
||||
});
|
||||
const needScroll = ["IMG", "VIDEO", "AUDIO"].includes(target.tagName) || target.classList.contains("img")
|
||||
const needScroll = ["IMG", "VIDEO", "AUDIO"].includes(target.tagName) || target.classList.contains("img");
|
||||
documentSelf.onmousemove = (moveEvent: MouseEvent) => {
|
||||
const moveTarget = moveEvent.target as HTMLElement;
|
||||
// table cell select
|
||||
|
|
|
@ -1182,7 +1182,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
|
||||
// h1 - h6 hotkey
|
||||
if (matchHotKey(window.siyuan.config.keymap.editor.heading.paragraph.custom, event)) {
|
||||
const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))
|
||||
const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||
if (selectsElement.length === 0) {
|
||||
selectsElement.push(nodeElement);
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
|
|||
if (previousElement) {
|
||||
if (previousElement.classList.contains("p") && getContenteditableElement(previousElement).textContent === "") {
|
||||
// 空块向后删除时移除改块 https://github.com/siyuan-note/siyuan/issues/11732
|
||||
const ppElement = getPreviousBlock(previousElement)
|
||||
const ppElement = getPreviousBlock(previousElement);
|
||||
transaction(protyle, [{
|
||||
action: "delete",
|
||||
id: previousElement.getAttribute("data-node-id"),
|
||||
|
|
|
@ -1144,7 +1144,7 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoO
|
|||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (needDebounce) {
|
||||
|
@ -1166,10 +1166,10 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoO
|
|||
// 插入块后会导致高度变化,从而产生再次定位 https://github.com/siyuan-note/siyuan/issues/11798
|
||||
doOperations.find(item => {
|
||||
if (item.action === "insert") {
|
||||
protyle.observerLoad?.disconnect()
|
||||
protyle.observerLoad?.disconnect();
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
const processFold = (operation: IOperation, protyle: IProtyle) => {
|
||||
|
@ -1225,7 +1225,7 @@ const processFold = (operation: IOperation, protyle: IProtyle) => {
|
|||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const updateTransaction = (protyle: IProtyle, id: string, newHTML: string, html: string) => {
|
||||
if (newHTML === html) {
|
||||
|
|
Loading…
Add table
Reference in a new issue