|
@@ -8,7 +8,7 @@ import {
|
|
|
} from "./hasClosest";
|
|
|
import {Constants} from "../../constants";
|
|
|
import {paste} from "./paste";
|
|
|
-import {cancelSB, genEmptyElement, genSBElement} from "../../block/util";
|
|
|
+import {cancelSB, genEmptyElement, genSBElement, insertEmptyBlock} from "../../block/util";
|
|
|
import {transaction} from "../wysiwyg/transaction";
|
|
|
import {getTopAloneElement} from "../wysiwyg/getBlock";
|
|
|
import {updateListOrder} from "../wysiwyg/list";
|
|
@@ -806,8 +806,19 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|
|
const sourceElements: Element[] = [];
|
|
|
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP);
|
|
|
const selectedIds = gutterTypes[2].split(",");
|
|
|
+ if (event.altKey || event.shiftKey) {
|
|
|
+ if (event.y > protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().bottom) {
|
|
|
+ insertEmptyBlock(protyle, "afterend", protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"));
|
|
|
+ } else {
|
|
|
+ const range = getRangeByPoint(event.clientX, event.clientY);
|
|
|
+ if (hasClosestByAttribute(range.startContainer, "data-type", "NodeBlockQueryEmbed")) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ focusByRange(range);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (event.altKey) {
|
|
|
- focusByRange(getRangeByPoint(event.clientX, event.clientY));
|
|
|
let html = "";
|
|
|
for (let i = 0; i < selectedIds.length; i++) {
|
|
|
const response = await fetchSyncPost("/api/block/getRefText", {id: selectedIds[i]});
|
|
@@ -815,7 +826,6 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|
|
}
|
|
|
insertHTML(html, protyle);
|
|
|
} else if (event.shiftKey) {
|
|
|
- focusByRange(getRangeByPoint(event.clientX, event.clientY));
|
|
|
let html = "";
|
|
|
selectedIds.forEach(item => {
|
|
|
html += `{{select * from blocks where id='${item}'}}\n`;
|