mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-24 07:20:16 +05:30
feat(IPC): expose get-monospace-settings + set-monospace-settings to renderer
Renderer already calls window.electronAPI.invoke('get-monospace-settings')
to apply body classes; this wires up the channel allowlist and main-process
handlers so the IPC actually returns the active monospace settings and
persists updates.
This commit is contained in:
+24
@@ -361,6 +361,30 @@ ipcMain.handle('plugin-settings:get', (_event, key) => {
|
|||||||
ipcMain.handle('plugin-settings:set', (_event, { key, value }) => {
|
ipcMain.handle('plugin-settings:set', (_event, { key, value }) => {
|
||||||
store.set(key, value);
|
store.set(key, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Monospace settings IPC — consumed by the renderer to apply CSS classes
|
||||||
|
// and to feed the PrintPreview overlay. Returns the full settings object so
|
||||||
|
// defaults are applied centrally here.
|
||||||
|
ipcMain.handle('get-monospace-settings', () => {
|
||||||
|
const s = readSettingsJsonCached();
|
||||||
|
return {
|
||||||
|
monospaceFont: s.monospaceFont || 'jetbrains-mono',
|
||||||
|
monospaceLigatures: s.monospaceLigatures === true,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
ipcMain.handle('set-monospace-settings', (_event, partial) => {
|
||||||
|
const safe = partial && typeof partial === 'object' ? partial : {};
|
||||||
|
if (safe.monospaceFont !== undefined) {
|
||||||
|
store.set('monospaceFont', safe.monospaceFont);
|
||||||
|
}
|
||||||
|
if (safe.monospaceLigatures !== undefined) {
|
||||||
|
store.set('monospaceLigatures', safe.monospaceLigatures === true);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
monospaceFont: readSettingsJsonCached().monospaceFont || 'jetbrains-mono',
|
||||||
|
monospaceLigatures: readSettingsJsonCached().monospaceLigatures === true,
|
||||||
|
};
|
||||||
|
});
|
||||||
ipcMain.handle('get-app-version', () => app.getVersion());
|
ipcMain.handle('get-app-version', () => app.getVersion());
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ const ALLOWED_SEND_CHANNELS = [
|
|||||||
// Plugin settings
|
// Plugin settings
|
||||||
'plugin-settings:get',
|
'plugin-settings:get',
|
||||||
'plugin-settings:set',
|
'plugin-settings:set',
|
||||||
|
|
||||||
|
// Monospace font settings
|
||||||
|
'get-monospace-settings',
|
||||||
|
'set-monospace-settings',
|
||||||
];
|
];
|
||||||
|
|
||||||
const ALLOWED_RECEIVE_CHANNELS = [
|
const ALLOWED_RECEIVE_CHANNELS = [
|
||||||
|
|||||||
Reference in New Issue
Block a user