X-Git-Url: http://git.dj3c1t.com/index.cgi?a=blobdiff_plain;f=mw%2Flibs%2Ftiny_mce%2Fplugins%2Fpaste%2Fjs%2Fpastetext.js;fp=mw%2Flibs%2Ftiny_mce%2Fplugins%2Fpaste%2Fjs%2Fpastetext.js;h=c524f9eb033881f3c9463ff2d284dbb541454f1a;hb=36ed114046cbe3d72a3589230e9f306a54fcc79d;hp=0000000000000000000000000000000000000000;hpb=281c96e95451269f2614684b8de5be25862c8374;p=mtweb diff --git a/mw/libs/tiny_mce/plugins/paste/js/pastetext.js b/mw/libs/tiny_mce/plugins/paste/js/pastetext.js new file mode 100644 index 0000000..c524f9e --- /dev/null +++ b/mw/libs/tiny_mce/plugins/paste/js/pastetext.js @@ -0,0 +1,36 @@ +tinyMCEPopup.requireLangPack(); + +var PasteTextDialog = { + init : function() { + this.resize(); + }, + + insert : function() { + var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines; + + // Convert linebreaks into paragraphs + if (document.getElementById('linebreaks').checked) { + lines = h.split(/\r?\n/); + if (lines.length > 1) { + h = ''; + tinymce.each(lines, function(row) { + h += '

' + row + '

'; + }); + } + } + + tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h}); + tinyMCEPopup.close(); + }, + + resize : function() { + var vp = tinyMCEPopup.dom.getViewPort(window), el; + + el = document.getElementById('content'); + + el.style.width = (vp.w - 20) + 'px'; + el.style.height = (vp.h - 90) + 'px'; + } +}; + +tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);