summaryrefslogtreecommitdiff
path: root/public/javascripts/tiny_mce/plugins/paste/js
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-09-09 12:07:57 +0200
committerhukl <contact@smyck.org>2009-09-09 12:07:57 +0200
commita6292dd0fecd4482fe863ed849d126b5281b1a8a (patch)
tree7c4c32e1a3448c5d1995a236ed01c731018da13d /public/javascripts/tiny_mce/plugins/paste/js
parent83fe1b1abd7d7bb85679be3f1341e5c88db0ae83 (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')
-rw-r--r--[-rwxr-xr-x]public/javascripts/tiny_mce/plugins/paste/js/pastetext.js58
-rw-r--r--[-rwxr-xr-x]public/javascripts/tiny_mce/plugins/paste/js/pasteword.js79
2 files changed, 63 insertions, 74 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 @@
1tinyMCEPopup.requireLangPack(); 1tinyMCEPopup.requireLangPack();
2 2
3function saveContent() { 3var 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
17function 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
27var wHeight=0, wWidth=0, owHeight=0, owWidth=0; 29 el = document.getElementById('content');
28 30
29function 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'; 36tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);
39 document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
40}
41
42tinyMCEPopup.onInit.add(onLoadInit); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js b/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js
index 6701b99..a52731c 100755..100644
--- a/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js
+++ b/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js
@@ -1,56 +1,51 @@
1tinyMCEPopup.requireLangPack(); 1tinyMCEPopup.requireLangPack();
2 2
3function saveContent() { 3var PasteWordDialog = {
4 var html = document.getElementById("frmData").contentWindow.document.body.innerHTML; 4 init : function() {
5 var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
5 6
6 if (html == ''){ 7 // Create iframe
7 tinyMCEPopup.close(); 8 el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
8 return false; 9 ifr = document.getElementById('iframe');
9 } 10 doc = ifr.contentWindow.document;
10
11 tinyMCEPopup.execCommand('mcePasteWord', false, html);
12 tinyMCEPopup.close();
13}
14 11
15function onLoadInit() { 12 // Force absolute CSS urls
16 tinyMCEPopup.resizeToInnerSize(); 13 css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
14 css = css.concat(tinymce.explode(ed.settings.content_css) || []);
15 tinymce.each(css, function(u) {
16 cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
17 });
17 18
18 // Fix for endless reloading in FF 19 // Write content into iframe
19 window.setTimeout(createIFrame, 10); 20 doc.open();
20} 21 doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
22 doc.close();
21 23
22function createIFrame() { 24 doc.designMode = 'on';
23 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>'; 25 this.resize();
24}
25 26
26var wHeight=0, wWidth=0, owHeight=0, owWidth=0; 27 window.setTimeout(function() {
28 ifr.contentWindow.focus();
29 }, 10);
30 },
27 31
28function initIframe(doc) { 32 insert : function() {
29 var dir = tinyMCEPopup.editor.settings.directionality; 33 var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
30 34
31 doc.body.dir = dir; 35 tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
32 36 tinyMCEPopup.close();
33 // Remove Gecko spellchecking 37 },
34 if (tinymce.isGecko)
35 doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
36 38
37 resizeInputs(); 39 resize : function() {
38} 40 var vp = tinyMCEPopup.dom.getViewPort(window), el;
39 41
40function resizeInputs() { 42 el = document.getElementById('iframe');
41 if (!tinymce.isIE) {
42 wHeight = self.innerHeight - 80;
43 wWidth = self.innerWidth - 18;
44 } else {
45 wHeight = document.body.clientHeight - 80;
46 wWidth = document.body.clientWidth - 18;
47 }
48 43
49 var elm = document.getElementById('frmData'); 44 if (el) {
50 if (elm) { 45 el.style.width = (vp.w - 20) + 'px';
51 elm.style.height = Math.abs(wHeight) + 'px'; 46 el.style.height = (vp.h - 90) + 'px';
52 elm.style.width = Math.abs(wWidth) + 'px'; 47 }
53 } 48 }
54} 49};
55 50
56tinyMCEPopup.onInit.add(onLoadInit); 51tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);