mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
3d71a2644b
commit
41ca310e09
12 changed files with 34 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"adaptiveWidth": "Adaptive Width",
|
||||||
"tabLimit": "Tab Limit",
|
"tabLimit": "Tab Limit",
|
||||||
"tabLimit1": "Sort by opening time, close the earliest opened tab",
|
"tabLimit1": "Sort by opening time, close the earliest opened tab",
|
||||||
"pasteEscaped": "Paste escaped text",
|
"pasteEscaped": "Paste escaped text",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"adaptiveWidth": "Ancho adaptable",
|
||||||
"tabLimit": "Límite de la pestaña",
|
"tabLimit": "Límite de la pestaña",
|
||||||
"tabLimit1": "Ordenar por hora de apertura, cerrar la primera pestaña abierta",
|
"tabLimit1": "Ordenar por hora de apertura, cerrar la primera pestaña abierta",
|
||||||
"pasteEscaped": "Pegar texto escapado",
|
"pasteEscaped": "Pegar texto escapado",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"adaptiveWidth": "Largeur adaptative",
|
||||||
"tabLimit": "Nombre maximum d'onglets ouverts",
|
"tabLimit": "Nombre maximum d'onglets ouverts",
|
||||||
"tabLimit1": "Trier par heure d'ouverture, fermer le premier onglet ouvert",
|
"tabLimit1": "Trier par heure d'ouverture, fermer le premier onglet ouvert",
|
||||||
"pasteEscaped": "Coller le texte échappé",
|
"pasteEscaped": "Coller le texte échappé",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"adaptiveWidth": "自適應寬度",
|
||||||
"tabLimit": "頁簽打開最大數量",
|
"tabLimit": "頁簽打開最大數量",
|
||||||
"tabLimit1": "按照打開時間排序,關閉最早打開的頁簽",
|
"tabLimit1": "按照打開時間排序,關閉最早打開的頁簽",
|
||||||
"pasteEscaped": "粘貼轉義文本",
|
"pasteEscaped": "粘貼轉義文本",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"fullWidth": "自适应宽度",
|
||||||
"tabLimit": "页签打开最大数量",
|
"tabLimit": "页签打开最大数量",
|
||||||
"tabLimit1": "按照打开时间排序,关闭最早打开的页签",
|
"tabLimit1": "按照打开时间排序,关闭最早打开的页签",
|
||||||
"pasteEscaped": "粘贴转义文本",
|
"pasteEscaped": "粘贴转义文本",
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
|
transition: left .15s cubic-bezier(0, 0, .2, 1) 0ms;
|
||||||
|
|
||||||
.protyle-icons {
|
.protyle-icons {
|
||||||
position: initial;
|
position: initial;
|
||||||
|
|
@ -347,6 +348,7 @@
|
||||||
margin: 34px 16px 0 24px;
|
margin: 34px 16px 0 24px;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
transition: margin .15s cubic-bezier(0, 0, .2, 1) 0ms;
|
||||||
|
|
||||||
&:hover .protyle-title__icon {
|
&:hover .protyle-title__icon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
.protyle-wysiwyg {
|
.protyle-wysiwyg {
|
||||||
padding: 34px 16px 16px 24px;
|
padding: 34px 16px 16px 24px;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
|
transition: padding .15s cubic-bezier(0, 0, .2, 1) 0ms;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,20 @@ import {getAllModels} from "../layout/getAll";
|
||||||
import {setInlineStyle} from "../util/assets";
|
import {setInlineStyle} from "../util/assets";
|
||||||
import {fetchPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
import {confirmDialog} from "../dialog/confirmDialog";
|
import {confirmDialog} from "../dialog/confirmDialog";
|
||||||
|
import {setPadding} from "../protyle/ui/initUI";
|
||||||
|
|
||||||
export const editor = {
|
export const editor = {
|
||||||
element: undefined as Element,
|
element: undefined as Element,
|
||||||
genHTML: () => {
|
genHTML: () => {
|
||||||
let fontFamilyHTML = "";
|
let fontFamilyHTML = "";
|
||||||
fontFamilyHTML = '<select id="fontFamily" class="b3-select fn__flex-center fn__size200"></select>';
|
fontFamilyHTML = '<select id="fontFamily" class="b3-select fn__flex-center fn__size200"></select>';
|
||||||
return `
|
return `<label class="fn__flex b3-label">
|
||||||
|
<div class="fn__flex-1">
|
||||||
|
${window.siyuan.languages.fullWidth}
|
||||||
|
</div>
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<input class="b3-switch fn__flex-center" id="fullWidth" type="checkbox"${window.siyuan.config.editor.fullWidth ? " checked" : ""}/>
|
||||||
|
</label>
|
||||||
<label class="fn__flex b3-label">
|
<label class="fn__flex b3-label">
|
||||||
<div class="fn__flex-1">
|
<div class="fn__flex-1">
|
||||||
${window.siyuan.languages.md12}
|
${window.siyuan.languages.md12}
|
||||||
|
|
@ -146,6 +153,7 @@ export const editor = {
|
||||||
|
|
||||||
const setEditor = () => {
|
const setEditor = () => {
|
||||||
fetchPost("/api/setting/setEditor", {
|
fetchPost("/api/setting/setEditor", {
|
||||||
|
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
|
||||||
displayBookmarkIcon: (editor.element.querySelector("#displayBookmarkIcon") as HTMLInputElement).checked,
|
displayBookmarkIcon: (editor.element.querySelector("#displayBookmarkIcon") as HTMLInputElement).checked,
|
||||||
displayNetImgMark: (editor.element.querySelector("#displayNetImgMark") as HTMLInputElement).checked,
|
displayNetImgMark: (editor.element.querySelector("#displayNetImgMark") as HTMLInputElement).checked,
|
||||||
codeSyntaxHighlightLineNum: (editor.element.querySelector("#codeSyntaxHighlightLineNum") as HTMLInputElement).checked,
|
codeSyntaxHighlightLineNum: (editor.element.querySelector("#codeSyntaxHighlightLineNum") as HTMLInputElement).checked,
|
||||||
|
|
@ -186,6 +194,7 @@ export const editor = {
|
||||||
window.siyuan.config.editor = editor;
|
window.siyuan.config.editor = editor;
|
||||||
getAllModels().editor.forEach((item) => {
|
getAllModels().editor.forEach((item) => {
|
||||||
item.editor.reload();
|
item.editor.reload();
|
||||||
|
setPadding(item.editor.protyle);
|
||||||
});
|
});
|
||||||
setInlineStyle();
|
setInlineStyle();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ const getLang = (keys: string[]) => {
|
||||||
export const initConfigSearch = (element: HTMLElement) => {
|
export const initConfigSearch = (element: HTMLElement) => {
|
||||||
const configIndex = [
|
const configIndex = [
|
||||||
// 编辑器
|
// 编辑器
|
||||||
getLang(["config",
|
getLang(["config", "fullWidth",
|
||||||
"editor", "md2", "md3", "md12", "md16", "md27", "md28", "md29", "md30", "md31", "md32", "md33", "md34", "md39",
|
"editor", "md2", "md3", "md12", "md16", "md27", "md28", "md29", "md30", "md31", "md32", "md33", "md34", "md39",
|
||||||
"fontSizeTip", "fontSize", "font", "font1", "generateHistory", "generateHistoryInterval",
|
"fontSizeTip", "fontSize", "font", "font1", "generateHistory", "generateHistoryInterval",
|
||||||
"historyRetentionDays", "historyRetentionDaysTip", "clearHistory"
|
"historyRetentionDays", "historyRetentionDaysTip", "clearHistory"
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ export abstract class Constants {
|
||||||
public static readonly SIZE_GET_MAX = 102400;
|
public static readonly SIZE_GET_MAX = 102400;
|
||||||
public static readonly SIZE_UNDO = 64;
|
public static readonly SIZE_UNDO = 64;
|
||||||
public static readonly SIZE_TITLE = 512;
|
public static readonly SIZE_TITLE = 512;
|
||||||
|
public static readonly SIZE_EDITOR_WIDTH = 760;
|
||||||
|
|
||||||
// ws callback
|
// ws callback
|
||||||
public static readonly CB_MOUNT_HELP = "cb-mount-help";
|
public static readonly CB_MOUNT_HELP = "cb-mount-help";
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import {setEditMode} from "../util/setEditMode";
|
||||||
import {lineNumberRender} from "../markdown/highlightRender";
|
import {lineNumberRender} from "../markdown/highlightRender";
|
||||||
import {scrollEvent} from "../scroll/event";
|
import {scrollEvent} from "../scroll/event";
|
||||||
import {isMobile} from "../../util/functions";
|
import {isMobile} from "../../util/functions";
|
||||||
|
import {Constants} from "../../constants";
|
||||||
|
|
||||||
export const initUI = (protyle: IProtyle) => {
|
export const initUI = (protyle: IProtyle) => {
|
||||||
protyle.contentElement = document.createElement("div");
|
protyle.contentElement = document.createElement("div");
|
||||||
|
|
@ -46,8 +47,18 @@ export const addLoading = (protyle: IProtyle) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setPadding = (protyle: IProtyle) => {
|
export const setPadding = (protyle: IProtyle) => {
|
||||||
const min16 = protyle.element.clientWidth > 888 ? 96 : 16;
|
let min16 = 16;
|
||||||
const min24 = protyle.element.clientWidth > 888 ? 96 : 24;
|
let min24 = 24;
|
||||||
|
if (!isMobile()) {
|
||||||
|
const padding = (protyle.element.clientWidth - Constants.SIZE_EDITOR_WIDTH) / 2
|
||||||
|
if (!window.siyuan.config.editor.fullWidth && padding > 96) {
|
||||||
|
min16 = padding
|
||||||
|
min24 = padding
|
||||||
|
} else if (protyle.element.clientWidth > Constants.SIZE_EDITOR_WIDTH) {
|
||||||
|
min16 = 96
|
||||||
|
min24 = 96
|
||||||
|
}
|
||||||
|
}
|
||||||
if (protyle.options.render.background && protyle.options.render.title) {
|
if (protyle.options.render.background && protyle.options.render.title) {
|
||||||
protyle.background.element.lastElementChild.setAttribute("style", `left:${min16}px`);
|
protyle.background.element.lastElementChild.setAttribute("style", `left:${min16}px`);
|
||||||
protyle.title.element.style.margin = `16px ${min16}px 0 ${min24}px`;
|
protyle.title.element.style.margin = `16px ${min16}px 0 ${min24}px`;
|
||||||
|
|
|
||||||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -177,6 +177,7 @@ declare interface IExport {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface IEditor {
|
declare interface IEditor {
|
||||||
|
fullWidth: boolean;
|
||||||
fontSize: number;
|
fontSize: number;
|
||||||
generateHistoryInterval: number;
|
generateHistoryInterval: number;
|
||||||
historyRetentionDays: number;
|
historyRetentionDays: number;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue