Skip to content

Commit

Permalink
🎨 #12948
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 28, 2024
1 parent 4187c39 commit 90a89f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion app/src/history/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const renderCompare = (app: App, element: HTMLElement) => {
leftElement.classList.remove("fn__none");
const textElement = leftElement.querySelector("textarea");
const type = pathPosix().extname(response.data.content).toLowerCase();
const titleElement = leftElement.querySelector(".protyle-title__input");
if (Constants.SIYUAN_ASSETS_IMAGE.concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO).includes(type)) {
textElement.previousElementSibling.innerHTML = renderAssetsPreview(response.data.content);
textElement.previousElementSibling.classList.remove("fn__none");
Expand All @@ -101,6 +102,7 @@ const renderCompare = (app: App, element: HTMLElement) => {
action: [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML],
});
}
titleElement.textContent = response.data.title;
leftElement.querySelector(".history__date").textContent = dayjs(response.data.updated).format("YYYY-MM-DD HH:mm");
});
const id2 = element.getAttribute("data-id2");
Expand All @@ -109,6 +111,7 @@ const renderCompare = (app: App, element: HTMLElement) => {
fetchPost("/api/repo/openRepoSnapshotDoc", {id: id2}, (response) => {
const textElement = rightElement.querySelector("textarea");
const type = pathPosix().extname(response.data.content).toLowerCase();
const titleElement = rightElement.querySelector(".protyle-title__input");
if (Constants.SIYUAN_ASSETS_IMAGE.concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO).includes(type)) {
textElement.previousElementSibling.innerHTML = renderAssetsPreview(response.data.content);
textElement.previousElementSibling.classList.remove("fn__none");
Expand All @@ -130,6 +133,7 @@ const renderCompare = (app: App, element: HTMLElement) => {
action: [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML],
});
}
titleElement.textContent = response.data.title;
rightElement.querySelector(".history__date").textContent = dayjs(response.data.updated).format("YYYY-MM-DD HH:mm");
});
} else {
Expand Down Expand Up @@ -262,12 +266,14 @@ const genHTML = (left: string, right: string, dialog: Dialog, direct: string) =>
<div class="fn__flex-1 fn__flex" data-type="editors">
<div class="fn__none fn__flex-1 fn__flex-column">
<div class="history__date">${dayjs(response.data.left.created).format("YYYY-MM-DD HH:mm")}</div>
<div class="protyle-title__input ft__center ft__breakword">${response.data.left.title}</div>
<div class="ft__center"></div>
<textarea class="history__text fn__none fn__flex-1" readonly></textarea>
<div class="fn__flex-1"></div>
</div>
<div class="fn__none fn__flex-1 fn__flex-column" style="border-left: 1px solid var(--b3-border-color);">
<div class="history__date">${dayjs(response.data.right.created).format("YYYY-MM-DD HH:mm")}</div>
<div class="history__date">${response.data.right.title} ${dayjs(response.data.right.created).format("YYYY-MM-DD HH:mm")}</div>
<div class="protyle-title__input ft__center ft__breakword">${response.data.right.title}</div>
<div class="ft__center"></div>
<textarea class="history__text fn__none fn__flex-1" readonly></textarea>
<div class="fn__flex-1"></div>
Expand Down
2 changes: 1 addition & 1 deletion app/src/history/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const openDocHistory = (options: {
</ul>
<div class="history__resize"></div>
<div class="fn__flex-1 fn__flex-column">
<div class="protyle-title__input ft__center"></div>
<div class="protyle-title__input ft__center ft__breakword"></div>
<textarea class="fn__flex-1 history__text fn__none" readonly data-type="mdPanel"></textarea>
<div class="fn__flex-1 history__text fn__none" style="padding: 0" data-type="docPanel"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/src/history/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export const openHistory = (app: App) => {
</ul>
<div class="history__resize"></div>
<div class="fn__flex-column fn__flex-1">
<div class="protyle-title__input ft__center"></div>
<div class="protyle-title__input ft__center ft__breakword"></div>
<div class="fn__flex-1 history__text fn__none" data-type="assetPanel"></div>
<textarea class="fn__flex-1 history__text fn__none" data-type="mdPanel"></textarea>
<div class="fn__flex-1 history__text fn__none" style="padding: 0" data-type="docPanel"></div>
Expand Down

0 comments on commit 90a89f8

Please sign in to comment.