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

Fix high latency autosave bug in editor.new #4459

Merged
merged 1 commit into from
Nov 17, 2014

Conversation

novaugust
Copy link
Contributor

Closes #4400

  • Clean up willtransition logic in editor-base-route

Known bug: If you have typed into the body before the transition, after the transition completes your cursor is reset to the start of the line.
I've tried fixing this by having codemirror intelligently goToDocEnd after being initialized, but it instead places it halfway. I'm still working on a fix for that. I'm not sure what's the greater evil; 4400 or the one-time cursor jump.

The problem comes from the fact that the entire template is torn down and rebuilt, even though nothing actually changes. I think that the ultimate solution for this may be to remove the editor.new and editor.edit routes in favor of just having an editor route. new/edit already share almost all of their code, and I feel like the separation between the two has caused a lot of issues as we try to refactor autosave ( #4321's attempted fixes, for example )

@ErisDS
Copy link
Member

ErisDS commented Nov 16, 2014

TravisBuildNotPassedDerpNeedsMoreEqualsException 😜

@novaugust novaugust force-pushed the slow-save-errors#4400 branch 2 times, most recently from 19af594 to 24fed69 Compare November 16, 2014 15:14
Closes TryGhost#4400
- Added focusCursorAtEnd property to codemirror component, to set the cursor at document end on load. Used for posts that have been edited
- centralized codemirror init code in component
@novaugust novaugust force-pushed the slow-save-errors#4400 branch from 24fed69 to a9ce31f Compare November 16, 2014 15:54
@novaugust
Copy link
Contributor Author

Updated, no more cursor position bug, and derps underped.

@ErisDS
Copy link
Member

ErisDS commented Nov 17, 2014

Testing using yosemite chrome, the problem is consistent on master. This PR fixes it up and makes it work muuuch more smoothly. Do like 👍

ErisDS added a commit that referenced this pull request Nov 17, 2014
Fix high latency autosave bug in editor.new
@ErisDS ErisDS merged commit 611c221 into TryGhost:master Nov 17, 2014
@ErisDS
Copy link
Member

ErisDS commented Nov 17, 2014

In other news, whilst this fixes autosave in the /new/ route, it completely breaks the code for managing images when editing a post.

@javorszky
Copy link
Contributor

le sigh

ErisDS added a commit to ErisDS/Ghost that referenced this pull request Nov 17, 2014
ref TryGhost#4459

- move initMarkers back to its original home
- add new test that a post with an image can be edited
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autosave causing the 'do you want to leave' nag on new posts
3 participants