Skip to content

Commit c5484fb

Browse files
committed
Merge branch 'master' into filter-tags-and-folders
2 parents 0d4b625 + 079aaec commit c5484fb

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

browser/components/CodeEditor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export default class CodeEditor extends React.Component {
202202
}
203203
cm.execCommand('goLineEnd')
204204
} else if (
205-
!charBeforeCursor.match(/\t|\s|\r|\n/) &&
205+
!charBeforeCursor.match(/\t|\s|\r|\n|\$/) &&
206206
cursor.ch > 1
207207
) {
208208
// text expansion on tab key if the char before is alphabet
@@ -489,7 +489,7 @@ export default class CodeEditor extends React.Component {
489489
getWordBeforeCursor (line, lineNumber, cursorPosition) {
490490
let wordBeforeCursor = ''
491491
const originCursorPosition = cursorPosition
492-
const emptyChars = /\t|\s|\r|\n/
492+
const emptyChars = /\t|\s|\r|\n|\$/
493493

494494
// to prevent the word is long that will crash the whole app
495495
// the safeStop is there to stop user to expand words that longer than 20 chars

browser/main/NoteList/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,29 @@ const { remote } = require('electron')
2626
const { dialog } = remote
2727
const WP_POST_PATH = '/wp/v2/posts'
2828

29+
const regexMatchStartingTitleNumber = new RegExp('^([0-9]*\.?[0-9]+).*$')
30+
2931
function sortByCreatedAt (a, b) {
3032
return new Date(b.createdAt) - new Date(a.createdAt)
3133
}
3234

3335
function sortByAlphabetical (a, b) {
36+
const matchA = regexMatchStartingTitleNumber.exec(a.title)
37+
const matchB = regexMatchStartingTitleNumber.exec(b.title)
38+
39+
if (matchA && matchA.length === 2 && matchB && matchB.length === 2) {
40+
// Both note titles are starting with a float. We will compare it now.
41+
const floatA = parseFloat(matchA[1])
42+
const floatB = parseFloat(matchB[1])
43+
44+
const diff = floatA - floatB
45+
if (diff !== 0) {
46+
return diff
47+
}
48+
49+
// The float values are equal. We will compare the full title.
50+
}
51+
3452
return a.title.localeCompare(b.title)
3553
}
3654

docs/code_style.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,11 @@ class MyComponent extends React.Component {
7979
// code goes here...
8080
}
8181
}
82-
```
82+
```
83+
84+
## React Hooks
85+
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.
86+
87+
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.
88+
89+
Read more about hooks in the [React hooks introduction](https://reactjs.org/docs/hooks-intro.html).

locales/es-ES.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"Successfully applied!": "¡Aplicado con éxito!",
135135
"Albanian": "Albanés",
136136
"Chinese (zh-CN)": "Chino - China",
137-
"Chinese (zh-TW)": "Chino - Taiwan",
137+
"Chinese (zh-TW)": "Chino - Taiwán",
138138
"Danish": "Danés",
139139
"Japanese": "Japonés",
140140
"Korean": "Coreano",
@@ -155,9 +155,9 @@
155155
"Allow dangerous html tags": "Permitir etiquetas html peligrosas",
156156
"⚠ 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! ⚠",
157157
"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.",
158-
"Spellcheck disabled": "Spellcheck disabled",
159-
"Show menu bar": "Show menu bar",
160-
"Auto Detect": "Auto Detect",
158+
"Spellcheck disabled": "Deshabilitar corrector ortográfico",
159+
"Show menu bar": "Mostrar barra del menú",
160+
"Auto Detect": "Detección automática",
161161
"Snippet Default Language": "Lenguaje por defecto de los fragmentos de código",
162162
"Filter tags/folders...": "filter etiquetas/carpeta..."
163163
}

0 commit comments

Comments
 (0)