This commit is contained in:
Vanessa 2023-12-12 20:53:42 +08:00
parent f40ad7a8f1
commit 63eab3c5c1
3 changed files with 6 additions and 6 deletions

View file

@ -70,8 +70,8 @@ export class Gutter {
selectElements.forEach(item => {
if (item.getAttribute("data-type") === "NodeIFrame") {
const embedElement = genEmptyElement();
embedElement.classList.add("protyle-wysiwyg--select")
getContenteditableElement(embedElement).innerHTML = `<svg class="svg"><use xlink:href="#iconLanguage"></use></svg> IFrame`
embedElement.classList.add("protyle-wysiwyg--select");
getContenteditableElement(embedElement).innerHTML = "<svg class=\"svg\"><use xlink:href=\"#iconLanguage\"></use></svg> IFrame";
ghostElement.append(embedElement);
} else {
ghostElement.append(item.cloneNode(true));

View file

@ -359,7 +359,7 @@ export const enableProtyle = (protyle: IProtyle) => {
const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScrollAttr) => {
let focusElement: Element;
if (scrollAttr && scrollAttr.focusId) {
focusElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${scrollAttr.focusId}"]`)
focusElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${scrollAttr.focusId}"]`);
} else {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${protyle.block.id}"]`)).find((item: HTMLElement) => {
if (!hasClosestByAttribute(item, "data-type", "block-render", true)) {
@ -372,7 +372,7 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
preventScroll(protyle);
focusElement = protyle.wysiwyg.element.lastElementChild;
} else if (!focusElement || action.includes(Constants.CB_GET_FOCUSFIRST)) {
focusElement = protyle.wysiwyg.element.firstElementChild
focusElement = protyle.wysiwyg.element.firstElementChild;
}
if (action.includes(Constants.CB_GET_HL)) {
preventScroll(protyle); // 搜索页签滚动会导致再次请求
@ -397,7 +397,7 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
protyle.contentElement.scrollTop = scrollAttr.scrollTop;
}
// 加强定位
protyle.observerLoad = new ResizeObserver((entries) => {
protyle.observerLoad = new ResizeObserver(() => {
if (action.includes(Constants.CB_GET_FOCUS) || action.includes(Constants.CB_GET_HL) || action.includes(Constants.CB_GET_FOCUSFIRST)) {
focusElement.scrollIntoView();
} else if (scrollAttr && scrollAttr.scrollTop) {

View file

@ -1052,7 +1052,7 @@ export class WYSIWYG {
private bindEvent(protyle: IProtyle) {
// 删除块时av 头尾需重新计算位置
protyle.observer = new ResizeObserver((entries) => {
protyle.observer = new ResizeObserver(() => {
const contentRect = protyle.contentElement.getBoundingClientRect();
protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => {
if (item.querySelector(".av__title")) {