🚨
This commit is contained in:
parent
1444f12f0d
commit
b1bb3f1fa6
5 changed files with 16 additions and 17 deletions
|
@ -1,5 +1,4 @@
|
|||
import {fetchPost} from "../../util/fetch";
|
||||
import {hasClosestByClassName} from "../../protyle/util/hasClosest";
|
||||
import {Dialog} from "../../dialog";
|
||||
import {objEquals} from "../../util/functions";
|
||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||
|
|
|
@ -583,7 +583,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
y: rect.top + 26,
|
||||
h: 26
|
||||
});
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app")
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app");
|
||||
if (!protyle.disabled) {
|
||||
window.siyuan.menus.menu.element.querySelector("input").select();
|
||||
window.siyuan.menus.menu.removeCB = () => {
|
||||
|
@ -1063,7 +1063,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
}
|
||||
|
||||
window.siyuan.menus.menu.popup({x: position.clientX, y: position.clientY});
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app")
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app");
|
||||
if (!protyle.disabled) {
|
||||
const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea");
|
||||
textElements[0].focus();
|
||||
|
@ -1250,7 +1250,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
y: rect.top + 26,
|
||||
h: 26
|
||||
});
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app")
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app");
|
||||
const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea");
|
||||
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {
|
||||
textElements[1].select();
|
||||
|
@ -1387,7 +1387,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
|||
y: rect.top + 26,
|
||||
h: 26
|
||||
});
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app")
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app");
|
||||
window.siyuan.menus.menu.element.querySelector("input").select();
|
||||
};
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ export class Gutter {
|
|||
window.siyuan.menus.menu.fullscreen();
|
||||
} else {
|
||||
window.siyuan.menus.menu.popup({x: event.clientX - 16, y: event.clientY - 16, isLeft: true});
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app")
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app");
|
||||
focusByRange(protyle.toolbar.range);
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ export class Gutter {
|
|||
if (!window.siyuan.ctrlIsPressed && !window.siyuan.altIsPressed && !window.siyuan.shiftIsPressed) {
|
||||
this.renderMenu(protyle, buttonElement);
|
||||
window.siyuan.menus.menu.popup({x: event.clientX - 16, y: event.clientY - 16, isLeft: true});
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app")
|
||||
window.siyuan.menus.menu.element.setAttribute("data-from", hasClosestByClassName(protyle.element, "block__edit") ? "popover" : "app");
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -589,7 +589,7 @@ export const renderCell = (cellValue: IAVCellValue, wrap: boolean) => {
|
|||
text += `<span ${cellValue.type !== "number" ? "" : 'style="right:auto;left:5px"'} data-type="copy" class="block__icon"><svg><use xlink:href="#iconCopy"></use></svg></span>`;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
export const updateHeaderCell = (cellElement: HTMLElement, headerValue: {
|
||||
icon?: string,
|
||||
|
@ -598,16 +598,16 @@ export const updateHeaderCell = (cellElement: HTMLElement, headerValue: {
|
|||
}) => {
|
||||
if (typeof headerValue.icon !== "undefined") {
|
||||
cellElement.dataset.icon = headerValue.icon;
|
||||
cellElement.querySelector(".av__cellheadericon").outerHTML = headerValue.icon ? unicode2Emoji(headerValue.icon, "av__cellheadericon", true) : `<svg class="av__cellheadericon"><use xlink:href="#${getColIconByType(cellElement.dataset.dtype as TAVCol)}"></use></svg>`
|
||||
cellElement.querySelector(".av__cellheadericon").outerHTML = headerValue.icon ? unicode2Emoji(headerValue.icon, "av__cellheadericon", true) : `<svg class="av__cellheadericon"><use xlink:href="#${getColIconByType(cellElement.dataset.dtype as TAVCol)}"></use></svg>`;
|
||||
}
|
||||
if (typeof headerValue.name !== "undefined") {
|
||||
cellElement.querySelector(".av__celltext").textContent = headerValue.name;
|
||||
}
|
||||
if (typeof headerValue.pin !== "undefined") {
|
||||
const textElement = cellElement.querySelector(".av__celltext")
|
||||
const textElement = cellElement.querySelector(".av__celltext");
|
||||
if (headerValue.pin) {
|
||||
if (!textElement.nextElementSibling) {
|
||||
textElement.insertAdjacentHTML("afterend", '<div class="fn__flex-1"></div><svg class="av__cellheadericon"><use xlink:href="#iconPin"></use></svg>')
|
||||
textElement.insertAdjacentHTML("afterend", '<div class="fn__flex-1"></div><svg class="av__cellheadericon"><use xlink:href="#iconPin"></use></svg>');
|
||||
}
|
||||
} else {
|
||||
if (textElement.nextElementSibling) {
|
||||
|
@ -616,4 +616,4 @@ export const updateHeaderCell = (cellElement: HTMLElement, headerValue: {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -389,12 +389,12 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
|
|||
action: "update",
|
||||
data: blockElement.outerHTML,
|
||||
id: id,
|
||||
}]
|
||||
}];
|
||||
const undoOperation: IOperation[] = [{
|
||||
action: "update",
|
||||
data: html,
|
||||
id: id,
|
||||
}]
|
||||
}];
|
||||
let previousElement = blockElement;
|
||||
Array.from(newElement.children).forEach((item: HTMLElement) => {
|
||||
const newId = item.getAttribute("data-node-id");
|
||||
|
@ -403,15 +403,15 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
|
|||
data: item.outerHTML,
|
||||
id: newId,
|
||||
previousID: previousElement.getAttribute("data-node-id"),
|
||||
})
|
||||
});
|
||||
undoOperation.push({
|
||||
action: "delete",
|
||||
id: newId,
|
||||
})
|
||||
});
|
||||
previousElement.insertAdjacentElement("afterend", item);
|
||||
mathRender(previousElement.nextElementSibling);
|
||||
previousElement = item;
|
||||
})
|
||||
});
|
||||
transaction(protyle, doOperation, undoOperation);
|
||||
focusBlock(blockElement.nextElementSibling);
|
||||
scrollCenter(protyle);
|
||||
|
|
Loading…
Add table
Reference in a new issue