vault backup: 2026-04-16 20:14:53
This commit is contained in:
52
.obsidian/plugins/multi-properties/main.js
vendored
52
.obsidian/plugins/multi-properties/main.js
vendored
@@ -5433,7 +5433,7 @@ var KNOWN_BAD_CHARACTERS = [
|
||||
// src/AddPropForm.svelte
|
||||
var root_12 = from_html(`<button type="button" class="suggested-prop"> </button>`);
|
||||
var root2 = from_html(`<div id="multi-properties-modal" class="modal-content"><div id="alert-container" class="alert-container hidden svelte-18exwij"><div>ERROR</div> <div id="alert-text"> </div></div> <p>Select from existing properties or create new ones:</p> <div class="suggested-props svelte-18exwij"></div> <p>Type in a property name, then value. Use the dropbox to choose what type of
|
||||
data you wish to store.</p> <p> </p> <p>If you want to add Tags, use the name "tags".</p> <form><label> <select id="alter-prop-select"><option>Ignore the prop entirely.</option><option>Overwrite new value over prop.</option><option>Append new value to prop.</option></select></label> <div class="modal-inputs-container svelte-18exwij"></div> <div class="modal-add-container svelte-18exwij"><button type="button" class="a-btn">Add</button></div> <div class="modal-button-container"><button type="submit" class="btn-submit">Submit</button></div></form></div>`);
|
||||
data you wish to store.</p> <p> </p> <p>如需添加标签,请使用属性名 "tags"。</p> <form><label> <select id="alter-prop-select"><option>Ignore the prop entirely.</option><option>Overwrite new value over prop.</option><option>Append new value to prop.</option></select></label> <div class="modal-inputs-container svelte-18exwij"></div> <div class="modal-add-container svelte-18exwij"><button type="button" class="a-btn">Add</button></div> <div class="modal-button-container"><button type="submit" class="btn-submit">Submit</button></div></form></div>`);
|
||||
var $$css2 = {
|
||||
hash: "svelte-18exwij",
|
||||
code: ".modal-inputs-container.svelte-18exwij {height:200px;width:100%;overflow-y:scroll;border-radius:5px;border-style:solid;display:flex;flex-direction:column;align-items:center;}.modal-add-container.svelte-18exwij {margin-top:10px;}.alert-container.svelte-18exwij {display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:10px;background-color:red;font-weight:bold;}.suggested-props.svelte-18exwij {overflow-y:scroll;max-height:100px;}.hidden.svelte-18exwij {display:none;}"
|
||||
@@ -5634,7 +5634,7 @@ var import_obsidian = require("obsidian");
|
||||
|
||||
// src/AddConfirmForm.svelte
|
||||
var root_13 = from_html(`<li> </li>`);
|
||||
var root3 = from_html(`<div><form><p class="msg svelte-n0gky0"> </p> <p>The following props will be added:</p> <ul></ul> <p>Are you sure you wish to proceed?</p> <button class="mod-warning" type="submit">Confirm</button> <button type="button">Cancel</button></form></div>`);
|
||||
var root3 = from_html(`<div><form><p class="msg svelte-n0gky0"> </p> <p>以下属性将被添加:</p> <ul></ul> <p>确认要继续执行吗?</p> <button class="mod-warning" type="submit">Confirm</button> <button type="button">Cancel</button></form></div>`);
|
||||
var $$css3 = {
|
||||
hash: "svelte-n0gky0",
|
||||
code: ".msg.svelte-n0gky0 {font-weight:bold;padding-bottom:10px;}"
|
||||
@@ -5708,7 +5708,7 @@ var AddConfirmModal = class extends import_obsidian.Modal {
|
||||
this.close();
|
||||
}
|
||||
onOpen() {
|
||||
this.titleEl.createEl("h2", { text: "Add Properties" });
|
||||
this.titleEl.createEl("h2", { text: "添加属性" });
|
||||
this.component = mount(AddConfirmForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -5752,7 +5752,7 @@ var PropModal = class extends import_obsidian2.Modal {
|
||||
).open();
|
||||
}
|
||||
onOpen() {
|
||||
this.titleEl.createEl("h2", { text: "Add Properties" });
|
||||
this.titleEl.createEl("h2", { text: "添加属性" });
|
||||
this.component = mount(AddPropForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -5785,7 +5785,7 @@ var SettingTab = class extends import_obsidian3.PluginSettingTab {
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian3.Setting(containerEl).setName("Recursive Iteration").setDesc(
|
||||
new import_obsidian3.Setting(containerEl).setName("递归迭代").setDesc(
|
||||
"When toggled on, while looping through all files in a folder, you will also loop through any sub-folders."
|
||||
).addToggle((toggle) => {
|
||||
toggle.setValue(this.plugin.settings.recursive);
|
||||
@@ -5794,22 +5794,22 @@ var SettingTab = class extends import_obsidian3.PluginSettingTab {
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian3.Setting(containerEl).setName("List Delimiter").setDesc(
|
||||
new import_obsidian3.Setting(containerEl).setName("列表分隔符").setDesc(
|
||||
"Set delimiter to use when creating a list. Commas(,) are used by default."
|
||||
).addText((text2) => {
|
||||
text2.setValue(this.plugin.settings.delimiter);
|
||||
text2.onChange(async (value) => {
|
||||
if (value.length > 1) {
|
||||
text2.setValue(value[0]);
|
||||
new import_obsidian3.Notice("Delimiter must be a single character.");
|
||||
new import_obsidian3.Notice("分隔符必须是单个字符。");
|
||||
return;
|
||||
}
|
||||
this.plugin.settings.delimiter = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new import_obsidian3.Setting(containerEl).setName("Default Props File").setDesc(
|
||||
"Select a file with properties that you want to load into the Multi Properties form by default. Type in the full path of the desired file.(ex. Templates/PropFile 1)"
|
||||
new import_obsidian3.Setting(containerEl).setName("默认属性文件").setDesc(
|
||||
"选择一个包含属性的文件,该文件将默认载入多属性表单。请输入目标文件的完整路径。(例如:Templates/PropFile 1)"
|
||||
).addText((text2) => {
|
||||
text2.setValue(this.plugin.settings.defaultPropPath);
|
||||
text2.onChange(async (value) => {
|
||||
@@ -5825,7 +5825,7 @@ var import_obsidian5 = require("obsidian");
|
||||
|
||||
// src/RemovePropForm.svelte
|
||||
var root_14 = from_html(`<label><input type="checkbox"/> </label>`);
|
||||
var root4 = from_html(`<div><div id="alert-container" class="alert-container hidden svelte-1c8m26c"><div>ERROR</div> <div id="alert-text"> </div></div> <p>Select the properties you wish to remove from the file selection.</p> <form><div class="name-container svelte-1c8m26c"></div> <div class="button-container svelte-1c8m26c"><button type="submit">Confirm</button> <button type="button"> </button></div></form></div>`);
|
||||
var root4 = from_html(`<div><div id="alert-container" class="alert-container hidden svelte-1c8m26c"><div>ERROR</div> <div id="alert-text"> </div></div> <p>从文件选择中勾选您希望移除的属性。</p> <form><div class="name-container svelte-1c8m26c"></div> <div class="button-container svelte-1c8m26c"><button type="submit">Confirm</button> <button type="button"> </button></div></form></div>`);
|
||||
var $$css4 = {
|
||||
hash: "svelte-1c8m26c",
|
||||
code: ".name-container.svelte-1c8m26c {display:flex;flex-direction:column;gap:5px;margin-top:10px;margin-bottom:20px;}.alert-container.svelte-1c8m26c {display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:10px;background-color:red;font-weight:bold;}.button-container.svelte-1c8m26c {display:flex;flex-direction:row;justify-content:space-between;}.hidden.svelte-1c8m26c {display:none;}"
|
||||
@@ -5856,7 +5856,7 @@ function RemovePropForm($$anchor, $$props) {
|
||||
function onSubmit(e) {
|
||||
e.preventDefault();
|
||||
if (get(checkCount) === 0) {
|
||||
set(alertText, "Please select at least one property to remove.");
|
||||
set(alertText, "请至少选择一个要移除的属性。");
|
||||
get(errorEl) === null || get(errorEl) === void 0 ? void 0 : get(errorEl).classList.remove("hidden");
|
||||
return;
|
||||
}
|
||||
@@ -5907,7 +5907,7 @@ var import_obsidian4 = require("obsidian");
|
||||
|
||||
// src/RemoveConfirmForm.svelte
|
||||
var root_15 = from_html(`<li> </li>`);
|
||||
var root5 = from_html(`<div><form><p> </p> <ul></ul> <p>Are you sure you wish to proceed?</p> <button class="mod-warning" type="submit">Delete</button> <button type="button">Cancel</button></form></div>`);
|
||||
var root5 = from_html(`<div><form><p> </p> <ul></ul> <p>确认要继续执行吗?</p> <button class="mod-warning" type="submit">Delete</button> <button type="button">Cancel</button></form></div>`);
|
||||
function RemoveConfirmForm($$anchor, $$props) {
|
||||
push($$props, true);
|
||||
let names = prop($$props, "names", 19, () => ["test", "test2"]);
|
||||
@@ -5941,7 +5941,7 @@ function RemoveConfirmForm($$anchor, $$props) {
|
||||
bind_this(button, ($$value) => set(btnCancel, $$value), () => get(btnCancel));
|
||||
reset(form);
|
||||
reset(div);
|
||||
template_effect(() => set_text(text2, `The following ${get(word) ?? ""} will be removed:`));
|
||||
template_effect(() => set_text(text2, `下列 ${get(word) ?? ""} 将被移除:`));
|
||||
event("submit", form, onSubmit);
|
||||
append($$anchor, div);
|
||||
pop();
|
||||
@@ -5964,10 +5964,10 @@ var RemoveConfirmModal = class extends import_obsidian4.Modal {
|
||||
}
|
||||
onOpen() {
|
||||
if (!this.names || this.names.length === 0) {
|
||||
new import_obsidian4.Notice("Please check at least one property to remove.");
|
||||
new import_obsidian4.Notice("请检查至少一个要删除的属性。");
|
||||
this.close();
|
||||
}
|
||||
this.titleEl.createEl("h2", { text: "Remove Properties" });
|
||||
this.titleEl.createEl("h2", { text: "移除属性" });
|
||||
this.component = mount(RemoveConfirmForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -5983,7 +5983,7 @@ var RemoveConfirmModal = class extends import_obsidian4.Modal {
|
||||
var RemoveModal = class extends import_obsidian5.Modal {
|
||||
constructor(app, names, submission) {
|
||||
if (!names || names.length === 0) {
|
||||
new import_obsidian5.Notice("No properties to remove");
|
||||
new import_obsidian5.Notice("没有要删除的属性");
|
||||
return;
|
||||
}
|
||||
super(app);
|
||||
@@ -6003,7 +6003,7 @@ var RemoveModal = class extends import_obsidian5.Modal {
|
||||
).open();
|
||||
}
|
||||
onOpen() {
|
||||
this.titleEl.createEl("h2", { text: "Remove Properties" });
|
||||
this.titleEl.createEl("h2", { text: "移除属性" });
|
||||
this.component = mount(RemovePropForm, {
|
||||
target: this.contentEl,
|
||||
props: {
|
||||
@@ -6235,7 +6235,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.app.workspace.on("files-menu", (menu, nodes) => {
|
||||
let obj = nodes;
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Add props to selected files").onClick(() => this.createPropModal(obj));
|
||||
item.setIcon("archive").setTitle("向所选文件添加props").onClick(() => this.createPropModal(obj));
|
||||
});
|
||||
})
|
||||
);
|
||||
@@ -6243,17 +6243,17 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.app.workspace.on("files-menu", (menu, nodes) => {
|
||||
let obj = nodes;
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Remove props from selected files").onClick(async () => this.createRemoveModal(obj));
|
||||
item.setIcon("archive").setTitle("从选定的文件中删除props").onClick(async () => this.createRemoveModal(obj));
|
||||
});
|
||||
})
|
||||
);
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("search:results-menu", (menu, leaf) => {
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Add props to search results").onClick(() => {
|
||||
item.setIcon("archive").setTitle("在搜索结果中添加props").onClick(() => {
|
||||
let files = this.getFilesFromSearch(leaf);
|
||||
if (!files.length) {
|
||||
new import_obsidian7.Notice("No files to add properties to.", 4e3);
|
||||
new import_obsidian7.Notice("没有要添加属性的文件。", 4e3);
|
||||
return;
|
||||
}
|
||||
this.createPropModal(files);
|
||||
@@ -6264,10 +6264,10 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("search:results-menu", (menu, leaf) => {
|
||||
menu.addItem((item) => {
|
||||
item.setIcon("archive").setTitle("Remove props from search results").onClick(async () => {
|
||||
item.setIcon("archive").setTitle("在搜索结果中移除props").onClick(async () => {
|
||||
let files = this.getFilesFromSearch(leaf);
|
||||
if (!files.length) {
|
||||
new import_obsidian7.Notice("No files to remove properties from.", 4e3);
|
||||
new import_obsidian7.Notice("没有要从中删除属性的文件。", 4e3);
|
||||
return;
|
||||
}
|
||||
this.createRemoveModal(files);
|
||||
@@ -6374,7 +6374,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
this.removePropsCallback(props, allFiles.length)
|
||||
);
|
||||
if (names.length === 0) {
|
||||
new import_obsidian7.Notice("No properties to remove", 4e3);
|
||||
new import_obsidian7.Notice("无属性可移除", 4e3);
|
||||
return;
|
||||
}
|
||||
const sortedNames = [...names].sort(
|
||||
@@ -6389,7 +6389,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
const metadata = this.app.metadataCache.getFileCache(file);
|
||||
const frontmatter = metadata?.frontmatter;
|
||||
if (!frontmatter) {
|
||||
new import_obsidian7.Notice("Not a valid Props template.", 4e3);
|
||||
new import_obsidian7.Notice("无效的属性模板。", 4e3);
|
||||
return;
|
||||
}
|
||||
const allPropsWithType = this.app.metadataCache.getAllPropertyInfos();
|
||||
@@ -6416,7 +6416,7 @@ var MultiPropPlugin2 = class extends import_obsidian7.Plugin {
|
||||
return tmp;
|
||||
} catch (e) {
|
||||
new import_obsidian7.Notice(
|
||||
`${e}. Check if you entered a valid path in the Default Props File setting.`,
|
||||
`${e}. 请检查默认属性文件设置中输入的路径是否有效。`,
|
||||
1e4
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user