]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/plugins/pastetext/plugin.js
2 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
7 * @fileOverview Paste as plain text plugin.
11 // The pastetext command definition.
13 // Snapshots are done manually by editable.insertXXX methods.
17 exec: function( editor
) {
18 editor
.getClipboardData( { title: editor
.lang
.pastetext
.title
}, function( data
) {
19 // Do not use editor#paste, because it would start from beforePaste event.
20 data
&& editor
.fire( 'paste', {
22 dataValue: data
.dataValue
,
24 dataTransfer: CKEDITOR
.plugins
.clipboard
.initPasteDataTransfer()
27 editor
.fire( 'afterCommandExec', {
29 command: pasteTextCmd
,
36 // Register the plugin.
37 CKEDITOR
.plugins
.add( 'pastetext', {
38 requires: 'clipboard',
39 // jscs:disable maximumLineLength
40 lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
41 // jscs:enable maximumLineLength
42 icons: 'pastetext,pastetext-rtl', // %REMOVE_LINE_CORE%
43 hidpi: true, // %REMOVE_LINE_CORE%
44 init: function( editor
) {
45 var commandName
= 'pastetext';
47 editor
.addCommand( commandName
, pasteTextCmd
);
49 editor
.ui
.addButton
&& editor
.ui
.addButton( 'PasteText', {
50 label: editor
.lang
.pastetext
.button
,
52 toolbar: 'clipboard,40'
55 if ( editor
.config
.forcePasteAsPlainText
) {
56 editor
.on( 'beforePaste', function( evt
) {
57 // Do NOT overwrite if HTML format is explicitly requested.
58 // This allows pastefromword dominates over pastetext.
59 if ( evt
.data
.type
!= 'html' )
60 evt
.data
.type
= 'text';
64 editor
.on( 'pasteState', function( evt
) {
65 editor
.getCommand( commandName
).setState( evt
.data
);
73 * Whether to force all pasting operations to insert on plain text into the
74 * editor, loosing any formatting information possibly available in the source
77 * **Note:** paste from word (dialog) is not affected by this configuration.
79 * config.forcePasteAsPlainText = true;
81 * @cfg {Boolean} [forcePasteAsPlainText=false]
82 * @member CKEDITOR.config