mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🐛 聚焦列表 * 1
* 2,第一个列表项反向缩进后刷新会关闭页签
This commit is contained in:
parent
d5158ee9bd
commit
99ec37e78c
4 changed files with 11 additions and 8 deletions
|
|
@ -39,7 +39,6 @@ import {pushBack} from "../mobile/util/MobileBackFoward";
|
||||||
import {exportAsset} from "./util";
|
import {exportAsset} from "./util";
|
||||||
import {removeLink} from "../protyle/toolbar/Link";
|
import {removeLink} from "../protyle/toolbar/Link";
|
||||||
import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey";
|
import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey";
|
||||||
import {getEnableHTML} from "../protyle/wysiwyg/removeEmbed";
|
|
||||||
import {renameTag} from "../util/noRelyPCFunction";
|
import {renameTag} from "../util/noRelyPCFunction";
|
||||||
|
|
||||||
export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
|
|
@ -666,13 +665,13 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
openMenu(imgSrc, false, false);
|
openMenu(imgSrc, false, false);
|
||||||
}
|
}
|
||||||
window.siyuan.menus.menu.popup({x: position.clientX, y: position.clientY});
|
window.siyuan.menus.menu.popup({x: position.clientX, y: position.clientY});
|
||||||
const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea")
|
const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea");
|
||||||
textElements[0].focus();
|
textElements[0].focus();
|
||||||
window.siyuan.menus.menu.removeCB = () => {
|
window.siyuan.menus.menu.removeCB = () => {
|
||||||
imgElement.setAttribute("alt", textElements[2].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
|
imgElement.setAttribute("alt", textElements[2].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
|
||||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText = false) => {
|
export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText = false) => {
|
||||||
|
|
@ -824,7 +823,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
y: rect.top + 26,
|
y: rect.top + 26,
|
||||||
h: 26
|
h: 26
|
||||||
});
|
});
|
||||||
const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea")
|
const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea");
|
||||||
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {
|
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {
|
||||||
textElements[1].select();
|
textElements[1].select();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -846,7 +845,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
}
|
}
|
||||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import {hideElements} from "../ui/hideElements";
|
||||||
import {processRender} from "../util/processCode";
|
import {processRender} from "../util/processCode";
|
||||||
import {highlightRender} from "../markdown/highlightRender";
|
import {highlightRender} from "../markdown/highlightRender";
|
||||||
import {blockRender} from "../markdown/blockRender";
|
import {blockRender} from "../markdown/blockRender";
|
||||||
import {getEnableHTML, removeEmbed} from "../wysiwyg/removeEmbed";
|
import {removeEmbed} from "../wysiwyg/removeEmbed";
|
||||||
import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";
|
import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,8 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||||
const range = getEditorRange(protyle.wysiwyg.element);
|
const range = getEditorRange(protyle.wysiwyg.element);
|
||||||
if (siyuanHTML) {
|
if (siyuanHTML) {
|
||||||
// 编辑器内部粘贴
|
// 编辑器内部粘贴
|
||||||
const tempElement = document.createElement("div")
|
const tempElement = document.createElement("div");
|
||||||
tempElement.innerHTML = siyuanHTML
|
tempElement.innerHTML = siyuanHTML;
|
||||||
let isBlock = false;
|
let isBlock = false;
|
||||||
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
|
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
|
||||||
const newId = Lute.NewNodeID();
|
const newId = Lute.NewNodeID();
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,10 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
|
||||||
action: "delete",
|
action: "delete",
|
||||||
id: liId
|
id: liId
|
||||||
});
|
});
|
||||||
|
// 聚焦列表,第一个列表项反向缩进后刷新会关闭页签
|
||||||
|
if (liId === protyle.block.id) {
|
||||||
|
protyle.block.id = protyle.block.parentID;
|
||||||
|
}
|
||||||
undoOperations.splice(0, 0, {
|
undoOperations.splice(0, 0, {
|
||||||
action: "insert",
|
action: "insert",
|
||||||
data: movedHTML,
|
data: movedHTML,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue