0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added new paragraph keyboard shortcut

`Ctrl / Cmd + Enter` now enters a new paragraph, but only if the user is not on a new line.
This commit is contained in:
Matthew Harrison-Jones 2013-09-27 14:41:38 +01:00
parent 9df4955bcb
commit 32aebc40d3
3 changed files with 15 additions and 1 deletions

View file

@ -114,6 +114,13 @@
case "currentDate":
md = moment(new Date()).format("D MMMM YYYY");
break;
case 'newLine':
cursor = this.elem.getCursor();
if (this.elem.getLine(cursor.line) !== "") {
this.elem.setLine(cursor.line, this.elem.getLine(cursor.line) + "\n\n");
}
pass = false;
break;
default:
if (this.options.syntax[this.style]) {
md = this.options.syntax[this.style].replace('$1', text);

View file

@ -83,6 +83,11 @@
<td></td>
<td>Ctrl + Alt + W</td>
</tr>
<tr>
<td>New Paragraph</td>
<td></td>
<td>Ctrl / Cmd + Enter</td>
</tr>
<tr>
<td>Uppercase</td>
<td></td>

View file

@ -33,7 +33,9 @@
{'key': 'Ctrl+Alt+W', 'style': 'selectword'},
{'key': 'Ctrl+L', 'style': 'list'},
{'key': 'Ctrl+Alt+C', 'style': 'copyHTML'},
{'key': 'Meta+Alt+C', 'style': 'copyHTML'}
{'key': 'Meta+Alt+C', 'style': 'copyHTML'},
{'key': 'Meta+Enter', 'style': 'newLine'},
{'key': 'Ctrl+Enter', 'style': 'newLine'}
],
imageMarkdownRegex = /^(?:\{<(.*?)>\})?!(?:\[([^\n\]]*)\])(?:\(([^\n\]]*)\))?$/gim,
markerRegex = /\{<([\w\W]*?)>\}/;