Vanessa 2022-11-01 10:51:06 +08:00
parent 9d9746d739
commit 1b5bc9f396
15 changed files with 84 additions and 5 deletions

View file

@ -1,5 +1,11 @@
document.body.insertAdjacentHTML('afterBegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="iconLtr" viewBox="0 0 32 32">
<path d="M12.4 20.8v-8.8q-2.64 0-4.52-1.72t-1.88-4.28q0-2.52 1.74-4.26t4.26-1.74h11.2v2.4h-3.6v18.4h-2.4v-18.4h-2.4v18.4zM24.56 32l-1.68-1.68 2.96-2.96h-24.24v-2.4h24.24l-2.96-2.96 1.68-1.68 5.84 5.84zM12.4 9.6v-7.2q-1.68 0-2.84 0.96t-1.16 2.64 1.16 2.64 2.84 0.96z"></path>
</symbol>
<symbol id="iconRtl" viewBox="0 0 32 32">
<path d="M7.44 32l-5.84-5.84 5.84-5.84 1.68 1.68-2.96 2.96h24.24v2.4h-24.24l2.96 2.96zM12.4 20.8v-8.8q-2.64 0-4.52-1.72t-1.88-4.28q0-2.52 1.74-4.26t4.26-1.74h11.2v2.4h-3.6v18.4h-2.4v-18.4h-2.4v18.4zM12.4 9.6v-7.2q-1.68 0-2.84 0.96t-1.16 2.64 1.16 2.64 2.84 0.96z"></path>
</symbol>
<symbol id="iconBack" viewBox="0 0 32 32">
<path d="M30.135 14.508h-22.973l13.75-11.936c0.22-0.192 0.086-0.55-0.204-0.55h-3.475c-0.153 0-0.298 0.055-0.412 0.153l-14.838 12.874c-0.266 0.231-0.433 0.57-0.433 0.948s0.167 0.717 0.431 0.947l0.002 0.001 14.924 12.953c0.059 0.051 0.13 0.079 0.204 0.079h3.593c0.291 0 0.424-0.361 0.204-0.55l-13.746-11.936h22.973c0.173 0 0.314-0.141 0.314-0.314v-2.356c0-0.173-0.141-0.314-0.314-0.314z"></path>
</symbol>

View file

@ -2,5 +2,5 @@
"name": "ant",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
"version": "1.6.0"
"version": "1.7.0"
}

View file

@ -28,6 +28,18 @@
<body>
<h2>SiYuan</h2>
<div class="fn__clear">
<div>
<svg>
<use xlink:href="#iconRtl"></use>
</svg>
iconRtl
</div>
<div>
<svg>
<use xlink:href="#iconLtr"></use>
</svg>
iconLtr
</div>
<div>
<svg>
<use xlink:href="#iconBack"></use>

View file

@ -1,5 +1,11 @@
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="iconLtr" viewBox="0 0 32 32">
<path d="M12.4 20.8v-8.8q-2.64 0-4.52-1.72t-1.88-4.28q0-2.52 1.74-4.26t4.26-1.74h11.2v2.4h-3.6v18.4h-2.4v-18.4h-2.4v18.4zM24.56 32l-1.68-1.68 2.96-2.96h-24.24v-2.4h24.24l-2.96-2.96 1.68-1.68 5.84 5.84zM12.4 9.6v-7.2q-1.68 0-2.84 0.96t-1.16 2.64 1.16 2.64 2.84 0.96z"></path>
</symbol>
<symbol id="iconRtl" viewBox="0 0 32 32">
<path d="M7.44 32l-5.84-5.84 5.84-5.84 1.68 1.68-2.96 2.96h24.24v2.4h-24.24l2.96 2.96zM12.4 20.8v-8.8q-2.64 0-4.52-1.72t-1.88-4.28q0-2.52 1.74-4.26t4.26-1.74h11.2v2.4h-3.6v18.4h-2.4v-18.4h-2.4v18.4zM12.4 9.6v-7.2q-1.68 0-2.84 0.96t-1.16 2.64 1.16 2.64 2.84 0.96z"></path>
</symbol>
<symbol id="iconBack" viewBox="0 0 32 32">
<path d="M16 30.5l-14.5-14.5 14.5-14.5 1.903 1.903-11.237 11.237h23.834v2.719h-23.834l11.237 11.237z"></path>
</symbol>

View file

@ -2,5 +2,5 @@
"name": "material",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
"version": "1.6.0"
"version": "1.7.0"
}

View file

@ -116,6 +116,7 @@
"justify": "Justify",
"justifyTip": "Render content side-aligned",
"rtl": "Right to Left (RTL)",
"ltr": "Left to Right (LTR)",
"rtlTip": "Render content from right to left",
"height": "Height",
"deactivateUser": "Deactivate Account",

View file

@ -116,6 +116,7 @@
"justify": "Justificar",
"justifyTip": "Representar contenido alineado lateralmente",
"rtl": "De derecha a izquierda (RTL)",
"ltr": "De izquierda a derecha (LTR)",
"rtlTip": "Reproducir contenido de derecha a izquierda",
"height": "Altura",
"deactivateUser": "Desactivar cuenta",

View file

