📱 repeat bind event

This commit is contained in:
Vanessa 2023-03-30 11:52:44 +08:00
parent 440e005267
commit 90a4270deb
5 changed files with 12 additions and 12 deletions

View file

@ -248,7 +248,8 @@ const bindProviderEvent = () => {
export const repos = {
element: undefined as Element,
genHTML: () => {
return `<div><div style="position: fixed;width: 800px;height: 434px;box-sizing: border-box;text-align: center;display: flex;align-items: center;justify-content: center;z-index: 1;" id="reposLoading">
return `<div>
<div style="position: fixed;width: 800px;height: 434px;box-sizing: border-box;text-align: center;display: flex;align-items: center;justify-content: center;z-index: 1;" id="reposLoading">
<img src="/stage/loading-pure.svg">
</div>
<label class="fn__flex b3-label config__item">
@ -371,7 +372,7 @@ export const repos = {
loadingElement.style.width = repos.element.clientWidth + "px";
loadingElement.style.height = repos.element.clientHeight + "px";
bindSyncCloudListEvent(syncConfigElement);
repos.element.addEventListener("click", (event) => {
repos.element.firstElementChild.addEventListener("click", (event) => {
const target = event.target as HTMLElement;
if (target.getAttribute("data-type") === "config") {
if (syncConfigElement.classList.contains("fn__none")) {

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") {

View file

@ -25,6 +25,7 @@ import {onGet} from "../util/onGet";
import {saveScroll} from "../scroll/saveScroll";
import {hideElements} from "../ui/hideElements";
import {confirmDialog} from "../../dialog/confirmDialog";
import {reloadProtyle} from "../util/reload";
export class Breadcrumb {
public element: HTMLElement;
@ -314,13 +315,7 @@ export class Breadcrumb {
accelerator: window.siyuan.config.keymap.editor.general.refresh.custom,
label: window.siyuan.languages.refresh,
click: () => {
fetchPost("/api/filetree/getDoc", {
id: protyle.block.showAll ? protyle.block.id : protyle.block.rootID,
mode: 0,
size: protyle.block.showAll ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
}, getResponse => {
onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true);
});
reloadProtyle(protyle);
}
}).element);
if (!isMobile()) {