Changeset 521
- Timestamp:
- 08/09/08 19:58:01 (4 years ago)
- Location:
- branches/scott/0.6-a4/js/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/scott/0.6-a4/js/plugins/plugin1/test.js
r506 r521 18 18 behaviors: { 19 19 mouseover: function(e) { 20 $('#log').html('Plugin for<br /> WYMeditor Instance ' + e.data._index);20 // $('#log').html('Plugin for<br /> WYMeditor Instance ' + e.data.parent._index); 21 21 }, 22 22 mouseout: function(e) { 23 $('#log').html('');23 // $('#log').html(''); 24 24 }, 25 25 click: function(e) { 26 26 e.preventDefault(); 27 e.data.parent.sapi.cacheSelection(); 27 28 $.get("html/paste.html", function(data) { 28 29 $.modal(data, { … … 30 31 overlay: 75, 31 32 onShow: function(dialog) { 32 $(".wym_dialog .wym_cancel").bind('click', function(e) { 33 $(".wym_dialog .wym_cancel").bind('click', e.data, function(e) { 34 e.preventDefault(); 33 35 $.modal.close(); 36 e.data.parent.sapi.restoreSelection(); 34 37 }); 35 38 $(".wym_dialog .wym_submit").bind('click', e.data, function(e) { 36 39 e.preventDefault(); 37 40 var editor = e.data.parent; 41 editor.sapi.restoreSelection(); 38 42 var text = $("#paste_text").val(); 39 43 if ($.trim(text) != "") -
branches/scott/0.6-a4/js/plugins/sapi/sapi.js
r520 r521 221 221 }; 222 222 223 /** 224 * IMPORTANT: Because the selection/range object is part of the DOM, it is owned by 225 * the parent window of the document which contains it. Therefore, the selection 226 * within an editor must be cached within the scope of the parent window of the 227 * editor. This means that the selection object must be stored in the iframe's 228 * window. 229 */ 230 223 231 sapi.prototype.cacheSelection = function() { 224 var w = this.parent._iframe.contentWindow; 225 var d = this.parent._doc; 232 $('#log').html('Caching selection<br />'); 233 var w = this.parent.docWindow; 234 var d = this.parent.doc; 226 235 if (w.getSelection) { 227 236 var selection = w.getSelection(); … … 248 257 }; 249 258 250 sapi.prototype.restoreSelection = function(index) { 251 var w = this.parent._iframe.contentWindow; 252 var d = this.parent._doc; 259 sapi.prototype.restoreSelection = function() { 260 $('#log').html($('#log').html()+'Re-storing selection<br />'); 261 var w = this.parent.docWindow; 262 var d = this.parent.doc; 253 263 try {jQuery(d).focus();} catch(e) {} 254 264 if (w._selection) { … … 269 279 270 280 sapi.replaceSelectionText = function(text) { 271 var w = this.parent. _iframe.contentWindow;272 var d = this.parent. _doc;281 var w = this.parent.docWindow; 282 var d = this.parent.doc; 273 283 try {jQuery(d).focus();} catch(e) {} 274 284 if (!w.getSelection && … … 425 435 { 426 436 $.extend(p, { 427 method: "compareEndPoints",437 method: "compareEndPoints", 428 438 StartToStart: "StartToStart", 429 StartToEnd: "StartToEnd",430 EndToEnd: "EndToEnd",431 EndToStart: "EndToStart"439 StartToEnd: "StartToEnd", 440 EndToEnd: "EndToEnd", 441 EndToStart: "EndToStart" 432 442 }); 433 443 } … … 435 445 { 436 446 $.extend(p, { 437 method: "compareBoundaryPoints",447 method: "compareBoundaryPoints", 438 448 StartToStart: 0, 439 StartToEnd: 1,440 EndToEnd: 2,441 EndToStart: 3449 StartToEnd: 1, 450 EndToEnd: 2, 451 EndToStart: 3 442 452 }); 443 453 }
Note: See TracChangeset
for help on using the changeset viewer.