🚨
This commit is contained in:
parent
24856a1c84
commit
7e37563fcd
12 changed files with 26 additions and 28 deletions
|
@ -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 {
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
@ -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");
|
||||
|
|
|
@ -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,
|
||||
|
@ -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>
|
||||
|
@ -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: "",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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")}">
|
||||
|
|
|
@ -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,
|
||||
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 为旧值
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 &&
|
||||
|
@ -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");
|
||||
|
@ -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) => {
|
||||
|
@ -1479,7 +1479,7 @@ 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] ||
|
||||
|
@ -1487,8 +1487,8 @@ export class WYSIWYG {
|
|||
html += "</tr>";
|
||||
}
|
||||
item.innerHTML = "";
|
||||
})
|
||||
html += '</table>'
|
||||
});
|
||||
html += "</table>";
|
||||
textPlain = protyle.lute.HTML2Md(html);
|
||||
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue