You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
Desktop: Allow for custom Joplin theme and Ace editor styles (#2099)
* Delete unused file * Implement CssUtils * Inject custom CSS styles * Add info about custom CSS styles to README * Add note that ElectronClient/app/app.js is generated * Add support for Setting.TYPE_BUTTON * Add buttons in Preferences to open custom CSS files * Swap custom CSS filenames * Swap custom CSS filenames * Wrap "Edit" with translation fn * Incorporate PR feedback from @laurent22 * Add openOrCreateFile to Settings * Move openOrCreateFile to shim * Removing header for now - see https://github.com/laurent22/joplin/pull/2099#discussion_r353120915
This commit is contained in:
committed by
Laurent Cozic
parent
4f3e031f4f
commit
611be7c0fa
@@ -358,7 +358,23 @@ function shimInit() {
|
||||
|
||||
shim.openUrl = url => {
|
||||
const { bridge } = require('electron').remote.require('./bridge');
|
||||
bridge().openExternal(url);
|
||||
// Returns true if it opens the file successfully; returns false if it could
|
||||
// not find the file.
|
||||
return bridge().openExternal(url);
|
||||
};
|
||||
|
||||
shim.openOrCreateFile = (filepath, defaultContents) => {
|
||||
// If the file doesn't exist, create it
|
||||
if (!fs.existsSync(filepath)) {
|
||||
fs.writeFile(filepath, defaultContents, 'utf-8', (error) => {
|
||||
if (error) {
|
||||
console.error(`error: ${error}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Open the file
|
||||
return shim.openUrl(`file://${filepath}`);
|
||||
};
|
||||
|
||||
shim.waitForFrame = () => {};
|
||||
|
||||
Reference in New Issue
Block a user