From 29cd63d3a79e1630444851d430f6d68f5bb6896f Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Mon, 11 Jun 2018 18:40:55 +0800 Subject: [PATCH 01/33] Improve Traditional Chinese translation --- locales/zh-TW.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locales/zh-TW.json b/locales/zh-TW.json index 4b915ff9..e8c86b88 100755 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -4,10 +4,10 @@ "Preferences": "偏好設定", "Make a note": "做點筆記", "Ctrl": "Ctrl", - "Ctrl(^)": "Ctrl", + "Ctrl(^)": "Ctrl(^)", "to create a new note": "新增筆記", "Toggle Mode": "切換模式", - "Trash": "廢紙簍", + "Trash": "垃圾桶", "MODIFICATION DATE": "修改時間", "Words": "單字", "Letters": "字數", @@ -20,8 +20,8 @@ ".html": ".html", "Print": "列印", "Your preferences for Boostnote": "Boostnote 偏好設定", - "Storages": "本機儲存空間", - "Add Storage Location": "新增一個本機儲存位置", + "Storages": "儲存空間", + "Add Storage Location": "新增儲存位置", "Add Folder": "新增資料夾", "Open Storage folder": "開啟儲存資料夾", "Unlink": "解除連結", @@ -43,12 +43,12 @@ "Switch to Preview": "切回預覽頁面的時機", "When Editor Blurred": "當編輯器失去焦點時", "When Editor Blurred, Edit On Double Click": "當編輯器失去焦點時,雙擊切換到編輯畫面", - "On Right Click": "點擊右鍵切換兩個頁面", + "On Right Click": "點選右鍵切換兩個頁面", "Editor Keymap": "編輯器 Keymap", "default": "預設", "vim": "vim", "emacs": "emacs", - "⚠️ Please restart boostnote after you change the keymap": "⚠️ 請重新開啟 Boostnote 以完成設定。", + "⚠️ Please restart boostnote after you change the keymap": "⚠️ 修改鍵盤配置請重新開啟 Boostnote ", "Show line numbers in the editor": "在編輯器中顯示行號", "Allow editor to scroll past the last line": "允許編輯器捲軸捲動超過最後一行", "Bring in web page title when pasting URL on editor": "在編輯器貼上網址的時候,自動加上網頁標題", @@ -79,7 +79,7 @@ "Analytics": "分析", "Boostnote collects anonymous data for the sole purpose of improving the application, and strictly does not collect any personal information such the contents of your notes.": "Boostnote 收集匿名資料單純只為了提升軟體使用體驗,絕對不收集任何個人資料(包括筆記內容)", "You can see how it works on ": "你可以看看它的程式碼是如何運作 ", - "You can choose to enable or disable this option.": "你可以選擇啟用或禁用這項功能", + "You can choose to enable or disable this option.": "你可以選擇啟用或停用這項功能", "Enable analytics to help improve Boostnote": "允許數據分析以協助我們改進 Boostnote", "Crowdfunding": "群眾募資", "Dear everyone,": "親愛的用戶:", @@ -104,9 +104,9 @@ "Confirm": "確認", "Cancel": "取消", "Markdown Note": "Markdown 筆記", - "This format is for creating text documents. Checklists, code blocks and Latex blocks are available.": "建立文件、清單,也可以使用程式碼區塊甚至是 Latex 區塊。", + "This format is for creating text documents. Checklists, code blocks and Latex blocks are available.": "建立文件、清單,也可以使用程式碼區塊及 Latex 區塊。", "Snippet Note": "程式碼片段筆記", - "This format is for creating code snippets. Multiple snippets can be grouped into a single note.": "建立程式碼區塊片段。數個程式碼區塊可以合在同一個筆記裡。", + "This format is for creating code snippets. Multiple snippets can be grouped into a single note.": "建立程式碼區塊片段。多個程式碼區塊可以分組爲同一個筆記。", "Tab to switch format": "使用 Tab 鍵切換格式", "Updated": "依更新時間排序", "Created": "依建立時間排序", @@ -117,12 +117,12 @@ "Blog Type": "部落格類型", "Blog Address": "部落格網址", "Save": "儲存", - "Auth": "Auth", + "Auth": "驗證", "Authentication Method": "認證方法", "JWT": "JWT", "USER": "USER", "Token": "Token", - "Storage": "本機儲存空間", + "Storage": "儲存空間", "Hotkeys": "快捷鍵", "Show/Hide Boostnote": "顯示/隱藏 Boostnote", "Restore": "還原", @@ -144,7 +144,7 @@ "Russian": "Russian", "Editor Rulers": "編輯器中顯示垂直尺規", "Enable": "啟用", - "Disable": "禁用", + "Disable": "停用", "Sanitization": "過濾 HTML 程式碼", "Only allow secure html tags (recommended)": "只允許安全的 HTML 標籤 (建議)", "Allow styles": "允許樣式", From 68a328a36436762093f7076b0a9269c21813d8b2 Mon Sep 17 00:00:00 2001 From: Jannick Hemelhof Date: Wed, 13 Jun 2018 16:08:18 +0200 Subject: [PATCH 02/33] Removed unused packages --- package.json | 4 -- webpack-skeleton.js | 4 -- yarn.lock | 99 +++------------------------------------------ 3 files changed, 6 insertions(+), 101 deletions(-) diff --git a/package.json b/package.json index 187f8603..b94d0435 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,6 @@ "lodash-move": "^1.1.1", "markdown-it": "^6.0.1", "markdown-it-admonition": "https://github.com/johannbre/markdown-it-admonition.git", - "markdown-it-checkbox": "^1.1.0", "markdown-it-emoji": "^1.1.1", "markdown-it-footnote": "^3.0.0", "markdown-it-imsize": "^2.0.1", @@ -80,7 +79,6 @@ "markdown-it-named-headers": "^0.0.4", "markdown-it-plantuml": "^0.3.0", "markdown-it-smartarrows": "^1.0.1", - "md5": "^2.0.0", "mdurl": "^1.0.1", "moment": "^2.10.3", "mousetrap": "^1.6.1", @@ -97,8 +95,6 @@ "sander": "^0.5.1", "sanitize-html": "^1.18.2", "striptags": "^2.2.1", - "superagent": "^1.2.0", - "superagent-promise": "^1.0.3", "unique-slug": "2.0.0", "uuid": "^3.2.1" }, diff --git a/webpack-skeleton.js b/webpack-skeleton.js index 525ef60b..aca0791f 100644 --- a/webpack-skeleton.js +++ b/webpack-skeleton.js @@ -28,16 +28,12 @@ var config = { externals: [ 'node-ipc', 'electron', - 'md5', - 'superagent', - 'superagent-promise', 'lodash', 'markdown-it', 'moment', 'markdown-it-emoji', 'fs-jetpack', '@rokt33r/markdown-it-math', - 'markdown-it-checkbox', 'markdown-it-kbd', 'markdown-it-plantuml', 'markdown-it-admonition', diff --git a/yarn.lock b/yarn.lock index 23ba4c45..c1d4faf2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1574,10 +1574,6 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0, chalk@^2.4.1: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -charenc@~0.0.1: - version "0.0.2" - resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" - chokidar@^1.0.0, chokidar@^1.4.2: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" @@ -1794,7 +1790,7 @@ colors@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" -combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5: +combined-stream@1.0.6, combined-stream@~1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" dependencies: @@ -1830,7 +1826,7 @@ compare-versions@^3.1.0: version "3.2.1" resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.2.1.tgz#a49eb7689d4caaf0b6db5220173fd279614000f7" -component-emitter@^1.2.1, component-emitter@~1.2.0: +component-emitter@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" @@ -1960,10 +1956,6 @@ cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" -cookiejar@2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.0.6.tgz#0abf356ad00d1c5a219d88d44518046dd026acfe" - copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" @@ -2015,10 +2007,6 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" -crypt@~0.0.1: - version "0.0.2" - resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" - cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" @@ -2206,7 +2194,7 @@ debug@*, debug@^3.0.1, debug@^3.1.0: dependencies: ms "2.0.0" -debug@2, debug@2.6.9, debug@^2.1.1, debug@^2.1.2, debug@^2.1.3, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9: +debug@2.6.9, debug@^2.1.1, debug@^2.1.2, debug@^2.1.3, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -3082,10 +3070,6 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" - extend@~3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" @@ -3351,14 +3335,6 @@ forever-agent@~0.6.0, forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" -form-data@1.0.0-rc3: - version "1.0.0-rc3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-1.0.0-rc3.tgz#d35bc62e7fbc2937ae78f948aaa0d38d90607577" - dependencies: - async "^1.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.3" - form-data@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-0.2.0.tgz#26f8bc26da6440e299cbdcfb69035c4f77a6e466" @@ -3375,10 +3351,6 @@ form-data@~2.3.1: combined-stream "1.0.6" mime-types "^2.1.12" -formidable@~1.0.14: - version "1.0.17" - resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.0.17.tgz#ef5491490f9433b705faa77249c99029ae348559" - forwarded@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" @@ -4236,7 +4208,7 @@ is-binary-path@^1.0.0: dependencies: binary-extensions "^1.0.0" -is-buffer@^1.1.5, is-buffer@~1.1.1: +is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -5392,12 +5364,6 @@ map-visit@^1.0.0: version "1.0.2" resolved "https://github.com/johannbre/markdown-it-admonition.git#e0c0fcd59e9119d6d60ed209aa3d0f1177ec0166" -markdown-it-checkbox@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/markdown-it-checkbox/-/markdown-it-checkbox-1.1.0.tgz#20cff97f33d77d172f9dcf1bcfc92cecc5330fac" - dependencies: - underscore "^1.8.2" - markdown-it-emoji@^1.1.1: version "1.4.0" resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc" @@ -5492,14 +5458,6 @@ md5-o-matic@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/md5-o-matic/-/md5-o-matic-0.1.1.tgz#822bccd65e117c514fab176b25945d54100a03c3" -md5@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9" - dependencies: - charenc "~0.0.1" - crypt "~0.0.1" - is-buffer "~1.1.1" - mdurl@^1.0.1, mdurl@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" @@ -5561,7 +5519,7 @@ merge@^1.1.3: version "1.2.0" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" -methods@~1.1.1, methods@~1.1.2: +methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -5609,7 +5567,7 @@ mime-db@~1.12.0: version "1.12.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.12.0.tgz#3d0c63180f458eb10d325aaa37d7c58ae312e9d7" -mime-types@^2.1.12, mime-types@^2.1.3, mime-types@~2.1.17, mime-types@~2.1.18: +mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.18: version "2.1.18" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" dependencies: @@ -5621,10 +5579,6 @@ mime-types@~2.0.1, mime-types@~2.0.3: dependencies: mime-db "~1.12.0" -mime@1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53" - mime@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" @@ -6779,10 +6733,6 @@ q@^1.1.2: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" -qs@2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-2.3.3.tgz#e9e85adbe75da0bbe4c8e0476a086290f863b404" - qs@6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" @@ -7030,15 +6980,6 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -readable-stream@1.0.27-1: - version "1.0.27-1" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.27-1.tgz#6b67983c20357cefd07f0165001a16d710d91078" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readable-stream@^1.1.8, readable-stream@~1.1.9: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" @@ -7114,10 +7055,6 @@ redent@^1.0.0: indent-string "^2.1.0" strip-indent "^1.0.1" -reduce-component@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/reduce-component/-/reduce-component-1.0.1.tgz#e0c93542c574521bea13df0f9488ed82ab77c5da" - reduce-css-calc@^1.2.6: version "1.3.0" resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716" @@ -8043,26 +7980,6 @@ sumchecker@^1.2.0: debug "^2.2.0" es6-promise "^4.0.5" -superagent-promise@^1.0.3: - version "1.1.0" - resolved "https://registry.yarnpkg.com/superagent-promise/-/superagent-promise-1.1.0.tgz#baf22d8bbdd439a9b07dd10f8c08f54fe2503533" - -superagent@^1.2.0: - version "1.8.5" - resolved "https://registry.yarnpkg.com/superagent/-/superagent-1.8.5.tgz#1c0ddc3af30e80eb84ebc05cb2122da8fe940b55" - dependencies: - component-emitter "~1.2.0" - cookiejar "2.0.6" - debug "2" - extend "3.0.0" - form-data "1.0.0-rc3" - formidable "~1.0.14" - methods "~1.1.1" - mime "1.3.4" - qs "2.3.3" - readable-stream "1.0.27-1" - reduce-component "1.0.1" - supertap@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supertap/-/supertap-1.0.0.tgz#bd9751c7fafd68c68cf8222a29892206a119fa9e" @@ -8402,10 +8319,6 @@ underscore.string@~2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-2.4.0.tgz#8cdd8fbac4e2d2ea1e7e2e8097c42f442280f85b" -underscore@^1.8.2: - version "1.9.0" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.0.tgz#31dbb314cfcc88f169cd3692d9149d81a00a73e4" - underscore@~1.4.x: version "1.4.4" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.4.4.tgz#61a6a32010622afa07963bf325203cf12239d604" From 868eefd2cf9658c46415ae0ee918b66820dff7ce Mon Sep 17 00:00:00 2001 From: Romain Le Quellec Date: Tue, 19 Jun 2018 22:20:17 +0200 Subject: [PATCH 03/33] update fr translation --- locales/fr.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locales/fr.json b/locales/fr.json index dd25e806..8b880aa6 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -141,16 +141,16 @@ "Portuguese": "Portugais", "Spanish": "Espagnol", "You have to save!": "Il faut sauvegarder !", - "Russian": "Russian", + "Russian": "Russe", "Command(⌘)": "Command(⌘)", - "Editor Rulers": "Editor Rulers", - "Enable": "Enable", - "Disable": "Disable", - "Allow preview to scroll past the last line": "Allow preview to scroll past the last line", + "Editor Rulers": "Règles dans l'éditeur", + "Enable": "Activer", + "Disable": "Désactiver", + "Allow preview to scroll past the last line": "Permettre de scroller après la dernière ligne dans l'aperçu", "Sanitization": "Sanitization", - "Only allow secure html tags (recommended)": "Only allow secure html tags (recommended)", - "Allow styles": "Allow styles", - "Allow dangerous html tags": "Allow dangerous html tags", - "Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.": "Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.", - "⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠" + "Only allow secure html tags (recommended)": "N'accepter que les tags html sécurisés (recommandé)", + "Allow styles": "Accepter les styles", + "Allow dangerous html tags": "Accepter les tags html dangereux", + "Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.": "Convertir des flèches textuelles en jolis signes. ⚠ Cela va interferérer avec les éventuels commentaires HTML dans votre Markdown.", + "⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ Vous avez collé un lien qui référence une pièce-jointe qui n'a pas pu être récupéré dans le dossier de stockage de la note. Coller des liens qui font référence à des pièces-jointes ne fonctionne que si la source et la destination et la même. Veuillez plutôt utiliser du Drag & Drop ! ⚠" } From 129e3b283d5d254f94288b1b05d6301c5b0eeeaf Mon Sep 17 00:00:00 2001 From: voidsatisfaction Date: Wed, 20 Jun 2018 14:29:57 +0900 Subject: [PATCH 04/33] fix tiny typo --- lib/main-app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main-app.js b/lib/main-app.js index e7e52715..1f3f1320 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -90,7 +90,7 @@ app.on('ready', function () { mainWindow.setMenu(menu) } - // Check update every hour + // Check update every day setInterval(function () { checkUpdate() }, 1000 * 60 * 60 * 24) @@ -106,7 +106,7 @@ app.on('ready', function () { checkUpdate() } }) - }, 10000) + }, 10 * 1000) ipcServer = require('./ipcServer') ipcServer.server.start() }) From 7970016fbfb33f5fd124c281ca5c92477e2fb419 Mon Sep 17 00:00:00 2001 From: ehhc Date: Wed, 20 Jun 2018 08:48:55 +0200 Subject: [PATCH 05/33] One more try to fix the handling of images in the legacy location --- browser/main/lib/dataApi/attachmentManagement.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/main/lib/dataApi/attachmentManagement.js b/browser/main/lib/dataApi/attachmentManagement.js index aec59927..57de90e0 100644 --- a/browser/main/lib/dataApi/attachmentManagement.js +++ b/browser/main/lib/dataApi/attachmentManagement.js @@ -106,7 +106,7 @@ function migrateAttachments (renderedHTML, storagePath, noteKey) { * @returns {String} postprocessed HTML in which all :storage references are mapped to the actual paths. */ function fixLocalURLS (renderedHTML, storagePath) { - return renderedHTML.replace(new RegExp(mdurl.encode(path.sep), 'g'), path.sep).replace(new RegExp(STORAGE_FOLDER_PLACEHOLDER, 'g'), 'file:///' + path.join(storagePath, DESTINATION_FOLDER)) + return renderedHTML.replace(new RegExp(mdurl.encode(path.sep), 'g'), path.sep).replace(new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER, 'g'), 'file:///' + path.join(storagePath, DESTINATION_FOLDER)) } /** @@ -192,7 +192,7 @@ function handlePastImageEvent (codeEditor, storageKey, noteKey, dataTransferItem */ function getAttachmentsInContent (markdownContent) { const preparedInput = markdownContent.replace(new RegExp(mdurl.encode(path.sep), 'g'), path.sep) - const regexp = new RegExp(STORAGE_FOLDER_PLACEHOLDER + escapeStringRegexp(path.sep) + '?([a-zA-Z0-9]|-)*' + escapeStringRegexp(path.sep) + '[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)?', 'g') + const regexp = new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '(' + escapeStringRegexp(path.sep) + '|/)' + '?([a-zA-Z0-9]|-)*' + '(' + escapeStringRegexp(path.sep) + '|/)' + '[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)?', 'g') return preparedInput.match(regexp) } From 7c0097951c550c86be785f0150d2c2c835c6f329 Mon Sep 17 00:00:00 2001 From: voidsatisfaction Date: Wed, 20 Jun 2018 21:38:36 +0900 Subject: [PATCH 06/33] fix: m key issue --- browser/main/lib/ConfigManager.js | 4 ++-- browser/main/lib/shortcutManager.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index 0f070fc6..ecdceac3 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -21,8 +21,8 @@ export const DEFAULT_CONFIG = { listStyle: 'DEFAULT', // 'DEFAULT', 'SMALL' amaEnabled: true, hotkey: { - toggleMain: OSX ? 'Cmd + Alt + L' : 'Super + Alt + E', - toggleMode: OSX ? 'Cmd + M' : 'Ctrl + M' + toggleMain: OSX ? 'Command + Alt + L' : 'Super + Alt + E', + toggleMode: OSX ? 'Command + M' : 'Ctrl + M' }, ui: { language: 'en', diff --git a/browser/main/lib/shortcutManager.js b/browser/main/lib/shortcutManager.js index 2b937aea..ac2a3a08 100644 --- a/browser/main/lib/shortcutManager.js +++ b/browser/main/lib/shortcutManager.js @@ -3,7 +3,7 @@ import CM from 'browser/main/lib/ConfigManager' import ee from 'browser/main/lib/eventEmitter' import { isObjectEqual } from 'browser/lib/utils' require('mousetrap-global-bind') -const functions = require('./shortcut') +import functions from './shortcut' let shortcuts = CM.get().hotkey From a2ddb5654070863ab9ceb635520b1baabc0daeb6 Mon Sep 17 00:00:00 2001 From: voidsatisfaction Date: Wed, 20 Jun 2018 21:45:24 +0900 Subject: [PATCH 07/33] fix: change mode to more desiarable way --- browser/main/Detail/MarkdownNoteDetail.js | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index a8fc938b..b0be06b0 100755 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -277,6 +277,7 @@ class MarkdownNoteDetail extends React.Component { handleSwitchMode (type) { this.setState({ editorType: type }, () => { + this.focus(); const newConfig = Object.assign({}, this.props.config) newConfig.editor.type = type ConfigManager.set(newConfig) From bdd5b7b3a7bb9324f66daaaa413c44d4ee5492d6 Mon Sep 17 00:00:00 2001 From: voidsatisfaction Date: Wed, 20 Jun 2018 21:57:11 +0900 Subject: [PATCH 08/33] fix: no need semicolon --- browser/main/Detail/MarkdownNoteDetail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index b0be06b0..82073162 100755 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -277,7 +277,7 @@ class MarkdownNoteDetail extends React.Component { handleSwitchMode (type) { this.setState({ editorType: type }, () => { - this.focus(); + this.focus() const newConfig = Object.assign({}, this.props.config) newConfig.editor.type = type ConfigManager.set(newConfig) From 7c3aaff635ce8bd6f1713d7ee5f10a15746ad5f1 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Thu, 21 Jun 2018 02:48:44 +0900 Subject: [PATCH 09/33] Rewrite invalid hotkeys when loading --- browser/main/lib/ConfigManager.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index ecdceac3..0f6264be 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -182,6 +182,17 @@ function assignConfigValues (originalConfig, rcConfig) { config.ui = Object.assign({}, DEFAULT_CONFIG.ui, originalConfig.ui, rcConfig.ui) config.editor = Object.assign({}, DEFAULT_CONFIG.editor, originalConfig.editor, rcConfig.editor) config.preview = Object.assign({}, DEFAULT_CONFIG.preview, originalConfig.preview, rcConfig.preview) + + rewriteHotkey(config) + + return config +} + +function rewriteHotkey (config) { + const keys = [...Object.keys(config.hotkey)] + keys.forEach(key => { + config.hotkey[key] = config.hotkey[key].replace(/Cmd/g, 'Command') + }) return config } From 653b9850185efdba8be6d33d3d64292bc83c2e5d Mon Sep 17 00:00:00 2001 From: yosmoc Date: Sat, 23 Jun 2018 14:02:46 +0900 Subject: [PATCH 10/33] plantuml non-english character support and timing diagram support --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 54c02a8b..7af52118 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "markdown-it-kbd": "^1.1.1", "markdown-it-multimd-table": "^2.0.1", "markdown-it-named-headers": "^0.0.4", - "markdown-it-plantuml": "^0.3.0", + "markdown-it-plantuml": "^1.1.0", "markdown-it-smartarrows": "^1.0.1", "md5": "^2.0.0", "mdurl": "^1.0.1", diff --git a/yarn.lock b/yarn.lock index d5bce1d1..99dd0d80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5426,9 +5426,9 @@ markdown-it-named-headers@^0.0.4: dependencies: string "^3.0.1" -markdown-it-plantuml@^0.3.0: - version "0.3.2" - resolved "https://registry.yarnpkg.com/markdown-it-plantuml/-/markdown-it-plantuml-0.3.2.tgz#f93a49bdfc8417b0df3c88700445f53487e57356" +markdown-it-plantuml@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/markdown-it-plantuml/-/markdown-it-plantuml-1.1.0.tgz#9ab8bfa09a02d80845e16e60f87a488edb50fdde" markdown-it-smartarrows@^1.0.1: version "1.0.1" From c36689934d49dd9e23e0fd69268ac261512f587e Mon Sep 17 00:00:00 2001 From: Johann Breytenbach Date: Fri, 1 Jun 2018 00:08:08 -0700 Subject: [PATCH 11/33] Fix rendering of admonitions in Windows --- browser/components/MarkdownPreview.js | 4 +++- browser/components/markdown.styl | 22 ++++++++++++---------- package.json | 1 + yarn.lock | 4 ++++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/browser/components/MarkdownPreview.js b/browser/components/MarkdownPreview.js index 4a745055..124bd8c3 100755 --- a/browser/components/MarkdownPreview.js +++ b/browser/components/MarkdownPreview.js @@ -21,10 +21,12 @@ const attachmentManagement = require('../main/lib/dataApi/attachmentManagement') const { app } = remote const path = require('path') +const fileUrl = require('file-url') + const dialog = remote.dialog const markdownStyle = require('!!css!stylus?sourceMap!./markdown.styl')[0][1] -const appPath = 'file://' + (process.env.NODE_ENV === 'production' +const appPath = fileUrl(process.env.NODE_ENV === 'production' ? app.getAppPath() : path.resolve()) const CSS_FILES = [ diff --git a/browser/components/markdown.styl b/browser/components/markdown.styl index 6f8a97f1..cf94bb8e 100644 --- a/browser/components/markdown.styl +++ b/browser/components/markdown.styl @@ -315,6 +315,8 @@ $admonition-icon position absolute left 1.2rem font-family: "Material Icons" + font-weight: normal; + font-style: normal; font-size: 24px display: inline-block; line-height: 1; @@ -346,27 +348,27 @@ $admonition-title margin-bottom 0 admonition_types = { - note: {border-color: #448aff, title-color: rgba(68,138,255,.1), icon: "note"}, - hint: {border-color: #00bfa5, title-color: rgba(0,191,165,.1), icon: "info"}, - danger: {border-color: #ff1744, title-color: rgba(255,23,68,.1), icon: "block"}, - caution: {border-color: #ff9100, title-color: rgba(255,145,0,.1), icon: "warning"}, - error: {border-color: #ff1744, title-color: rgba(255,23,68,.1), icon: "error"}, - attention: {border-color: #64dd17, title-color: rgba(100,221,23,.1), icon: "priority_high"} + note: {color: #0288D1, icon: "note"}, + hint: {color: #009688, icon: "info_outline"}, + danger: {color: #c2185b, icon: "block"}, + caution: {color: #ffa726, icon: "warning"}, + error: {color: #d32f2f, icon: "error_outline"}, + attention: {color: #455a64, icon: "priority_high"} } for name, val in admonition_types .admonition.{name} @extend $admonition - border-left-color: val[border-color] + border-left-color: val[color] .admonition.{name}>.admonition-title @extend $admonition-title - border-bottom-color: .1rem solid val[title-color] - background-color: val[title-color] + border-bottom-color: .1rem solid rgba(val[color], 0.2) + background-color: rgba(val[color], 0.2) .admonition.{name}>.admonition-title:before @extend $admonition-icon - color: val[border-color] + color: val[color] content: val[icon] themeDarkBackground = darken(#21252B, 10%) diff --git a/package.json b/package.json index 54c02a8b..22dae2d2 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "electron-config": "^0.2.1", "electron-gh-releases": "^2.0.2", "escape-string-regexp": "^1.0.5", + "file-url": "^2.0.2", "filenamify": "^2.0.0", "flowchart.js": "^1.6.5", "font-awesome": "^4.3.0", diff --git a/yarn.lock b/yarn.lock index d5bce1d1..2936c98a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3206,6 +3206,10 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +file-url@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/file-url/-/file-url-2.0.2.tgz#e951784d79095127d3713029ab063f40818ca2ae" + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" From 58eeb901587d8cf65e2676e1dd28b007c249d974 Mon Sep 17 00:00:00 2001 From: Kazz Yokomizo Date: Mon, 25 Jun 2018 15:46:41 +0900 Subject: [PATCH 12/33] Update issue template Add IssueHunt url --- ISSUE_TEMPLATE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index f185492a..1f5ada57 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -20,6 +20,6 @@ If your issue is regarding boostnote mobile, move to https://github.com/BoostIO/ - OS Version and name : \ No newline at end of file +Love Boostnote? Please consider supporting us on IssueHunt: +👉 https://issuehunt.io/repos/53266139 +--> From c69f34836a0461ee8644d11acdecdcd9b4bfd6d4 Mon Sep 17 00:00:00 2001 From: ehhc Date: Mon, 25 Jun 2018 15:18:45 +0200 Subject: [PATCH 13/33] handle dot in file name --- browser/main/lib/dataApi/attachmentManagement.js | 2 +- tests/dataApi/attachmentManagement.test.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/main/lib/dataApi/attachmentManagement.js b/browser/main/lib/dataApi/attachmentManagement.js index 57de90e0..a4c420bd 100644 --- a/browser/main/lib/dataApi/attachmentManagement.js +++ b/browser/main/lib/dataApi/attachmentManagement.js @@ -192,7 +192,7 @@ function handlePastImageEvent (codeEditor, storageKey, noteKey, dataTransferItem */ function getAttachmentsInContent (markdownContent) { const preparedInput = markdownContent.replace(new RegExp(mdurl.encode(path.sep), 'g'), path.sep) - const regexp = new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '(' + escapeStringRegexp(path.sep) + '|/)' + '?([a-zA-Z0-9]|-)*' + '(' + escapeStringRegexp(path.sep) + '|/)' + '[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)?', 'g') + const regexp = new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '(' + escapeStringRegexp(path.sep) + '|/)' + '?([a-zA-Z0-9]|-)*' + '(' + escapeStringRegexp(path.sep) + '|/)' + '([a-zA-Z0-9]|\\.)+(\\.[a-zA-Z0-9]+)?', 'g') return preparedInput.match(regexp) } diff --git a/tests/dataApi/attachmentManagement.test.js b/tests/dataApi/attachmentManagement.test.js index 454bde54..4ce031a7 100644 --- a/tests/dataApi/attachmentManagement.test.js +++ b/tests/dataApi/attachmentManagement.test.js @@ -200,7 +200,7 @@ it('should test that getAttachmentsInContent finds all attachments', function () ' \n' + '' const actual = systemUnderTest.getAttachmentsInContent(testInput) - const expected = [':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + 'd6c5ee92.jpg'] + const expected = [':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp.png', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx.pdf', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + 'd6c5ee92.jpg'] expect(actual).toEqual(expect.arrayContaining(expected)) }) @@ -225,8 +225,8 @@ it('should test that getAbsolutePathsOfAttachmentsInContent returns all absolute ' \n' + '' const actual = systemUnderTest.getAbsolutePathsOfAttachmentsInContent(testInput, dummyStoragePath) - const expected = [dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp', - dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx', + const expected = [dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp.png', + dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx.pdf', dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + 'd6c5ee92.jpg'] expect(actual).toEqual(expect.arrayContaining(expected)) }) From f7fd99ec20ebe23431e7fe5e468bf18480ac0cc1 Mon Sep 17 00:00:00 2001 From: Jannick Hemelhof Date: Tue, 26 Jun 2018 11:27:37 +0200 Subject: [PATCH 14/33] Update electron to v2.0.3 --- package.json | 4 ++-- yarn.lock | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2f5f3839..71123f5e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "dev-start": "concurrently --kill-others \"npm run webpack\" \"npm run hot\"" }, "config": { - "electron-version": "1.8.7" + "electron-version": "2.0.3" }, "repository": { "type": "git", @@ -116,7 +116,7 @@ "css-loader": "^0.19.0", "devtron": "^1.1.0", "dom-storage": "^2.0.2", - "electron": "2.0.2", + "electron": "2.0.3", "electron-packager": "^6.0.0", "eslint": "^3.13.1", "eslint-config-standard": "^6.2.1", diff --git a/yarn.lock b/yarn.lock index 535e8d6e..e7863799 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2565,9 +2565,9 @@ electron-winstaller@^2.2.0: lodash.template "^4.2.2" temp "^0.8.3" -electron@2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.2.tgz#b77e05f83419cc5ec921a2d21f35b55e4bfc3d68" +electron@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.3.tgz#8e591e820cae2ccdb0c3fd74c6d07834913fc133" dependencies: "@types/node" "^8.0.24" electron-download "^3.0.1" From 5c60da0f8f8e50c455f04101d1140ace6ac591d6 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 27 Jun 2018 15:59:14 +0900 Subject: [PATCH 15/33] apply style to each themes button --- browser/main/modals/PreferencesModal/SnippetTab.styl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/browser/main/modals/PreferencesModal/SnippetTab.styl b/browser/main/modals/PreferencesModal/SnippetTab.styl index 118c56ed..fcd73b3e 100644 --- a/browser/main/modals/PreferencesModal/SnippetTab.styl +++ b/browser/main/modals/PreferencesModal/SnippetTab.styl @@ -154,6 +154,8 @@ body[data-theme="dark"] background darken($ui-dark-backgroundColor, 5) .snippet-detail color white + .group-control-button + colorDarkPrimaryButton() body[data-theme="solarized-dark"] .snippets @@ -166,6 +168,8 @@ body[data-theme="solarized-dark"] background darken($ui-solarized-dark-backgroundColor, 5) .snippet-detail color white + .group-control-button + colorSolarizedDarkPrimaryButton() body[data-theme="monokai"] .snippets @@ -178,3 +182,5 @@ body[data-theme="monokai"] background darken($ui-monokai-backgroundColor, 5) .snippet-detail color white + .group-control-button + colorMonokaiPrimaryButton() From c42b5c88066c76abc8646b5b40dae56931514c30 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 27 Jun 2018 16:13:42 +0900 Subject: [PATCH 16/33] First snippet is selected when open Snippets tab --- browser/main/modals/PreferencesModal/SnippetList.js | 7 +++++-- browser/main/modals/PreferencesModal/SnippetTab.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/browser/main/modals/PreferencesModal/SnippetList.js b/browser/main/modals/PreferencesModal/SnippetList.js index 3cf28cf6..22e800f2 100644 --- a/browser/main/modals/PreferencesModal/SnippetList.js +++ b/browser/main/modals/PreferencesModal/SnippetList.js @@ -21,7 +21,10 @@ class SnippetList extends React.Component { } reloadSnippetList () { - dataApi.fetchSnippet().then(snippets => this.setState({snippets})) + dataApi.fetchSnippet().then(snippets => { + this.setState({snippets}) + this.props.onSnippetSelect(snippets[0]) + }) } handleSnippetContextMenu (snippet) { @@ -43,7 +46,7 @@ class SnippetList extends React.Component { } handleSnippetClick (snippet) { - this.props.onSnippetClick(snippet) + this.props.onSnippetSelect(snippet) } createSnippet () { diff --git a/browser/main/modals/PreferencesModal/SnippetTab.js b/browser/main/modals/PreferencesModal/SnippetTab.js index 67e9ace6..ec2a872e 100644 --- a/browser/main/modals/PreferencesModal/SnippetTab.js +++ b/browser/main/modals/PreferencesModal/SnippetTab.js @@ -25,7 +25,7 @@ class SnippetTab extends React.Component { }, 500) } - handleSnippetClick (snippet) { + handleSnippetSelect (snippet) { const { currentSnippet } = this.state if (currentSnippet === null || currentSnippet.id !== snippet.id) { dataApi.fetchSnippet(snippet.id).then(changedSnippet => { @@ -66,7 +66,7 @@ class SnippetTab extends React.Component {
{i18n.__('Snippets')}
From 7414d52dc26be3a19a1fd41f2a8b6ca62f176d8b Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 27 Jun 2018 16:27:55 +0900 Subject: [PATCH 17/33] selected snippet item background-color is darken --- browser/main/modals/PreferencesModal/SnippetList.js | 12 +++++++++++- browser/main/modals/PreferencesModal/SnippetTab.js | 3 ++- browser/main/modals/PreferencesModal/SnippetTab.styl | 12 ++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/browser/main/modals/PreferencesModal/SnippetList.js b/browser/main/modals/PreferencesModal/SnippetList.js index 22e800f2..e2ba7708 100644 --- a/browser/main/modals/PreferencesModal/SnippetList.js +++ b/browser/main/modals/PreferencesModal/SnippetList.js @@ -58,6 +58,16 @@ class SnippetList extends React.Component { }).catch(err => { throw err }) } + defineSnippetStyleName (snippet) { + const { currentSnippet } = this.props + if (currentSnippet == null) return + if (currentSnippet.id === snippet.id) { + return 'snippet-item-selected' + } else { + return 'snippet-item' + } + } + render () { const { snippets } = this.state return ( @@ -73,7 +83,7 @@ class SnippetList extends React.Component { { snippets.map((snippet) => (
  • this.handleSnippetContextMenu(snippet)} onClick={() => this.handleSnippetClick(snippet)}> diff --git a/browser/main/modals/PreferencesModal/SnippetTab.js b/browser/main/modals/PreferencesModal/SnippetTab.js index ec2a872e..e35ecd69 100644 --- a/browser/main/modals/PreferencesModal/SnippetTab.js +++ b/browser/main/modals/PreferencesModal/SnippetTab.js @@ -67,7 +67,8 @@ class SnippetTab extends React.Component {
    {i18n.__('Snippets')}
    + onSnippetDeleted={this.handleDeleteSnippet.bind(this)} + currentSnippet={currentSnippet} />
    {i18n.__('Snippet name')}
    diff --git a/browser/main/modals/PreferencesModal/SnippetTab.styl b/browser/main/modals/PreferencesModal/SnippetTab.styl index fcd73b3e..02307b64 100644 --- a/browser/main/modals/PreferencesModal/SnippetTab.styl +++ b/browser/main/modals/PreferencesModal/SnippetTab.styl @@ -122,6 +122,10 @@ &:hover background darken(#f5f5f5, 5) + .snippet-item-selected + @extend .snippet-list .snippet-item + background darken(#f5f5f5, 5) + .snippet-detail width 70% height calc(100% - 200px) @@ -142,6 +146,8 @@ body[data-theme="default"], body[data-theme="white"] background $ui-borderColor &:hover background darken($ui-backgroundColor, 5) + .snippet-item-selected + background darken($ui-backgroundColor, 5) body[data-theme="dark"] .snippets @@ -152,6 +158,8 @@ body[data-theme="dark"] background $ui-dark-borderColor &:hover background darken($ui-dark-backgroundColor, 5) + .snippet-item-selected + background darken($ui-dark-backgroundColor, 5) .snippet-detail color white .group-control-button @@ -166,6 +174,8 @@ body[data-theme="solarized-dark"] background $ui-solarized-dark-borderColor &:hover background darken($ui-solarized-dark-backgroundColor, 5) + .snippet-item-selected + background darken($ui-solarized-dark-backgroundColor, 5) .snippet-detail color white .group-control-button @@ -180,6 +190,8 @@ body[data-theme="monokai"] background $ui-monokai-borderColor &:hover background darken($ui-monokai-backgroundColor, 5) + .snippet-item-selected + background darken($ui-monokai-backgroundColor, 5) .snippet-detail color white .group-control-button From 58354061d808c21b55c9c837c34e98f6f58e02de Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 27 Jun 2018 19:34:58 +0900 Subject: [PATCH 18/33] set font-family to editor in Preference > Interface --- browser/components/CodeEditor.js | 2 +- browser/lib/consts.js | 10 +++++- browser/main/modals/PreferencesModal/UiTab.js | 32 +++++++++++++++++-- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 91e7683a..b1d63124 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -14,7 +14,7 @@ const { ipcRenderer } = require('electron') CodeMirror.modeURL = '../node_modules/codemirror/mode/%N/%N.js' -const defaultEditorFontFamily = ['Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'monospace'] +const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY const buildCMRulers = (rulers, enableRulers) => enableRulers ? rulers.map(ruler => ({column: ruler})) : [] diff --git a/browser/lib/consts.js b/browser/lib/consts.js index ec811007..84b962eb 100644 --- a/browser/lib/consts.js +++ b/browser/lib/consts.js @@ -36,7 +36,15 @@ const consts = { 'Violet Eggplant' ], THEMES: ['default'].concat(themes), - SNIPPET_FILE: snippetFile + SNIPPET_FILE: snippetFile, + DEFAULT_EDITOR_FONT_FAMILY: [ + 'Monaco', + 'Menlo', + 'Ubuntu Mono', + 'Consolas', + 'source-code-pro', + 'monospace' + ] } module.exports = consts diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index ce149f65..55b0050c 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -17,6 +17,8 @@ const OSX = global.process.platform === 'darwin' const electron = require('electron') const ipc = electron.ipcRenderer +const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY + class UiTab extends React.Component { constructor (props) { super(props) @@ -165,6 +167,10 @@ class UiTab extends React.Component { const codemirrorSampleCode = 'function iamHappy (happy) {\n\tif (happy) {\n\t console.log("I am Happy!")\n\t} else {\n\t console.log("I am not Happy!")\n\t}\n};' const enableEditRulersStyle = config.editor.enableRulers ? 'block' : 'none' const customCSS = config.preview.customCSS + let { fontFamily } = config.editor + fontFamily = _.isString(fontFamily) && fontFamily.length > 0 + ? [fontFamily].concat(defaultEditorFontFamily) + : defaultEditorFontFamily return (
    @@ -262,8 +268,16 @@ class UiTab extends React.Component { }) } -
    - (this.codeMirrorInstance = e)} value={codemirrorSampleCode} options={{ lineNumbers: true, readOnly: true, mode: 'javascript', theme: codemirrorTheme }} /> +
    + (this.codeMirrorInstance = e)} + value={codemirrorSampleCode} + options={{ + lineNumbers: true, + readOnly: true, + mode: 'javascript', + theme: codemirrorTheme + }} />
    @@ -596,7 +610,19 @@ class UiTab extends React.Component { type='checkbox' />  {i18n.__('Allow custom CSS for preview')} - this.handleUIChange(e)} ref={e => (this.customCSSCM = e)} value={config.preview.customCSS} options={{ lineNumbers: true, mode: 'css', theme: codemirrorTheme }} /> +
    + this.handleUIChange(e)} + ref={e => (this.customCSSCM = e)} + value={config.preview.customCSS} + options={{ + lineNumbers: true, + mode: 'css', + theme: codemirrorTheme + }} /> +
    From 8f4c92e251fcc0f9189c79408b5656b5ef4f08e0 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 27 Jun 2018 19:48:09 +0900 Subject: [PATCH 19/33] extract normalizeEditorFonrFamily --- browser/components/CodeEditor.js | 7 ++----- browser/lib/normalizeEditorFontFamily.js | 9 +++++++++ browser/main/modals/PreferencesModal/UiTab.js | 8 ++------ 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 browser/lib/normalizeEditorFontFamily.js diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index b1d63124..de542f49 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -11,10 +11,10 @@ import crypto from 'crypto' import consts from 'browser/lib/consts' import fs from 'fs' const { ipcRenderer } = require('electron') +import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily' CodeMirror.modeURL = '../node_modules/codemirror/mode/%N/%N.js' -const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY const buildCMRulers = (rulers, enableRulers) => enableRulers ? rulers.map(ruler => ({column: ruler})) : [] @@ -495,10 +495,7 @@ export default class CodeEditor extends React.Component { render () { const {className, fontSize} = this.props - let fontFamily = this.props.fontFamily - fontFamily = _.isString(fontFamily) && fontFamily.length > 0 - ? [fontFamily].concat(defaultEditorFontFamily) - : defaultEditorFontFamily + const fontFamily = normalizeEditorFontFamily(this.props.fontFamily) const width = this.props.width return (
    0 + ? [fontFamily].concat(defaultEditorFontFamily) + : defaultEditorFontFamily +} diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index 55b0050c..56d8d19c 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -11,14 +11,13 @@ import 'codemirror-mode-elixir' import _ from 'lodash' import i18n from 'browser/lib/i18n' import { getLanguages } from 'browser/lib/Languages' +import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily' const OSX = global.process.platform === 'darwin' const electron = require('electron') const ipc = electron.ipcRenderer -const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY - class UiTab extends React.Component { constructor (props) { super(props) @@ -167,10 +166,7 @@ class UiTab extends React.Component { const codemirrorSampleCode = 'function iamHappy (happy) {\n\tif (happy) {\n\t console.log("I am Happy!")\n\t} else {\n\t console.log("I am not Happy!")\n\t}\n};' const enableEditRulersStyle = config.editor.enableRulers ? 'block' : 'none' const customCSS = config.preview.customCSS - let { fontFamily } = config.editor - fontFamily = _.isString(fontFamily) && fontFamily.length > 0 - ? [fontFamily].concat(defaultEditorFontFamily) - : defaultEditorFontFamily + const fontFamily = normalizeEditorFontFamily(config.editor.fontFamily) return (
    From 95c10a1de7f3e8d75c7c5fd5437326a4be4a461b Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 27 Jun 2018 20:42:01 +0900 Subject: [PATCH 20/33] add test --- browser/components/CodeEditor.js | 2 +- browser/lib/normalizeEditorFontFamily.js | 4 ++-- tests/lib/normalize-editor-font-family-test.js | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 tests/lib/normalize-editor-font-family-test.js diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index de542f49..a4d2278e 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -506,7 +506,7 @@ export default class CodeEditor extends React.Component { ref='root' tabIndex='-1' style={{ - fontFamily: fontFamily.join(', '), + fontFamily, fontSize: fontSize, width: width }} diff --git a/browser/lib/normalizeEditorFontFamily.js b/browser/lib/normalizeEditorFontFamily.js index 290e452a..a2a2ec31 100644 --- a/browser/lib/normalizeEditorFontFamily.js +++ b/browser/lib/normalizeEditorFontFamily.js @@ -4,6 +4,6 @@ import isString from 'lodash/isString' export default function normalizeEditorFontFamily (fontFamily) { const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY return isString(fontFamily) && fontFamily.length > 0 - ? [fontFamily].concat(defaultEditorFontFamily) - : defaultEditorFontFamily + ? [fontFamily].concat(defaultEditorFontFamily).join(', ') + : defaultEditorFontFamily.join(', ') } diff --git a/tests/lib/normalize-editor-font-family-test.js b/tests/lib/normalize-editor-font-family-test.js new file mode 100644 index 00000000..aacd03ac --- /dev/null +++ b/tests/lib/normalize-editor-font-family-test.js @@ -0,0 +1,16 @@ +/** + * @fileoverview Unit test for browser/lib/normalizeEditorFontFamily + */ +import test from 'ava' +import normalizeEditorFontFamily from '../../browser/lib/normalizeEditorFontFamily' +import consts from '../../browser/lib/consts' +const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY + +test('normalizeEditorFontFamily() should return default font family (string[])', t => { + t.is(normalizeEditorFontFamily(), defaultEditorFontFamily.join(', ')) +}) + +test('normalizeEditorFontFamily(["hoge", "huga"]) should return default font family connected with arg.', t => { + const arg = 'font1, font2' + t.is(normalizeEditorFontFamily(arg), `${arg}, ${defaultEditorFontFamily.join(', ')}`) +}) From 009573584198f50fb484da8e9cd1b485f2e409a0 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 27 Jun 2018 20:42:19 +0900 Subject: [PATCH 21/33] fix from eslint --- browser/main/modals/PreferencesModal/UiTab.js | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index 56d8d19c..aa3568e7 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -165,7 +165,6 @@ class UiTab extends React.Component { const { config, codemirrorTheme } = this.state const codemirrorSampleCode = 'function iamHappy (happy) {\n\tif (happy) {\n\t console.log("I am Happy!")\n\t} else {\n\t console.log("I am not Happy!")\n\t}\n};' const enableEditRulersStyle = config.editor.enableRulers ? 'block' : 'none' - const customCSS = config.preview.customCSS const fontFamily = normalizeEditorFontFamily(config.editor.fontFamily) return (
    From 8a6c86bf656c0829168f954bdc81ab125cae96f7 Mon Sep 17 00:00:00 2001 From: Kelvin Wong Date: Thu, 28 Jun 2018 13:08:39 +0800 Subject: [PATCH 22/33] Add collapsed state for storage The root cause of this issue is that when the folder is clicked, the router pushed the path and the StorageItem component has been refreshed and isOpen has been reset - Add storing collapse state for storage - Add tests - Default as collapsed for fallback fix BoostIo/Boostnote#1979 BoostIo/Boostnote#1911 --- browser/main/SideNav/StorageItem.js | 16 +++++++- browser/main/lib/dataApi/addStorage.js | 6 ++- browser/main/lib/dataApi/index.js | 1 + .../main/lib/dataApi/resolveStorageData.js | 3 +- browser/main/lib/dataApi/toggleStorage.js | 28 ++++++++++++++ browser/main/store.js | 6 +++ tests/dataApi/toggleStorage-test.js | 38 +++++++++++++++++++ 7 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 browser/main/lib/dataApi/toggleStorage.js create mode 100644 tests/dataApi/toggleStorage-test.js diff --git a/browser/main/SideNav/StorageItem.js b/browser/main/SideNav/StorageItem.js index 93e9157f..1c4b4d15 100644 --- a/browser/main/SideNav/StorageItem.js +++ b/browser/main/SideNav/StorageItem.js @@ -21,8 +21,10 @@ class StorageItem extends React.Component { constructor (props) { super(props) + const { storage } = this.props + this.state = { - isOpen: true + isOpen: !!storage.isOpen } } @@ -68,8 +70,18 @@ class StorageItem extends React.Component { } handleToggleButtonClick (e) { + const { storage, dispatch } = this.props + const isOpen = !this.state.isOpen + dataApi.toggleStorage(storage.key, isOpen) + .then((storage) => { + dispatch({ + type: 'EXPAND_STORAGE', + storage: storage, + isOpen: isOpen + }) + }) this.setState({ - isOpen: !this.state.isOpen + isOpen: isOpen }) } diff --git a/browser/main/lib/dataApi/addStorage.js b/browser/main/lib/dataApi/addStorage.js index 630c0bd3..bfd6698a 100644 --- a/browser/main/lib/dataApi/addStorage.js +++ b/browser/main/lib/dataApi/addStorage.js @@ -37,7 +37,8 @@ function addStorage (input) { key, name: input.name, type: input.type, - path: input.path + path: input.path, + isOpen: false } return Promise.resolve(newStorage) @@ -48,7 +49,8 @@ function addStorage (input) { key: newStorage.key, type: newStorage.type, name: newStorage.name, - path: newStorage.path + path: newStorage.path, + isOpen: false }) localStorage.setItem('storages', JSON.stringify(rawStorages)) diff --git a/browser/main/lib/dataApi/index.js b/browser/main/lib/dataApi/index.js index 7c57e016..4e2f0061 100644 --- a/browser/main/lib/dataApi/index.js +++ b/browser/main/lib/dataApi/index.js @@ -1,5 +1,6 @@ const dataApi = { init: require('./init'), + toggleStorage: require('./toggleStorage'), addStorage: require('./addStorage'), renameStorage: require('./renameStorage'), removeStorage: require('./removeStorage'), diff --git a/browser/main/lib/dataApi/resolveStorageData.js b/browser/main/lib/dataApi/resolveStorageData.js index af040c5d..681a102e 100644 --- a/browser/main/lib/dataApi/resolveStorageData.js +++ b/browser/main/lib/dataApi/resolveStorageData.js @@ -8,7 +8,8 @@ function resolveStorageData (storageCache) { key: storageCache.key, name: storageCache.name, type: storageCache.type, - path: storageCache.path + path: storageCache.path, + isOpen: storageCache.isOpen } const boostnoteJSONPath = path.join(storageCache.path, 'boostnote.json') diff --git a/browser/main/lib/dataApi/toggleStorage.js b/browser/main/lib/dataApi/toggleStorage.js new file mode 100644 index 00000000..dbb625c3 --- /dev/null +++ b/browser/main/lib/dataApi/toggleStorage.js @@ -0,0 +1,28 @@ +const _ = require('lodash') +const resolveStorageData = require('./resolveStorageData') + +/** + * @param {String} key + * @param {Boolean} isOpen + * @return {Object} Storage meta data + */ +function toggleStorage (key, isOpen) { + let cachedStorageList + try { + cachedStorageList = JSON.parse(localStorage.getItem('storages')) + if (!_.isArray(cachedStorageList)) throw new Error('invalid storages') + } catch (err) { + console.log('error got') + console.error(err) + return Promise.reject(err) + } + const targetStorage = _.find(cachedStorageList, {key: key}) + if (targetStorage == null) return Promise.reject('Storage') + + targetStorage.isOpen = isOpen + localStorage.setItem('storages', JSON.stringify(cachedStorageList)) + + return resolveStorageData(targetStorage) +} + +module.exports = toggleStorage diff --git a/browser/main/store.js b/browser/main/store.js index 7ea6decb..a1b6b791 100644 --- a/browser/main/store.js +++ b/browser/main/store.js @@ -360,6 +360,12 @@ function data (state = defaultDataMap(), action) { state.storageMap = new Map(state.storageMap) state.storageMap.set(action.storage.key, action.storage) return state + case 'EXPAND_STORAGE': + state = Object.assign({}, state) + state.storageMap = new Map(state.storageMap) + action.storage.isOpen = action.isOpen + state.storageMap.set(action.storage.key, action.storage) + return state } return state } diff --git a/tests/dataApi/toggleStorage-test.js b/tests/dataApi/toggleStorage-test.js new file mode 100644 index 00000000..5169a4f4 --- /dev/null +++ b/tests/dataApi/toggleStorage-test.js @@ -0,0 +1,38 @@ +const test = require('ava') +const toggleStorage = require('browser/main/lib/dataApi/toggleStorage') + +global.document = require('jsdom').jsdom('') +global.window = document.defaultView +global.navigator = window.navigator + +const Storage = require('dom-storage') +const localStorage = window.localStorage = global.localStorage = new Storage(null, { strict: true }) +const path = require('path') +const _ = require('lodash') +const TestDummy = require('../fixtures/TestDummy') +const sander = require('sander') +const os = require('os') + +const storagePath = path.join(os.tmpdir(), 'test/toggle-storage') + +test.beforeEach((t) => { + t.context.storage = TestDummy.dummyStorage(storagePath) + localStorage.setItem('storages', JSON.stringify([t.context.storage.cache])) +}) + +test.serial('Toggle a storage location', (t) => { + const storageKey = t.context.storage.cache.key + return Promise.resolve() + .then(function doTest () { + return toggleStorage(storageKey, true) + }) + .then(function assert (data) { + const cachedStorageList = JSON.parse(localStorage.getItem('storages')) + t.true(_.find(cachedStorageList, {key: storageKey}).isOpen === true) + }) +}) + +test.after(function after () { + localStorage.clear() + sander.rimrafSync(storagePath) +}) From 72e3784fa5fe083e4f992ab0a2223dc361a6945f Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 28 Jun 2018 17:37:36 +0900 Subject: [PATCH 23/33] update codemirror --- package.json | 2 +- yarn.lock | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 28f1239b..99113d6e 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@rokt33r/season": "^5.3.0", "aws-sdk": "^2.48.0", "aws-sdk-mobile-analytics": "^0.9.2", - "codemirror": "^5.37.0", + "codemirror": "^5.39.0", "codemirror-mode-elixir": "^1.1.1", "electron-config": "^0.2.1", "electron-gh-releases": "^2.0.2", diff --git a/yarn.lock b/yarn.lock index 7bf19d2b..42f51ab9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1727,10 +1727,14 @@ codemirror-mode-elixir@^1.1.1: dependencies: codemirror "^5.20.2" -codemirror@^5.18.2, codemirror@^5.20.2, codemirror@^5.37.0: +codemirror@^5.18.2, codemirror@^5.20.2: version "5.38.0" resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.38.0.tgz#26a9551446e51dbdde36aabe60f72469724fd332" +codemirror@^5.39.0: + version "5.39.0" + resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.39.0.tgz#4654f7d2f7e525e04a62e72d9482348ccb37dce5" + coffee-script@^1.10.0: version "1.12.7" resolved "https://registry.yarnpkg.com/coffee-script/-/coffee-script-1.12.7.tgz#c05dae0cb79591d05b3070a8433a98c9a89ccc53" From ddd339851b4a418d08c7bdd626ea3af9984f790f Mon Sep 17 00:00:00 2001 From: Kelvin Wong Date: Fri, 29 Jun 2018 10:58:11 +0800 Subject: [PATCH 24/33] Fix code style --- browser/main/SideNav/StorageItem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/main/SideNav/StorageItem.js b/browser/main/SideNav/StorageItem.js index 1c4b4d15..8cb0e510 100644 --- a/browser/main/SideNav/StorageItem.js +++ b/browser/main/SideNav/StorageItem.js @@ -76,8 +76,8 @@ class StorageItem extends React.Component { .then((storage) => { dispatch({ type: 'EXPAND_STORAGE', - storage: storage, - isOpen: isOpen + storage, + isOpen }) }) this.setState({ From ae493cbd0eae962ac0eb0ccbf462ef4f87436e7f Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 30 Jun 2018 00:51:15 +0900 Subject: [PATCH 25/33] v0.11.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28f1239b..1c2cb91d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "boost", "productName": "Boostnote", - "version": "0.11.6", + "version": "0.11.7", "main": "index.js", "description": "Boostnote", "license": "GPL-3.0", From 0a42b0f61ff74037a2536a72daaf9fc6265d887f Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 30 Jun 2018 16:08:13 +0900 Subject: [PATCH 26/33] use context.popup on NoteList --- browser/main/NoteList/index.js | 37 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 3626130d..bcba23cc 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -21,6 +21,7 @@ import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig' import Markdown from '../../lib/markdown' import i18n from 'browser/lib/i18n' import { confirmDeleteNote } from 'browser/lib/confirmDeleteNote' +import context from 'browser/lib/context' const { remote } = require('electron') const { Menu, MenuItem, dialog } = remote @@ -491,55 +492,51 @@ class NoteList extends React.Component { const updateLabel = i18n.__('Update Blog') const openBlogLabel = i18n.__('Open Blog') - const menu = new Menu() + const templates = [] if (location.pathname.match(/\/trash/)) { - menu.append(new MenuItem({ + templates.push({ label: restoreNote, click: this.restoreNote - })) - menu.append(new MenuItem({ + }, { label: deleteLabel, click: this.deleteNote - })) + }) } else { if (!location.pathname.match(/\/starred/)) { - menu.append(new MenuItem({ + templates.push({ label: pinLabel, click: this.pinToTop - })) + }) } - menu.append(new MenuItem({ + templates.push({ label: deleteLabel, click: this.deleteNote - })) - menu.append(new MenuItem({ + }, { label: cloneNote, click: this.cloneNote.bind(this) - })) - menu.append(new MenuItem({ + }, { label: copyNoteLink, click: this.copyNoteLink(note) - })) + }) if (note.type === 'MARKDOWN_NOTE') { if (note.blog && note.blog.blogLink && note.blog.blogId) { - menu.append(new MenuItem({ + templates.push({ label: updateLabel, click: this.publishMarkdown.bind(this) - })) - menu.append(new MenuItem({ + }, { label: openBlogLabel, click: () => this.openBlog.bind(this)(note) - })) + }) } else { - menu.append(new MenuItem({ + templates.push({ label: publishLabel, click: this.publishMarkdown.bind(this) - })) + }) } } } - menu.popup() + context.popup(templates) } updateSelectedNotes (updateFunc, cleanSelection = true) { From 64407e5ca63797cf063110e4d21bae62b5228ffb Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 30 Jun 2018 16:12:23 +0900 Subject: [PATCH 27/33] use context.popup on SnippetNoteDetai; --- browser/main/Detail/SnippetNoteDetail.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index c65f1425..75be4798 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -32,7 +32,7 @@ import { confirmDeleteNote } from 'browser/lib/confirmDeleteNote' const electron = require('electron') const { remote } = electron -const { Menu, MenuItem, dialog } = remote +const { dialog } = remote class SnippetNoteDetail extends React.Component { constructor (props) { @@ -451,14 +451,14 @@ class SnippetNoteDetail extends React.Component { } handleModeButtonClick (e, index) { - const menu = new Menu() + const templetes = [] CodeMirror.modeInfo.sort(function (a, b) { return a.name.localeCompare(b.name) }).forEach((mode) => { - menu.append(new MenuItem({ + templetes.push({ label: mode.name, click: (e) => this.handleModeOptionClick(index, mode.name)(e) - })) + }) }) - menu.popup(remote.getCurrentWindow()) + context.popup(templetes) } handleIndentTypeButtonClick (e) { From f6afc756dc056f982fb65748e9c3d3286380af8d Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 30 Jun 2018 16:16:18 +0900 Subject: [PATCH 28/33] use context.popup on SnippetList --- browser/main/modals/PreferencesModal/SnippetList.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/browser/main/modals/PreferencesModal/SnippetList.js b/browser/main/modals/PreferencesModal/SnippetList.js index 3cf28cf6..fa18cda0 100644 --- a/browser/main/modals/PreferencesModal/SnippetList.js +++ b/browser/main/modals/PreferencesModal/SnippetList.js @@ -4,8 +4,7 @@ import CSSModules from 'browser/lib/CSSModules' import dataApi from 'browser/main/lib/dataApi' import i18n from 'browser/lib/i18n' import eventEmitter from 'browser/main/lib/eventEmitter' -const { remote } = require('electron') -const { Menu, MenuItem } = remote +import context from 'browser/lib/context' class SnippetList extends React.Component { constructor (props) { @@ -25,14 +24,10 @@ class SnippetList extends React.Component { } handleSnippetContextMenu (snippet) { - const menu = new Menu() - menu.append(new MenuItem({ + context.popup([{ label: i18n.__('Delete snippet'), - click: () => { - this.deleteSnippet(snippet) - } - })) - menu.popup() + click: () => this.deleteSnippet(snippet) + }]) } deleteSnippet (snippet) { From 294c3f10ab21a1616e75b1103ddb91a9ab367637 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 30 Jun 2018 16:21:35 +0900 Subject: [PATCH 29/33] use context.popup on StorageItem --- browser/main/SideNav/StorageItem.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/browser/main/SideNav/StorageItem.js b/browser/main/SideNav/StorageItem.js index 93e9157f..bf64b030 100644 --- a/browser/main/SideNav/StorageItem.js +++ b/browser/main/SideNav/StorageItem.js @@ -11,9 +11,10 @@ import StorageItemChild from 'browser/components/StorageItem' import _ from 'lodash' import { SortableElement } from 'react-sortable-hoc' import i18n from 'browser/lib/i18n' +import context from 'browser/lib/context' const { remote } = require('electron') -const { Menu, dialog } = remote +const { dialog } = remote const escapeStringRegexp = require('escape-string-regexp') const path = require('path') @@ -27,7 +28,7 @@ class StorageItem extends React.Component { } handleHeaderContextMenu (e) { - const menu = Menu.buildFromTemplate([ + context.popup([ { label: i18n.__('Add Folder'), click: (e) => this.handleAddFolderButtonClick(e) @@ -40,8 +41,6 @@ class StorageItem extends React.Component { click: (e) => this.handleUnlinkStorageClick(e) } ]) - - menu.popup() } handleUnlinkStorageClick (e) { @@ -94,7 +93,7 @@ class StorageItem extends React.Component { } handleFolderButtonContextMenu (e, folder) { - const menu = Menu.buildFromTemplate([ + context.popup([ { label: i18n.__('Rename Folder'), click: (e) => this.handleRenameFolderClick(e, folder) @@ -123,8 +122,6 @@ class StorageItem extends React.Component { click: (e) => this.handleFolderDeleteClick(e, folder) } ]) - - menu.popup() } handleRenameFolderClick (e, folder) { From 47845fd4e3b9ef59f659d320d33b3eff55380f34 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 30 Jun 2018 16:23:51 +0900 Subject: [PATCH 30/33] use context.popup on SideNav --- browser/main/SideNav/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/main/SideNav/index.js b/browser/main/SideNav/index.js index 67adf700..d8561b7e 100644 --- a/browser/main/SideNav/index.js +++ b/browser/main/SideNav/index.js @@ -19,6 +19,7 @@ import ListButton from './ListButton' import TagButton from './TagButton' import {SortableContainer} from 'react-sortable-hoc' import i18n from 'browser/lib/i18n' +import context from 'browser/lib/context' class SideNav extends React.Component { // TODO: should not use electron stuff v0.7 @@ -254,10 +255,9 @@ class SideNav extends React.Component { handleFilterButtonContextMenu (event) { const { data } = this.props const trashedNotes = data.trashedSet.toJS().map((uniqueKey) => data.noteMap.get(uniqueKey)) - const menu = Menu.buildFromTemplate([ + context.popup([ { label: i18n.__('Empty Trash'), click: () => this.emptyTrash(trashedNotes) } ]) - menu.popup() } render () { From 1038e86196d1d553b1c20c3748791f65ab757750 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 30 Jun 2018 16:25:44 +0900 Subject: [PATCH 31/33] use context.popup on StatusBar --- browser/main/StatusBar/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/browser/main/StatusBar/index.js b/browser/main/StatusBar/index.js index e5f5ae1a..8b48e3d3 100644 --- a/browser/main/StatusBar/index.js +++ b/browser/main/StatusBar/index.js @@ -4,10 +4,11 @@ import CSSModules from 'browser/lib/CSSModules' import styles from './StatusBar.styl' import ZoomManager from 'browser/main/lib/ZoomManager' import i18n from 'browser/lib/i18n' +import context from 'browser/lib/context' const electron = require('electron') const { remote, ipcRenderer } = electron -const { Menu, MenuItem, dialog } = remote +const { dialog } = remote const zoomOptions = [0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0] @@ -26,16 +27,16 @@ class StatusBar extends React.Component { } handleZoomButtonClick (e) { - const menu = new Menu() + const templates = [] zoomOptions.forEach((zoom) => { - menu.append(new MenuItem({ + templates.push({ label: Math.floor(zoom * 100) + '%', click: () => this.handleZoomMenuItemClick(zoom) - })) + }) }) - menu.popup(remote.getCurrentWindow()) + context.popup(templates) } handleZoomMenuItemClick (zoomFactor) { From d8aad65b241441349c5d7121524718fcbfc3c162 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 30 Jun 2018 16:28:17 +0900 Subject: [PATCH 32/33] fix from eslint --- browser/main/NoteList/index.js | 2 +- browser/main/SideNav/index.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index bcba23cc..eeb16a5f 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -24,7 +24,7 @@ import { confirmDeleteNote } from 'browser/lib/confirmDeleteNote' import context from 'browser/lib/context' const { remote } = require('electron') -const { Menu, MenuItem, dialog } = remote +const { dialog } = remote const WP_POST_PATH = '/wp/v2/posts' function sortByCreatedAt (a, b) { diff --git a/browser/main/SideNav/index.js b/browser/main/SideNav/index.js index d8561b7e..c4fa417b 100644 --- a/browser/main/SideNav/index.js +++ b/browser/main/SideNav/index.js @@ -1,8 +1,6 @@ import PropTypes from 'prop-types' import React from 'react' import CSSModules from 'browser/lib/CSSModules' -const { remote } = require('electron') -const { Menu } = remote import dataApi from 'browser/main/lib/dataApi' import styles from './SideNav.styl' import { openModal } from 'browser/main/lib/modal' From cefe883025f3668d51b92d3d9e4323d091e70372 Mon Sep 17 00:00:00 2001 From: Kazz Yokomizo Date: Sun, 1 Jul 2018 21:59:08 +0900 Subject: [PATCH 33/33] Update slack invitation url --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 40866e46..6c68efaf 100644 --- a/readme.md +++ b/readme.md @@ -25,7 +25,7 @@ Boostnote is an open source project. It's an independent project with its ongoin ## Community - [Facebook Group](https://www.facebook.com/groups/boostnote/) - [Twitter](https://twitter.com/boostnoteapp) -- [Slack Group](https://join.slack.com/t/boostnote-group/shared_invite/enQtMzcwNDU3NDU3ODI0LTU1ZDgwZDNiZTNmN2RhOTY4OTM5ODY0ODUzMTRiNmQ0ZDMzZDRiYzg2YmQ5ZDYzZTQxYjMxYzBlNTM4NjcyYjM) +- [Slack Group](https://join.slack.com/t/boostnote-group/shared_invite/enQtMzkxOTk4ODkyNzc0LThkNmMzY2VlZjVhYTNiYjE5YjQyZGVjNTJlYTY1OGMyZTFjNGU5YTUyYjUzOWZhYTU4OTVlNDYyNDFjYWMzNDM) - [Blog](https://boostlog.io/tags/boostnote) - [Reddit](https://www.reddit.com/r/Boostnote/)