Skip to content

Commit

Permalink
🚨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 29, 2024
1 parent 24856a1 commit 7e37563
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 28 deletions.
1 change: 0 additions & 1 deletion app/src/block/Panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {openFileById} from "../editor/util";
import {fetchPost} from "../util/fetch";
import {showMessage} from "../dialog/message";
import {App} from "../index";
import {isMobile} from "../util/functions";
import {resize} from "../protyle/util/resize";

export class BlockPanel {
Expand Down
2 changes: 1 addition & 1 deletion app/src/history/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const genHTML = (left: string, right: string, dialog: Dialog, direct: string) =>
<span class="fn__flex-1"></span>
</div>`;
headElement.nextElementSibling.innerHTML = `<div class="fn__flex history__panel" style="height: 100%">
<div class="history__side" ${isMobile() ? '' : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDiffWidth}"`}>
<div class="history__side" ${isMobile() ? "" : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDiffWidth}"`}>
<ul class="b3-list b3-list--background">
<li class="b3-list-item">
<span class="b3-list-item__toggle b3-list-item__toggle--hl">
Expand Down
4 changes: 2 additions & 2 deletions app/src/history/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const openDocHistory = (options: {
pathString: string
}) => {
const contentHTML = `<div class="fn__flex fn__flex-1 history__panel">
<ul class="b3-list b3-list--background history__side" ${isMobile() ? '' : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDocWidth}"`}>
<ul class="b3-list b3-list--background history__side" ${isMobile() ? "" : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDocWidth}"`}>
<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>
</ul>
<div class="history__resize"></div>
Expand Down Expand Up @@ -168,7 +168,7 @@ export const openDocHistory = (options: {
action: [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML],
});
}
dialog.element.querySelector('.protyle-title__input').textContent = item.title;
dialog.element.querySelector(".protyle-title__input").textContent = item.title;
isLoading = false;
});
target.parentElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
Expand Down
10 changes: 5 additions & 5 deletions app/src/history/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
opElement.querySelector('option[value="replace"]').classList.remove("fn__none");
opElement.querySelector('option[value="outline"]').classList.remove("fn__none");
}
window.siyuan.storage[Constants.LOCAL_HISTORY].notebookId = notebookElement.value
window.siyuan.storage[Constants.LOCAL_HISTORY].type = parseInt(typeElement.value)
window.siyuan.storage[Constants.LOCAL_HISTORY].operation = opElement.value
window.siyuan.storage[Constants.LOCAL_HISTORY].notebookId = notebookElement.value;
window.siyuan.storage[Constants.LOCAL_HISTORY].type = parseInt(typeElement.value);
window.siyuan.storage[Constants.LOCAL_HISTORY].operation = opElement.value;
setStorageVal(Constants.LOCAL_HISTORY, window.siyuan.storage[Constants.LOCAL_HISTORY]);
fetchPost("/api/history/searchHistory", {
notebook: notebookElement.value,
Expand Down Expand Up @@ -393,7 +393,7 @@ export const openHistory = (app: App) => {
</div>
</div>
<div class="fn__flex fn__flex-1 history__panel">
<ul class="b3-list b3-list--background history__side" ${isMobile() ? '' : `style="width: ${localHistory.sideWidth}"`}>
<ul class="b3-list b3-list--background history__side" ${isMobile() ? "" : `style="width: ${localHistory.sideWidth}"`}>
<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>
</ul>
<div class="history__resize"></div>
Expand Down Expand Up @@ -483,7 +483,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
const docElement = firstPanelElement.querySelector('.history__text[data-type="docPanel"]') as HTMLElement;
const assetElement = firstPanelElement.querySelector('.history__text[data-type="assetPanel"]');
const mdElement = firstPanelElement.querySelector('.history__text[data-type="mdPanel"]') as HTMLTextAreaElement;
const titleElement = firstPanelElement.querySelector('.protyle-title__input') as HTMLElement;
const titleElement = firstPanelElement.querySelector(".protyle-title__input") as HTMLElement;
renderDoc(firstPanelElement, 1);
historyEditor = new Protyle(app, docElement, {
blockId: "",
Expand Down
2 changes: 1 addition & 1 deletion app/src/mobile/util/initFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const openDockMenu = (app: App) => {
}
}
custom = plugin.docks[dockId].mobileModel(document.querySelector('#sidebar [data-type="sidebar-plugin"]'));
window.siyuan.mobile.docks[dockId] = custom
window.siyuan.mobile.docks[dockId] = custom;
}
}
});
Expand Down
8 changes: 4 additions & 4 deletions app/src/protyle/gutter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class Gutter {
blockElement.setAttribute("updated", newUpdated);
} else {
if (!protyle.disabled && event.shiftKey) {
const blockId = rowElement.querySelector('[data-dtype="block"] .av__celltext--ref')?.getAttribute("data-id")
const blockId = rowElement.querySelector('[data-dtype="block"] .av__celltext--ref')?.getAttribute("data-id");
if (blockId) {
fetchPost("/api/attr/getBlockAttrs", {id: blockId}, (response) => {
openFileAttr(response.data, "av", protyle);
Expand Down Expand Up @@ -2243,9 +2243,9 @@ export class Gutter {
element = rowElement;
let iconAriaLabel = isMac() ? window.siyuan.languages.rowTip : window.siyuan.languages.rowTip.replace("⇧", "Shift+");
if (protyle.disabled) {
iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.indexOf("<br"))
iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.indexOf("<br"));
} else if (rowElement.querySelector('[data-dtype="block"]')?.getAttribute("data-detached") === "true") {
iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.lastIndexOf("<br"))
iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.lastIndexOf("<br"));
}
html = `<button data-type="NodeAttributeViewRowMenu" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" class="ariaLabel" data-position="right" aria-label="${iconAriaLabel}"><svg><use xlink:href="#iconDrag"></use></svg><span ${protyle.disabled ? "" : 'draggable="true" class="fn__grab"'}></span></button>`;
if (!protyle.disabled) {
Expand Down Expand Up @@ -2278,7 +2278,7 @@ export class Gutter {
index += 1;
let gutterTip = this.gutterTip;
if (protyle.disabled) {
gutterTip = this.gutterTip.split("<br>").splice(0, 2).join("<br>")
gutterTip = this.gutterTip.split("<br>").splice(0, 2).join("<br>");
}
const buttonHTML = `<button class="ariaLabel" data-position="right" aria-label="${gutterTip}"
data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}">
Expand Down
4 changes: 2 additions & 2 deletions app/src/protyle/render/av/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
/// #if !MOBILE
const blockId = rowElements[0].getAttribute("data-id");
const openSubmenus = openEditorTab(protyle.app, [blockId], undefined, undefined, true);
openSubmenus.push({type: "separator"})
openSubmenus.push({type: "separator"});
openSubmenus.push({
icon: "iconAttr",
label: window.siyuan.languages.attr,
Expand All @@ -274,7 +274,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
openFileAttr(response.data, "av", protyle);
});
}
})
});
menu.addItem({
id: "openBy",
label: window.siyuan.languages.openBy,
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/render/av/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protyl
nodeElement.querySelectorAll(".av__cell--select, .av__cell--active").forEach(item => {
item.classList.remove("av__cell--select", "av__cell--active");
item.querySelector(".av__drag-fill")?.remove();
})
});
selectRow(rowElement.querySelector(".av__firstcol"), "select");
event.preventDefault();
return true;
Expand Down
1 change: 0 additions & 1 deletion app/src/protyle/scroll/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {fetchPost} from "../../util/fetch";
import {updateHotkeyTip} from "../util/compatibility";
import {hasClosestByClassName} from "../util/hasClosest";
import {goEnd, goHome} from "../wysiwyg/commonHotkey";
import {isMobile} from "../../util/functions";
import {showTooltip} from "../../dialog/tooltip";

export class Scroll {
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/util/insertHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const processTable = (range: Range, html: string, protyle: IProtyle, blockElemen
range.collapse(false);
updateTransaction(protyle, blockElement.getAttribute("data-node-id"), blockElement.outerHTML, oldHTML);
return true;
}
};

export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
// 移动端插入嵌入块时,获取到的 range 为旧值
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/util/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ const readLocalFile = async (protyle: IProtyle, localFiles: string[]) => {
}
uploadLocalFiles(localFiles, protyle, true);
writeText("");
}
};

export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvent) & { target: HTMLElement }) => {
event.stopPropagation();
Expand Down
16 changes: 8 additions & 8 deletions app/src/protyle/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export class WYSIWYG {
const selectCellElements: HTMLTableCellElement[] = [];
const scrollLeft = nodeElement.firstElementChild.scrollLeft;
const tableSelectElement = nodeElement.querySelector(".table__select") as HTMLElement;
html = '<table>'
html = "<table>";
nodeElement.querySelectorAll("th, td").forEach((item: HTMLTableCellElement) => {
if (!item.classList.contains("fn__none") &&
item.offsetLeft + 6 > tableSelectElement.offsetLeft + scrollLeft && item.offsetLeft + item.clientWidth - 6 < tableSelectElement.offsetLeft + scrollLeft + tableSelectElement.clientWidth &&
Expand All @@ -347,15 +347,15 @@ export class WYSIWYG {
selectCellElements.forEach((item, index) => {
if (index === 0 || !item.previousElementSibling ||
!item.previousElementSibling.isSameNode(selectCellElements[index - 1])) {
html += "<tr>"
html += "<tr>";
}
html += item.outerHTML;
if (!item.nextElementSibling || !selectCellElements[index + 1] ||
!item.nextElementSibling.isSameNode(selectCellElements[index + 1])) {
html += "</tr>";
}
})
html += '</table>'
});
html += "</table>";
textPlain = protyle.lute.HTML2Md(html);
} else {
const tempElement = document.createElement("div");
Expand Down Expand Up @@ -1466,7 +1466,7 @@ export class WYSIWYG {
const selectCellElements: HTMLTableCellElement[] = [];
const scrollLeft = nodeElement.firstElementChild.scrollLeft;
const tableSelectElement = nodeElement.querySelector(".table__select") as HTMLElement;
html = '<table>'
html = "<table>";
const oldHTML = nodeElement.outerHTML;
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
nodeElement.querySelectorAll("th, td").forEach((item: HTMLTableCellElement) => {
Expand All @@ -1479,16 +1479,16 @@ export class WYSIWYG {
selectCellElements.forEach((item, index) => {
if (index === 0 || !item.previousElementSibling ||
!item.previousElementSibling.isSameNode(selectCellElements[index - 1])) {
html += "<tr>"
html += "<tr>";
}
html += item.outerHTML;
if (!item.nextElementSibling || !selectCellElements[index + 1] ||
!item.nextElementSibling.isSameNode(selectCellElements[index + 1])) {
html += "</tr>";
}
item.innerHTML = "";
})
html += '</table>'
});
html += "</table>";
textPlain = protyle.lute.HTML2Md(html);
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);
} else {
Expand Down

0 comments on commit 7e37563

Please sign in to comment.