mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
This commit is contained in:
parent
ee6c493fb0
commit
ceb9aef1d6
3 changed files with 7 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
|
||||||
import {openMenuPanel} from "./openMenuPanel";
|
import {openMenuPanel} from "./openMenuPanel";
|
||||||
import {Menu} from "../../../plugin/Menu";
|
import {Menu} from "../../../plugin/Menu";
|
||||||
import {updateAttrViewCellAnimation} from "./action";
|
import {updateAttrViewCellAnimation} from "./action";
|
||||||
|
import {isCtrl} from "../../util/compatibility";
|
||||||
|
|
||||||
export const getCalcValue = (column: IAVColumn) => {
|
export const getCalcValue = (column: IAVColumn) => {
|
||||||
if (!column.calc || !column.calc.result) {
|
if (!column.calc || !column.calc.result) {
|
||||||
|
|
@ -380,7 +381,8 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
|
||||||
if (event.isComposing) {
|
if (event.isComposing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.key === "Escape" || event.key === "Enter") {
|
if (event.key === "Escape" ||
|
||||||
|
(event.key === "Enter" && !event.shiftKey && !isCtrl(event))) {
|
||||||
updateCellValue(protyle, type, cellElements);
|
updateCellValue(protyle, type, cellElements);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
@ -400,7 +402,7 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
|
||||||
const avid = cellElements[0].parentElement.dataset.avid;
|
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"]')
|
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;
|
return;
|
||||||
}
|
}
|
||||||
const blockElement = hasClosestBlock(cellElements[0]);
|
const blockElement = hasClosestBlock(cellElements[0]);
|
||||||
|
|
|
||||||
|
|
@ -507,8 +507,8 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
}
|
}
|
||||||
menu.addItem({
|
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>
|
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"}></div>`,
|
<input type="checkbox" class="b3-switch fn__flex-center"${cellElement.style.whiteSpace === "nowrap" ? "" : " checked"}></label>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
const inputElement = element.querySelector("input") as HTMLInputElement;
|
const inputElement = element.querySelector("input") as HTMLInputElement;
|
||||||
inputElement.addEventListener("change", () => {
|
inputElement.addEventListener("change", () => {
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ ${cell.valueType === "block" ? 'data-block-id="' + (cell.value.block.id || "") +
|
||||||
${cell.value?.isDetached ? ' data-detached="true"' : ""}
|
${cell.value?.isDetached ? ' data-detached="true"' : ""}
|
||||||
style="width: ${data.columns[index].width || "200px"};
|
style="width: ${data.columns[index].width || "200px"};
|
||||||
${cell.bgColor ? `background-color:${cell.bgColor};` : ""}
|
${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.valueType !== "number" ? "" : "flex-direction: row-reverse;"}
|
||||||
${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue