comparison js/dnd-library.js @ 15:7a5f74482ee3

More cross browser work, garbage collection for timers, etc.
author David Eads <eads@chicagotech.org>
date Mon, 02 Mar 2009 23:22:37 -0600
parents 99ba5941779c
children bb68dc3ad56f
comparison
equal deleted inserted replaced
14:ef7ad7b5baa4 15:7a5f74482ee3
23 //$('.footer', $this).html(data.footer); 23 //$('.footer', $this).html(data.footer);
24 for (editor_id in data.editor_representations) { 24 for (editor_id in data.editor_representations) {
25 Drupal.settings.dndEditorRepresentations[editor_id] = data.editor_representations[editor_id]; 25 Drupal.settings.dndEditorRepresentations[editor_id] = data.editor_representations[editor_id];
26 } 26 }
27 var params = Drupal.wysiwyg.instances[editor]; 27 var params = Drupal.wysiwyg.instances[editor];
28 $('#' + editor).trigger('wysiwygDetach', params);
28 $('#' + editor).trigger('wysiwygAttach', params); 29 $('#' + editor).trigger('wysiwygAttach', params);
29 }); 30 });
30 return false; 31 return false;
31 }); 32 });
32 33
47 window.Drupal.behaviors.dndLibrary[editor_fn](data, settings); 48 window.Drupal.behaviors.dndLibrary[editor_fn](data, settings);
48 } 49 }
49 } 50 }
50 51
51 Drupal.behaviors.dndLibrary.detach_library = function(e, data) { 52 Drupal.behaviors.dndLibrary.detach_library = function(e, data) {
52 //console.log('detach'); 53 for (t in $(document).data('dnd_timers')) {
54 clearInterval(t);
55 }
56 $(document).removeData('dnd_timers');
53 } 57 }
54 58
55 59
56 Drupal.behaviors.dndLibrary.attach_tinymce = function(data, settings) { 60 Drupal.behaviors.dndLibrary.attach_tinymce = function(data, settings) {
57 61
74 78
75 Drupal.behaviors.dndLibrary._attach_tinymce = function(data, settings, tiny_instance) { 79 Drupal.behaviors.dndLibrary._attach_tinymce = function(data, settings, tiny_instance) {
76 settings = $.extend({ 80 settings = $.extend({
77 targets: $('#'+ data.field +'-wrapper iframe'), 81 targets: $('#'+ data.field +'-wrapper iframe'),
78 insertAfter: '<p><span id="__caret">_</span></p>', 82 insertAfter: '<p><span id="__caret">_</span></p>',
83
84 // Back out markup to render in place after parent container
85 preprocessDrop: function(target, drop) {
86 drop.id = 'DND-TMP-' + $.data(drop);
87 // Do some native tiny manipulations
88 return drop;
89 },
79 postprocessDrop: function(target, drop, element) { 90 postprocessDrop: function(target, drop, element) {
80 // Get our special span, select it, delete it, and hope the caret 91 // Get our special span, select it, delete it, and hope the caret
81 // resets correctly. 92 // resets correctly.
82 tiny_instance.selection.select(tiny_instance.dom.get('__caret')); 93 tiny_instance.selection.select(tiny_instance.dom.get('__caret'));
83 tiny_instance.execCommand('Delete', false, null); 94 tiny_instance.execCommand('Delete', false, null);