This commit is contained in:
Vanessa 2023-09-28 17:25:18 +08:00
parent ee6c493fb0
commit ceb9aef1d6
3 changed files with 7 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {openMenuPanel} from "./openMenuPanel";
import {Menu} from "../../../plugin/Menu";
import {updateAttrViewCellAnimation} from "./action";
import {isCtrl} from "../../util/compatibility";
export const getCalcValue = (column: IAVColumn) => {
if (!column.calc || !column.calc.result) {
@ -380,7 +381,8 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
if (event.isComposing) {
return;
}
if (event.key === "Escape" || event.key === "Enter") {
if (event.key === "Escape" ||
(event.key === "Enter" && !event.shiftKey && !isCtrl(event))) {
updateCellValue(protyle, type, cellElements);
event.preventDefault();
event.stopPropagation();
@ -400,7 +402,7 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
const avid = cellElements[0].parentElement.dataset.avid;
cellElements[0] = protyle.wysiwyg.element.querySelector(`[data-av-id="${avid}"] .av__row--add`).previousElementSibling.querySelector('[data-detached="true"]')
}
if ( cellElements.length === 1 && cellElements[0].dataset.detached === "true" && !cellElements[0].parentElement.dataset.id) {
if (cellElements.length === 1 && cellElements[0].dataset.detached === "true" && !cellElements[0].parentElement.dataset.id) {
return;
}
const blockElement = hasClosestBlock(cellElements[0]);

View file

@ -507,8 +507,8 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
menu.addSeparator();
}
menu.addItem({
label: `<div class="fn__flex" style="margin: 4px 0"><span>${window.siyuan.languages.wrap}</span><span class="fn__space fn__flex-1"></span>
<input type="checkbox" class="b3-switch fn__flex-center"${cellElement.style.whiteSpace === "nowrap" ? "" : " checked"}></div>`,
label: `<label class="fn__flex" style="margin: 4px 0"><span>${window.siyuan.languages.wrap}</span><span class="fn__space fn__flex-1"></span>
<input type="checkbox" class="b3-switch fn__flex-center"${cellElement.style.whiteSpace === "nowrap" ? "" : " checked"}></label>`,
bind(element) {
const inputElement = element.querySelector("input") as HTMLInputElement;
inputElement.addEventListener("change", () => {

View file

@ -115,7 +115,7 @@ ${cell.valueType === "block" ? 'data-block-id="' + (cell.value.block.id || "") +
${cell.value?.isDetached ? ' data-detached="true"' : ""}
style="width: ${data.columns[index].width || "200px"};
${cell.bgColor ? `background-color:${cell.bgColor};` : ""}
${data.columns[index].wrap ? "" : "white-space: nowrap;"}
white-space: ${data.columns[index].wrap ? "pre-wrap" : "nowrap"};
${cell.valueType !== "number" ? "" : "flex-direction: row-reverse;"}
${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
});