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

Implement text expansions #110

Merged
merged 1 commit into from
Sep 3, 2015
Merged

Implement text expansions #110

merged 1 commit into from
Sep 3, 2015

Conversation

bantic
Copy link
Collaborator

@bantic bantic commented Sep 3, 2015

  • Trigger is "space"
  • "*" -> ul>li
  • "1" and "1." -> ol>li
  • "##" -> h2
  • "###" -> h3

Adds editor#registerExpansion which takes an expansion.
An expansion has these keys:

  • trigger the keycode of the triggering key event. All of the existing ones use 32 ("space")
  • text the text that must match to the left of the cursor. Currently this only looks for text matching from the beginning of the section to the cursor. In the future it wouldn't be hard to modify it to handle in-context text, so you could bold text by adding "**" on either side of a word, perhaps
  • run a method that will get passed the editor instance when this expansion is triggered

fixes #87

gpy

  * Trigger is "space"
  * "*" -> ul>li
  * "1" and "1." -> ol>li
  * "##" -> h2
  * "###" -> h3

fixes #87
bantic added a commit that referenced this pull request Sep 3, 2015
@bantic bantic merged commit 4ea9e76 into master Sep 3, 2015
@bantic
Copy link
Collaborator Author

bantic commented Sep 3, 2015

cc @ErisDS This was something you had asked about a while back. It's finally landed!

@bantic bantic deleted the text-expansions branch September 3, 2015 19:57
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.

text expansion: "* " -> unordered list item, "1. " -> ordered list item
1 participant