Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update examples

  • Loading branch information...
commit 0b2a465bd475cfc67c906b2a65b0da493a3a7cdf 1 parent 7cef831
Henri Bergius bergie authored
2  examples/format.js
@@ -11,7 +11,7 @@
11 11 _create: function() {
12 12 var buttonize, buttonset, format, widget, _i, _len, _ref;
13 13 widget = this;
14   - buttonset = jQuery("<span></span>");
  14 + buttonset = jQuery("<span class=\"" + widget.widgetName + "\"></span>");
15 15 buttonize = __bind(function(format) {
16 16 var button, id, label;
17 17 label = format.substr(0, 1).toUpperCase();
17 examples/hallo.js
@@ -142,7 +142,7 @@
142 142 return "" + (S4()) + (S4()) + "-" + (S4()) + "-" + (S4()) + "-" + (S4()) + "-" + (S4()) + (S4()) + (S4());
143 143 },
144 144 _getToolbarPosition: function(event, selection) {
145   - var containerElement, containerPosition, newRange, position, range, tmpSpan;
  145 + var containerElement, containerPosition, newRange, offsety, position, range, tmpSpan;
146 146 if (event.originalEvent instanceof MouseEvent) {
147 147 if (this.options.floating) {
148 148 return [event.pageX, event.pageY];
@@ -153,7 +153,17 @@
153 153 containerElement = $(event.target).parent('[contenteditable]').first();
154 154 }
155 155 containerPosition = containerElement.position();
156   - return [containerPosition.left - this.options.offset.x, containerPosition.top - this.options.offset.y];
  156 + switch (this.options.offset.y) {
  157 + case "top":
  158 + offsety = containerPosition.top - this.toolbar.outerHeight();
  159 + break;
  160 + case "bottom":
  161 + offsety = containerPosition.top + containerElement.outerHeight();
  162 + break;
  163 + default:
  164 + offsety = containerPosition.top - this.options.offset.y;
  165 + }
  166 + return [containerPosition.left - this.options.offset.x, offsety];
157 167 }
158 168 }
159 169 range = selection.getRangeAt(0);
@@ -182,6 +192,7 @@
182 192 position = widget._getToolbarPosition(data.originalEvent, data.selection);
183 193 widget.toolbar.css("top", position[1]);
184 194 widget.toolbar.css("left", position[0]);
  195 + console.log(widget.selection);
185 196 return widget.toolbar.show();
186 197 });
187 198 return this.element.bind("hallounselected", function(event, data) {
@@ -214,7 +225,7 @@
214 225 var changed, i, range, sel, selectedRanges, widget, _ref;
215 226 widget = event.data;
216 227 sel = window.getSelection();
217   - if (sel.type === "Caret") {
  228 + if (sel.type === "Caret" || sel.isCollapsed) {
218 229 if (widget.selection) {
219 230 widget.selection = null;
220 231 widget._trigger("unselected", null, {
2  examples/headings.js
@@ -11,7 +11,7 @@
11 11 _create: function() {
12 12 var button, buttonize, buttonset, header, id, label, widget, _i, _len, _ref;
13 13 widget = this;
14   - buttonset = jQuery("<span></span>");
  14 + buttonset = jQuery("<span class=\"" + widget.widgetName + "\"></span>");
15 15 id = "" + this.options.uuid + "-#paragraph";
16 16 label = "P";
17 17 buttonset.append(jQuery("<input id=\"" + id + "\" type=\"radio\" /><label for=\"" + id + "\">" + label + "</label>").button());
2  examples/justify.js
@@ -10,7 +10,7 @@
10 10 _create: function() {
11 11 var buttonize, buttonset, widget;
12 12 widget = this;
13   - buttonset = jQuery("<span></span>");
  13 + buttonset = jQuery("<span class=\"" + widget.widgetName + "\"></span>");
14 14 buttonize = __bind(function(alignment) {
15 15 var button, id;
16 16 id = "" + this.options.uuid + "-" + alignment;
2  examples/linkimg.js
@@ -31,7 +31,7 @@
31 31 return false;
32 32 };
33 33 dialog.find("form").submit(dialogSubmitCb);
34   - buttonset = jQuery("<span></span>");
  34 + buttonset = jQuery("<span class=\"" + widget.widgetName + "\"></span>");
35 35 buttonize = __bind(function(type) {
36 36 var button, id;
37 37 id = "" + this.options.uuid + "-" + type;
2  examples/lists.js
@@ -10,7 +10,7 @@
10 10 _create: function() {
11 11 var buttonize, buttonset, widget;
12 12 widget = this;
13   - buttonset = jQuery("<span></span>");
  13 + buttonset = jQuery("<span class=\"" + widget.widgetName + "\"></span>");
14 14 buttonize = __bind(function(type, label) {
15 15 var button, id;
16 16 id = "" + this.options.uuid + "-" + type;
2  examples/reundo.js
@@ -10,7 +10,7 @@
10 10 _create: function() {
11 11 var buttonize, buttonset, widget;
12 12 widget = this;
13   - buttonset = jQuery("<span></span>");
  13 + buttonset = jQuery("<span class=\"" + widget.widgetName + "\"></span>");
14 14 buttonize = __bind(function(cmd, label) {
15 15 var button, id;
16 16 id = "" + this.options.uuid + "-" + cmd;

0 comments on commit 0b2a465

Please sign in to comment.
Something went wrong with that request. Please try again.