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

Handle blank mobiledoc in editor #127

Merged
merged 1 commit into from
Sep 14, 2015
Merged

Handle blank mobiledoc in editor #127

merged 1 commit into from
Sep 14, 2015

Conversation

bantic
Copy link
Collaborator

@bantic bantic commented Sep 14, 2015

This removes some code that previously forced an empty mobiledoc to
have a single empty section in it. A mobiledoc can now be truly empty and
the editor will display it and respond to events correctly.

Added Post#isBlank and in the keydown listener, if the post is blank the
editor will insert a new empty markup section under the cursor.

Now that it is possible to have a fully empty mobiledoc, the css for showing
the placeholder will apply again. We currently stop a "backspace" keystroke if
it is at the beginning of the first markup section, so it is not possible to use
the keyboard to make a post completely blank, but it's possible to do so by removing
a card from the editor if the card was the only thing there.

Updated the demo.js with a removable card demo and an empty mobiledoc demo
so that the two scenarios described above are viable to test and see the
placeholder text rendered.

Added some additional handling for the embed intent (the "+" icon that shows up)
to ensure that it does not throw errors and that it does show up when the
editor is showing an empty mobiledoc.

  • Rename Section methods semantically
  • add "simple-card" demo, with "remove" button
  • Clean up cursor detection and embedIntent
  • Add Position.emptyPosition and Range.emptyRange
  • allow mobiledoc to have 0 sections
  • add Post#isBlank
  • Add tests for typing in blank mobiledoc
  • Tests for removing the last item (e.g., card) in a mobiledoc
  • Ensure that replaceSection works when section is undefined
  • Add empty mobiledoc to demo

fixes #125 #35 #71

 * Rename Section methods semantically
 * add "simple-card" demo, with "remove" button
 * Clean up cursor detection and embedIntent
 * Add Position.emptyPosition and Range.emptyRange
 * allow mobiledoc to have 0 sections
 * add Post#isBlank
 * Add tests for typing in blank mobiledoc
 * Tests for removing the last item (e.g., card) in a mobiledoc
 * Ensure that replaceSection works when section is undefined
 * Add empty mobiledoc to demo

fixes #125 #35 #71
bantic added a commit that referenced this pull request Sep 14, 2015
Handle blank mobiledoc in editor
@bantic bantic merged commit 068db51 into master Sep 14, 2015
@bantic bantic deleted the placeholder-125 branch September 14, 2015 21:56
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.

mobiledoc with no content should render placeholder
1 participant