4 * Copyright, Moxiecode Systems AB
5 * Released under LGPL License.
7 * License: http://www.tinymce.com/license
8 * Contributing: http://www.tinymce.com/contributing
12 * This class contains the tinymce plugin logic for the paste plugin.
14 * @class tinymce.pasteplugin.Plugin
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) {
25 PluginManager.add('paste', function(editor) {
26 var self = this, clipboard;
28 function togglePlainTextPaste() {
29 if (clipboard.pasteFormat == "text") {
31 clipboard.pasteFormat = "html";
33 clipboard.pasteFormat = "text";
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.'
42 userIsInformed = true;
47 self.clipboard = clipboard = new Clipboard(editor);
48 self.quirks = new Quirks(editor);
49 self.wordFilter = new WordFilter(editor);
51 if (editor.settings.paste_as_text) {
52 self.clipboard.pasteFormat = "text";
55 editor.addCommand('mceInsertClipboardContent', function(ui, value) {
57 self.clipboard.paste(value.content);
61 self.clipboard.pasteText(value.text);
65 editor.addButton('pastetext', {
67 tooltip: 'Paste as text',
68 onclick: togglePlainTextPaste,
69 active: self.clipboard.pasteFormat == "text"
72 editor.addMenuItem('pastetext', {
73 text: 'Paste as text',
75 active: clipboard.pasteFormat,
76 onclick: togglePlainTextPaste