-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch-modals-error.js
More file actions
59 lines (52 loc) · 2.11 KB
/
Copy pathpatch-modals-error.js
File metadata and controls
59 lines (52 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const fs = require('fs');
let file = 'c:/Users/admin/Dropbox/Apps/remotely-save/Croptop/.obsidian/plugins/proxima/src/modals/Modals.ts';
let content = fs.readFileSync(file, 'utf8');
const target = ` const renderSchema = () => {
schemaContainer.empty();
const schemaList = this.plugin.settings.projectSchemas[this.projectId];
const visibleList = this.plugin.settings.projectVisibleProps[this.projectId];`;
const replacement = ` const renderSchema = () => {
try {
schemaContainer.empty();
const schemaList = this.plugin.settings.projectSchemas[this.projectId] || [];
const visibleList = this.plugin.settings.projectVisibleProps[this.projectId] || [];`;
content = content.replace(target, replacement);
const endTarget = ` btnRow.style.marginTop = '10px';
new ButtonComponent(btnRow)
.setButtonText('+ Add Property')
.setCta()
.onClick(async () => {
const newId = 'prop-' + Date.now();
schemaList.push({
id: newId,
name: 'New Property',
type: 'text'
});
this.plugin.settings.projectVisibleProps[this.projectId].push(newId);
await this.plugin.saveSettings();
renderSchema();
});
};`;
const endReplacement = ` btnRow.style.marginTop = '10px';
new ButtonComponent(btnRow)
.setButtonText('+ Add Property')
.setCta()
.onClick(async () => {
const newId = 'prop-' + Date.now();
schemaList.push({
id: newId,
name: 'New Property',
type: 'text'
});
this.plugin.settings.projectVisibleProps[this.projectId].push(newId);
await this.plugin.saveSettings();
renderSchema();
});
} catch (err) {
console.error("Proxima schema render error:", err);
schemaContainer.createEl('div', { text: "Error rendering schema: " + err.message, cls: 'pos-error-text' });
}
};`;
content = content.replace(endTarget, endReplacement);
fs.writeFileSync(file, content);
console.log('Patched Modals.ts renderSchema error boundary');