annotate WebContent/jscripts/tiny_mce/plugins/paste/js/pastetext.js @ 6:5bb7cc86069c

restlet.jar
author dwinter
date Wed, 14 Mar 2012 16:21:45 +0100
parents 0be9d53a6967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 tinyMCEPopup.requireLangPack();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 var PasteTextDialog = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4 init : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 this.resize();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 insert : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 // Convert linebreaks into paragraphs
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 if (document.getElementById('linebreaks').checked) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13 lines = h.split(/\r?\n/);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 if (lines.length > 1) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 h = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 tinymce.each(lines, function(row) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 h += '<p>' + row + '</p>';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 resize : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 var vp = tinyMCEPopup.dom.getViewPort(window), el;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 el = document.getElementById('content');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 el.style.width = (vp.w - 20) + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 el.style.height = (vp.h - 90) + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);