mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🚨
This commit is contained in:
parent
349c45d137
commit
9ddd1c4674
6 changed files with 11 additions and 14 deletions
|
|
@ -139,7 +139,7 @@ export class Wnd {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const it = this as HTMLElement;
|
const it = this as HTMLElement;
|
||||||
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
|
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
|
||||||
it.style.opacity = ".1"
|
it.style.opacity = ".1";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newTabHeaderElement = hasClosestByTag(event.target, "LI");
|
const newTabHeaderElement = hasClosestByTag(event.target, "LI");
|
||||||
|
|
@ -444,7 +444,7 @@ export class Wnd {
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
tab.headElement.removeAttribute("style")
|
tab.headElement.removeAttribute("style");
|
||||||
}, Constants.TIMEOUT_TRANSITION);
|
}, Constants.TIMEOUT_TRANSITION);
|
||||||
|
|
||||||
tab.headElement.querySelector(".item__close").addEventListener("click", (event) => {
|
tab.headElement.querySelector(".item__close").addEventListener("click", (event) => {
|
||||||
|
|
|
||||||
|
|
@ -412,8 +412,8 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
|
||||||
|
|
||||||
export const resizeDrag = () => {
|
export const resizeDrag = () => {
|
||||||
const dragElement = document.getElementById("drag");
|
const dragElement = document.getElementById("drag");
|
||||||
const width = dragElement.clientWidth
|
const width = dragElement.clientWidth;
|
||||||
const left = dragElement.getBoundingClientRect().left
|
const left = dragElement.getBoundingClientRect().left;
|
||||||
const right = document.querySelector("#windowControls").clientWidth + document.querySelector("#barSearch").clientWidth * 4;
|
const right = document.querySelector("#windowControls").clientWidth + document.querySelector("#barSearch").clientWidth * 4;
|
||||||
if (left > right && left - right < width) {
|
if (left > right && left - right < width) {
|
||||||
dragElement.style.paddingRight = (left - right) + "px";
|
dragElement.style.paddingRight = (left - right) + "px";
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,6 @@ import * as dayjs from "dayjs";
|
||||||
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
||||||
import {cancelSB, insertEmptyBlock, jumpToParentNext} from "../../block/util";
|
import {cancelSB, insertEmptyBlock, jumpToParentNext} from "../../block/util";
|
||||||
import {scrollCenter} from "../../util/highlightById";
|
import {scrollCenter} from "../../util/highlightById";
|
||||||
import {isMobile} from "../../util/functions";
|
|
||||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
|
||||||
import {enableProtyle} from "../util/onGet";
|
|
||||||
import {countBlockWord} from "../../layout/status";
|
import {countBlockWord} from "../../layout/status";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
import {openFileById} from "../../editor/util";
|
import {openFileById} from "../../editor/util";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {focusBlock, focusByRange, focusByWbr} from "./selection";
|
import {focusBlock, focusByRange} from "./selection";
|
||||||
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "./hasClosest";
|
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "./hasClosest";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {paste} from "./paste";
|
import {paste} from "./paste";
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ export const disabledProtyle = (protyle: IProtyle) => {
|
||||||
hideElements(["gutter", "toolbar", "select", "hint", "util"], protyle);
|
hideElements(["gutter", "toolbar", "select", "hint", "util"], protyle);
|
||||||
protyle.disabled = true;
|
protyle.disabled = true;
|
||||||
if (protyle.title) {
|
if (protyle.title) {
|
||||||
const titleElement = protyle.title.element.querySelector(".protyle-title__input") as HTMLElement
|
const titleElement = protyle.title.element.querySelector(".protyle-title__input") as HTMLElement;
|
||||||
titleElement.setAttribute("contenteditable", "false");
|
titleElement.setAttribute("contenteditable", "false");
|
||||||
titleElement.style.userSelect = "text";
|
titleElement.style.userSelect = "text";
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +297,7 @@ export const enableProtyle = (protyle: IProtyle) => {
|
||||||
// iPhone,iPad 端输入 contenteditable 为 true 时会在块中间插入 span
|
// iPhone,iPad 端输入 contenteditable 为 true 时会在块中间插入 span
|
||||||
} else {
|
} else {
|
||||||
if (protyle.title) {
|
if (protyle.title) {
|
||||||
const titleElement = protyle.title.element.querySelector(".protyle-title__input") as HTMLElement
|
const titleElement = protyle.title.element.querySelector(".protyle-title__input") as HTMLElement;
|
||||||
titleElement.setAttribute("contenteditable", "true");
|
titleElement.setAttribute("contenteditable", "true");
|
||||||
titleElement.style.userSelect = "";
|
titleElement.style.userSelect = "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,9 @@ export const renderSnippet = () => {
|
||||||
scriptElement.id = `snippetJS${item.name}`;
|
scriptElement.id = `snippetJS${item.name}`;
|
||||||
document.head.appendChild(scriptElement);
|
document.head.appendChild(scriptElement);
|
||||||
}
|
}
|
||||||
})
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const initAssets = () => {
|
export const initAssets = () => {
|
||||||
const emojiElement = document.getElementById("emojiScript");
|
const emojiElement = document.getElementById("emojiScript");
|
||||||
|
|
@ -185,7 +185,7 @@ export const setMode = (modeElementValue: number) => {
|
||||||
exportLayout(true);
|
exportLayout(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.siyuan.config.appearance = response.data
|
window.siyuan.config.appearance = response.data;
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_THEME, response.data.modeOS ? "system" : (response.data.mode === 1 ? "dark" : "light"));
|
ipcRenderer.send(Constants.SIYUAN_CONFIG_THEME, response.data.modeOS ? "system" : (response.data.mode === 1 ? "dark" : "light"));
|
||||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSE, response.data.closeButtonBehavior);
|
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSE, response.data.closeButtonBehavior);
|
||||||
|
|
@ -194,4 +194,4 @@ export const setMode = (modeElementValue: number) => {
|
||||||
document.querySelector("#barMode use").setAttribute("xlink:href", `#icon${window.siyuan.config.appearance.modeOS ? "Mode" : (window.siyuan.config.appearance.mode === 0 ? "Light" : "Dark")}`);
|
document.querySelector("#barMode use").setAttribute("xlink:href", `#icon${window.siyuan.config.appearance.modeOS ? "Mode" : (window.siyuan.config.appearance.mode === 0 ? "Light" : "Dark")}`);
|
||||||
});
|
});
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue