diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index d6d48b36..bc2719dc 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -663,8 +663,8 @@ export default class CodeEditor extends React.Component { const checkMarkdownNoteIsOpen = mode === 'Boost Flavored Markdown' return checkMarkdownNoteIsOpen ? { - 'getAnnotations': this.validatorOfMarkdown, - 'async': true + getAnnotations: this.validatorOfMarkdown, + async: true } : false } @@ -679,10 +679,10 @@ export default class CodeEditor extends React.Component { return } const lintOptions = { - 'strings': { - 'content': text + strings: { + content: text }, - 'config': lintConfigJson + config: lintConfigJson } return markdownlint(lintOptions, (err, result) => { diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index 4d1b672c..a2265321 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -119,7 +119,7 @@ class MarkdownEditor extends React.Component { status: 'PREVIEW' }, () => { this.refs.preview.focus() - this.refs.preview.scrollTo(cursorPosition.line) + this.refs.preview.scrollToRow(cursorPosition.line) }) eventEmitter.emit('topbar:togglelockbutton', this.state.status) } diff --git a/browser/components/MarkdownPreview.js b/browser/components/MarkdownPreview.js index db7914f2..af6a8b0d 100755 --- a/browser/components/MarkdownPreview.js +++ b/browser/components/MarkdownPreview.js @@ -21,6 +21,7 @@ import yaml from 'js-yaml' import { render } from 'react-dom' import Carousel from 'react-image-carousel' import ConfigManager from '../main/lib/ConfigManager' +import i18n from 'browser/lib/i18n' const { remote, shell } = require('electron') const attachmentManagement = require('../main/lib/dataApi/attachmentManagement') @@ -50,7 +51,6 @@ const CSS_FILES = [ * @param {String} opts.theme * @param {Boolean} [opts.lineNumber] Should show line number * @param {Boolean} [opts.scrollPastEnd] - * @param {Boolean} [opts.optimizeOverflowScroll] Should tweak body style to optimize overflow scrollbar display * @param {Boolean} [opts.allowCustomCSS] Should add custom css * @param {String} [opts.customCSS] Will be added to bottom, only if `opts.allowCustomCSS` is truthy * @returns {String} @@ -62,7 +62,6 @@ function buildStyle (opts) { codeBlockFontFamily, lineNumber, scrollPastEnd, - optimizeOverflowScroll, theme, allowCustomCSS, customCSS, @@ -103,7 +102,12 @@ ${markdownStyle} body { font-family: '${fontFamily.join("','")}'; font-size: ${fontSize}px; - ${scrollPastEnd ? 'padding-bottom: 90vh;' : ''} + + ${scrollPastEnd ? ` + padding-bottom: 90vh; + box-sizing: border-box; + ` + : ''} ${optimizeOverflowScroll ? 'height: 100%;' : ''} ${RTL ? 'direction: rtl;' : ''} ${RTL ? 'text-align: right;' : ''} @@ -184,6 +188,10 @@ const scrollBarStyle = ` ::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.15); } + +::-webkit-scrollbar-track-piece { + background-color: inherit; +} ` const scrollBarDarkStyle = ` ::-webkit-scrollbar { @@ -193,6 +201,10 @@ const scrollBarDarkStyle = ` ::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.3); } + +::-webkit-scrollbar-track-piece { + background-color: inherit; +} ` const OSX = global.process.platform === 'darwin' @@ -241,6 +253,7 @@ export default class MarkdownPreview extends React.Component { this.saveAsHtmlHandler = () => this.handleSaveAsHtml() this.saveAsPdfHandler = () => this.handleSaveAsPdf() this.printHandler = () => this.handlePrint() + this.resizeHandler = _.throttle(this.handleResize.bind(this), 100) this.linkClickHandler = this.handleLinkClick.bind(this) this.initMarkdown = this.initMarkdown.bind(this) @@ -346,7 +359,7 @@ export default class MarkdownPreview extends React.Component { customCSS, RTL }) - let body = this.markdown.render(noteContent) + let body = this.refs.root.contentWindow.document.body.innerHTML body = attachmentManagement.fixLocalURLS( body, this.props.storagePath @@ -366,7 +379,7 @@ export default class MarkdownPreview extends React.Component { let styles = '' files.forEach(file => { - styles += `` + styles += `` }) return ` @@ -421,7 +434,8 @@ export default class MarkdownPreview extends React.Component { .then(res => { dialog.showMessageBox(remote.getCurrentWindow(), { type: 'info', - message: `Exported to ${filename}` + message: `Exported to ${filename}`, + buttons: [i18n.__('Ok')] }) }) .catch(err => { @@ -536,6 +550,10 @@ export default class MarkdownPreview extends React.Component { 'scroll', this.scrollHandler ) + this.refs.root.contentWindow.addEventListener( + 'resize', + this.resizeHandler + ) eventEmitter.on('export:save-text', this.saveAsTextHandler) eventEmitter.on('export:save-md', this.saveAsMdHandler) eventEmitter.on('export:save-html', this.saveAsHtmlHandler) @@ -574,6 +592,10 @@ export default class MarkdownPreview extends React.Component { 'scroll', this.scrollHandler ) + this.refs.root.contentWindow.removeEventListener( + 'resize', + this.resizeHandler + ) eventEmitter.off('export:save-text', this.saveAsTextHandler) eventEmitter.off('export:save-md', this.saveAsMdHandler) eventEmitter.off('export:save-html', this.saveAsHtmlHandler) @@ -619,7 +641,7 @@ export default class MarkdownPreview extends React.Component { // Should scroll to top after selecting another note if (prevProps.noteKey !== this.props.noteKey) { - this.getWindow().scrollTo(0, 0) + this.scrollTo(0, 0) } } @@ -686,13 +708,11 @@ export default class MarkdownPreview extends React.Component { codeBlockFontFamily, lineNumber, scrollPastEnd, - optimizeOverflowScroll: true, theme, allowCustomCSS, customCSS, RTL }) - this.getWindow().document.documentElement.style.overflowY = 'hidden' } getCodeThemeLink (name) { @@ -1000,6 +1020,15 @@ export default class MarkdownPreview extends React.Component { } } + handleResize () { + _.forEach( + this.refs.root.contentWindow.document.querySelectorAll('svg[ratio]'), + el => { + el.setAttribute('height', el.clientWidth / el.getAttribute('ratio')) + } + ) + } + focus () { this.refs.root.focus() } @@ -1008,7 +1037,11 @@ export default class MarkdownPreview extends React.Component { return this.refs.root.contentWindow } - scrollTo (targetRow) { + /** + * @public + * @param {Number} targetRow + */ + scrollToRow (targetRow) { const blocks = this.getWindow().document.querySelectorAll( 'body>[data-line]' ) @@ -1018,12 +1051,21 @@ export default class MarkdownPreview extends React.Component { const row = parseInt(block.getAttribute('data-line')) if (row > targetRow || index === blocks.length - 1) { block = blocks[index - 1] - block != null && this.getWindow().scrollTo(0, block.offsetTop) + block != null && this.scrollTo(0, block.offsetTop) break } } } + /** + * `document.body.scrollTo` + * @param {Number} x + * @param {Number} y + */ + scrollTo (x, y) { + this.getWindow().document.body.scrollTo(x, y) + } + preventImageDroppedHandler (e) { e.preventDefault() e.stopPropagation() @@ -1061,12 +1103,12 @@ export default class MarkdownPreview extends React.Component { if (posOfHash > -1) { const extractedId = linkHash.slice(posOfHash + 1) const targetId = mdurl.encode(extractedId) - const targetElement = this.refs.root.contentWindow.document.getElementById( + const targetElement = this.getWindow().document.getElementById( targetId ) if (targetElement != null) { - this.getWindow().scrollTo(0, targetElement.offsetTop) + this.scrollTo(0, targetElement.offsetTop) } return } diff --git a/browser/components/NoteItem.js b/browser/components/NoteItem.js index 168af1ff..b672bfcc 100644 --- a/browser/components/NoteItem.js +++ b/browser/components/NoteItem.js @@ -5,6 +5,7 @@ import PropTypes from 'prop-types' import React from 'react' import { isArray, sortBy } from 'lodash' import invertColor from 'invert-color' +import Emoji from 'react-emoji-render' import CSSModules from 'browser/lib/CSSModules' import { getTodoStatus } from 'browser/lib/getTodoStatus' import styles from './NoteItem.styl' @@ -87,7 +88,7 @@ const NoteItem = ({ : }
{note.title.trim().length > 0 - ? note.title + ? : {i18n.__('Empty note')}}
diff --git a/browser/components/markdown.styl b/browser/components/markdown.styl index 4921b531..61939a64 100644 --- a/browser/components/markdown.styl +++ b/browser/components/markdown.styl @@ -363,7 +363,10 @@ admonition_types = { danger: {color: #c2185b, icon: "block"}, caution: {color: #ffa726, icon: "warning"}, error: {color: #d32f2f, icon: "error_outline"}, - attention: {color: #455a64, icon: "priority_high"} + question: {color: #64dd17, icon: "help_outline"}, + quote: {color: #9e9e9e, icon: "format_quote"}, + abstract: {color: #00b0ff, icon: "subject"}, + attention: {color: #455a64, icon: "priority_high"}, } for name, val in admonition_types @@ -424,6 +427,9 @@ pre.fence canvas, svg max-width 100% !important + svg[ratio] + width 100% + .gallery width 100% height 50vh @@ -444,6 +450,44 @@ pre.fence color $ui-text-color background-color $ui-tag-backgroundColor +.markdownIt-TOC-wrapper + list-style none + position fixed + right 0 + top 0 + margin-left 15px + z-index 1000 + transition transform .2s ease-in-out + transform translateX(100%) + + .markdownIt-TOC + display block + max-height 90vh + overflow-y auto + padding 25px + padding-left 38px + + &, + &:before + background-color $ui-dark-backgroundColor + color: $ui-dark-text-color + + &:hover + transform translateX(-15px) + + &:before + content 'TOC' + position absolute + width 60px + height 30px + top 60px + left -29px + display flex + align-items center + justify-content center + transform-origin top left + transform rotate(-90deg) + themeDarkBackground = darken(#21252B, 10%) themeDarkText = #f9f9f9 themeDarkBorder = lighten(themeDarkBackground, 20%) @@ -511,6 +555,14 @@ body[data-theme="dark"] color $ui-dark-text-color background-color $ui-dark-tag-backgroundColor + .markdownIt-TOC-wrapper + &, + &:before + background-color darken(themeDarkBackground, 5%) + color themeDarkText + + +themeSolarizedDarkBackground = $ui-solarized-dark-noteDetail-backgroundColor themeSolarizedDarkTableOdd = $ui-solarized-dark-noteDetail-backgroundColor themeSolarizedDarkTableEven = darken($ui-solarized-dark-noteDetail-backgroundColor, 10%) themeSolarizedDarkTableHead = themeSolarizedDarkTableEven @@ -519,7 +571,7 @@ themeSolarizedDarkTableBorder = themeDarkBorder body[data-theme="solarized-dark"] color $ui-solarized-dark-text-color border-color themeDarkBorder - background-color $ui-solarized-dark-noteDetail-backgroundColor + background-color themeSolarizedDarkBackground table thead tr @@ -554,6 +606,13 @@ body[data-theme="solarized-dark"] color $ui-solarized-dark-button--active-color background-color $ui-solarized-dark-button-backgroundColor + .markdownIt-TOC-wrapper + &, + &:before + background-color darken(themeSolarizedDarkBackground, 15%) + color themeDarkText + +themeMonokaiBackground = $ui-monokai-noteDetail-backgroundColor themeMonokaiTableOdd = $ui-monokai-noteDetail-backgroundColor themeMonokaiTableEven = darken($ui-monokai-noteDetail-backgroundColor, 10%) themeMonokaiTableHead = themeMonokaiTableEven @@ -562,7 +621,7 @@ themeMonokaiTableBorder = themeDarkBorder body[data-theme="monokai"] color $ui-monokai-text-color border-color themeDarkBorder - background-color $ui-monokai-noteDetail-backgroundColor + background-color themeMonokaiBackground table thead tr @@ -600,6 +659,13 @@ body[data-theme="monokai"] color $ui-monokai-button--active-color background-color $ui-monokai-button-backgroundColor + .markdownIt-TOC-wrapper + &, + &:before + background-color darken(themeMonokaiBackground, 15%) + color themeDarkText + +themeDraculaBackground = $ui-dracula-noteDetail-backgroundColor themeDraculaTableOdd = $ui-dracula-noteDetail-backgroundColor themeDraculaTableEven = darken($ui-dracula-noteDetail-backgroundColor, 10%) themeDraculaTableHead = themeDraculaTableEven @@ -608,7 +674,7 @@ themeDraculaTableBorder = themeDarkBorder body[data-theme="dracula"] color $ui-dracula-text-color border-color themeDarkBorder - background-color $ui-dracula-noteDetail-backgroundColor + background-color themeDraculaBackground table thead tr @@ -645,3 +711,9 @@ body[data-theme="dracula"] .prev, .next color $ui-dracula-button--active-color background-color $ui-dracula-button-backgroundColor + + .markdownIt-TOC-wrapper + &, + &:before + background-color darken(themeDraculaBackground, 15%) + color themeDarkText diff --git a/browser/components/render/MermaidRender.js b/browser/components/render/MermaidRender.js index d9ea549b..2b1e8b71 100644 --- a/browser/components/render/MermaidRender.js +++ b/browser/components/render/MermaidRender.js @@ -22,18 +22,40 @@ function getId () { function render (element, content, theme, enableHTMLLabel) { try { const height = element.attributes.getNamedItem('data-height') - if (height && height.value !== 'undefined') { + const isPredefined = height && height.value !== 'undefined' + if (isPredefined) { element.style.height = height.value + 'vh' } const isDarkTheme = theme === 'dark' || theme === 'solarized-dark' || theme === 'monokai' || theme === 'dracula' mermaidAPI.initialize({ theme: isDarkTheme ? 'dark' : 'default', themeCSS: isDarkTheme ? darkThemeStyling : '', - useMaxWidth: false, - flowchart: { htmlLabels: enableHTMLLabel } + flowchart: { + htmlLabels: enableHTMLLabel + }, + gantt: { + useWidth: element.clientWidth + } }) mermaidAPI.render(getId(), content, (svgGraph) => { element.innerHTML = svgGraph + + if (!isPredefined) { + const el = element.firstChild + const viewBox = el.getAttribute('viewBox').split(' ') + + let ratio = viewBox[2] / viewBox[3] + + if (el.style.maxWidth) { + const maxWidth = parseFloat(el.style.maxWidth) + + ratio *= el.parentNode.clientWidth / maxWidth + } + + el.setAttribute('ratio', ratio) + el.setAttribute('height', el.parentNode.clientWidth / ratio) + console.log(el) + } }) } catch (e) { element.className = 'mermaid-error' diff --git a/browser/lib/Languages.js b/browser/lib/Languages.js index 435747a9..42755af9 100644 --- a/browser/lib/Languages.js +++ b/browser/lib/Languages.js @@ -11,6 +11,10 @@ const languages = [ name: 'Chinese (zh-TW)', locale: 'zh-TW' }, + { + name: 'Czech', + locale: 'cs' + }, { name: 'Danish', locale: 'da' diff --git a/browser/lib/confirmDeleteNote.js b/browser/lib/confirmDeleteNote.js index 80d1ffc7..b67ed7e3 100644 --- a/browser/lib/confirmDeleteNote.js +++ b/browser/lib/confirmDeleteNote.js @@ -6,7 +6,7 @@ const { dialog } = remote export function confirmDeleteNote (confirmDeletion, permanent) { if (confirmDeletion || permanent) { const alertConfig = { - ype: 'warning', + type: 'warning', message: i18n.__('Confirm note deletion'), detail: i18n.__('This will permanently remove this note.'), buttons: [i18n.__('Confirm'), i18n.__('Cancel')] diff --git a/browser/lib/markdown.js b/browser/lib/markdown.js index 57f981db..c915f0ed 100644 --- a/browser/lib/markdown.js +++ b/browser/lib/markdown.js @@ -124,16 +124,23 @@ class Markdown { slugify: require('./slugify') }) this.md.use(require('markdown-it-kbd')) - this.md.use(require('markdown-it-admonition'), {types: ['note', 'hint', 'attention', 'caution', 'danger', 'error']}) + this.md.use(require('markdown-it-admonition'), {types: ['note', 'hint', 'attention', 'caution', 'danger', 'error', 'quote', 'abstract', 'question']}) this.md.use(require('markdown-it-abbr')) this.md.use(require('markdown-it-sub')) this.md.use(require('markdown-it-sup')) - this.md.use(markdownItTocAndAnchor, { - toc: true, - tocPattern: /\[TOC\]/i, - anchorLink: false, - appendIdToHeading: false + + this.md.use(md => { + markdownItTocAndAnchor(md, { + toc: true, + tocPattern: /\[TOC\]/i, + anchorLink: false, + appendIdToHeading: false + }) + + md.renderer.rules.toc_open = () => '
' + md.renderer.rules.toc_close = () => '
' }) + this.md.use(require('./markdown-it-deflist')) this.md.use(require('./markdown-it-frontmatter')) diff --git a/browser/main/SideNav/index.js b/browser/main/SideNav/index.js index 3167f487..241d4151 100644 --- a/browser/main/SideNav/index.js +++ b/browser/main/SideNav/index.js @@ -57,7 +57,7 @@ class SideNav extends React.Component { deleteTag (tag) { const selectedButton = remote.dialog.showMessageBox(remote.getCurrentWindow(), { - ype: 'warning', + type: 'warning', message: i18n.__('Confirm tag deletion'), detail: i18n.__('This will permanently remove this tag.'), buttons: [i18n.__('Confirm'), i18n.__('Cancel')] diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index 3406e0e1..7d3b4fd5 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -8,6 +8,7 @@ const win = global.process.platform === 'win32' const electron = require('electron') const { ipcRenderer } = electron const consts = require('browser/lib/consts') +const electronConfig = new (require('electron-config'))() let isInitialized = false @@ -26,6 +27,7 @@ export const DEFAULT_CONFIG = { sortTagsBy: 'ALPHABETICAL', // 'ALPHABETICAL', 'COUNTER' listStyle: 'DEFAULT', // 'DEFAULT', 'SMALL' amaEnabled: true, + autoUpdateEnabled: true, hotkey: { toggleMain: OSX ? 'Command + Alt + L' : 'Super + Alt + E', toggleMode: OSX ? 'Command + Alt + M' : 'Ctrl + M', @@ -142,6 +144,8 @@ function get () { _save(config) } + config.autoUpdateEnabled = electronConfig.get('autoUpdateEnabled', config.autoUpdateEnabled) + if (!isInitialized) { isInitialized = true let editorTheme = document.getElementById('editorTheme') @@ -206,6 +210,8 @@ function set (updates) { editorTheme.setAttribute('href', newTheme.path) } + electronConfig.set('autoUpdateEnabled', newConfig.autoUpdateEnabled) + ipcRenderer.send('config-renew', { config: get() }) diff --git a/browser/main/lib/dataApi/createNoteFromUrl.js b/browser/main/lib/dataApi/createNoteFromUrl.js index f9878210..ead93f9e 100644 --- a/browser/main/lib/dataApi/createNoteFromUrl.js +++ b/browser/main/lib/dataApi/createNoteFromUrl.js @@ -14,12 +14,18 @@ function validateUrl (str) { } } +const ERROR_MESSAGES = { + ENOTFOUND: 'URL not found. Please check the URL, or your internet connection and try again.', + VALIDATION_ERROR: 'Please check if the URL follows this format: https://www.google.com', + UNEXPECTED: 'Unexpected error! Please check console for details!' +} + function createNoteFromUrl (url, storage, folder, dispatch = null, location = null) { return new Promise((resolve, reject) => { const td = createTurndownService() if (!validateUrl(url)) { - reject({result: false, error: 'Please check your URL is in correct format. (Example, https://www.google.com)'}) + reject({result: false, error: ERROR_MESSAGES.VALIDATION_ERROR}) } const request = url.startsWith('https') ? https : http @@ -70,8 +76,9 @@ function createNoteFromUrl (url, storage, folder, dispatch = null, location = nu req.on('error', (e) => { console.error('error in parsing URL', e) - reject({result: false, error: e}) + reject({result: false, error: ERROR_MESSAGES[e.code] || ERROR_MESSAGES.UNEXPECTED}) }) + req.end() }) } diff --git a/browser/main/modals/PreferencesModal/InfoTab.js b/browser/main/modals/PreferencesModal/InfoTab.js index 71e99da9..66250412 100644 --- a/browser/main/modals/PreferencesModal/InfoTab.js +++ b/browser/main/modals/PreferencesModal/InfoTab.js @@ -61,6 +61,15 @@ class InfoTab extends React.Component { }) } + toggleAutoUpdate () { + const newConfig = { + autoUpdateEnabled: !this.state.config.autoUpdateEnabled + } + + this.setState({ config: newConfig }) + ConfigManager.set(newConfig) + } + infoMessage () { const { amaMessage } = this.state return amaMessage ?

{amaMessage}

: null @@ -140,6 +149,8 @@ class InfoTab extends React.Component { +
+
{i18n.__('Analytics')}
diff --git a/contributing.md b/contributing.md index fa71d5a5..717c31ef 100644 --- a/contributing.md +++ b/contributing.md @@ -1,3 +1,5 @@ +> [Please consider to contribute to the new Boost Note app too!](https://github.com/BoostIO/BoostNote.next) + # Contributing to Boostnote (English) ### When you open an issue or a bug report @@ -87,17 +89,17 @@ Pull requestをすることはその変化分のコードの著作権をBoostIO # Contributing to Boostnote (Simplified Chinese) ### 当您创建一个issue的时候 -我们对您的issue格式没有要求,但是我们有一个请求: +我们对您的issue格式没有要求,但是我们有一个请求: -**如果可能,请在开发者模式打开的情况下,为我们提供屏幕截图** +**如果可能,请在开发者模式打开的情况下,为我们提供屏幕截图** -(您可以通过`Ctrl+Shift+I`打开开发者模式)。 -感谢您对我们的支持。 +(您可以通过`Ctrl+Shift+I`打开开发者模式)。 +感谢您对我们的支持。 ### 关于您提供的Pull Request的著作权(版权)问题 -如果您提供了一个Pull Request,这表示您将您所修改的代码的著作权移交给BoostIO。 +如果您提供了一个Pull Request,这表示您将您所修改的代码的著作权移交给BoostIO。 -这并不表示Boostnote会成为一个需要付费的软件。如果我们想获得收益,我们会尝试一些其他的方法,比如说云存储、绑定手机软件等。 +这并不表示Boostnote会成为一个需要付费的软件。如果我们想获得收益,我们会尝试一些其他的方法,比如说云存储、绑定手机软件等。 因为GPLv3过于严格,不能和其他的一些协议兼容,所以我们有可能在将来会把BoostNote的协议改为一些较为宽松的协议,比如说BSD、MIT。 --- diff --git a/docs/pt_BR/build.md b/docs/pt_BR/build.md index ad539996..ae456522 100644 --- a/docs/pt_BR/build.md +++ b/docs/pt_BR/build.md @@ -42,7 +42,9 @@ Então nós preparamos um _script_ separado, o qual somente cria um executável. grunt pre-build ``` -Você irá encontrar o executável na pasta `dist`. Nota: o atualizador automático não funciona porque o app não está certificado. +Você irá encontrar o executável na pasta `dist`. + +**Nota:** o atualizador automático não funciona porque o app não está certificado. Se você achar isto necessário, você pode usar o _codesign_ ou o _authenticode_ com esse executável. @@ -50,7 +52,7 @@ Se você achar isto necessário, você pode usar o _codesign_ ou o _authenticode Pacotes de distribuição são gerados através do comando `grunt build` em plataforma Linux (e.g. Ubuntu, Fedora). -> Nota: você pode criar `.deb` e `.rpm` em um mesmo ambiente. +**Nota:** você pode criar `.deb` e `.rpm` em um mesmo ambiente. Depois de instalar uma versão suportada do `node` e do `npm`, deve-se instalar as dependências para gerar os pacotes. diff --git a/lib/main-app.js b/lib/main-app.js index 9a2c4e59..f8ee1ecf 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -4,6 +4,7 @@ const Menu = electron.Menu const ipc = electron.ipcMain const GhReleases = require('electron-gh-releases') const { isPackaged } = app +const electronConfig = new (require('electron-config'))() // electron.crashReporter.start() const singleInstance = app.requestSingleInstanceLock() @@ -40,6 +41,7 @@ function checkUpdate () { console.log('Updates are disabled in Development mode, see main-app.js') return true } + if (!electronConfig.get('autoUpdateEnabled', true)) return if (process.platform === 'linux' || isUpdateReady) { return true } diff --git a/lib/main-menu.js b/lib/main-menu.js index 124c6675..a072ed25 100644 --- a/lib/main-menu.js +++ b/lib/main-menu.js @@ -86,21 +86,21 @@ const file = { }, { label: 'Focus Note', - accelerator: macOS ? 'Command+E' : 'Control+E', + accelerator: 'CommandOrControl+E', click () { mainWindow.webContents.send('detail:focus') } }, { label: 'Delete Note', - accelerator: macOS ? 'Command+Shift+Backspace' : 'Control+Shift+Backspace', + accelerator: 'CommandOrControl+Shift+Backspace', click () { mainWindow.webContents.send('detail:delete') } }, { label: 'Clone Note', - accelerator: macOS ? 'Command+D' : 'Control+D', + accelerator: 'CommandOrControl+D', click () { mainWindow.webContents.send('list:clone') } @@ -260,7 +260,7 @@ const view = { }, { label: 'Toggle Developer Tools', - accelerator: macOS ? 'Command+Alt+I' : 'Control+Shift+I', + accelerator: 'CommandOrControl+Alt+I', click () { BrowserWindow.getFocusedWindow().toggleDevTools() } @@ -314,21 +314,21 @@ const view = { }, { label: 'Actual Size', - accelerator: macOS ? 'CommandOrControl+0' : 'Control+0', + accelerator: 'CommandOrControl+0', click () { mainWindow.webContents.send('status:zoomreset') } }, { label: 'Zoom In', - accelerator: macOS ? 'CommandOrControl+=' : 'Control+=', + accelerator: 'CommandOrControl+=', click () { mainWindow.webContents.send('status:zoomin') } }, { label: 'Zoom Out', - accelerator: macOS ? 'CommandOrControl+-' : 'Control+-', + accelerator: 'CommandOrControl+-', click () { mainWindow.webContents.send('status:zoomout') } diff --git a/lib/main.production.html b/lib/main.production.html index d6828acc..aea19e3c 100644 --- a/lib/main.production.html +++ b/lib/main.production.html @@ -10,6 +10,7 @@ + Boostnote @@ -129,6 +130,10 @@ + + + +