Vanessa 2025-11-27 11:06:24 +08:00
parent c68b4dc4c5
commit d33ab92c7f
14 changed files with 68 additions and 42 deletions

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "اسم السمة ${x} موجود بالفعل",
"statusBarMsgPushTip": "من خلال رسائل شريط الحالة يمكنك معرفة حالة عمل النظام فورًا، وإذا كانت مزعجة يمكنك إيقافها",
"useBackground": "ملء خلفية العمود بلون الخيار",
"print": "طباعة",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "Der Attributname ${x} ist bereits vorhanden",
"statusBarMsgPushTip": "Über Nachrichten in der Statusleiste können Sie den Zustand des Systems sofort erfahren, wenn sie stören, können Sie sie deaktivieren",
"useBackground": "Spaltenhintergrund mit der Farbe der Option füllen",
"print": "Drucken",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "The attribute name ${x} already exists",
"statusBarMsgPushTip": "Status bar messages let you instantly know the system's running status, and if they bother you you can turn them off",
"useBackground": "Fill column background with option color",
"print": "Print",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "El nombre del atributo ${x} ya existe",
"statusBarMsgPushTip": "A través de los mensajes en la barra de estado puedes conocer al instante el funcionamiento del sistema, si te molestan puedes desactivarlos",
"useBackground": "Rellenar el fondo de la columna con el color de la opción",
"print": "Imprimir",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "Le nom dattribut ${x} existe déjà",
"statusBarMsgPushTip": "Via les messages de la barre d'état, vous pouvez connaître immédiatement le fonctionnement du système, si cela vous dérange vous pouvez les désactiver",
"useBackground": "Remplir l'arrière-plan de la colonne avec la couleur de l'option",
"print": "Imprimer",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "שם המאפיין ${x} כבר קיים",
"statusBarMsgPushTip": "באמצעות הודעות בסרגל המצב ניתן לדעת מיד את מצב פעולתו של המערכת, ואם זה מפריע ניתן לכבות אותן",
"useBackground": "מלא את רקע העמודה בצבע האפשרות",
"print": "הדפס",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "Il nome dell'attributo ${x} esiste già",
"statusBarMsgPushTip": "Tramite i messaggi nella barra di stato è possibile conoscere immediatamente lo stato di funzionamento del sistema, se danno fastidio è possibile disattivarli",
"useBackground": "Riempire lo sfondo della colonna con il colore dell'opzione",
"print": "Stampa",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "属性名 ${x} は既に存在します",
"statusBarMsgPushTip": "ステータスバーのメッセージによってシステムの動作状況を即座に把握でき、迷惑に感じる場合はオフにできます",
"useBackground": "オプションの色で列の背景を塗りつぶす",
"print": "印刷",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "Nazwa atrybutu ${x} już istnieje",
"statusBarMsgPushTip": "Dzięki powiadomieniom na pasku stanu można na bieżąco poznać działanie systemu, a jeśli przeszkadzają, można je wyłączyć",
"useBackground": "Wypełnij tło kolumny kolorem opcji",
"print": "Drukuj",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "O nome do atributo ${x} já existe",
"statusBarMsgPushTip": "Por meio das mensagens na barra de status é possível saber imediatamente o funcionamento do sistema, se isso incomodar você pode desativálas",
"useBackground": "Preencher o fundo da coluna com a cor da opção",
"print": "Imprimir",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "Имя атрибута ${x} уже существует",
"statusBarMsgPushTip": "С помощью сообщений в строке состояния можно мгновенно узнать о работе системы, и если они мешают, их можно отключить",
"useBackground": "Заполнить фон столбца цветом опции",
"print": "Печать",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "屬性名 ${x} 已存在",
"statusBarMsgPushTip": "透過狀態列訊息可以即時地了解系統的運作情況,如果感到打擾可以將其關閉",
"useBackground": "按選項顏色填充列背景",
"print": "列印",

View file

@ -1,4 +1,5 @@
{
"hasAttrName": "属性名 <b>${x}</b> 已存在",
"statusBarMsgPushTip": "通过状态栏消息可以即时地了解系统的运行情况,如果感到打扰可以将其关闭",
"useBackground": "按选项颜色填充列背景",
"print": "打印",

View file

@ -26,6 +26,7 @@ import {copyTextByType} from "../protyle/toolbar/util";
import {hideElements} from "../protyle/ui/hideElements";
import {Protyle} from "../protyle";
import {getAllEditor} from "../layout/getAll";
import {hasClosestByClassName} from "../protyle/util/hasClosest";
const bindAttrInput = (inputElement: HTMLInputElement, id: string) => {
inputElement.addEventListener("change", () => {
@ -351,22 +352,34 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I
addDialog.destroy();
});
btnsElement[1].addEventListener("click", () => {
if (!isValidAttrName(inputElement.value)) {
showMessage(window.siyuan.languages.attrName + " <b>" + escapeHtml(inputElement.value) + "</b> " + window.siyuan.languages.invalid);
const value = inputElement.value.toLowerCase();
if (!isValidAttrName(value)) {
showMessage(window.siyuan.languages.attrName + " <b>" + escapeHtml(value) + "</b> " + window.siyuan.languages.invalid);
return false;
}
target.parentElement.insertAdjacentHTML("beforebegin", `<div class="b3-label b3-label--noborder">
let existElement: HTMLElement | false;
Array.from(dialog.element.querySelectorAll('.custom-attr[data-type="custom"] .b3-label .fn__flex-1')).find((labelItem: HTMLElement) => {
if (labelItem.textContent === value) {
existElement = hasClosestByClassName(labelItem, "b3-label");
return true;
}
});
if (existElement) {
showMessage(window.siyuan.languages.hasAttrName.replace('${x}', value));
} else {
target.parentElement.insertAdjacentHTML("beforebegin", `<div class="b3-label b3-label--noborder">
<div class="fn__flex">
<span class="fn__flex-1">${inputElement.value}</span>
<span class="fn__flex-1">${value}</span>
<span data-action="remove" class="block__icon block__icon--show"><svg><use xlink:href="#iconMin"></use></svg></span>
</div>
<div class="fn__hr"></div>
<textarea style="resize: vertical" spellcheck="false" data-name="custom-${inputElement.value}" class="b3-text-field fn__block" rows="1" placeholder="${window.siyuan.languages.attrValue1}"></textarea>
<textarea style="resize: vertical" spellcheck="false" data-name="custom-${value}" class="b3-text-field fn__block" rows="1" placeholder="${window.siyuan.languages.attrValue1}"></textarea>
</div>`);
const valueElement = target.parentElement.previousElementSibling.querySelector(".b3-text-field") as HTMLInputElement;
valueElement.focus();
bindAttrInput(valueElement, attrs.id);
addDialog.destroy();
const newInputElement = target.parentElement.previousElementSibling.querySelector(".b3-text-field") as HTMLInputElement;
newInputElement.focus();
bindAttrInput(newInputElement, attrs.id);
addDialog.destroy();
}
});
event.stopPropagation();
event.preventDefault();
@ -444,42 +457,42 @@ export const copySubMenu = (ids: string[], accelerator = true, focusElement?: El
}
}
},
/// #if BROWSER
{
id: "copyWebURL",
iconHTML: "",
label: window.siyuan.languages.copyWebURL,
click: () => {
copyTextByType(ids, "webURL");
if (focusElement) {
focusBlock(focusElement);
/// #if BROWSER
{
id: "copyWebURL",
iconHTML: "",
label: window.siyuan.languages.copyWebURL,
click: () => {
copyTextByType(ids, "webURL");
if (focusElement) {
focusBlock(focusElement);
}
}
}
},
/// #endif
{
id: "copyHPath",
iconHTML: "",
label: window.siyuan.languages.copyHPath,
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyHPath.custom : undefined,
click: () => {
copyTextByType(ids, "hPath");
if (focusElement) {
focusBlock(focusElement);
},
/// #endif
{
id: "copyHPath",
iconHTML: "",
label: window.siyuan.languages.copyHPath,
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyHPath.custom : undefined,
click: () => {
copyTextByType(ids, "hPath");
if (focusElement) {
focusBlock(focusElement);
}
}
}
}, {
id: "copyID",
iconHTML: "",
label: window.siyuan.languages.copyID,
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyID.custom : undefined,
click: () => {
copyTextByType(ids, "id");
if (focusElement) {
focusBlock(focusElement);
}, {
id: "copyID",
iconHTML: "",
label: window.siyuan.languages.copyID,
accelerator: accelerator ? window.siyuan.config.keymap.editor.general.copyID.custom : undefined,
click: () => {
copyTextByType(ids, "id");
if (focusElement) {
focusBlock(focusElement);
}
}
}
}];
}];
if (stdMarkdownId) {
menuItems.push({