mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 07:46:09 +01:00
🎨 font size
This commit is contained in:
parent
aa22b4892a
commit
713aba12e2
6 changed files with 36 additions and 15 deletions
|
|
@ -49,6 +49,15 @@ export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => {
|
|||
</button>`;
|
||||
});
|
||||
|
||||
const nodeElements = getFontNodeElements(protyle);
|
||||
let disableFont = false;
|
||||
nodeElements?.find((item: HTMLElement) => {
|
||||
if (item.classList.contains("list") || item.classList.contains("li")) {
|
||||
disableFont = true;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
let lastColorHTML = "";
|
||||
const lastFonts = window.siyuan.storage[Constants.LOCAL_FONTSTYLES];
|
||||
if (lastFonts.length > 0) {
|
||||
|
|
@ -82,9 +91,11 @@ export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => {
|
|||
</button>`;
|
||||
break;
|
||||
case "fontSize":
|
||||
lastColorHTML += `<button class="keyboard__slash-item" data-type="${lastFontStatus[0]}">
|
||||
if (!disableFont) {
|
||||
lastColorHTML += `<button class="keyboard__slash-item" data-type="${lastFontStatus[0]}">
|
||||
<span class="keyboard__slash-text">${lastFontStatus[1]}</span>
|
||||
</button>`;
|
||||
}
|
||||
break;
|
||||
case "style1":
|
||||
lastColorHTML += `<button class="keyboard__slash-item" data-type="${lastFontStatus[0]}">
|
||||
|
|
@ -103,7 +114,6 @@ export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => {
|
|||
}
|
||||
let textElement: HTMLElement;
|
||||
let fontSize = "16px";
|
||||
const nodeElements = getFontNodeElements(protyle);
|
||||
if (nodeElements && nodeElements.length > 0) {
|
||||
textElement = nodeElements[0] as HTMLElement;
|
||||
} else {
|
||||
|
|
@ -157,8 +167,8 @@ export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => {
|
|||
<span class="keyboard__slash-text">${window.siyuan.languages.clearFontStyle}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="keyboard__slash-title">${window.siyuan.languages.fontSize}</div>
|
||||
<div class="keyboard__slash-block">
|
||||
<div class="keyboard__slash-title${disableFont ? " fn__none" : ""}">${window.siyuan.languages.fontSize}</div>
|
||||
<div class="keyboard__slash-block${disableFont ? " fn__none" : ""}">
|
||||
<select class="b3-select fn__block" style="width: calc(50% - 8px);margin: 4px 0 8px 0;">
|
||||
<option ${fontSize === "12px" ? "selected" : ""} value="12px">12px</option>
|
||||
<option ${fontSize === "13px" ? "selected" : ""} value="13px">13px</option>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue