PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/editors/tiny_mce_3_4_3_1/plugins/paste/js/pasteword.js

#
JavaScript | 51 lines | 36 code | 12 blank | 3 comment | 2 complexity | 112504d12e971e4d32f17a59c5616c36 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. tinyMCEPopup.requireLangPack();
  2. var PasteWordDialog = {
  3. init : function() {
  4. var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
  5. // Create iframe
  6. el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
  7. ifr = document.getElementById('iframe');
  8. doc = ifr.contentWindow.document;
  9. // Force absolute CSS urls
  10. css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
  11. css = css.concat(tinymce.explode(ed.settings.content_css) || []);
  12. tinymce.each(css, function(u) {
  13. cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
  14. });
  15. // Write content into iframe
  16. doc.open();
  17. doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
  18. doc.close();
  19. doc.designMode = 'on';
  20. this.resize();
  21. window.setTimeout(function() {
  22. ifr.contentWindow.focus();
  23. }, 10);
  24. },
  25. insert : function() {
  26. var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
  27. tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
  28. tinyMCEPopup.close();
  29. },
  30. resize : function() {
  31. var vp = tinyMCEPopup.dom.getViewPort(window), el;
  32. el = document.getElementById('iframe');
  33. if (el) {
  34. el.style.width = (vp.w - 20) + 'px';
  35. el.style.height = (vp.h - 90) + 'px';
  36. }
  37. }
  38. };
  39. tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);