]> code.citadel.org Git - citadel.git/blobdiff - webcit/tiny_mce/plugins/paste/js/pastetext.js
more font size tweaks.
[citadel.git] / webcit / tiny_mce / plugins / paste / js / pastetext.js
index 326bb16a2af7367a8fd4500139e92036740fdbb7..c524f9eb033881f3c9463ff2d284dbb541454f1a 100644 (file)
@@ -1,42 +1,36 @@
 tinyMCEPopup.requireLangPack();\r
 \r
-function saveContent() {\r
-       if (document.forms[0].htmlSource.value == '') {\r
+var PasteTextDialog = {\r
+       init : function() {\r
+               this.resize();\r
+       },\r
+\r
+       insert : function() {\r
+               var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;\r
+\r
+               // Convert linebreaks into paragraphs\r
+               if (document.getElementById('linebreaks').checked) {\r
+                       lines = h.split(/\r?\n/);\r
+                       if (lines.length > 1) {\r
+                               h = '';\r
+                               tinymce.each(lines, function(row) {\r
+                                       h += '<p>' + row + '</p>';\r
+                               });\r
+                       }\r
+               }\r
+\r
+               tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});\r
                tinyMCEPopup.close();\r
-               return false;\r
-       }\r
-\r
-       tinyMCEPopup.execCommand('mcePasteText', false, {\r
-               html : document.forms[0].htmlSource.value,\r
-               linebreaks : document.forms[0].linebreaks.checked\r
-       });\r
-\r
-       tinyMCEPopup.close();\r
-}\r
+       },\r
 \r
-function onLoadInit() {\r
-       tinyMCEPopup.resizeToInnerSize();\r
+       resize : function() {\r
+               var vp = tinyMCEPopup.dom.getViewPort(window), el;\r
 \r
-       // Remove Gecko spellchecking\r
-       if (tinymce.isGecko)\r
-               document.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");\r
+               el = document.getElementById('content');\r
 \r
-       resizeInputs();\r
-}\r
-\r
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;\r
-\r
-function resizeInputs() {\r
-       if (!tinymce.isIE) {\r
-               wHeight = self.innerHeight-80;\r
-               wWidth = self.innerWidth-17;\r
-       } else {\r
-               wHeight = document.body.clientHeight-80;\r
-               wWidth = document.body.clientWidth-17;\r
+               el.style.width  = (vp.w - 20) + 'px';\r
+               el.style.height = (vp.h - 90) + 'px';\r
        }\r
+};\r
 \r
-       document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';\r
-       document.forms[0].htmlSource.style.width  = Math.abs(wWidth) + 'px';\r
-}\r
-\r
-tinyMCEPopup.onInit.add(onLoadInit);
\ No newline at end of file
+tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);\r