mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-02 02:40:15 +01:00
This commit is contained in:
parent
a5417ec301
commit
3616462dff
1 changed files with 4 additions and 5 deletions
|
|
@ -22,7 +22,7 @@ const selectIsEditor = (editor: Element, range?: Range) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// table 选中处理
|
// table 选中处理
|
||||||
export const fixTableRange = (range:Range) => {
|
export const fixTableRange = (range: Range) => {
|
||||||
const tableElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeTable");
|
const tableElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeTable");
|
||||||
if (range.toString() !== "" && tableElement && range.commonAncestorContainer.nodeType !== 3) {
|
if (range.toString() !== "" && tableElement && range.commonAncestorContainer.nodeType !== 3) {
|
||||||
const parentTag = (range.commonAncestorContainer as Element).tagName;
|
const parentTag = (range.commonAncestorContainer as Element).tagName;
|
||||||
|
|
@ -521,10 +521,9 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
|
||||||
cursorElement = cellElements[cellElements.length - 1];
|
cursorElement = cellElements[cellElements.length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const range = getEditorRange(cursorElement);
|
// 需要定位到第一个 child https://github.com/siyuan-note/siyuan/issues/5930
|
||||||
range.selectNodeContents(cursorElement);
|
const range = setFirstNodeRange(cursorElement, getEditorRange(cursorElement))
|
||||||
range.collapse(toStart);
|
focusByRange(range)
|
||||||
focusByRange(range);
|
|
||||||
return range;
|
return range;
|
||||||
} else if (parentElement) {
|
} else if (parentElement) {
|
||||||
parentElement.focus();
|
parentElement.focus();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue