Arthur Brandao 5 سال پیش
والد
کامیت
6f02bfcdf2
3فایلهای تغییر یافته به همراه17 افزوده شده و 17 حذف شده
  1. 6 6
      app/main/application-menu.js
  2. 5 5
      app/main/function/dialog.js
  3. 6 6
      app/main/function/menu.js

+ 6 - 6
app/main/application-menu.js

@@ -1,5 +1,5 @@
 const {Menu, shell} = require('electron');
-const func = require('./function/menu');
+const menu = require('./function/menu');
 const dialog = require('./function/dialog');
 const demo = require('./function/demo-application-menu');
 
@@ -10,12 +10,12 @@ let template = [
       {
         label: 'Nouveau',
         accelerator: 'CmdOrCtrl+N',
-        click: func.new
+        click: menu.new
       },
       {
         label: 'Importer',
         accelerator: 'CmdOrCtrl+I',
-        click: func.import
+        click: menu.import
       },
       {
         type: 'separator'
@@ -86,7 +86,7 @@ let template = [
             return 'Ctrl+Shift+I'
           }
         })(),
-        click: func.devTool
+        click: menu.devTool
       }
     ]
   },
@@ -120,5 +120,5 @@ let template = [
   }
 ];
 
-const menu = Menu.buildFromTemplate(template);
-Menu.setApplicationMenu(menu);
+const appMenu = Menu.buildFromTemplate(template);
+Menu.setApplicationMenu(appMenu);

+ 5 - 5
app/main/function/dialog.js

@@ -1,7 +1,7 @@
 const {dialog} = require('electron');
-const obj = {};
+const dlg = {};
 
-obj.messagePromise = function(title, content, type = '', buttons = ['Ok'], defaultButton = 0, attach = true) {
+dlg.messagePromise = function(title, content, type = '', buttons = ['Ok'], defaultButton = 0, attach = true) {
     const opts = {
         type: type,
         title: title,
@@ -16,8 +16,8 @@ obj.messagePromise = function(title, content, type = '', buttons = ['Ok'], defau
     }
 }
 
-obj.message = function(title, content, type = 'info', buttons = ['Ok'], defaultButton = 0, attach = true, callback = null) {
-    const promise = obj.messagePromise(title, content, type, buttons, defaultButton, attach);
+dlg.message = function(title, content, type = 'info', buttons = ['Ok'], defaultButton = 0, attach = true, callback = null) {
+    const promise = dlg.messagePromise(title, content, type, buttons, defaultButton, attach);
     if (callback !== null) {
         promise.then(data => {
             callback(data.response, buttons[data.response]);
@@ -25,4 +25,4 @@ obj.message = function(title, content, type = 'info', buttons = ['Ok'], defaultB
     }
 }
 
-module.exports = obj;
+module.exports = dlg;

+ 6 - 6
app/main/function/menu.js

@@ -1,18 +1,18 @@
 const window = require('../../../helper/window');
-const menuFunction = {};
+const menu = {};
 
-menuFunction.new = function() {
-    window.new('./app/src/edit.html');
+menu.new = function() {
+    window.new('./app/src/edit.html', 800, 575);
 };
 
-menuFunction.import = function() {
+menu.import = function() {
     console.log('Import');
 }
 
-menuFunction.devTool = function (item, focusedWindow) {
+menu.devTool = function (item, focusedWindow) {
     if (focusedWindow) {
         focusedWindow.toggleDevTools()
     }
 }
 
-module.exports = menuFunction;
+module.exports = menu;