This commit is contained in:
Vanessa 2022-08-31 13:19:03 +08:00
parent c8bc6f3013
commit 5d70f3cf64
5 changed files with 19 additions and 19 deletions

View file

@ -202,7 +202,7 @@ export const editor = {
onSetEditor: (editor: IEditor) => { onSetEditor: (editor: IEditor) => {
window.siyuan.config.editor = editor; window.siyuan.config.editor = editor;
getAllModels().editor.forEach((item) => { getAllModels().editor.forEach((item) => {
reloadProtyle(item.editor.protyle) reloadProtyle(item.editor.protyle);
setPadding(item.editor.protyle); setPadding(item.editor.protyle);
if (window.siyuan.config.editor.fullWidth) { if (window.siyuan.config.editor.fullWidth) {
item.editor.protyle.contentElement.setAttribute("data-fullwidth", "true"); item.editor.protyle.contentElement.setAttribute("data-fullwidth", "true");

View file

@ -100,7 +100,7 @@ class Protyle {
size: Constants.SIZE_GET, size: Constants.SIZE_GET,
}, getResponse => { }, getResponse => {
onGet(getResponse, this.protyle); onGet(getResponse, this.protyle);
}) });
} else { } else {
reloadProtyle(this.protyle); reloadProtyle(this.protyle);
} }

View file

@ -19,4 +19,4 @@ export const reloadProtyle = (protyle:IProtyle) => {
}, getResponse => { }, getResponse => {
onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true); onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true);
}); });
} };

View file

@ -537,7 +537,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
} }
getAllModels().editor.forEach(item => { getAllModels().editor.forEach(item => {
if (rootIds[0] === item.editor.protyle.block.rootID) { if (rootIds[0] === item.editor.protyle.block.rootID) {
reloadProtyle(item.editor.protyle) reloadProtyle(item.editor.protyle);
} }
}); });
if (!currentList.nextElementSibling && searchPanelElement.children[0]) { if (!currentList.nextElementSibling && searchPanelElement.children[0]) {

View file

@ -9,7 +9,7 @@ import {renderAssetsPreview} from "../asset/renderAssets";
import Protyle from "../protyle"; import Protyle from "../protyle";
import {onGet} from "../protyle/util/onGet"; import {onGet} from "../protyle/util/onGet";
let historyEditor: Protyle let historyEditor: Protyle;
const renderDoc = (element: HTMLElement, currentPage: number) => { const renderDoc = (element: HTMLElement, currentPage: number) => {
const previousElement = element.querySelector('[data-type="docprevious"]'); const previousElement = element.querySelector('[data-type="docprevious"]');
const nextElement = element.querySelector('[data-type="docnext"]'); const nextElement = element.querySelector('[data-type="docnext"]');
@ -30,12 +30,12 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
docElement.classList.add("fn__none"); docElement.classList.add("fn__none");
mdElement.classList.add("fn__none"); mdElement.classList.add("fn__none");
if (typeElement.value === "0") { if (typeElement.value === "0") {
opElement.removeAttribute("disabled") opElement.removeAttribute("disabled");
notebookElement.removeAttribute("disabled") notebookElement.removeAttribute("disabled");
assetElement.classList.add("fn__none"); assetElement.classList.add("fn__none");
} else { } else {
opElement.setAttribute("disabled", "disabled") opElement.setAttribute("disabled", "disabled");
notebookElement.setAttribute("disabled", "disabled") notebookElement.setAttribute("disabled", "disabled");
assetElement.classList.remove("fn__none"); assetElement.classList.remove("fn__none");
} }
fetchPost("/api/history/searchHistory", { fetchPost("/api/history/searchHistory", {
@ -84,11 +84,11 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {
}, (contentResponse) => { }, (contentResponse) => {
if (contentResponse.data.isLargeDoc) { if (contentResponse.data.isLargeDoc) {
mdElement.value = contentResponse.data.content; mdElement.value = contentResponse.data.content;
mdElement.classList.remove("fn__none") mdElement.classList.remove("fn__none");
docElement.classList.add("fn__none") docElement.classList.add("fn__none");
} else { } else {
mdElement.classList.add("fn__none") mdElement.classList.add("fn__none");
docElement.classList.remove("fn__none") docElement.classList.remove("fn__none");
onGet(contentResponse, historyEditor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]); onGet(contentResponse, historyEditor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]);
} }
}); });
@ -233,10 +233,10 @@ export const openHistory = () => {
} }
const currentNotebookId = localStorage.getItem(Constants.LOCAL_HISTORYNOTEID); const currentNotebookId = localStorage.getItem(Constants.LOCAL_HISTORYNOTEID);
let notebookSelectHTML = ''; let notebookSelectHTML = "";
window.siyuan.notebooks.forEach((item) => { window.siyuan.notebooks.forEach((item) => {
if (!item.closed) { if (!item.closed) {
notebookSelectHTML += ` <option value="${item.id}"${item.id === currentNotebookId ? " selected" : ""}>${item.name}</option>` notebookSelectHTML += ` <option value="${item.id}"${item.id === currentNotebookId ? " selected" : ""}>${item.name}</option>`;
} }
}); });
const dialog = new Dialog({ const dialog = new Dialog({
@ -423,11 +423,11 @@ export const openHistory = () => {
}, (response) => { }, (response) => {
if (response.data.isLargeDoc) { if (response.data.isLargeDoc) {
mdElement.value = response.data.content; mdElement.value = response.data.content;
mdElement.classList.remove("fn__none") mdElement.classList.remove("fn__none");
docElement.classList.add("fn__none") docElement.classList.add("fn__none");
} else { } else {
mdElement.classList.add("fn__none") mdElement.classList.add("fn__none");
docElement.classList.remove("fn__none") docElement.classList.remove("fn__none");
onGet(response, historyEditor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]); onGet(response, historyEditor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]);
} }
}); });