]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/debian/missing-sources/framework/Web/Javascripts/source/tinymce-405/plugins/paste/classes/Plugin.js
baculum: Add missing-sources directory in debian metadata structure
[bacula/bacula] / gui / baculum / debian / missing-sources / framework / Web / Javascripts / source / tinymce-405 / plugins / paste / classes / Plugin.js
1 /**
2  * Plugin.js
3  *
4  * Copyright, Moxiecode Systems AB
5  * Released under LGPL License.
6  *
7  * License: http://www.tinymce.com/license
8  * Contributing: http://www.tinymce.com/contributing
9  */
10
11 /**
12  * This class contains the tinymce plugin logic for the paste plugin.
13  *
14  * @class tinymce.pasteplugin.Plugin
15  * @private
16  */
17 define("tinymce/pasteplugin/Plugin", [
18         "tinymce/PluginManager",
19         "tinymce/pasteplugin/Clipboard",
20         "tinymce/pasteplugin/WordFilter",
21         "tinymce/pasteplugin/Quirks"
22 ], function(PluginManager, Clipboard, WordFilter, Quirks) {
23         var userIsInformed;
24
25         PluginManager.add('paste', function(editor) {
26                 var self = this, clipboard;
27
28                 function togglePlainTextPaste() {
29                         if (clipboard.pasteFormat == "text") {
30                                 this.active(false);
31                                 clipboard.pasteFormat = "html";
32                         } else {
33                                 clipboard.pasteFormat = "text";
34                                 this.active(true);
35
36                                 if (!userIsInformed) {
37                                         editor.windowManager.alert(
38                                                 'Paste is now in plain text mode. Contents will now ' +
39                                                 'be pasted as plain text until you toggle this option off.'
40                                         );
41
42                                         userIsInformed = true;
43                                 }
44                         }
45                 }
46
47                 self.clipboard = clipboard = new Clipboard(editor);
48                 self.quirks = new Quirks(editor);
49                 self.wordFilter = new WordFilter(editor);
50
51                 if (editor.settings.paste_as_text) {
52                         self.clipboard.pasteFormat = "text";
53                 }
54
55                 editor.addCommand('mceInsertClipboardContent', function(ui, value) {
56                         if (value.content) {
57                                 self.clipboard.paste(value.content);
58                         }
59
60                         if (value.text) {
61                                 self.clipboard.pasteText(value.text);
62                         }
63                 });
64
65                 editor.addButton('pastetext', {
66                         icon: 'pastetext',
67                         tooltip: 'Paste as text',
68                         onclick: togglePlainTextPaste,
69                         active: self.clipboard.pasteFormat == "text"
70                 });
71
72                 editor.addMenuItem('pastetext', {
73                         text: 'Paste as text',
74                         selectable: true,
75                         active: clipboard.pasteFormat,
76                         onclick: togglePlainTextPaste
77                 });
78         });
79 });