mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-10 22:52:34 +01:00
♻️
This commit is contained in:
parent
fd0893d8d8
commit
6806392b41
57 changed files with 271 additions and 360 deletions
|
|
@ -19,7 +19,6 @@ import {uploadLocalFiles} from "../upload";
|
|||
import {insertHTML} from "./insertHTML";
|
||||
import {isBrowser} from "../../util/functions";
|
||||
import {hideElements} from "../ui/hideElements";
|
||||
import {App} from "../../index";
|
||||
|
||||
const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement: Element, newSourceElement: Element,
|
||||
isSameDoc: boolean, isBottom: boolean, isCopy: boolean) => {
|
||||
|
|
@ -696,7 +695,7 @@ const dragSame = async (protyle: IProtyle, sourceElements: Element[], targetElem
|
|||
focusBlock(sourceElements[0]);
|
||||
};
|
||||
|
||||
export const dropEvent = (app: App, protyle: IProtyle, editorElement: HTMLElement) => {
|
||||
export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||
editorElement.addEventListener("dragstart", (event) => {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.tagName === "IMG") {
|
||||
|
|
@ -853,7 +852,7 @@ export const dropEvent = (app: App, protyle: IProtyle, editorElement: HTMLElemen
|
|||
id: protyle.block.id,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet({data: getResponse, protyle, app});
|
||||
onGet({data: getResponse, protyle});
|
||||
/// #if !MOBILE
|
||||
// 文档标题互转后,需更新大纲
|
||||
updatePanelByEditor({
|
||||
|
|
|
|||
|
|
@ -16,14 +16,12 @@ import {removeLoading} from "../ui/initUI";
|
|||
import {isMobile} from "../../util/functions";
|
||||
import {foldPassiveType} from "../wysiwyg/renderBacklink";
|
||||
import {showMessage} from "../../dialog/message";
|
||||
import {App} from "../../index";
|
||||
|
||||
export const onGet = (options: {
|
||||
data: IWebSocketData,
|
||||
protyle: IProtyle,
|
||||
action?: string[],
|
||||
scrollAttr?: IScrollAttr
|
||||
app: App
|
||||
}) => {
|
||||
if (!options.action) {
|
||||
options.action = [];
|
||||
|
|
@ -79,7 +77,7 @@ export const onGet = (options: {
|
|||
action: options.action,
|
||||
scrollAttr: options.scrollAttr,
|
||||
isSyncing: options.data.data.isSyncing,
|
||||
}, options.protyle, options.app);
|
||||
}, options.protyle);
|
||||
removeLoading(options.protyle);
|
||||
return;
|
||||
}
|
||||
|
|
@ -101,7 +99,7 @@ export const onGet = (options: {
|
|||
action: options.action,
|
||||
scrollAttr: options.scrollAttr,
|
||||
isSyncing: options.data.data.isSyncing,
|
||||
}, options.protyle, options.app);
|
||||
}, options.protyle);
|
||||
setTitle(response.data.ial.title);
|
||||
removeLoading(options.protyle);
|
||||
});
|
||||
|
|
@ -113,7 +111,7 @@ const setHTML = (options: {
|
|||
isSyncing: boolean,
|
||||
expand: boolean,
|
||||
scrollAttr?: IScrollAttr
|
||||
}, protyle: IProtyle, app: App) => {
|
||||
}, protyle: IProtyle) => {
|
||||
if (protyle.contentElement.classList.contains("fn__none")) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -261,7 +259,7 @@ const setHTML = (options: {
|
|||
mode: 2,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet({data: getResponse, protyle, action: [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID], app});
|
||||
onGet({data: getResponse, protyle, action: [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]});
|
||||
});
|
||||
}
|
||||
if (options.action.includes(Constants.CB_GET_APPEND) || options.action.includes(Constants.CB_GET_BEFORE)) {
|
||||
|
|
@ -270,7 +268,7 @@ const setHTML = (options: {
|
|||
if (protyle.options.render.breadcrumb) {
|
||||
protyle.breadcrumb.render(protyle);
|
||||
}
|
||||
app.plugins.forEach(item => {
|
||||
protyle.app.plugins.forEach(item => {
|
||||
item.eventBus.emit("loaded-protyle", protyle);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ import {getDocByScroll, saveScroll} from "../scroll/saveScroll";
|
|||
import {renderBacklink} from "../wysiwyg/renderBacklink";
|
||||
import {hasClosestByClassName} from "./hasClosest";
|
||||
import {preventScroll} from "../scroll/preventScroll";
|
||||
import {App} from "../../index";
|
||||
|
||||
export const reloadProtyle = (protyle: IProtyle, app: App, focus: boolean) => {
|
||||
export const reloadProtyle = (protyle: IProtyle, focus: boolean) => {
|
||||
if (window.siyuan.config.editor.displayBookmarkIcon) {
|
||||
protyle.wysiwyg.element.classList.add("protyle-wysiwyg--attr");
|
||||
} else {
|
||||
|
|
@ -40,7 +39,6 @@ export const reloadProtyle = (protyle: IProtyle, app: App, focus: boolean) => {
|
|||
} else {
|
||||
preventScroll(protyle);
|
||||
getDocByScroll({
|
||||
app,
|
||||
protyle,
|
||||
focus,
|
||||
scrollAttr: saveScroll(protyle, true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue