From 12229a17190bce85b6b63c47dff8000e0ef8e39f Mon Sep 17 00:00:00 2001 From: amedora Date: Thu, 9 May 2019 10:55:31 +0900 Subject: [PATCH 1/7] allow to expand snippets following $ character --- browser/components/CodeEditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 2f2b1551..4893b342 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -202,7 +202,7 @@ export default class CodeEditor extends React.Component { } cm.execCommand('goLineEnd') } else if ( - !charBeforeCursor.match(/\t|\s|\r|\n/) && + !charBeforeCursor.match(/\t|\s|\r|\n|\$/) && cursor.ch > 1 ) { // text expansion on tab key if the char before is alphabet @@ -489,7 +489,7 @@ export default class CodeEditor extends React.Component { getWordBeforeCursor (line, lineNumber, cursorPosition) { let wordBeforeCursor = '' const originCursorPosition = cursorPosition - const emptyChars = /\t|\s|\r|\n/ + const emptyChars = /\t|\s|\r|\n|\$/ // to prevent the word is long that will crash the whole app // the safeStop is there to stop user to expand words that longer than 20 chars From 5b63bedc0d4facb5e53daaadb3490172b4e0fbcc Mon Sep 17 00:00:00 2001 From: David Dreher Date: Sat, 2 Mar 2019 14:21:12 +0100 Subject: [PATCH 2/7] fix issue #2894: sort alphabetical will now parse float values starting at all titles and compare these. --- browser/main/NoteList/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index cfcfcc99..78b7a8cf 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -26,11 +26,30 @@ const { remote } = require('electron') const { dialog } = remote const WP_POST_PATH = '/wp/v2/posts' +const matchStartingTitleNumber = new RegExp('^([0-9]*\.?[0-9]+).*$') + function sortByCreatedAt (a, b) { return new Date(b.createdAt) - new Date(a.createdAt) } function sortByAlphabetical (a, b) { + const matchA = matchStartingTitleNumber.exec(a.title) + const matchB = matchStartingTitleNumber.exec(b.title) + + if (matchA && matchA.length === 2 && matchB && matchB.length === 2) { + // Both note titles are starting with a float. We will compare it now. + const floatA = parseFloat(matchA[1]) + const floatB = parseFloat(matchB[1]) + + if (floatA < floatB) { + return -1 + } else if (floatA > floatB) { + return 1 + } + + // The float values are equal. We will compare the full title. + } + return a.title.localeCompare(b.title) } From 19fc1fd674738e4cdb9c3dee02872501f77e2ace Mon Sep 17 00:00:00 2001 From: David Dreher Date: Sat, 2 Mar 2019 14:30:31 +0100 Subject: [PATCH 3/7] rename const --- browser/main/NoteList/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 78b7a8cf..e83acad4 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -26,15 +26,15 @@ const { remote } = require('electron') const { dialog } = remote const WP_POST_PATH = '/wp/v2/posts' -const matchStartingTitleNumber = new RegExp('^([0-9]*\.?[0-9]+).*$') +const regexMatchStartingTitleNumber = new RegExp('^([0-9]*\.?[0-9]+).*$') function sortByCreatedAt (a, b) { return new Date(b.createdAt) - new Date(a.createdAt) } function sortByAlphabetical (a, b) { - const matchA = matchStartingTitleNumber.exec(a.title) - const matchB = matchStartingTitleNumber.exec(b.title) + const matchA = regexMatchStartingTitleNumber.exec(a.title) + const matchB = regexMatchStartingTitleNumber.exec(b.title) if (matchA && matchA.length === 2 && matchB && matchB.length === 2) { // Both note titles are starting with a float. We will compare it now. From 2cbbe7aeda61a17d52ece8538f6c8cf73f0a8e61 Mon Sep 17 00:00:00 2001 From: David Dreher Date: Mon, 25 Mar 2019 06:25:44 +0100 Subject: [PATCH 4/7] Check if the float is quals (abs value is greather 0.01) and return the sub value when not. --- browser/main/NoteList/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index e83acad4..c12b9977 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -41,10 +41,8 @@ function sortByAlphabetical (a, b) { const floatA = parseFloat(matchA[1]) const floatB = parseFloat(matchB[1]) - if (floatA < floatB) { - return -1 - } else if (floatA > floatB) { - return 1 + if (Math.abs(floatA - floatB) > 0.01) { + return floatA - floatB } // The float values are equal. We will compare the full title. From 9a6ee9d2ef2d853b623d386c928088356ba4dbce Mon Sep 17 00:00:00 2001 From: David Dreher Date: Wed, 8 May 2019 06:37:34 +0200 Subject: [PATCH 5/7] change return handling of sortByAlphabetical --- browser/main/NoteList/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index c12b9977..41d09885 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -41,8 +41,9 @@ function sortByAlphabetical (a, b) { const floatA = parseFloat(matchA[1]) const floatB = parseFloat(matchB[1]) - if (Math.abs(floatA - floatB) > 0.01) { - return floatA - floatB + const diff = floatA - floatB + if (diff !== 0) { + return diff } // The float values are equal. We will compare the full title. From 1601292db73a31fabd433191a6c8d7d6305b6ec3 Mon Sep 17 00:00:00 2001 From: AWolf81 Date: Fri, 10 May 2019 07:30:48 +0200 Subject: [PATCH 6/7] add react hooks section --- docs/code_style.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/code_style.md b/docs/code_style.md index d8f458d7..c0416216 100644 --- a/docs/code_style.md +++ b/docs/code_style.md @@ -79,4 +79,11 @@ class MyComponent extends React.Component { // code goes here... } } -``` \ No newline at end of file +``` + +## React Hooks +Existing code will be kept class-based and will only be changed to functional components with hooks if it improves readability or makes things more reusable. + +For new components it's OK to use hooks with functional components but don't mix hooks & class-based components within a feature - just for code style / readability reasons. + +Read more about hooks in the [React hooks introduction](https://reactjs.org/docs/hooks-intro.html). From 079aaec21e5a1f510312c2103a81a737a9c8859e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Here=C3=B1=C3=BA?= Date: Thu, 4 Apr 2019 08:28:47 -0300 Subject: [PATCH 7/7] Fixed typo on string 137 * plus some translations added --- locales/es-ES.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locales/es-ES.json b/locales/es-ES.json index a42e6bb4..f8003088 100644 --- a/locales/es-ES.json +++ b/locales/es-ES.json @@ -134,7 +134,7 @@ "Successfully applied!": "¡Aplicado con éxito!", "Albanian": "Albanés", "Chinese (zh-CN)": "Chino - China", - "Chinese (zh-TW)": "Chino - Taiwan", + "Chinese (zh-TW)": "Chino - Taiwán", "Danish": "Danés", "Japanese": "Japonés", "Korean": "Coreano", @@ -155,8 +155,8 @@ "Allow dangerous html tags": "Permitir etiquetas html peligrosas", "⚠ You have pasted a link referring an attachment that could not be found in the 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! ⚠": "⚠ Ha pegado un enlace a un archivo adjunto que no se puede encontrar en el almacenamiento de esta nota. Pegar enlaces a archivos adjuntos solo está soportado si el origen y el destino son el mismo almacenamiento. ¡Por favor, mejor arrastre el archivo! ⚠", "Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.": "Convertir flechas textuales a símbolos bonitos. ⚠ Esto interferirá cuando use comentarios HTML en Markdown.", - "Spellcheck disabled": "Spellcheck disabled", - "Show menu bar": "Show menu bar", - "Auto Detect": "Auto Detect", + "Spellcheck disabled": "Deshabilitar corrector ortográfico", + "Show menu bar": "Mostrar barra del menú", + "Auto Detect": "Detección automática", "Snippet Default Language": "Lenguaje por defecto de los fragmentos de código" }