mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 19:41:05 +08:00
This commit is contained in:
parent
5c21de0a0c
commit
d2b687f405
@ -227,11 +227,12 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 32px;
|
height: 42px;
|
||||||
background: var(--b3-theme-background);
|
background: var(--b3-theme-background);
|
||||||
z-index: 212;
|
z-index: 212;
|
||||||
display: flex;
|
display: flex;
|
||||||
border-top: 1px solid var(--b3-theme-surface-lighter);
|
border-top: 1px solid var(--b3-theme-surface-lighter);
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@ -239,10 +240,10 @@
|
|||||||
border: 0;
|
border: 0;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
height: 18px;
|
height: 16px;
|
||||||
width: 18px;
|
width: 16px;
|
||||||
padding: 4px;
|
padding: 5px;
|
||||||
margin: 4px;
|
margin: 3px;
|
||||||
color: var(--b3-theme-on-surface);
|
color: var(--b3-theme-on-surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
<button data-type="undo"><svg><use xlink:href="#iconUndo"></use></svg></button>
|
<button data-type="undo"><svg><use xlink:href="#iconUndo"></use></svg></button>
|
||||||
<button data-type="redo"><svg><use xlink:href="#iconRedo"></use></svg></button>
|
<button data-type="redo"><svg><use xlink:href="#iconRedo"></use></svg></button>
|
||||||
<span class="fn__flex-1"></span>
|
<span class="fn__flex-1"></span>
|
||||||
|
<button data-type="done"><svg><use xlink:href="#iconRedo"></use></svg></button>
|
||||||
</div>
|
</div>
|
||||||
<div id="transactionTip" class="fn__none"></div>
|
<div id="transactionTip" class="fn__none"></div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -17,7 +17,7 @@ import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
|||||||
import {MobileBacklinks} from "./MobileBacklinks";
|
import {MobileBacklinks} from "./MobileBacklinks";
|
||||||
import {MobileBookmarks} from "./MobileBookmarks";
|
import {MobileBookmarks} from "./MobileBookmarks";
|
||||||
import {MobileTags} from "./MobileTags";
|
import {MobileTags} from "./MobileTags";
|
||||||
import {hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar";
|
import {hideKeyboard, hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar";
|
||||||
import {getSearch} from "../../util/functions";
|
import {getSearch} from "../../util/functions";
|
||||||
import {syncGuide} from "../../sync/syncGuide";
|
import {syncGuide} from "../../sync/syncGuide";
|
||||||
|
|
||||||
@ -31,7 +31,9 @@ export const initFramework = () => {
|
|||||||
let backlink: MobileBacklinks;
|
let backlink: MobileBacklinks;
|
||||||
let bookmark: MobileBookmarks;
|
let bookmark: MobileBookmarks;
|
||||||
let tag: MobileTags;
|
let tag: MobileTags;
|
||||||
sidebarElement.querySelector(".toolbar--border").addEventListener(getEventName(), (event: Event & { target: Element }) => {
|
sidebarElement.querySelector(".toolbar--border").addEventListener(getEventName(), (event: Event & {
|
||||||
|
target: Element
|
||||||
|
}) => {
|
||||||
const svgElement = hasTopClosestByTag(event.target, "svg");
|
const svgElement = hasTopClosestByTag(event.target, "svg");
|
||||||
if (!svgElement || svgElement.classList.contains("toolbar__icon--active")) {
|
if (!svgElement || svgElement.classList.contains("toolbar__icon--active")) {
|
||||||
return;
|
return;
|
||||||
@ -74,7 +76,9 @@ export const initFramework = () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
window.siyuan.mobile.files = new MobileFiles();
|
window.siyuan.mobile.files = new MobileFiles();
|
||||||
document.getElementById("toolbarFile").addEventListener("click", () => {
|
document.getElementById("toolbarFile").addEventListener("click", (event) => {
|
||||||
|
hideKeyboardToolbar();
|
||||||
|
hideKeyboard();
|
||||||
sidebarElement.style.left = "0";
|
sidebarElement.style.left = "0";
|
||||||
document.querySelector(".scrim").classList.remove("fn__none");
|
document.querySelector(".scrim").classList.remove("fn__none");
|
||||||
const type = sidebarElement.querySelector(".toolbar--border .toolbar__icon--active").getAttribute("data-type");
|
const type = sidebarElement.querySelector(".toolbar--border .toolbar__icon--active").getAttribute("data-type");
|
||||||
@ -120,6 +124,15 @@ export const initFramework = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
if (navigator.userAgent.indexOf("iPhone") > -1 && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
||||||
|
// 不知道为什么 iPhone 中如果是编辑状态,点击文档后无法点击标题
|
||||||
|
setTimeout(() => {
|
||||||
|
editElement.dispatchEvent(new CustomEvent(getEventName()));
|
||||||
|
setTimeout(() => {
|
||||||
|
editElement.dispatchEvent(new CustomEvent(getEventName()));
|
||||||
|
}, Constants.TIMEOUT_INPUT);
|
||||||
|
}, Constants.TIMEOUT_INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
scrimElement.addEventListener(getEventName(), () => {
|
scrimElement.addEventListener(getEventName(), () => {
|
||||||
closePanel();
|
closePanel();
|
||||||
|
@ -16,6 +16,7 @@ import {Dialog} from "../../dialog";
|
|||||||
import {syncGuide} from "../../sync/syncGuide";
|
import {syncGuide} from "../../sync/syncGuide";
|
||||||
import {openCard} from "../../card/openCard";
|
import {openCard} from "../../card/openCard";
|
||||||
import {pathPosix} from "../../util/pathName";
|
import {pathPosix} from "../../util/pathName";
|
||||||
|
import {hideKeyboard, hideKeyboardToolbar} from "./showKeyboardToolbar";
|
||||||
|
|
||||||
const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) => {
|
const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) => {
|
||||||
closePanel();
|
closePanel();
|
||||||
@ -114,6 +115,8 @@ const genWorkspace = (workspaceDirElement: Element) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
export const popMenu = () => {
|
export const popMenu = () => {
|
||||||
|
hideKeyboard();
|
||||||
|
hideKeyboardToolbar();
|
||||||
const modelElement = document.getElementById("model");
|
const modelElement = document.getElementById("model");
|
||||||
const modelMainElement = document.getElementById("modelMain");
|
const modelMainElement = document.getElementById("modelMain");
|
||||||
const scrimElement = document.querySelector(".scrim");
|
const scrimElement = document.querySelector(".scrim");
|
||||||
|
@ -41,6 +41,10 @@ export const hideKeyboardToolbar = () => {
|
|||||||
toolbarElement.classList.add("fn__none");
|
toolbarElement.classList.add("fn__none");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const hideKeyboard = () => {
|
||||||
|
(document.activeElement as HTMLElement).blur();
|
||||||
|
};
|
||||||
|
|
||||||
export const initKeyboardToolbar = () => {
|
export const initKeyboardToolbar = () => {
|
||||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||||
toolbarElement.addEventListener("click", (event) => {
|
toolbarElement.addEventListener("click", (event) => {
|
||||||
@ -49,12 +53,16 @@ export const initKeyboardToolbar = () => {
|
|||||||
if (!buttonElement || !window.siyuan.mobile.editor) {
|
if (!buttonElement || !window.siyuan.mobile.editor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (window.siyuan.mobile.editor.protyle.disabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const type = buttonElement.getAttribute("data-type");
|
const type = buttonElement.getAttribute("data-type");
|
||||||
|
if (type === "done") {
|
||||||
|
hideKeyboard();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (window.siyuan.mobile.editor.protyle.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const protyle = window.siyuan.mobile.editor.protyle;
|
const protyle = window.siyuan.mobile.editor.protyle;
|
||||||
if (type === "undo") {
|
if (type === "undo") {
|
||||||
protyle.undo.undo(protyle);
|
protyle.undo.undo(protyle);
|
||||||
|
@ -214,8 +214,6 @@ export class Protyle {
|
|||||||
item.classList.remove("layout__wnd--active");
|
item.classList.remove("layout__wnd--active");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// #else
|
|
||||||
showKeyboardToolbar();
|
|
||||||
/// #endif
|
/// #endif
|
||||||
});
|
});
|
||||||
// 需等渲染完后再回调,用于定位搜索字段 https://github.com/siyuan-note/siyuan/issues/3171
|
// 需等渲染完后再回调,用于定位搜索字段 https://github.com/siyuan-note/siyuan/issues/3171
|
||||||
|
Loading…
Reference in New Issue
Block a user