This commit is contained in:
Vanessa 2022-07-08 10:38:11 +08:00
parent d7b983b36c
commit b8444f7aca
5 changed files with 18 additions and 18 deletions

View file

@ -372,7 +372,7 @@ const getHightlightCoordsByRect = (pdf: any, color: string, rectResizeElement: H
const mergeRects = (range: Range) => {
const rects = range.getClientRects();
const mergedRects: { left: number, top: number, right: number, bottom: number }[] = [];
let lastTop: number = undefined
let lastTop: number = undefined;
Array.from(rects).forEach(item => {
if (item.height === 0 || item.width === 0) {
return;
@ -381,11 +381,11 @@ const mergeRects = (range: Range) => {
mergedRects.push({left: item.left, top: item.top, right: item.right, bottom: item.bottom});
lastTop = item.top;
} else {
mergedRects[mergedRects.length - 1].right = item.right
mergedRects[mergedRects.length - 1].right = item.right;
}
})
return mergedRects
}
});
return mergedRects;
};
const getHightlightCoordsByRange = (pdf: any, color: string) => {
const range = window.getSelection().getRangeAt(0);

View file

@ -524,7 +524,7 @@ ${passwordHTML}
window.siyuan.config.sync.cloudName = name;
getCloudList(true);
});
return
return;
}
confirmDialog(window.siyuan.languages.confirm, response.msg, () => {

View file

@ -149,7 +149,7 @@ const openFile = (options: IOpenFileOptions) => {
wnd.split(direction).addTab(newTab(options));
}
} else if (options.keepCursor && wnd.children[0].model) {
const tab = newTab(options)
const tab = newTab(options);
tab.headElement.setAttribute("keep-cursor", options.id);
wnd.addTab(tab, options.keepCursor);
} else if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
@ -239,7 +239,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
if (options.mode) {
setEditMode(editor.editor.protyle, options.mode);
}
}
};
const newTab = (options: IOpenFileOptions) => {
let tab: Tab;
@ -293,7 +293,7 @@ const newTab = (options: IOpenFileOptions) => {
});
}
return tab;
}
};
export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackStack = false, reload = false) => {
let title = window.siyuan.languages.siyuanNote;

View file

@ -21,11 +21,11 @@ const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
needRender = false;
return true;
}
})
});
if (needRender) {
protyle.hint.render(protyle);
}
}
};
export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element) => {
const range = getEditorRange(protyle.wysiwyg.element);
@ -59,7 +59,7 @@ export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Ele
blockRender(protyle, protyle.wysiwyg.element);
processRender(protyle.wysiwyg.element);
highlightRender(protyle.wysiwyg.element);
filterClipboardHint(protyle, textPlain)
filterClipboardHint(protyle, textPlain);
scrollCenter(protyle);
};
@ -199,7 +199,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
// 转换为 md避免再次粘贴 ID 重复
const tempMd = protyle.lute.BlockDOM2StdMd(tempElement.innerHTML);
writeText(tempMd);
filterClipboardHint(protyle, tempMd)
filterClipboardHint(protyle, tempMd);
} else if (textHTML.endsWith(Constants.ZWSP)) {
// 编辑器内部粘贴
tempElement.innerHTML = textHTML.substr(0, textHTML.length - 1);
@ -213,7 +213,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
});
const tempInnerHTML = tempElement.innerHTML;
insertHTML(tempInnerHTML, protyle);
filterClipboardHint(protyle, tempInnerHTML)
filterClipboardHint(protyle, tempInnerHTML);
} else {
tempElement.innerHTML = textHTML;
tempElement.querySelectorAll("[style]").forEach((e) => {
@ -239,7 +239,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
blockRender(protyle, protyle.wysiwyg.element);
processRender(protyle.wysiwyg.element);
highlightRender(protyle.wysiwyg.element);
filterClipboardHint(protyle, response.data)
filterClipboardHint(protyle, response.data);
scrollCenter(protyle);
});
return;
@ -258,7 +258,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
}
const textPlainDom = protyle.lute.Md2BlockDOM(textPlain);
insertHTML(textPlainDom, protyle);
filterClipboardHint(protyle, textPlainDom)
filterClipboardHint(protyle, textPlainDom);
}
blockRender(protyle, protyle.wysiwyg.element);
processRender(protyle.wysiwyg.element);

View file

@ -109,7 +109,7 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
element.lastElementChild.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
return;
}
let actionHTML = ''
let actionHTML = "";
if (type === "cloudTag") {
actionHTML = `<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="downloadSnapshot" aria-label="${window.siyuan.languages.download}"><svg><use xlink:href="#iconDownload"></use></svg></span>
<span class="b3-list-item__action b3-tooltips b3-tooltips__w" data-type="removeCloudRepoTagSnapshot" aria-label="${window.siyuan.languages.remove}"><svg><use xlink:href="#iconTrashcan"></use></svg></span>`;
@ -450,7 +450,7 @@ export const openHistory = () => {
confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} <i>${tag}</i>?`, () => {
fetchPost("/api/repo/" + type, {tag}, () => {
if (target.parentElement.parentElement.childElementCount === 1) {
target.parentElement.parentElement.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`
target.parentElement.parentElement.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
} else {
target.parentElement.remove();
}