mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
70ab49f7aa
commit
40567de9fd
2 changed files with 0 additions and 19 deletions
|
|
@ -473,16 +473,6 @@ export const activeBlur = () => {
|
||||||
export const initKeyboardToolbar = () => {
|
export const initKeyboardToolbar = () => {
|
||||||
let preventRender = false;
|
let preventRender = false;
|
||||||
document.addEventListener("selectionchange", () => {
|
document.addEventListener("selectionchange", () => {
|
||||||
if (isInAndroid()) {
|
|
||||||
const range = document.getSelection().getRangeAt(0);
|
|
||||||
const editor = getCurrentEditor();
|
|
||||||
if (range.toString() && editor.protyle.wysiwyg.element.contains(range.startContainer) &&
|
|
||||||
range.getBoundingClientRect().top < editor.protyle.contentElement.getBoundingClientRect().top) {
|
|
||||||
window.siyuan.mobile.androidLastRange = range.cloneRange();
|
|
||||||
} else {
|
|
||||||
window.siyuan.mobile.androidLastRange = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!preventRender) {
|
if (!preventRender) {
|
||||||
renderKeyboardToolbar();
|
renderKeyboardToolbar();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,6 @@ const popSide = (render = true) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const handleTouchEnd = (event: TouchEvent, app: App) => {
|
export const handleTouchEnd = (event: TouchEvent, app: App) => {
|
||||||
if (isInAndroid() && window.siyuan.mobile.androidLastRange && getSelection().rangeCount>0) {
|
|
||||||
const range = getSelection().getRangeAt(0);
|
|
||||||
if (range.toString() && range.startContainer === window.siyuan.mobile.androidLastRange.startContainer) {
|
|
||||||
range.setStart(window.siyuan.mobile.androidLastRange.startContainer, window.siyuan.mobile.androidLastRange.startOffset);
|
|
||||||
focusByRange(range);
|
|
||||||
const editor = getCurrentEditor();
|
|
||||||
editor.protyle.toolbar.range = range;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isIPhone() && globalTouchEnd(event, yDiff, time, app)) {
|
if (isIPhone() && globalTouchEnd(event, yDiff, time, app)) {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue