📱 repeat bind event

This commit is contained in:
Vanessa 2023-03-30 11:52:44 +08:00 committed by Liang Ding
parent 8d461d9481
commit efffc97bec
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
5 changed files with 12 additions and 12 deletions

View file

@ -13,6 +13,7 @@ import {hideElements} from "../protyle/ui/hideElements";
import {pushBack} from "./util/MobileBackFoward";
import {setStorageVal} from "../protyle/util/compatibility";
import {showMessage} from "../dialog/message";
import {saveScroll} from "../protyle/scroll/saveScroll";
export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) => {
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id, action};
@ -44,6 +45,7 @@ export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) =
return;
}
if (window.siyuan.mobile.editor) {
saveScroll(window.siyuan.mobile.editor.protyle);
pushBack();
addLoading(window.siyuan.mobile.editor.protyle);
fetchPost("/api/filetree/getDoc", {

View file

@ -20,7 +20,7 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
icon: "iconList",
html: `<ul class="b3-list b3-list--mobile">${html}</ul>`,
bindEvent(element: HTMLElement) {
element.addEventListener("click", (event) => {
element.firstElementChild.addEventListener("click", (event) => {
const liElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");
if (liElement) {
openMobileFileById(liElement.dataset.nodeId, [Constants.CB_GET_SCROLL])

View file

@ -18,7 +18,8 @@ export const initAbout = () => {
openModel({
title: window.siyuan.languages.about,
icon: "iconInfo",
html: `<div class="b3-label fn__flex${window.siyuan.config.readonly ? " fn__none" : ""}">
html: `<div>
<div class="b3-label fn__flex${window.siyuan.config.readonly ? " fn__none" : ""}">
<div class="fn__flex-1">
${window.siyuan.languages.about11}
<div class="b3-label__text">${window.siyuan.languages.about12}</div>
@ -131,12 +132,13 @@ export const initAbout = () => {
</div>
<div style="color:var(--b3-theme-surface);font-family: cursive;">&nbsp;</div>
${window.siyuan.languages.about1}
</div>
</div>`,
bindEvent(modelMainElement: HTMLElement) {
const workspaceDirElement = modelMainElement.querySelector("#workspaceDir");
genWorkspace(workspaceDirElement);
const importKeyElement = modelMainElement.querySelector("#importKey");
modelMainElement.addEventListener("click", (event) => {
modelMainElement.firstElementChild.addEventListener("click", (event) => {
let target = event.target as HTMLElement;
while (target && !target.isSameNode(modelMainElement)) {
if (target.id === "authCode") {