Permalink
Browse files

Expand to word

  • Loading branch information...
1 parent 5479b55 commit 94695983b591f9be23a6f0d8f360d06d6022f789 @icebeat committed May 21, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −1 index.html
  2. +5 −0 js/commands.js
View
@@ -17,7 +17,7 @@
<script type="text/javascript" src="js/parser.js"></script>
<script type="text/javascript" src="js/undomanager.js"></script>
<script type="text/javascript">
- var text = ["# SHORTCUTS", "", "FocusMode: Cmd + D", "SmartTyping: Type \"<\", \"\"\", \"[\", \"{\" & \"(\"", "Save: Cmd + S", "Indent: Tab or Shift + Tab", "", "## Emphasis and Strong", "", "Emphasis: *example* = _example_ (or Cmd + I)", "Strong: **example** = __example__ (or Cmd + B)", "Delete: -example- (or Cmd + U)", "", "## Numbered lists: type \"1.\" + space", "", "1. Ordered list item", "2. Ordered list item", "3. Ordered list item (enter to create a new item)", "", "## Bulleted lists: type \"*\" + space", "", "* Bulleted list item", "* Bulleted list item", "* Bulleted list item", "", "## ToDo lists: type \"-\" or \"+\" + space", "", "- Task (Mark as done, click on \"-\")", "+ Task Done", "", "## Indentation", "", " This is an example of a indented paragraph.", "", "## Blockquotes", "", "> This is an example of a quoted paragraph. It stays indented over multiple lines until you hit enter.", "","@icebeat"]
+ var text = ["# SHORTCUTS", "", "FocusMode: Cmd + D", "SmartTyping: Type \"<\", \"\"\", \"[\", \"{\" & \"(\"", "Save: Cmd + S", "Indent: Tab or Shift + Tab", "", "## Emphasis and Strong", "", "Emphasis: *example* = _example_ (or Cmd + I)", "Strong: **example** = __example__ (or Cmd + B)", "Delete: -example- (or Cmd + U)", "", "**Expand** to word: Shift + Cmd + Key", "", "## Numbered lists: type \"1.\" + space", "", "1. Ordered list item", "2. Ordered list item", "3. Ordered list item (enter to create a new item)", "", "## Bulleted lists: type \"*\" + space", "", "* Bulleted list item", "* Bulleted list item", "* Bulleted list item", "", "## ToDo lists: type \"-\" or \"+\" + space", "", "- Task (Mark as done, click on \"-\")", "+ Task Done", "", "## Indentation", "", " This is an example of a indented paragraph.", "", "## Blockquotes", "", "> This is an example of a quoted paragraph. It stays indented over multiple lines until you hit enter.", "","@icebeat"]
var Document = new Editor(localStorage["content"] || text);
Document.goDocStart();
Document.focusInput();
View
@@ -538,6 +538,11 @@ Extend(Editor.prototype, {
},
smartTyping: function (from, to, open, close, select, noHistory) {
+ if (this.shiftSelecting && Range.equal(from, to)) {
+ var positions = this.findWord(to);
+ from = positions.from;
+ to = positions.to;
+ }
var _from = Range.copy(from), _to = Range.copy(to);
var value = this.getContent(from, to), textSelected = value.chunk[1];
value = value.chunk[0] + open + value.chunk[1] + close + value.chunk[2];

0 comments on commit 9469598

Please sign in to comment.