PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
JavaScript | 36 lines | 27 code | 8 blank | 1 comment | 2 complexity | d6e4b39f19b89118b34b0d21491494b7 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. tinyMCEPopup.requireLangPack();
  2. var PasteTextDialog = {
  3. init : function() {
  4. this.resize();
  5. },
  6. insert : function() {
  7. var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
  8. // Convert linebreaks into paragraphs
  9. if (document.getElementById('linebreaks').checked) {
  10. lines = h.split(/\r?\n/);
  11. if (lines.length > 1) {
  12. h = '';
  13. tinymce.each(lines, function(row) {
  14. h += '<p>' + row + '</p>';
  15. });
  16. }
  17. }
  18. tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
  19. tinyMCEPopup.close();
  20. },
  21. resize : function() {
  22. var vp = tinyMCEPopup.dom.getViewPort(window), el;
  23. el = document.getElementById('content');
  24. el.style.width = (vp.w - 20) + 'px';
  25. el.style.height = (vp.h - 90) + 'px';
  26. }
  27. };
  28. tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);