This commit is contained in:
Vanessa 2023-02-04 09:51:24 +08:00
parent c3d3cb189c
commit 25bb76f586
4 changed files with 12 additions and 12 deletions

View file

@ -101,14 +101,14 @@ export const showDiff = (data: { id: string, time: string }[]) => {
if (data.length !== 2) { if (data.length !== 2) {
return; return;
} }
let left let left;
let right let right;
if (data[0].time > data[1].time) { if (data[0].time > data[1].time) {
left = data[1].id left = data[1].id;
right = data[0].id right = data[0].id;
} else { } else {
left = data[0].id left = data[0].id;
right = data[1].id right = data[1].id;
} }
fetchPost("/api/repo/diffRepoSnapshots", {left, right}, (response) => { fetchPost("/api/repo/diffRepoSnapshots", {left, right}, (response) => {
const dialog = new Dialog({ const dialog = new Dialog({

View file

@ -460,7 +460,7 @@ export const openHistory = () => {
if (id === item.id) { if (id === item.id) {
idJSON.splice(index, 1); idJSON.splice(index, 1);
} }
}) });
} else { } else {
target.classList.add("b3-list-item--focus"); target.classList.add("b3-list-item--focus");
while (idJSON.length > 1) { while (idJSON.length > 1) {

View file

@ -557,10 +557,10 @@ export class WYSIWYG {
mouseElement = newMouseElement; mouseElement = newMouseElement;
} }
hideElements(["select"], protyle); hideElements(["select"], protyle);
let firstElement let firstElement;
if (moveEvent.clientY > y) { if (moveEvent.clientY > y) {
firstElement = startFirstElement || document.elementFromPoint(newLeft - 1, newTop); firstElement = startFirstElement || document.elementFromPoint(newLeft - 1, newTop);
endLastElement = undefined endLastElement = undefined;
} else { } else {
firstElement = document.elementFromPoint(newLeft - 1, newTop); firstElement = document.elementFromPoint(newLeft - 1, newTop);
startFirstElement = undefined; startFirstElement = undefined;
@ -585,7 +585,7 @@ export class WYSIWYG {
let selectElements: Element[] = []; let selectElements: Element[] = [];
let currentElement: Element | boolean = firstBlockElement; let currentElement: Element | boolean = firstBlockElement;
let hasJump = false; let hasJump = false;
const selectBottom = endLastElement ? endLastElement.getBoundingClientRect().bottom : (newTop + newHeight) const selectBottom = endLastElement ? endLastElement.getBoundingClientRect().bottom : (newTop + newHeight);
while (currentElement) { while (currentElement) {
if (currentElement && !currentElement.classList.contains("protyle-attr")) { if (currentElement && !currentElement.classList.contains("protyle-attr")) {
const currentRect = currentElement.getBoundingClientRect(); const currentRect = currentElement.getBoundingClientRect();
@ -628,7 +628,7 @@ export class WYSIWYG {
} }
} }
if (moveEvent.clientY <= y && !endLastElement) { if (moveEvent.clientY <= y && !endLastElement) {
endLastElement = selectElements[selectElements.length - 1] endLastElement = selectElements[selectElements.length - 1];
} }
if (selectElements.length === 1 && !selectElements[0].classList.contains("list") && !selectElements[0].classList.contains("bq") && !selectElements[0].classList.contains("sb")) { if (selectElements.length === 1 && !selectElements[0].classList.contains("list") && !selectElements[0].classList.contains("bq") && !selectElements[0].classList.contains("sb")) {
// 只有一个 p 时不选中 // 只有一个 p 时不选中

View file

@ -82,7 +82,7 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin
}); });
} }
} else { } else {
let title = data.data.path || "Untitled" let title = data.data.path || "Untitled";
title = title.substring(title.lastIndexOf("/") + 1); title = title.substring(title.lastIndexOf("/") + 1);
if (!validateName(title)) { if (!validateName(title)) {
return; return;