diff options
| author | hukl <contact@smyck.org> | 2009-09-09 12:07:57 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-09 12:07:57 +0200 |
| commit | a6292dd0fecd4482fe863ed849d126b5281b1a8a (patch) | |
| tree | 7c4c32e1a3448c5d1995a236ed01c731018da13d /public/javascripts/tiny_mce/plugins/paste/js/pastetext.js | |
| parent | 83fe1b1abd7d7bb85679be3f1341e5c88db0ae83 (diff) | |
huge tiny_mce update - now using the tiny_mce jquery build which allows tiny_mce to be initialized via jquery - great!
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/paste/js/pastetext.js')
| -rw-r--r--[-rwxr-xr-x] | public/javascripts/tiny_mce/plugins/paste/js/pastetext.js | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/public/javascripts/tiny_mce/plugins/paste/js/pastetext.js b/public/javascripts/tiny_mce/plugins/paste/js/pastetext.js index 326bb16..c524f9e 100755..100644 --- a/public/javascripts/tiny_mce/plugins/paste/js/pastetext.js +++ b/public/javascripts/tiny_mce/plugins/paste/js/pastetext.js | |||
| @@ -1,42 +1,36 @@ | |||
| 1 | tinyMCEPopup.requireLangPack(); | 1 | tinyMCEPopup.requireLangPack(); |
| 2 | 2 | ||
| 3 | function saveContent() { | 3 | var PasteTextDialog = { |
| 4 | if (document.forms[0].htmlSource.value == '') { | 4 | init : function() { |
| 5 | tinyMCEPopup.close(); | 5 | this.resize(); |
| 6 | return false; | 6 | }, |
| 7 | } | ||
| 8 | |||
| 9 | tinyMCEPopup.execCommand('mcePasteText', false, { | ||
| 10 | html : document.forms[0].htmlSource.value, | ||
| 11 | linebreaks : document.forms[0].linebreaks.checked | ||
| 12 | }); | ||
| 13 | 7 | ||
| 14 | tinyMCEPopup.close(); | 8 | insert : function() { |
| 15 | } | 9 | var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines; |
| 16 | 10 | ||
| 17 | function onLoadInit() { | 11 | // Convert linebreaks into paragraphs |
| 18 | tinyMCEPopup.resizeToInnerSize(); | 12 | if (document.getElementById('linebreaks').checked) { |
| 13 | lines = h.split(/\r?\n/); | ||
| 14 | if (lines.length > 1) { | ||
| 15 | h = ''; | ||
| 16 | tinymce.each(lines, function(row) { | ||
| 17 | h += '<p>' + row + '</p>'; | ||
| 18 | }); | ||
| 19 | } | ||
| 20 | } | ||
| 19 | 21 | ||
| 20 | // Remove Gecko spellchecking | 22 | tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h}); |
| 21 | if (tinymce.isGecko) | 23 | tinyMCEPopup.close(); |
| 22 | document.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck"); | 24 | }, |
| 23 | 25 | ||
| 24 | resizeInputs(); | 26 | resize : function() { |
| 25 | } | 27 | var vp = tinyMCEPopup.dom.getViewPort(window), el; |
| 26 | 28 | ||
| 27 | var wHeight=0, wWidth=0, owHeight=0, owWidth=0; | 29 | el = document.getElementById('content'); |
| 28 | 30 | ||
| 29 | function resizeInputs() { | 31 | el.style.width = (vp.w - 20) + 'px'; |
| 30 | if (!tinymce.isIE) { | 32 | el.style.height = (vp.h - 90) + 'px'; |
| 31 | wHeight = self.innerHeight-80; | ||
| 32 | wWidth = self.innerWidth-17; | ||
| 33 | } else { | ||
| 34 | wHeight = document.body.clientHeight-80; | ||
| 35 | wWidth = document.body.clientWidth-17; | ||
| 36 | } | 33 | } |
| 34 | }; | ||
| 37 | 35 | ||
| 38 | document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px'; | 36 | tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog); |
| 39 | document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px'; | ||
| 40 | } | ||
| 41 | |||
| 42 | tinyMCEPopup.onInit.add(onLoadInit); \ No newline at end of file | ||
