Mercurial > public > sg101
comparison media/js/tiny_mce/plugins/paste/editor_plugin_src.js @ 247:6ed2932901fa
Update tinymce to 3.3.9
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 18 Sep 2010 19:54:11 +0000 |
parents | 237710206167 |
children |
comparison
equal
deleted
inserted
replaced
246:e4dc0b649fcb | 247:6ed2932901fa |
---|---|
143 | 143 |
144 if (dom.get('_mcePaste')) | 144 if (dom.get('_mcePaste')) |
145 return; | 145 return; |
146 | 146 |
147 // Create container to paste into | 147 // Create container to paste into |
148 n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF'); | 148 n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF<br _mce_bogus="1">'); |
149 | 149 |
150 // If contentEditable mode we need to find out the position of the closest element | 150 // If contentEditable mode we need to find out the position of the closest element |
151 if (body != ed.getDoc().body) | 151 if (body != ed.getDoc().body) |
152 posY = dom.getPos(ed.selection.getStart(), body).y; | 152 posY = dom.getPos(ed.selection.getStart(), body).y; |
153 else | 153 else |
207 window.setTimeout(function() { | 207 window.setTimeout(function() { |
208 var h = '', nl = dom.select('div.mcePaste'); | 208 var h = '', nl = dom.select('div.mcePaste'); |
209 | 209 |
210 // WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string | 210 // WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string |
211 each(nl, function(n) { | 211 each(nl, function(n) { |
212 var child = n.firstChild; | |
213 | |
214 // WebKit inserts a DIV container with lots of odd styles | |
215 if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) { | |
216 dom.remove(child, 1); | |
217 } | |
218 | |
212 // WebKit duplicates the divs so we need to remove them | 219 // WebKit duplicates the divs so we need to remove them |
213 each(dom.select('div.mcePaste', n), function(n) { | 220 each(dom.select('div.mcePaste', n), function(n) { |
214 dom.remove(n, 1); | 221 dom.remove(n, 1); |
215 }); | 222 }); |
216 | 223 |
217 // Remove apply style spans | 224 // Remove apply style spans |
218 each(dom.select('span.Apple-style-span', n), function(n) { | 225 each(dom.select('span.Apple-style-span', n), function(n) { |
219 dom.remove(n, 1); | 226 dom.remove(n, 1); |
227 }); | |
228 | |
229 // Remove bogus br elements | |
230 each(dom.select('br[_mce_bogus]', n), function(n) { | |
231 dom.remove(n); | |
220 }); | 232 }); |
221 | 233 |
222 h += n.innerHTML; | 234 h += n.innerHTML; |
223 }); | 235 }); |
224 | 236 |
675 sel.collapse(false); | 687 sel.collapse(false); |
676 } | 688 } |
677 } | 689 } |
678 | 690 |
679 // Insert a marker for the caret position | 691 // Insert a marker for the caret position |
680 this._insert('<span id="' + markerId + '"> </span>', 1); | 692 this._insert('<span id="' + markerId + '"></span>', 1); |
681 marker = dom.get(markerId); | 693 marker = dom.get(markerId); |
682 parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td'); | 694 parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td'); |
683 | 695 |
684 // If it's a parent block but not a table cell | 696 // If it's a parent block but not a table cell |
685 if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) { | 697 if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) { |