This commit is contained in:
Vanessa 2023-04-22 19:22:53 +08:00
parent dce6444b97
commit 820a51e5c2
4 changed files with 11 additions and 13 deletions

View file

@ -50,7 +50,7 @@ export const kernelError = () => {
</div>
</div>`
});
dialog.element.id = 'errorLog'
dialog.element.id = "errorLog";
const restartElement = dialog.element.querySelector(".b3-button");
if (restartElement) {
restartElement.addEventListener("click", () => {

View file

@ -75,7 +75,7 @@ const renderCompare = (element: HTMLElement) => {
leftElement.lastElementChild.classList.remove("fn__none");
onGet(response, leftEditor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]);
}
textElement.previousElementSibling.textContent = dayjs(response.data.updated).format("YYYY-MM-DD HH:mm")
textElement.previousElementSibling.textContent = dayjs(response.data.updated).format("YYYY-MM-DD HH:mm");
});
const id2 = element.getAttribute("data-id2");
if (id2) {
@ -91,7 +91,7 @@ const renderCompare = (element: HTMLElement) => {
rightElement.lastElementChild.classList.remove("fn__none");
onGet(response, rightEditor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]);
}
textElement.previousElementSibling.textContent = dayjs(response.data.updated).format("YYYY-MM-DD HH:mm")
textElement.previousElementSibling.textContent = dayjs(response.data.updated).format("YYYY-MM-DD HH:mm");
});
} else {
rightElement.classList.add("fn__none");
@ -143,10 +143,10 @@ export const showDiff = (data: { id: string, time: string }[]) => {
break;
} else if (target.classList.contains("block__icon")) {
if (target.getAttribute("data-direct") === "left") {
target.setAttribute("data-direct", "right")
target.setAttribute("data-direct", "right");
genHTML(right, left, dialog, "right");
} else {
target.setAttribute("data-direct", "left")
target.setAttribute("data-direct", "left");
genHTML(left, right, dialog, "left");
}
event.preventDefault();
@ -167,17 +167,17 @@ const genHTML = (left: string, right: string, dialog: Dialog, direct:string) =>
const headElement = dialog.element.querySelector(".b3-dialog__header");
headElement.innerHTML = `<div style="padding: 0;min-height: auto;" class="block__icons">
<span class="fn__flex-1"></span>
<code class="fn__code${isPhone ? " fn__none" : ''}">${left.substring(0, 7)}</code>
<code class="fn__code${isPhone ? " fn__none" : ""}">${left.substring(0, 7)}</code>
${isPhone ? "" : '<span class="fn__space"></span>'}
${dayjs(response.data.left.created).format("YYYY-MM-DD HH:mm")}
<span class="fn__space"></span>
<span class="block__icon block__icon--show" data-direct="${direct}"><svg><use xlink:href="#iconForward"></use></svg></span>
<span class="fn__space"></span>
<code class="fn__code${isPhone ? " fn__none" : ''}">${right.substring(0, 7)}</code>
<code class="fn__code${isPhone ? " fn__none" : ""}">${right.substring(0, 7)}</code>
${isPhone ? "" : '<span class="fn__space"></span>'}
${dayjs(response.data.right.created).format("YYYY-MM-DD HH:mm")}
<span class="fn__flex-1"></span>
</div>`
</div>`;
headElement.nextElementSibling.innerHTML = `<div class="fn__flex" style="height: 100%;${isMobile() ? "flex-direction: column;" : ""}">
<div class="history__diff"${isMobile() ? 'style="flex:1;width:auto"' : ""}>
<ul class="b3-list b3-list--background">
@ -222,4 +222,4 @@ const genHTML = (left: string, right: string, dialog: Dialog, direct:string) =>
</div>
</div>`;
});
}
};

View file

@ -34,7 +34,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
let id = blockElement.getAttribute("data-node-id");
range.insertNode(document.createElement("wbr"));
let oldHTML = blockElement.outerHTML;
const isNodeCodeBlock = blockElement.getAttribute("data-type") === "NodeCodeBlock"
const isNodeCodeBlock = blockElement.getAttribute("data-type") === "NodeCodeBlock";
if (!isBlock &&
(isNodeCodeBlock || protyle.toolbar.getCurrentType(range).includes("code"))) {
range.deleteContents();

View file

@ -6,16 +6,14 @@ import {writeText} from "./compatibility";
import {clipboard} from "electron";
/// #endif
import {hasClosestBlock} from "./hasClosest";
import {focusByWbr, getEditorRange} from "./selection";
import {getEditorRange} from "./selection";
import {blockRender} from "../markdown/blockRender";
import {highlightRender} from "../markdown/highlightRender";
import {updateTransaction} from "../wysiwyg/transaction";
import {fetchPost, fetchSyncPost} from "../../util/fetch";
import {isDynamicRef, isFileAnnotation} from "../../util/functions";
import {insertHTML} from "./insertHTML";
import {scrollCenter} from "../../util/highlightById";
import {hideElements} from "../ui/hideElements";
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {
let needRender = true;