diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index e219de63095..49610bdc998 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -14,6 +14,8 @@ import {focusByRange} from "../../util/selection";
import {writeText} from "../../util/compatibility";
import {showMessage} from "../../../dialog/message";
import {previewImage} from "../../preview/image";
+import {fetchPost} from "../../../util/fetch";
+import {pathPosix} from "../../../util/pathName";
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
const blockElement = hasClosestBlock(event.target);
@@ -190,6 +192,31 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.stopPropagation();
return true;
}
+
+ const createDocElement = hasClosestByAttribute(event.target, "data-type","createdoc");
+ if (createDocElement) {
+ // fetchPost("/api/filetree/createDocWithMd", {
+ // notebook: protyle.notebookId,
+ // path: pathPosix().join(pathString, realFileName),
+ // parentID: protyle.block.rootID,
+ // markdown: ""
+ // }, response => {
+ // transaction(protyle, [{
+ // action: "updateAttrViewCell",
+ // id: cellId,
+ // avID,
+ // keyID: colId,
+ // rowID,
+ // data: {
+ // isDetached: false
+ // }
+ // }]);
+ // });
+ event.preventDefault();
+ event.stopPropagation();
+ return true;
+ }
+
return false;
};
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 6d60b75f22b..986c17e42ae 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -343,14 +343,14 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
if (!type) {
type = cellElements[0].parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElements[0].getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
}
- if (type === "block") {
+ if (type === "block" && (cellElements.length > 0 || !cellElements[0].getAttribute("data-detached"))) {
return;
}
const cellRect = cellElements[0].getBoundingClientRect();
let html = "";
const style = `style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px;height: ${cellRect.height}px"`;
const blockElement = hasClosestBlock(cellElements[0]);
- if (["text", "url", "email", "phone"].includes(type)) {
+ if (["text", "url", "email", "phone", "block"].includes(type)) {
html = ``;
} else if (type === "number") {
html = ``;
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 8f9691d088f..614865aba24 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -70,8 +70,10 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '