mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-30 12:15:16 +01:00
📱
This commit is contained in:
parent
f8c1f60fd4
commit
a21e51fa19
1 changed files with 11 additions and 2 deletions
|
|
@ -1,15 +1,24 @@
|
|||
import {getEventName} from "../../protyle/util/compatibility";
|
||||
import {listIndent, listOutdent} from "../../protyle/wysiwyg/list";
|
||||
import {hasClosestBlock, hasClosestByMatchTag} from "../../protyle/util/hasClosest";
|
||||
import {insertEmptyBlock} from "../../block/util";
|
||||
import {moveToDown, moveToUp} from "../../protyle/wysiwyg/move";
|
||||
import {Constants} from "../../constants";
|
||||
import {focusByRange} from "../../protyle/util/selection";
|
||||
import {scrollCenter} from "../../util/highlightById";
|
||||
|
||||
export const showKeyboardToolbar = (bottom = 0) => {
|
||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||
toolbarElement.classList.remove("fn__none");
|
||||
toolbarElement.style.bottom = bottom + "px";
|
||||
let range: Range;
|
||||
if (getSelection().rangeCount > 0) {
|
||||
range = getSelection().getRangeAt(0);
|
||||
}
|
||||
if (!range || !window.siyuan.mobileEditor ||
|
||||
!window.siyuan.mobileEditor.protyle.wysiwyg.element.contains(range.startContainer)) {
|
||||
return;
|
||||
}
|
||||
scrollCenter(window.siyuan.mobileEditor.protyle);
|
||||
};
|
||||
|
||||
export const hideKeyboardToolbar = () => {
|
||||
|
|
@ -75,7 +84,7 @@ export const initKeyboardToolbar = () => {
|
|||
if (type === "clear") {
|
||||
if (range.toString()) {
|
||||
protyle.toolbar.setInlineMark(protyle, "clear", "toolbar");
|
||||
} else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.tagName === "SPAN"){
|
||||
} else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.tagName === "SPAN") {
|
||||
range.setStartAfter(range.startContainer.parentElement);
|
||||
range.collapse(false);
|
||||
range.insertNode(document.createTextNode(Constants.ZWSP));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue