]> git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blame - sources/plugins/iframe/plugin.js
Update to 4.7.3
[perso/Immae/Projets/packagist/ludivine-ckeditor-component.git] / sources / plugins / iframe / plugin.js
CommitLineData
c63493c8
IB
1/**\r
2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.\r
3 * For licensing, see LICENSE.md or http://ckeditor.com/license\r
4 */\r
5\r
6( function() {\r
7 CKEDITOR.plugins.add( 'iframe', {\r
8 requires: 'dialog,fakeobjects',\r
9 // jscs:disable maximumLineLength\r
1794320d 10 lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,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,oc,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%\r
c63493c8
IB
11 // jscs:enable maximumLineLength\r
12 icons: 'iframe', // %REMOVE_LINE_CORE%\r
13 hidpi: true, // %REMOVE_LINE_CORE%\r
14 onLoad: function() {\r
15 CKEDITOR.addCss( 'img.cke_iframe' +\r
16 '{' +\r
17 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/placeholder.png' ) + ');' +\r
18 'background-position: center center;' +\r
19 'background-repeat: no-repeat;' +\r
20 'border: 1px solid #a9a9a9;' +\r
21 'width: 80px;' +\r
22 'height: 80px;' +\r
23 '}'\r
24 );\r
25 },\r
26 init: function( editor ) {\r
27 var pluginName = 'iframe',\r
28 lang = editor.lang.iframe,\r
29 allowed = 'iframe[align,longdesc,frameborder,height,name,scrolling,src,title,width]';\r
30\r
31 if ( editor.plugins.dialogadvtab )\r
32 allowed += ';iframe' + editor.plugins.dialogadvtab.allowedContent( { id: 1, classes: 1, styles: 1 } );\r
33\r
34 CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/iframe.js' );\r
35 editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName, {\r
36 allowedContent: allowed,\r
37 requiredContent: 'iframe'\r
38 } ) );\r
39\r
40 editor.ui.addButton && editor.ui.addButton( 'Iframe', {\r
41 label: lang.toolbar,\r
42 command: pluginName,\r
43 toolbar: 'insert,80'\r
44 } );\r
45\r
46 editor.on( 'doubleclick', function( evt ) {\r
47 var element = evt.data.element;\r
48 if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' )\r
49 evt.data.dialog = 'iframe';\r
50 } );\r
51\r
52 if ( editor.addMenuItems ) {\r
53 editor.addMenuItems( {\r
54 iframe: {\r
55 label: lang.title,\r
56 command: 'iframe',\r
57 group: 'image'\r
58 }\r
59 } );\r
60 }\r
61\r
62 // If the "contextmenu" plugin is loaded, register the listeners.\r
63 if ( editor.contextMenu ) {\r
64 editor.contextMenu.addListener( function( element ) {\r
65 if ( element && element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' )\r
66 return { iframe: CKEDITOR.TRISTATE_OFF };\r
67 } );\r
68 }\r
69 },\r
70 afterInit: function( editor ) {\r
71 var dataProcessor = editor.dataProcessor,\r
72 dataFilter = dataProcessor && dataProcessor.dataFilter;\r
73\r
74 if ( dataFilter ) {\r
75 dataFilter.addRules( {\r
76 elements: {\r
77 iframe: function( element ) {\r
78 return editor.createFakeParserElement( element, 'cke_iframe', 'iframe', true );\r
79 }\r
80 }\r
81 } );\r
82 }\r
83 }\r
84 } );\r
85} )();\r