Skip to content

Commit

Permalink
Small tweaks (#302)
Browse files Browse the repository at this point in the history
* Small cleanups
* ElectronJS tweaks: (1) It won't open debug console by default anymore. (2) It binds a shortcut to open debug console in production build, too.
  • Loading branch information
mkoskim authored Dec 14, 2024
1 parent 366a328 commit 403d4b5
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 32 deletions.
10 changes: 8 additions & 2 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function createWindow()
mainWindow.setMenu(null);
//console.log("Languages:", mainWindow.webContents.session.availableSpellCheckerLanguages)
//mainWindow.webContents.session.setSpellCheckerLanguages(['fi'])
mainWindow.webContents.openDevTools();
//mainWindow.webContents.openDevTools();

if(isDev)
{
Expand Down Expand Up @@ -112,7 +112,7 @@ const reduxDevToolsPath = path.join(
const {app, session} = electron;

app.whenReady().then(async () => {
try {
if(isDev) try {
console.log("Loading extension:", reactDevToolsPath)
await session.defaultSession.loadExtension(reactDevToolsPath)
//session.defaultSession.loadExtension(reduxDevToolsPath)
Expand All @@ -121,6 +121,12 @@ app.whenReady().then(async () => {
}
createWindow();
//globalShortcut.register('CommandOrControl+Q', () => { app.quit() });

if(!isDev) {
globalShortcut.register('F12', () => {
mainWindow.webContents.openDevTools();
});
}
});

app.on("window-all-closed", () => {
Expand Down
8 changes: 2 additions & 6 deletions src/document/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import {loadmawe, createmawe, buf2tree, fromXML} from "./xmljs/load"
import {savemawe, toXML} from "./xmljs/save"
import {asRTF, asHTML} from "./print"

import {info} from "./head"

Expand All @@ -33,9 +32,6 @@ export const mawe = {
},
decodebuf, file2buf, buf2tree, fromXML,
toXML,

// Exporting
asRTF, asHTML,
}

export {elemAsText, elemName, filterCtrlElems}
Expand Down Expand Up @@ -72,7 +68,7 @@ function create(buffer) {

//-----------------------------------------------------------------------------

export async function saveas(doc, filename) {
async function saveas(doc, filename) {
//const file = await fs.fstat(filename)
//console.log("Saving:", doc)
// TODO: Fill in basename + suffix
Expand All @@ -82,6 +78,6 @@ export async function saveas(doc, filename) {
})
}

export async function save(doc) {
async function save(doc) {
return await savemawe(doc);
}
21 changes: 0 additions & 21 deletions src/document/print.js

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion src/gui/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//*****************************************************************************
//*****************************************************************************

import "./styles/editor.css"
import "./editor.css"
import "../common/styles/sheet.css"

/* eslint-disable no-unused-vars */
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/gui/export/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// ****************************************************************************

import "./styles/export.css"
import "./export.css"
import "../common/styles/sheet.css"

import React, {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/gui/import/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//*****************************************************************************
//*****************************************************************************

import "./styles/import.css"
import "./import.css"
import "../common/styles/sheet.css"

import React, {
Expand Down

0 comments on commit 403d4b5

Please sign in to comment.