mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
Compare commits
6 commits
67f232076e
...
40328523ad
Author | SHA1 | Date | |
---|---|---|---|
![]() |
40328523ad | ||
![]() |
7cc61ba650 | ||
![]() |
d372e871f4 | ||
![]() |
ea781d30ed | ||
![]() |
f747739fd5 | ||
![]() |
dffd12477e |
16 changed files with 89 additions and 27 deletions
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "قاعدة البيانات هذه",
|
||||
"relatedTo": "الربط بـ",
|
||||
"relation": "ربط",
|
||||
"relatedItems": "العناصر المرتبطة",
|
||||
"rollup": "القيمة المحتسبة",
|
||||
"rollupProperty": "الخاصية",
|
||||
"rollupCalc": "الحساب بـ",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "Diese Datenbank",
|
||||
"relatedTo": "Verbindung zu",
|
||||
"relation": "Beziehung",
|
||||
"relatedItems": "Verknüpfte Einträge",
|
||||
"rollup": "Rollup",
|
||||
"rollupProperty": "Eigenschaft",
|
||||
"rollupCalc": "Berechnen",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "This database",
|
||||
"relatedTo": "Relation to",
|
||||
"relation": "Relation",
|
||||
"relatedItems": "Related Items",
|
||||
"rollup": "Rollup",
|
||||
"rollupProperty": "Property",
|
||||
"rollupCalc": "Calculate",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "Esta base de datos",
|
||||
"relatedTo": "Relación con",
|
||||
"relation": "Relación",
|
||||
"relatedItems": "Elementos relacionados",
|
||||
"rollup": "Acumular",
|
||||
"rollupProperty": "Propiedad",
|
||||
"rollupCalc": "Calcular",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "Cette base de données",
|
||||
"relatedTo": " Relation avec ",
|
||||
"relation": "Relation",
|
||||
"relatedItems": "Éléments liés",
|
||||
"rollup": "Rollup",
|
||||
"rollupProperty": "Propriété",
|
||||
"rollupCalc": "Calculer",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "בסיס הנתונים הזה",
|
||||
"relatedTo": "קשר ל",
|
||||
"relation": "קשר",
|
||||
"relatedItems": "פריטים קשורים",
|
||||
"rollup": "סיכום",
|
||||
"rollupProperty": "מאפיין",
|
||||
"rollupCalc": "חישוב",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "Questo database",
|
||||
"relatedTo": "Relazionato a",
|
||||
"relation": "Relazione",
|
||||
"relatedItems": "Elementi correlati",
|
||||
"rollup": "Rollup",
|
||||
"rollupProperty": "Proprietà",
|
||||
"rollupCalc": "Calcola",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "現在のデータベース",
|
||||
"relatedTo": "関連付け",
|
||||
"relation": "関連",
|
||||
"relatedItems": "関連項目",
|
||||
"rollup": "集計",
|
||||
"rollupProperty": "属性",
|
||||
"rollupCalc": "計算方法",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "Ta baza danych",
|
||||
"relatedTo": "Powiązane z",
|
||||
"relation": "Relacja",
|
||||
"relatedItems": "Powiązane elementy",
|
||||
"rollup": "Skumuluje",
|
||||
"rollupProperty": "Właściwość",
|
||||
"rollupCalc": "Oblicz",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "Este banco de dados",
|
||||
"relatedTo": "Relacionado a",
|
||||
"relation": "Relação",
|
||||
"relatedItems": "Itens relacionados",
|
||||
"rollup": "Rollup",
|
||||
"rollupProperty": "Propriedade",
|
||||
"rollupCalc": "Calcular",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "Эта база данных",
|
||||
"relatedTo": "Связано с",
|
||||
"relation": "Связь",
|
||||
"relatedItems": "Связанные элементы",
|
||||
"rollup": "Свод",
|
||||
"rollupProperty": "Свойство",
|
||||
"rollupCalc": "Вычислить",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "目前資料庫",
|
||||
"relatedTo": "關聯至",
|
||||
"relation": "關聯",
|
||||
"relatedItems": "已關聯條目",
|
||||
"rollup": "匯總",
|
||||
"rollupProperty": "總計欄位",
|
||||
"rollupCalc": "彙總方式",
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
"thisDatabase": "当前数据库",
|
||||
"relatedTo": "关联至",
|
||||
"relation": "关联",
|
||||
"relatedItems": "已关联条目",
|
||||
"rollup": "汇总",
|
||||
"rollupProperty": "汇总字段",
|
||||
"rollupCalc": "汇总方式",
|
||||
|
|
|
@ -13,6 +13,8 @@ import {getFieldsByData, getViewName} from "./view";
|
|||
import {getColId} from "./col";
|
||||
import {getFieldIdByCellElement} from "./row";
|
||||
import {isMobile} from "../../../util/functions";
|
||||
import {showMessage} from "../../../dialog/message";
|
||||
import {writeText} from "../../util/compatibility";
|
||||
|
||||
interface IAVItem {
|
||||
avID: string;
|
||||
|
@ -249,6 +251,17 @@ export const toggleUpdateRelationBtn = (menuItemsElement: HTMLElement, avId: str
|
|||
}
|
||||
};
|
||||
|
||||
const updateCopyRelatedItems = (menuElement: Element) => {
|
||||
const inputElement = menuElement.querySelector(".b3-form__icona .b3-text-field");
|
||||
if (menuElement.querySelector(".b3-menu__icon.fn__grab")) {
|
||||
inputElement.nextElementSibling.classList.remove("fn__none");
|
||||
inputElement.classList.add("b3-form__icona-input");
|
||||
} else {
|
||||
inputElement.nextElementSibling.classList.add("fn__none");
|
||||
inputElement.classList.remove("b3-form__icona-input");
|
||||
}
|
||||
};
|
||||
|
||||
const genSelectItemHTML = (options: {
|
||||
type: "selected" | "empty" | "unselect",
|
||||
id?: string,
|
||||
|
@ -322,6 +335,7 @@ ${keyword ? genSelectItemHTML({
|
|||
text: menuElement.querySelector(".popover__block").outerHTML
|
||||
}) : (html ? "" : genSelectItemHTML({type: "empty"}))}`;
|
||||
menuElement.querySelector(".b3-menu__items .b3-menu__item:not(.fn__none)").classList.add("b3-menu__item--current");
|
||||
updateCopyRelatedItems(menuElement);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -369,7 +383,7 @@ ${html || genSelectItemHTML({type: "empty"})}`;
|
|||
options.menuElement.querySelector(".b3-menu__items .b3-menu__item:not(.fn__none)").classList.add("b3-menu__item--current");
|
||||
const inputElement = options.menuElement.querySelector("input");
|
||||
inputElement.focus();
|
||||
const databaseName = inputElement.parentElement.querySelector(".popover__block");
|
||||
const databaseName = inputElement.parentElement.parentElement.querySelector(".popover__block");
|
||||
databaseName.innerHTML = Lute.EscapeHTMLStr(response.data.name);
|
||||
databaseName.setAttribute("data-id", response.data.blockIDs[0]);
|
||||
const listElement = options.menuElement.querySelector(".b3-menu__items");
|
||||
|
@ -396,6 +410,26 @@ ${html || genSelectItemHTML({type: "empty"})}`;
|
|||
event.stopPropagation();
|
||||
filterItem(options.menuElement, options.cellElements[0], inputElement.value);
|
||||
});
|
||||
updateCopyRelatedItems(options.menuElement)
|
||||
options.menuElement.querySelector('[data-type="copyRelatedItems"]').addEventListener("click", () => {
|
||||
let copyText = "";
|
||||
const selectedElements = options.menuElement.querySelectorAll('.b3-menu__item[draggable="true"]');
|
||||
selectedElements.forEach((item: HTMLElement) => {
|
||||
if (selectedElements.length > 1) {
|
||||
copyText += "* ";
|
||||
}
|
||||
const textElement = item.querySelector(".b3-menu__label") as HTMLElement;
|
||||
if (!textElement.dataset.id || textElement.dataset.id === "undefined") {
|
||||
copyText += textElement.textContent + "\n";
|
||||
} else {
|
||||
copyText += `((${textElement.dataset.id} "${textElement.textContent}"))\n`;
|
||||
}
|
||||
});
|
||||
if (copyText) {
|
||||
writeText(copyText.trimEnd());
|
||||
showMessage(window.siyuan.languages.copied);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -410,9 +444,12 @@ export const getRelationHTML = (data: IAV, cellElements?: HTMLElement[]) => {
|
|||
if (colRelationData && colRelationData.avID) {
|
||||
return `<div data-av-id="${colRelationData.avID}" class="fn__flex-column">
|
||||
<div class="b3-menu__item" data-type="nobg">
|
||||
<input class="b3-text-field fn__flex-1"/>
|
||||
<div class="b3-form__icona">
|
||||
<input class="b3-text-field fn__flex-1 b3-form__icona-input fn__size200"/>
|
||||
<svg class="b3-form__icona-icon ariaLabel" data-position="north" data-type="copyRelatedItems" aria-label="${window.siyuan.languages.copy} ${window.siyuan.languages.relatedItems}"><use xlink:href="#iconCopy"></use></svg>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<span style="color: var(--b3-protyle-inline-blockref-color);" data-id="" class="popover__block fn__pointer"></span>
|
||||
<span style="color: var(--b3-protyle-inline-blockref-color);max-width: 200px" data-id="" class="popover__block fn__pointer fn__ellipsis"></span>
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="b3-menu__items">
|
||||
|
@ -539,4 +576,5 @@ class="${target.className} ariaLabel" draggable="true">${genSelectItemHTML({
|
|||
}
|
||||
}
|
||||
updateCellsValue(protyle, nodeElement, newValue, cellElements);
|
||||
updateCopyRelatedItems(menuElement);
|
||||
};
|
||||
|
|
|
@ -473,7 +473,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
const textHTMLLowercase = textHTML.toLowerCase();
|
||||
if (textPlain && "" !== textPlain.trim() && (textHTML.startsWith("<span") || textHTML.startsWith("<br")) &&
|
||||
(0 > textHTMLLowercase.indexOf("class=\"katex") && 0 > textHTMLLowercase.indexOf("class=\"math") &&
|
||||
0 > textHTMLLowercase.indexOf("</a>") && 0 > textHTMLLowercase.indexOf("</img>") &&
|
||||
0 > textHTMLLowercase.indexOf("</a>") && 0 > textHTMLLowercase.indexOf("</img>") && 0 > textHTMLLowercase.indexOf("</code>") &&
|
||||
0 > textHTMLLowercase.indexOf("</b>") && 0 > textHTMLLowercase.indexOf("</strong>") &&
|
||||
0 > textHTMLLowercase.indexOf("</i>") && 0 > textHTMLLowercase.indexOf("</em>") &&
|
||||
0 > textHTMLLowercase.indexOf("</ol>") && 0 > textHTMLLowercase.indexOf("</ul>") &&
|
||||
|
|
|
@ -121,16 +121,24 @@ func parseTTCFontFamily(fontPath string) (ret []string) {
|
|||
continue
|
||||
}
|
||||
|
||||
family, _ := font.Name(nil, ttc.NameIDFamily)
|
||||
if "" == family {
|
||||
family, _ = font.Name(nil, ttc.NameIDTypographicFamily)
|
||||
}
|
||||
family, _ := font.Name(nil, ttc.NameIDFull)
|
||||
family = strings.TrimSpace(family)
|
||||
if "" == family || strings.HasPrefix(family, ".") {
|
||||
continue
|
||||
}
|
||||
if "" != family && !strings.HasPrefix(family, ".") {
|
||||
ret = append(ret, family)
|
||||
}
|
||||
|
||||
family, _ = font.Name(nil, ttc.NameIDFamily)
|
||||
family = strings.TrimSpace(family)
|
||||
if "" != family && !strings.HasPrefix(family, ".") {
|
||||
ret = append(ret, family)
|
||||
}
|
||||
|
||||
family, _ = font.Name(nil, ttc.NameIDTypographicFamily)
|
||||
family = strings.TrimSpace(family)
|
||||
if "" != family && !strings.HasPrefix(family, ".") {
|
||||
ret = append(ret, family)
|
||||
}
|
||||
}
|
||||
ret = gulu.Str.RemoveDuplicatedElem(ret)
|
||||
return
|
||||
}
|
||||
|
@ -150,35 +158,38 @@ func parseTTFFontFamily(fontPath string) (ret string) {
|
|||
return
|
||||
}
|
||||
|
||||
if strings.Contains(fontPath, "04") {
|
||||
logging.LogInfo(fontPath)
|
||||
}
|
||||
|
||||
t, err := font.NameTable()
|
||||
if err != nil {
|
||||
logging.LogErrorf("get font [%s] name table failed: %s", fontPath, err)
|
||||
return
|
||||
}
|
||||
|
||||
var family, subfamily string
|
||||
for _, e := range t.List() {
|
||||
if sfnt.NameFontFamily != e.NameID && sfnt.NamePreferredFamily != e.NameID {
|
||||
continue
|
||||
}
|
||||
|
||||
if sfnt.PlatformLanguageID(1033) == e.LanguageID || sfnt.PlatformLanguageID(2052) == e.LanguageID {
|
||||
if sfnt.NameFontFamily == e.NameID && (sfnt.PlatformLanguageID(1033) == e.LanguageID || sfnt.PlatformLanguageID(2052) == e.LanguageID) {
|
||||
v, _, err := transform.Bytes(textUnicode.UTF16(textUnicode.BigEndian, textUnicode.IgnoreBOM).NewDecoder(), e.Value)
|
||||
if err != nil {
|
||||
return ""
|
||||
if err == nil {
|
||||
family = strings.TrimSpace(string(v))
|
||||
}
|
||||
val := string(v)
|
||||
if sfnt.NameFontFamily == e.NameID && "" != val {
|
||||
ret = val
|
||||
}
|
||||
if sfnt.NamePreferredFamily == e.NameID && "" != val {
|
||||
ret = val
|
||||
if sfnt.NameFontSubfamily == e.NameID && (sfnt.PlatformLanguageID(1033) == e.LanguageID || sfnt.PlatformLanguageID(2052) == e.LanguageID) {
|
||||
v, _, err := transform.Bytes(textUnicode.UTF16(textUnicode.BigEndian, textUnicode.IgnoreBOM).NewDecoder(), e.Value)
|
||||
if err == nil {
|
||||
subfamily = strings.TrimSpace(string(v))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = strings.TrimSpace(ret)
|
||||
if strings.HasPrefix(ret, ".") {
|
||||
return ""
|
||||
if family != "" && !strings.HasPrefix(family, ".") {
|
||||
if subfamily != "" && !strings.Contains(subfamily, "<") && !strings.EqualFold(subfamily, "Regular") {
|
||||
ret = family + " " + subfamily // 例如 "PingFang SC Bold"
|
||||
} else {
|
||||
ret = family
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue