🚨
This commit is contained in:
parent
d3287a5184
commit
ef5835a6c7
8 changed files with 34 additions and 35 deletions
|
@ -53,10 +53,10 @@ export const cancelSB = (protyle: IProtyle, nodeElement: Element) => {
|
|||
doOperations.forEach(item => {
|
||||
const element = protyle.wysiwyg.element.querySelector(`[data-node-id="${item.id}"]`);
|
||||
if (element && element.getAttribute("data-type") === "NodeBlockQueryEmbed") {
|
||||
element.removeAttribute("data-render")
|
||||
blockRender(protyle, element)
|
||||
element.removeAttribute("data-render");
|
||||
blockRender(protyle, element);
|
||||
}
|
||||
})
|
||||
});
|
||||
return {
|
||||
doOperations, undoOperations, previousId
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ import {listIndent, listOutdent} from "../../protyle/wysiwyg/list";
|
|||
import {hasClosestBlock, hasClosestByClassName, hasClosestByMatchTag} from "../../protyle/util/hasClosest";
|
||||
import {moveToDown, moveToUp} from "../../protyle/wysiwyg/move";
|
||||
import {Constants} from "../../constants";
|
||||
import {focusByRange, getEditorRange, getSelectionPosition} from "../../protyle/util/selection";
|
||||
import {focusByRange, getSelectionPosition} from "../../protyle/util/selection";
|
||||
import {removeBlock} from "../../protyle/wysiwyg/remove";
|
||||
import {hintSlash} from "../../protyle/hint/extend";
|
||||
|
||||
|
@ -12,22 +12,22 @@ let showKeyboardToolbarUtil = false;
|
|||
const renderSlashMenu = (protyle: IProtyle, toolbarElement: Element) => {
|
||||
protyle.hint.splitChar = "/";
|
||||
protyle.hint.lastIndex = -1;
|
||||
const utilElement = toolbarElement.querySelector(".keyboard__util") as HTMLElement
|
||||
utilElement.innerHTML = protyle.hint.getHTMLByData(hintSlash("", protyle), false)
|
||||
const utilElement = toolbarElement.querySelector(".keyboard__util") as HTMLElement;
|
||||
utilElement.innerHTML = protyle.hint.getHTMLByData(hintSlash("", protyle), false);
|
||||
protyle.hint.bindUploadEvent(protyle, utilElement);
|
||||
}
|
||||
};
|
||||
|
||||
const renderKeyboardToolbarUtil = () => {
|
||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||
const keyboardHeight = (parseInt(toolbarElement.getAttribute("data-keyboardheight")) + 42) + "px"
|
||||
toolbarElement.style.height = keyboardHeight
|
||||
window.siyuan.mobile.editor.protyle.element.style.marginBottom = keyboardHeight
|
||||
const keyboardHeight = (parseInt(toolbarElement.getAttribute("data-keyboardheight")) + 42) + "px";
|
||||
toolbarElement.style.height = keyboardHeight;
|
||||
window.siyuan.mobile.editor.protyle.element.style.marginBottom = keyboardHeight;
|
||||
window.siyuan.menus.menu.remove();
|
||||
showKeyboardToolbarUtil = true;
|
||||
setTimeout(() => {
|
||||
showKeyboardToolbarUtil = false
|
||||
}, 1000)
|
||||
}
|
||||
showKeyboardToolbarUtil = false;
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const renderKeyboardToolbar = () => {
|
||||
clearTimeout(renderKeyboardToolbarTimeout);
|
||||
|
@ -36,10 +36,10 @@ const renderKeyboardToolbar = () => {
|
|||
return;
|
||||
}
|
||||
hideKeyboardToolbarUtil();
|
||||
if (window.innerHeight + 200 > ((window.orientation === 90 || window.orientation === -90) ? screen.width : screen.height)) {
|
||||
hideKeyboardToolbar();
|
||||
return;
|
||||
}
|
||||
// if (window.innerHeight + 200 > ((window.orientation === 90 || window.orientation === -90) ? screen.width : screen.height)) {
|
||||
// hideKeyboardToolbar();
|
||||
// return;
|
||||
// }
|
||||
|
||||
const dynamicElements = document.querySelectorAll("#keyboardToolbar .keyboard__dynamic");
|
||||
const range = getSelection().getRangeAt(0);
|
||||
|
@ -62,7 +62,7 @@ const renderKeyboardToolbar = () => {
|
|||
}
|
||||
const nodeElement = hasClosestBlock(range.startContainer);
|
||||
if (nodeElement) {
|
||||
const indentElement = dynamicElements[0].querySelector('[data-type="indent"]')
|
||||
const indentElement = dynamicElements[0].querySelector('[data-type="indent"]');
|
||||
if (nodeElement.parentElement.classList.contains("li")) {
|
||||
indentElement.classList.remove("fn__none");
|
||||
indentElement.nextElementSibling.classList.remove("fn__none");
|
||||
|
@ -75,7 +75,7 @@ const renderKeyboardToolbar = () => {
|
|||
}
|
||||
}
|
||||
if (selectText && isProtyle) {
|
||||
dynamicElements[1].querySelectorAll('.protyle-toolbar__item--current').forEach(item => {
|
||||
dynamicElements[1].querySelectorAll(".protyle-toolbar__item--current").forEach(item => {
|
||||
item.classList.remove("protyle-toolbar__item--current");
|
||||
});
|
||||
const types = protyle.toolbar.getCurrentType();
|
||||
|
@ -97,16 +97,16 @@ const renderKeyboardToolbar = () => {
|
|||
};
|
||||
|
||||
const hideKeyboardToolbarUtil = () => {
|
||||
document.getElementById("keyboardToolbar").style.height = ""
|
||||
window.siyuan.mobile.editor.protyle.element.style.marginBottom = ""
|
||||
}
|
||||
document.getElementById("keyboardToolbar").style.height = "";
|
||||
window.siyuan.mobile.editor.protyle.element.style.marginBottom = "";
|
||||
};
|
||||
|
||||
export const showKeyboardToolbar = (height: number) => {
|
||||
if (getSelection().rangeCount === 0 || window.siyuan.config.editor.readOnly || window.siyuan.config.readonly) {
|
||||
return;
|
||||
}
|
||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||
toolbarElement.setAttribute("data-keyboardheight", height.toString())
|
||||
toolbarElement.setAttribute("data-keyboardheight", height.toString());
|
||||
hideKeyboardToolbarUtil();
|
||||
if (!toolbarElement.classList.contains("fn__none")) {
|
||||
return;
|
||||
|
|
|
@ -29,7 +29,6 @@ import {openFileById} from "../../editor/util";
|
|||
import {openMobileFileById} from "../../mobile/editor";
|
||||
import {getIconByType} from "../../editor/getIcon";
|
||||
import {processRender} from "../util/processCode";
|
||||
import {getEventName} from "../util/compatibility";
|
||||
import {Dialog} from "../../dialog";
|
||||
import {isMobile} from "../../util/functions";
|
||||
|
||||
|
@ -245,7 +244,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
|||
if (hasSearch) {
|
||||
hintsHTML = hintsHTML + "</div>";
|
||||
}
|
||||
return hintsHTML
|
||||
return hintsHTML;
|
||||
}
|
||||
|
||||
public genHTML(data: IHintData[], protyle: IProtyle, hide = false, hasSearch = false) {
|
||||
|
|
|
@ -36,7 +36,7 @@ export const blockRender = (protyle: IProtyle, element: Element, top?: number) =
|
|||
breadcrumb = window.siyuan.config.editor.embedBlockBreadcrumb;
|
||||
}
|
||||
// https://github.com/siyuan-note/siyuan/issues/7575
|
||||
const sbElement = hasTopClosestByClassName(item, "sb")
|
||||
const sbElement = hasTopClosestByClassName(item, "sb");
|
||||
if (sbElement) {
|
||||
breadcrumb = false;
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ export class Toolbar {
|
|||
item.replaceWith(spanElement);
|
||||
});
|
||||
}
|
||||
const toolbarElement = isMobile() ? document.querySelector("#keyboardToolbar .keyboard__dynamic") : this.element
|
||||
const toolbarElement = isMobile() ? document.querySelector("#keyboardToolbar .keyboard__dynamic") : this.element;
|
||||
const actionBtn = action === "toolbar" ? toolbarElement.querySelector(`[data-type="${type}"]`) : undefined;
|
||||
const newNodes: Node[] = [];
|
||||
|
||||
|
|
|
@ -825,13 +825,13 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
// 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
|
||||
sourceElements.forEach(item => {
|
||||
if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") {
|
||||
item.removeAttribute("data-render")
|
||||
blockRender(protyle, item)
|
||||
item.removeAttribute("data-render");
|
||||
blockRender(protyle, item);
|
||||
}
|
||||
})
|
||||
});
|
||||
if (targetElement.getAttribute("data-type") === "NodeBlockQueryEmbed") {
|
||||
targetElement.removeAttribute("data-render")
|
||||
blockRender(protyle, targetElement)
|
||||
targetElement.removeAttribute("data-render");
|
||||
blockRender(protyle, targetElement);
|
||||
}
|
||||
}
|
||||
} else if (event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE)?.split("-").length > 1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {hideElements} from "../ui/hideElements";
|
||||
import {copyPlainText, getEventName, isCtrl, isMac, writeText} from "../util/compatibility";
|
||||
import {copyPlainText, isCtrl, isMac, writeText} from "../util/compatibility";
|
||||
import {
|
||||
focusBlock,
|
||||
focusByRange,
|
||||
|
|
|
@ -730,8 +730,8 @@ export const turnsIntoOneTransaction = (options: {
|
|||
}
|
||||
// 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
|
||||
if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") {
|
||||
item.removeAttribute("data-render")
|
||||
blockRender(options.protyle, item)
|
||||
item.removeAttribute("data-render");
|
||||
blockRender(options.protyle, item);
|
||||
}
|
||||
});
|
||||
transaction(options.protyle, doOperations, undoOperations);
|
||||
|
|
Loading…
Add table
Reference in a new issue