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 diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index cfcfcc99..41d09885 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -26,11 +26,29 @@ const { remote } = require('electron') const { dialog } = remote const WP_POST_PATH = '/wp/v2/posts' +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 = 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. + const floatA = parseFloat(matchA[1]) + const floatB = parseFloat(matchB[1]) + + const diff = floatA - floatB + if (diff !== 0) { + return diff + } + + // The float values are equal. We will compare the full title. + } + return a.title.localeCompare(b.title) } 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). diff --git a/locales/es-ES.json b/locales/es-ES.json index 06a11f54..f09e0c2c 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,9 +155,9 @@ "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", "Filter tags/folders...": "filter etiquetas/carpeta..." }