mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🚨
This commit is contained in:
parent
13ba672d1b
commit
2d348be542
7 changed files with 14 additions and 16 deletions
|
|
@ -8,7 +8,6 @@ import {Files} from "../layout/dock/Files";
|
|||
import {getDockByType} from "../layout/util";
|
||||
import {getAllModels} from "../layout/getAll";
|
||||
/// #endif
|
||||
import {getEventName} from "../protyle/util/compatibility";
|
||||
import {setNoteBook} from "../util/pathName";
|
||||
|
||||
export const getRandomEmoji = () => {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export class Menu {
|
|||
itemElement.classList.add("b3-menu__item--show");
|
||||
const rect = subMenuElement.getBoundingClientRect();
|
||||
let style = "";
|
||||
const leftPosition = rect.left - this.element.clientWidth - rect.width
|
||||
const leftPosition = rect.left - this.element.clientWidth - rect.width;
|
||||
if (rect.right > window.innerWidth && (
|
||||
leftPosition > 0 || Math.abs(leftPosition) < (rect.right - window.innerWidth))) {
|
||||
if (leftPosition >= 0) {
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
genImageWidthMenu(window.siyuan.languages.default, assetElement, imgElement, protyle, id, nodeElement, html),
|
||||
]
|
||||
}).element);
|
||||
const imgSrc = imgElement.getAttribute("src")
|
||||
const imgSrc = imgElement.getAttribute("src");
|
||||
if (imgSrc) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
openMenu(imgSrc);
|
||||
|
|
@ -822,7 +822,7 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
if (iframeSrc) {
|
||||
subMenus.push({
|
||||
type: "separator"
|
||||
})
|
||||
});
|
||||
return subMenus.concat(openMenu(iframeSrc, true) as IMenu[]);
|
||||
}
|
||||
return subMenus;
|
||||
|
|
@ -848,7 +848,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
|
|||
if (src.startsWith("assets/")) {
|
||||
subMenus.push({
|
||||
type: "separator"
|
||||
})
|
||||
});
|
||||
subMenus.push({
|
||||
label: window.siyuan.languages.rename,
|
||||
click() {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import {transaction, updateTransaction} from "./transaction";
|
|||
import {breakList, genListItemElement, listOutdent, updateListOrder} from "./list";
|
||||
import {hasClosestByMatchTag} from "../util/hasClosest";
|
||||
import {highlightRender} from "../markdown/highlightRender";
|
||||
import {setPosition} from "../../util/setPosition";
|
||||
import {Constants} from "../../constants";
|
||||
import {scrollCenter} from "../../util/highlightById";
|
||||
|
||||
|
|
|
|||
|
|
@ -1419,7 +1419,7 @@ export class WYSIWYG {
|
|||
const fileIds = fileElement.getAttribute("data-id").split("/");
|
||||
const linkAddress = `assets/${fileIds[1]}`;
|
||||
/// #if MOBILE
|
||||
openByMobile(linkAddress)
|
||||
openByMobile(linkAddress);
|
||||
/// #else
|
||||
if (window.siyuan.ctrlIsPressed) {
|
||||
openBy(linkAddress, "folder");
|
||||
|
|
@ -1461,7 +1461,7 @@ export class WYSIWYG {
|
|||
openBy(linkAddress, "app");
|
||||
}
|
||||
/// #else
|
||||
openByMobile(linkAddress)
|
||||
openByMobile(linkAddress);
|
||||
/// #endif
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1470,7 +1470,7 @@ export class WYSIWYG {
|
|||
showMessage(e);
|
||||
});
|
||||
/// #else
|
||||
openByMobile(linkAddress)
|
||||
openByMobile(linkAddress);
|
||||
/// #endif
|
||||
}
|
||||
/// #endif
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
|
|||
}
|
||||
let html = blockElement.outerHTML;
|
||||
let todoOldHTML = "";
|
||||
let focusHR = false
|
||||
let focusHR = false;
|
||||
if (editElement.textContent === "---" && !blockElement.classList.contains("code-block")) {
|
||||
html = `<div data-node-id="${id}" data-type="NodeThematicBreak" class="hr"><div></div></div>`;
|
||||
const nextBlockElement = getNextBlock(editElement);
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
protyle.toolbar.isNewEmptyInline = false;
|
||||
protyle.hint.enableEmoji = false;
|
||||
// 需使用 editabled,否则代码块会把语言字数算入
|
||||
const nodeEditableElement = getContenteditableElement(nodeElement) || nodeElement
|
||||
const nodeEditableElement = getContenteditableElement(nodeElement) || nodeElement;
|
||||
const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range);
|
||||
const tdElement = hasClosestByMatchTag(range.startContainer, "TD");
|
||||
if (event.key === "ArrowDown" && nodeEditableElement?.textContent.trimRight().substr(position.start).indexOf("\n") === -1 && (
|
||||
|
|
@ -594,14 +594,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
// 代码块或以软换行结尾的块移动光标 ↑ 会跳过 https://github.com/siyuan-note/siyuan/issues/5498
|
||||
if (getContenteditableElement(previousElement)?.textContent.endsWith("\n") && !foldElement) {
|
||||
focusBlock(previousElement, undefined, false);
|
||||
scrollCenter(protyle, previousElement)
|
||||
scrollCenter(protyle, previousElement);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
} else if (foldElement && foldElement.getAttribute("data-type") !== "NodeListItem") {
|
||||
// 遇到折叠块
|
||||
foldElement.scrollTop = 0;
|
||||
focusBlock(foldElement, undefined, true);
|
||||
scrollCenter(protyle, foldElement)
|
||||
scrollCenter(protyle, foldElement);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
|
@ -642,7 +642,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
nextElement = getFirstBlock(nextElement) as HTMLElement;
|
||||
}
|
||||
focusBlock(nextElement);
|
||||
scrollCenter(protyle, nextElement)
|
||||
scrollCenter(protyle, nextElement);
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
|
@ -651,7 +651,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
const nextFoldElement = getNextBlock(nodeElement) as HTMLElement;
|
||||
if (nextFoldElement && nextFoldElement.getAttribute("fold") === "1") {
|
||||
focusBlock(nextFoldElement);
|
||||
scrollCenter(protyle, nextFoldElement)
|
||||
scrollCenter(protyle, nextFoldElement);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
|
@ -1385,7 +1385,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (isNotEditBlock(nodeElement) && matchHotKey("⌘X", event)) {
|
||||
let html = "";
|
||||
nodeElement.classList.add("protyle-wysiwyg--select");
|
||||
const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")
|
||||
const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
|
||||
selectElements.forEach(item => {
|
||||
html += removeEmbed(item);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue