Skip to content

Commit

Permalink
Merge branch 'dev' of /~https://github.com/ci-win/siyuan into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/appearance/langs/es_ES.json
#	app/appearance/langs/fr_FR.json
#	app/appearance/langs/zh_CHT.json
  • Loading branch information
Soltus committed Apr 22, 2023
2 parents 5833b2a + fa5662d commit 8b9e7ea
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions app/appearance/langs/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@
"closeRight": "Close Tabs to the Right",
"closeUnmodified": "Close Unmodified Tabs",
"newFileTip": "Please open a notebook first",
"copyBlockRef": "Copy Block Ref",
"copyBlockEmbed": "Copy Block Embed",
"copyBlockRef": "Copy block ref",
"copyBlockEmbed": "Copy block embed",
"linkLevel": "Depth",
"mark": "Mark",
"splitLR": "Split Right",
Expand Down
4 changes: 2 additions & 2 deletions app/appearance/langs/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,8 @@
"closeRight": "关闭右侧页签",
"closeUnmodified": "关闭未修改的页签",
"newFileTip": "请先打开一个笔记本",
"copyBlockRef": "复制该块为引用块",
"copyBlockEmbed": "复制该块为嵌入块",
"copyBlockRef": "复制为引用块",
"copyBlockEmbed": "复制为嵌入块",
"linkLevel": "层级",
"mark": "标记",
"splitLR": "向右分屏",
Expand Down
2 changes: 1 addition & 1 deletion app/src/dialog/processSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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", () => {
Expand Down
27 changes: 16 additions & 11 deletions app/src/history/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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) {
Expand All @@ -92,7 +92,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");
Expand Down Expand Up @@ -144,11 +144,11 @@ 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")
genHTML(right, left, dialog);
target.setAttribute("data-direct", "right");
genHTML(right, left, dialog, "right");
} else {
target.setAttribute("data-direct", "left")
genHTML(left, right, dialog);
target.setAttribute("data-direct", "left");
genHTML(left, right, dialog, "left");
}
event.preventDefault();
event.stopPropagation();
Expand All @@ -157,23 +157,28 @@ export const showDiff = (data: { id: string, time: string }[]) => {
target = target.parentElement;
}
});
genHTML(left, right, dialog);
genHTML(left, right, dialog, "left");
};

const genHTML = (left: string, right: string, dialog: Dialog) => {
const genHTML = (left: string, right: string, dialog: Dialog, direct:string) => {
leftEditor = undefined;
rightEditor = undefined;
const isPhone = isMobile();
fetchPost("/api/repo/diffRepoSnapshots", {left, right}, (response) => {
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>
${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="left"><svg><use xlink:href="#iconForward"></use></svg></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>
${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">
Expand Down Expand Up @@ -218,4 +223,4 @@ const genHTML = (left: string, right: string, dialog: Dialog) => {
</div>
</div>`;
});
}
};
2 changes: 1 addition & 1 deletion app/src/protyle/util/insertHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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();
Expand Down
4 changes: 1 addition & 3 deletions app/src/protyle/util/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8b9e7ea

Please sign in to comment.