Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug where cursor would move to the end of the text after linkin…

…g a selection. SASSd css.
  • Loading branch information...
commit 6a669ef0b0ed43cecd0b3d4e93425037c8f03ff7 1 parent 8d3864b
@njakobsen njakobsen authored
View
2  app/assets/javascripts/text_editor.js.erb
@@ -257,7 +257,7 @@ var TextEditor = {
var front = (this.input.value).substring(0, selection.start);
var back = (this.input.value).substring(selection.end);
this.input.value = front + text + back;
- this.clearSelection();
+ this.createSelection(selection.start, selection.start);
this.input.scrollTop = scrollPos;
},
insertAroundSelection: function(textBefore, textAfter) {
View
127 app/assets/stylesheets/text_editor.css.scss
@@ -1,63 +1,72 @@
-/* including Helpers.less */
.text_editor_wrapper {
display: inline-block;
position: relative;
-}
-
-textarea.text_editor {
- border-top: 30px solid transparent;
- -webkit-border-top-left-radius: 0;
- -webkit-border-top-right-radius: 0;
- -moz-border-radius-topleft: 0;
- -moz-border-radius-topright: 0;
- border-top-left-radius: 0;
- border-top-right-radius: 0; }
-
-.text_editor_controls {
- -moz-box-sizing: border-box;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- background: none repeat scroll 0 0 #EEE;
- border: 1px solid #CCC;
- position: absolute;
- width: 100%; }
-
-.text_editor_controls .control {
- cursor: pointer;
- display: inline-block;
- font-family: 'Times New Roman';
- font-size: 1.1em;
- height: 30px;
- line-height: 30px;
- margin-right: 1px;
- text-align: center;
- vertical-align: middle;
- width: 30px; }
-
-.text_editor_controls .control:hover {
- background: #F7F7F7; }
-
-.text_editor_controls .separator {
- background-color: #C3C3C3;
- border-right: 1px solid #F7F7F7;
- display: inline-block;
- height: 23px;
- margin: 0 3px 0 2px;
- padding-right: 1px;
- vertical-align: middle; }
-
-.text_editor_controls .popup_item_search {
- height: 22px;
- -webkit-border-radius: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
- border-color: #DDD;
- padding: 0 0 0 10px;
- margin-left: 5px; }
-
-.control.heading2{
- font-size: 1em;
-}
-.control.heading3{
- font-size: 0.9em;
+
+
+ .text_editor_controls {
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ background: none repeat scroll 0 0 #EEE;
+ border: 1px solid #CCC;
+ position: absolute;
+ width: 100%;
+
+ .control {
+ cursor: pointer;
+ display: inline-block;
+ font-family: 'Times New Roman';
+ font-size: 1.1em;
+ height: 30px;
+ line-height: 30px;
+ margin-right: 1px;
+ text-align: center;
+ vertical-align: middle;
+ width: 30px;
+ }
+
+ .control:hover {
+ background: #F7F7F7;
+
+ }
+
+ .separator {
+ background-color: #C3C3C3;
+ border-right: 1px solid #F7F7F7;
+ display: inline-block;
+ height: 23px;
+ margin: 0 3px 0 2px;
+ padding-right: 1px;
+ vertical-align: middle;
+ }
+
+ .popup_item_search {
+ height: 22px;
+ -webkit-border-radius: 15px;
+ -moz-border-radius: 15px;
+ border-radius: 15px;
+ border-color: #DDD;
+ padding: 0 0 0 10px;
+ margin-left: 5px;
+ }
+
+ .control.heading2{
+ font-size: 1em;
+ }
+ .control.heading3{
+ font-size: 0.9em;
+ }
+
+ }
+
+ textarea.text_editor {
+ border-top: 30px solid transparent;
+ -webkit-border-top-left-radius: 0;
+ -webkit-border-top-right-radius: 0;
+ -moz-border-radius-topleft: 0;
+ -moz-border-radius-topright: 0;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+ resize: vertical;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.