Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KB Shortcut for Date Insertion is Borked #849

Closed
JohnONolan opened this issue Sep 20, 2013 · 0 comments
Closed

KB Shortcut for Date Insertion is Borked #849

JohnONolan opened this issue Sep 20, 2013 · 0 comments
Assignees
Labels
bug [triage] something behaving unexpectedly
Milestone

Comments

@JohnONolan
Copy link
Member

When in edit mode, if you attempt to insert current date (ctrl + shift + 1), if the letterCount of the date string is and odd number the entire interface freezes. This is related to line 127 of the markdown-actions.js file, which divides the letterCount by 2 to place the cursor in the middle of the text string.

I believe the solution is to change line 127 from: this.elem.setCursor({line: cursor.line, ch: cursor.ch - (letterCount / 2)}) to: this.elem.setCursor({line: cursor.line, ch: cursor.ch - Math.floor(letterCount / 2)}); This will account for odd length inputs.

But from a user perspective adding the cursor to the center of an inserted date is odd behavior, so after line 115 md = moment(new Date()).format("D MMMM YYYY") adding text = true; will cause the cursor to be placed at the end of the inserted date.

https://en.ghost.org/forum/using-ghost/37-insert-current-date-shortcut-bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants