This commit is contained in:
Vanessa 2022-09-03 11:20:36 +08:00
parent 3c48278df0
commit e02c071caa
3 changed files with 18 additions and 2 deletions

View file

@ -26,8 +26,11 @@ import {isMobile} from "../../util/functions";
import {confirmDialog} from "../../dialog/confirmDialog";
import {enableProtyle} from "../util/onGet";
import {countBlockWord} from "../../layout/status";
import {Constants} from "../../constants";
/// #if !MOBILE
import {openFileById} from "../../editor/util";
/// #endif
import {Constants} from "../../constants";
import {openMobileFileById} from "../../mobile/editor";
export class Gutter {
public element: HTMLElement;
@ -1184,10 +1187,14 @@ export class Gutter {
if (!protyle.block.showAll) {
const ids = protyle.path.split("/");
if (ids.length > 2) {
/// #if MOBILE
openMobileFileById(ids[ids.length - 2],[Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]);
/// #else
openFileById({
id: ids[ids.length - 2],
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]
});
/// #endif
}
} else {
zoomOut(protyle, protyle.block.parent2ID, id);

View file

@ -661,7 +661,7 @@ export class Toolbar {
pinData.styleH = textElement.style.height;
pinData.styleW = textElement.style.width;
} else {
this.subElement.style.width = "";
this.subElement.style.width = isMobile() ? "100vw" : "";
this.subElement.style.padding = "0";
}
this.subElement.innerHTML = `<div ${(isPin && this.subElement.firstElementChild.getAttribute("data-drag") === "true") ? 'data-drag="true"' : ""} class="block__popover--move"><div class="block__icons block__icons--border fn__flex">
@ -686,6 +686,10 @@ export class Toolbar {
<textarea spellcheck="false" class="b3-text-field b3-text-field--text fn__block" placeholder="${placeholder}" style="width:${isMobile() ? "80vw" : Math.max(480, renderElement.clientWidth * 0.7) + "px"};max-height:50vh"></textarea></div>`;
const autoHeight = () => {
textElement.style.height = textElement.scrollHeight + "px";
if (isMobile()) {
setPosition(this.subElement, 0, 0);
return;
}
if (this.subElement.firstElementChild.getAttribute("data-drag") === "true") {
if (textElement.getBoundingClientRect().bottom > window.innerHeight) {
this.subElement.style.top = window.innerHeight - this.subElement.clientHeight + "px";

View file

@ -64,6 +64,7 @@ import * as dayjs from "dayjs";
import {highlightRender} from "../markdown/highlightRender";
import {countBlockWord} from "../../layout/status";
import {insertHTML} from "../util/insertHTML";
import {openMobileFileById} from "../../mobile/editor";
export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
editorElement.addEventListener("keydown", async (event: KeyboardEvent & { target: HTMLElement }) => {
@ -411,10 +412,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (!protyle.block.showAll) {
const ids = protyle.path.split("/");
if (ids.length > 2) {
/// #if MOBILE
openMobileFileById(ids[ids.length - 2],[Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]);
/// #else
openFileById({
id: ids[ids.length - 2],
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]
});
/// #endif
}
} else {
zoomOut(protyle, protyle.block.parent2ID, nodeElement.getAttribute("data-node-id"));