mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
This commit is contained in:
parent
d61ee623f9
commit
6d8b14bbf3
2 changed files with 15 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import {openMenuPanel} from "./openMenuPanel";
|
|||
import {getLabelByNumberFormat} from "./number";
|
||||
import {removeAttrViewColAnimation, updateAttrViewCellAnimation} from "./action";
|
||||
import {openEmojiPanel, unicode2Emoji} from "../../../emoji";
|
||||
import {focusBlock} from "../../util/selection";
|
||||
|
||||
export const duplicateCol = (options: {
|
||||
protyle: IProtyle,
|
||||
|
|
@ -426,6 +427,8 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
type,
|
||||
}]);
|
||||
updateAttrViewCellAnimation(cellElement);
|
||||
// https://github.com/siyuan-note/siyuan/issues/9862
|
||||
focusBlock(blockElement);
|
||||
});
|
||||
menu.addItem({
|
||||
iconHTML: `<span style="align-self: center;margin-right: 8px;width: 14px;" class="block__icon block__icon--show">${cellElement.dataset.icon ? unicode2Emoji(cellElement.dataset.icon) : `<svg><use xlink:href="#${getColIconByType(type)}"></use></svg>`}</span>`,
|
||||
|
|
@ -466,6 +469,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
|||
}
|
||||
if (event.key === "Enter") {
|
||||
menu.close();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import * as dayjs from "dayjs";
|
|||
import {unicode2Emoji} from "../../../emoji";
|
||||
import {focusBlock} from "../../util/selection";
|
||||
import {isMac} from "../../util/compatibility";
|
||||
import {hasClosestByClassName} from "../../util/hasClosest";
|
||||
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
|
||||
import {stickyRow} from "./row";
|
||||
import {getCalcValue} from "./calc";
|
||||
|
||||
|
|
@ -303,6 +303,16 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||
focusBlock(e);
|
||||
}
|
||||
}
|
||||
if (getSelection().rangeCount > 0) {
|
||||
// 修改表头后光标重新定位
|
||||
const range = getSelection().getRangeAt(0)
|
||||
if (!hasClosestByClassName(range.startContainer, "av__title")) {
|
||||
const blockElement = hasClosestBlock(range.startContainer)
|
||||
if (blockElement && e.isSameNode(blockElement)) {
|
||||
focusBlock(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
e.querySelector(".layout-tab-bar").scrollLeft = (e.querySelector(".layout-tab-bar .item--focus") as HTMLElement).offsetLeft;
|
||||
if (cb) {
|
||||
cb();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue