jhtmlarea 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 504a8d714fd539f31a263714b41d3f0b85e03eec
4
- data.tar.gz: 88902eda32b99e05ce85e085f58515fe08b2f55c
3
+ metadata.gz: 4fa0b0afb0d455da7b41e4b45d1fcd6b79d20cfb
4
+ data.tar.gz: dc7afff03258e0ba959ad1eb7745649501a5ac74
5
5
  SHA512:
6
- metadata.gz: 8686f0070eceacc1496bb980bcc990a3b5e2bd59601375621c643e3c16889be7c3a341da688b5d22f2872116024242d12b0e3fdd5f6b414b03683ca1e8e6847d
7
- data.tar.gz: d75377135900662f17dce376c468846e48754feacb88930726955c9bb3a2d436f86b60c5aef9ee9bf3b032e1a2a6e722241a94918beae75cea7e59afa6ff2bfe
6
+ metadata.gz: 6c72c5f4ad0c3fb25721693574b32b61683588fb08afa0dc8850af0887a56f59bff44af1982ab90a7264e5c8c660997ead2ca13a078fc92ad2bf20c27cb1ad49
7
+ data.tar.gz: 0b972fc53c8d46fb61fc67f22e076f899bfa9fb618e4c8e223209435ab9b766e11af787f332445d1ed07f8738031233336d41f527586863296d07695c30a420b
@@ -1,3 +1,3 @@
1
1
  module Jhtmlarea
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -43,7 +43,9 @@
43
43
  priv.initToolBar.call(this, opts);
44
44
 
45
45
  var iframe = this.iframe = $("<iframe/>").height(textarea.height());
46
- iframe.width(textarea.width() - ($.browser.msie ? 0 : 4));
46
+ // jQuery.browser is deprecated
47
+ //iframe.width(textarea.width() - ($.browser.msie ? 0 : 4));
48
+ iframe.width(textarea.width() - 4;
47
49
  var htmlarea = this.htmlarea = $("<div/>").append(iframe);
48
50
 
49
51
  container.append(htmlarea).append(textarea.hide());
@@ -79,20 +81,24 @@
79
81
  return this.queryCommandValue(a);
80
82
  },
81
83
  getSelectedHTML: function () {
82
- if ($.browser.msie) {
83
- return this.getRange().htmlText;
84
- } else {
85
- var elem = this.getRange().cloneContents();
86
- return $("<p/>").append($(elem)).html();
87
- }
84
+ // if ($.browser.msie) {
85
+ // return this.getRange().htmlText;
86
+ // } else {
87
+ // var elem = this.getRange().cloneContents();
88
+ // return $("<p/>").append($(elem)).html();
89
+ // }
90
+ var elem = this.getRange().cloneContents();
91
+ return $("<p/>").append($(elem)).html();
92
+
88
93
  },
89
94
  getSelection: function () {
90
- if ($.browser.msie) {
91
- //return (this.editor.parentWindow.getSelection) ? this.editor.parentWindow.getSelection() : this.editor.selection;
92
- return this.editor.selection;
93
- } else {
94
- return this.iframe[0].contentDocument.defaultView.getSelection();
95
- }
95
+ // if ($.browser.msie) {
96
+ // //return (this.editor.parentWindow.getSelection) ? this.editor.parentWindow.getSelection() : this.editor.selection;
97
+ // return this.editor.selection;
98
+ // } else {
99
+ // return this.iframe[0].contentDocument.defaultView.getSelection();
100
+ // }
101
+ return this.iframe[0].contentDocument.defaultView.getSelection();
96
102
  },
