🎨 resize

This commit is contained in:
Vanessa 2023-07-16 20:59:14 +08:00
parent de68e10ec9
commit ec6ced8408
4 changed files with 17 additions and 9 deletions

View File

@ -108,6 +108,8 @@
flex-direction: row-reverse; flex-direction: row-reverse;
box-sizing: border-box; box-sizing: border-box;
opacity: 0; opacity: 0;
line-height: 26px;
overflow: hidden;
&.av__calc--ashow { &.av__calc--ashow {
opacity: 1; opacity: 1;

View File

@ -5,6 +5,7 @@
flex-direction: column; flex-direction: column;
box-sizing: border-box; box-sizing: border-box;
user-select: auto; user-select: auto;
overflow-x: auto;
.protyle-breadcrumb__bar { .protyle-breadcrumb__bar {
font-size: 14px; font-size: 14px;

View File

@ -339,11 +339,17 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC
const cellId = cellElement.getAttribute("data-id"); const cellId = cellElement.getAttribute("data-id");
const colId = cellElement.getAttribute("data-col-id"); const colId = cellElement.getAttribute("data-col-id");
const avID = blockElement.getAttribute("data-av-id"); const avID = blockElement.getAttribute("data-av-id");
let inputValue: string | number = (avMaskElement.querySelector(".b3-text-field") as HTMLInputElement).value; const inputValue: { content: string | number, isNotEmpty?: boolean } = {
let oldValue: string | number = cellElement.textContent.trim(); content: (avMaskElement.querySelector(".b3-text-field") as HTMLInputElement).value
};
const oldValue: { content: string | number, isNotEmpty?: boolean } = {
content: cellElement.textContent.trim()
};
if (type === "number") { if (type === "number") {
inputValue = parseFloat(inputValue); oldValue.content = parseFloat(oldValue.content as string);
oldValue = parseFloat(oldValue); oldValue.isNotEmpty = !!oldValue.content
inputValue.content = parseFloat(inputValue.content as string);
inputValue.isNotEmpty = !!inputValue.content
} }
transaction(protyle, [{ transaction(protyle, [{
action: "updateAttrViewCell", action: "updateAttrViewCell",
@ -352,7 +358,7 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC
keyID: colId, keyID: colId,
rowID, rowID,
data: { data: {
[type]: {content: inputValue} [type]: inputValue
} }
}], [{ }], [{
action: "updateAttrViewCell", action: "updateAttrViewCell",
@ -361,7 +367,7 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC
keyID: colId, keyID: colId,
rowID, rowID,
data: { data: {
[type]: {content: oldValue} [type]: oldValue
} }
}]); }]);
setTimeout(() => { setTimeout(() => {

View File

@ -3,12 +3,11 @@ import {setPadding} from "../ui/initUI";
import {hasClosestBlock} from "./hasClosest"; import {hasClosestBlock} from "./hasClosest";
import {Constants} from "../../constants"; import {Constants} from "../../constants";
let resizeTimeout: number;
export const resize = (protyle: IProtyle) => { export const resize = (protyle: IProtyle) => {
hideElements(["gutter"], protyle); hideElements(["gutter"], protyle);
setPadding(protyle); setPadding(protyle);
clearTimeout(resizeTimeout); // 不能 clearTimeout否则 split 时左侧无法 resize
resizeTimeout = window.setTimeout(() => { window.setTimeout(() => {
if (typeof echarts !== "undefined") { if (typeof echarts !== "undefined") {
protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => { protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => {
const chartInstance = echarts.getInstanceById(chartItem.firstElementChild.nextElementSibling.getAttribute("_echarts_instance_")); const chartInstance = echarts.getInstanceById(chartItem.firstElementChild.nextElementSibling.getAttribute("_echarts_instance_"));