/static/scripts/tiny_mce/plugins/paste/js/pasteword.js

http://n23.googlecode.com/ · JavaScript · 56 lines · 40 code · 14 blank · 2 comment · 6 complexity · 5760c35f976c0b076df0c043e3842de7 MD5 · raw file

  1. tinyMCEPopup.requireLangPack();
  2. function saveContent() {
  3. var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
  4. if (html == ''){
  5. tinyMCEPopup.close();
  6. return false;
  7. }
  8. tinyMCEPopup.execCommand('mcePasteWord', false, html);
  9. tinyMCEPopup.close();
  10. }
  11. function onLoadInit() {
  12. tinyMCEPopup.resizeToInnerSize();
  13. // Fix for endless reloading in FF
  14. window.setTimeout(createIFrame, 10);
  15. }
  16. function createIFrame() {
  17. document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
  18. }
  19. var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
  20. function initIframe(doc) {
  21. var dir = tinyMCEPopup.editor.settings.directionality;
  22. doc.body.dir = dir;
  23. // Remove Gecko spellchecking
  24. if (tinymce.isGecko)
  25. doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
  26. resizeInputs();
  27. }
  28. function resizeInputs() {
  29. if (!tinymce.isIE) {
  30. wHeight = self.innerHeight - 80;
  31. wWidth = self.innerWidth - 18;
  32. } else {
  33. wHeight = document.body.clientHeight - 80;
  34. wWidth = document.body.clientWidth - 18;
  35. }
  36. var elm = document.getElementById('frmData');
  37. if (elm) {
  38. elm.style.height = Math.abs(wHeight) + 'px';
  39. elm.style.width = Math.abs(wWidth) + 'px';
  40. }
  41. }
  42. tinyMCEPopup.onInit.add(onLoadInit);