97
103
  getRange: function () {
98
104
  var s = this.getSelection();
@@ -111,15 +117,17 @@
111
117
  pasteHTML: function (html) {
112
118
  this.iframe[0].contentWindow.focus();
113
119
  var r = this.getRange();
114
- if ($.browser.msie) {
115
- r.pasteHTML(html);
116
- } else if ($.browser.mozilla) {
117
- r.deleteContents();
118
- r.insertNode($((html.indexOf("<") != 0) ? $("<span/>").append(html) : html)[0]);
119
- } else { // Safari
120
- r.deleteContents();
121
- r.insertNode($(this.iframe[0].contentWindow.document.createElement("span")).append($((html.indexOf("<") != 0) ? "<span>" + html + "</span>" : html))[0]);
122
- }
120
+ // if ($.browser.msie) {
121
+ // r.pasteHTML(html);
122
+ // } else if ($.browser.mozilla) {
123
+ // r.deleteContents();
124
+ // r.insertNode($((html.indexOf("<") != 0) ? $("<span/>").append(html) : html)[0]);
125
+ // } else { // Safari
126
+ // r.deleteContents();
127
+ // r.insertNode($(this.iframe[0].contentWindow.document.createElement("span")).append($((html.indexOf("<") != 0) ? "<span>" + html + "</span>" : html))[0]);
128
+ // }
129
+ r.deleteContents();
130
+ r.insertNode($((html.indexOf("<") != 0) ? $("<span/>").append(html) : html)[0]);
123
131
  r.collapse(false);
124
132
  r.select();
125
133
  },
@@ -137,22 +145,24 @@
137
145
  underline: function () { this.ec("underline"); },
138
146
  strikeThrough: function () { this.ec("strikethrough"); },
139
147
  image: function (url) {
140
- if ($.browser.msie && !url) {
141
- this.ec("insertImage", true);
142
- } else {
143
- this.ec("insertImage", false, (url || prompt("Image URL:", "http://")));
144
- }
148
+ // if ($.browser.msie && !url) {
149
+ // this.ec("insertImage", true);
150
+ // } else {
151
+ // this.ec("insertImage", false, (url || prompt("Image URL:", "http://")));
152
+ // }
153
+ this.ec("insertImage", false, (url || prompt("Image URL:", "http://")));
145
154
  },
146
155
  removeFormat: function () {
147
156
  this.ec("removeFormat", false, []);
148
157
  this.unlink();
149
158
  },
150
159
  link: function () {
151
- if ($.browser.msie) {
152
- this.ec("createLink", true);
153
- } else {
154
- this.ec("createLink", false, prompt("Link URL:", "http://"));
155
- }
160
+ // if ($.browser.msie) {
161
+ // this.ec("createLink", true);
162
+ // } else {
163
+ // this.ec("createLink", false, prompt("Link URL:", "http://"));
164
+ // }
165
+ this.ec("createLink", false, prompt("Link URL:", "http://"));
156
166
  },
157
167
  unlink: function () { this.ec("unlink", false, []); },
158
168
  orderedList: function () { this.ec("insertorderedlist"); },
@@ -182,7 +192,8 @@
182
192
  this.heading(6);
183
193
  },
184
194
  heading: function (h) {
185
- this.formatBlock($.browser.msie ? "Heading " + h : "h" + h);
195
+ // this.formatBlock($.browser.msie ? "Heading " + h : "h" + h);
196
+ this.formatBlock("h" + h);
186
197
  },
187
198
 
188
199
  indent: function () {
@@ -207,22 +218,24 @@
207
218
  },
208
219
 
209
220
  increaseFontSize: function () {
210
- if ($.browser.msie) {
211
- this.ec("fontSize", false, this.qc("fontSize") + 1);
212
- } else if ($.browser.safari) {
213
- this.getRange().surroundContents($(this.iframe[0].contentWindow.document.createElement("span")).css("font-size", "larger")[0]);
214
- } else {
215
- this.ec("increaseFontSize", false, "big");
216
- }
221
+ // if ($.browser.msie) {
222
+ // this.ec("fontSize", false, this.qc("fontSize") + 1);
223
+ // } else if ($.browser.safari) {
224
+ // this.getRange().surroundContents($(this.iframe[0].contentWindow.document.createElement("span")).css("font-size", "larger")[0]);
225
+ // } else {
226
+ // this.ec("increaseFontSize", false, "big");
227
+ // }
228
+ this.ec("increaseFontSize", false, "big");
217
229
  },
218
230
  decreaseFontSize: function () {
219
- if ($.browser.msie) {
220
- this.ec("fontSize", false, this.qc("fontSize") - 1);
221
- } else if ($.browser.safari) {
222
- this.getRange().surroundContents($(this.iframe[0].contentWindow.document.createElement("span")).css("font-size", "smaller")[0]);
223
- } else {
224
- this.ec("decreaseFontSize", false, "small");
225
- }
231
+ // if ($.browser.msie) {
232
+ // this.ec("fontSize", false, this.qc("fontSize") - 1);
233
+ // } else if ($.browser.safari) {
234
+ // this.getRange().surroundContents($(this.iframe[0].contentWindow.document.createElement("span")).css("font-size", "smaller")[0]);
235
+ // } else {
236
+ // this.ec("decreaseFontSize", false, "small");
237
+ // }
238
+ this.ec("decreaseFontSize", false, "small");
226
239
  },
227
240
 
228
241
  forecolor: function (c) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jhtmlarea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dow Drake