mirror of
https://github.com/mars-marcelyn/Shuffle-Lab.git
synced 2026-07-22 07:44:45 +00:00
Remove fs and child_process usage
This commit is contained in:
parent
31fa65c68f
commit
50f6a3dcf3
2 changed files with 16 additions and 22 deletions
24
main.js
24
main.js
|
|
@ -119,13 +119,12 @@ module.exports = class VisualConceptLab extends Plugin {
|
|||
async loadLocale() {
|
||||
const lang = this.settings.language || 'en';
|
||||
try {
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const basePath = this.app.vault.adapter.getBasePath();
|
||||
const filePath = path.join(basePath, this.app.vault.configDir, 'plugins', 'shuffle-lab', 'lang', lang + '.json');
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
this.locale = JSON.parse(content);
|
||||
return;
|
||||
const adapter = this.app.vault.adapter;
|
||||
const filePath = this.app.vault.configDir + '/plugins/shuffle-lab/lang/' + lang + '.json';
|
||||
if (await adapter.exists(filePath)) {
|
||||
this.locale = JSON.parse(await adapter.read(filePath));
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
this.locale = Object.assign({}, FALLBACK_LOCALE);
|
||||
|
|
@ -157,16 +156,11 @@ module.exports = class VisualConceptLab extends Plugin {
|
|||
}
|
||||
|
||||
openLanguageFolder() {
|
||||
if (!Platform.isDesktop) {
|
||||
new Notice('Cannot open folder on this device');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const path = require('path');
|
||||
const { exec } = require('child_process');
|
||||
const { shell } = require('electron');
|
||||
const basePath = this.app.vault.adapter.getBasePath();
|
||||
const langDir = path.join(basePath, this.app.vault.configDir, 'plugins', 'shuffle-lab', 'lang');
|
||||
exec(`explorer.exe "${langDir}"`);
|
||||
const langDir = basePath + '/' + this.app.vault.configDir + '/plugins/shuffle-lab/lang';
|
||||
shell.openPath(langDir);
|
||||
} catch (e) {
|
||||
new Notice('Cannot open folder on this device');
|
||||
}
|
||||
|
|
|
|||
14
styles.css
14
styles.css
|
|
@ -235,13 +235,13 @@
|
|||
}
|
||||
|
||||
.shuffle-lab-modal {
|
||||
width: 100vw !important;
|
||||
height: 100vh !important;
|
||||
max-width: 100% !important;
|
||||
max-height: 100% !important;
|
||||
margin: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
background-color: #000 !important;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.shuffle-lab-warning {
|
||||
|
|
|
|||
Loading…
Reference in a new issue