@ -116,6 +116,7 @@
"justify": "Justifier",
"justifyTip": "Rendre le contenu aligné sur les côtés",
"rtl": "De droite à gauche (RTL)",
"ltr": "De gauche à droite (LTR)",
"rtlTip": "Rendre le contenu de droite à gauche",
"height": "haut",
"deactivateUser": "Désactiver le compte",

View file

@ -116,6 +116,7 @@
"justify": "兩側對齊",
"justifyTip": "將內容以兩側對齊的方式進行渲染",
"rtl": "從右到左RTL",
"ltr": "從左到右LTR",
"rtlTip": "將內容以從右到左的方式進行渲染",
"height": "高度",
"deactivateUser": "註銷賬號",

View file

@ -116,6 +116,7 @@
"justify": "两侧对齐",
"justifyTip": "将内容以两侧对齐的方式进行渲染",
"rtl": "从右到左RTL",
"ltr": "从左到右LTR",
"rtlTip": "将内容以从右到左的方式进行渲染",
"height": "高度",
"deactivateUser": "注销账号",

View file

@ -69,6 +69,22 @@ export const editor = {
<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">
<div class="fn__flex-1">
${window.siyuan.languages.justify}
<div class="b3-label__text">${window.siyuan.languages.justifyTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="justify" type="checkbox"${window.siyuan.config.editor.justify ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.rtl}
<div class="b3-label__text">${window.siyuan.languages.rtlTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="rtl" type="checkbox"${window.siyuan.config.editor.rtl ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.editReadonly}
@ -273,6 +289,8 @@ export const editor = {
fetchPost("/api/setting/setEditor", {
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
justify: (editor.element.querySelector("#justify") as HTMLInputElement).checked,
rtl: (editor.element.querySelector("#rtl") as HTMLInputElement).checked,
readOnly: (editor.element.querySelector("#readOnly") as HTMLInputElement).checked,
displayBookmarkIcon: (editor.element.querySelector("#displayBookmarkIcon") as HTMLInputElement).checked,
displayNetImgMark: (editor.element.querySelector("#displayNetImgMark") as HTMLInputElement).checked,

View file

@ -16,7 +16,7 @@ export const initConfigSearch = (element: HTMLElement) => {
"md39", "md40", "fontSizeTip", "fontSize", "font", "font1", "generateHistory", "generateHistoryInterval",
"historyRetentionDays", "historyRetentionDaysTip", "clearHistory", "katexMacros", "katexMacrosTip",
"editReadonly", "editReadonlyTip", "embedBlockBreadcrumb", "embedBlockBreadcrumbTip", "outdentTip",
"outdent", "floatWindowMode", "floatWindowModeTip"
"outdent", "floatWindowMode", "floatWindowModeTip", "justify", "justifyTip", "rtl", "rtlTip"
]),
// 文档树

View file

@ -1478,6 +1478,35 @@ export class Gutter {
e.style.textAlign = "justify";
});
}
}, {
type: "separator"
}, {
label: window.siyuan.languages.ltr,
icon: "iconRtl",
click: () => {
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
e.style.direction = "ltr";
});
}
}, {
label: window.siyuan.languages.rtl,
icon: "iconRtl",
click: () => {
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
e.style.direction = "rtl";
});
}
}, {
type: "separator"
}, {
label: window.siyuan.languages.clearFontStyle,
icon: "iconTrashcan",
click: () => {
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
e.style.textAlign = "";
e.style.direction = "";
});
}
}]
}).element);
}
@ -1662,7 +1691,7 @@ export class Gutter {
}]);
}
public render(protyle:IProtyle, element: Element, wysiwyg: HTMLElement) {
public render(protyle: IProtyle, element: Element, wysiwyg: HTMLElement) {
// https://github.com/siyuan-note/siyuan/issues/4659
const titleElement = wysiwyg.parentElement.querySelector(".protyle-title__input");
if (titleElement && titleElement.getAttribute("data-render") !== "true") {

View file

@ -245,6 +245,8 @@ declare interface IExport {
}
declare interface IEditor {
justify: boolean;
rtl: boolean;
readOnly: boolean;
listLogicalOutdent: boolean;
katexMacros: string;

View file

@ -162,7 +162,8 @@ export const setInlineStyle = (set = true) => {
.protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h1, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h2, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h3, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h4, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h5, .protyle-wysiwyg [data-node-id].li > .protyle-action ~ .h6 {line-height:${height + 8}px;}
.protyle-wysiwyg [data-node-id].li > .protyle-action:after {height: ${window.siyuan.config.editor.fontSize}px;width: ${window.siyuan.config.editor.fontSize}px;margin:-${window.siyuan.config.editor.fontSize / 2}px 0 0 -${window.siyuan.config.editor.fontSize / 2}px}
.protyle-wysiwyg [data-node-id].li > .protyle-action svg {height: ${Math.max(14, window.siyuan.config.editor.fontSize - 8)}px}
.protyle-wysiwyg [data-node-id] [spellcheck="false"] {min-height:${height}px}
.protyle-wysiwyg [data-node-id] [spellcheck="false"] {min-height:${height}px;}
.protyle-wysiwyg [data-node-id] {${window.siyuan.config.editor.rtl?" direction: rtl;":""}${window.siyuan.config.editor.justify?" text-align: justify;":""}}
.protyle-wysiwyg .li {min-height:${height + 8}px}
.protyle-gutters button svg {height:${height}px}
.protyle-wysiwyg img.emoji, .b3-typography img.emoji {width:${height - 8}px}