]>
git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blob - sources/plugins/iframe/dialogs/iframe.js
22c24f7a098999275067ef0e867fcfa29823d00e
2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
7 // Map 'true' and 'false' values to match W3C's specifications
8 // http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5
10 scrolling: { 'true': 'yes', 'false': 'no' },
11 frameborder: { 'true': '1', 'false': '0' }
14 function loadValue( iframeNode
) {
15 var isCheckbox
= this instanceof CKEDITOR
.ui
.dialog
.checkbox
;
16 if ( iframeNode
.hasAttribute( this.id
) ) {
17 var value
= iframeNode
.getAttribute( this.id
);
19 this.setValue( checkboxValues
[ this.id
][ 'true' ] == value
.toLowerCase() );
21 this.setValue( value
);
25 function commitValue( iframeNode
) {
26 var isRemove
= this.getValue() === '',
27 isCheckbox
= this instanceof CKEDITOR
.ui
.dialog
.checkbox
,
28 value
= this.getValue();
30 iframeNode
.removeAttribute( this.att
|| this.id
);
31 else if ( isCheckbox
)
32 iframeNode
.setAttribute( this.id
, checkboxValues
[ this.id
][ value
] );
34 iframeNode
.setAttribute( this.att
|| this.id
, value
);
37 CKEDITOR
.dialog
.add( 'iframe', function( editor
) {
38 var iframeLang
= editor
.lang
.iframe
,
39 commonLang
= editor
.lang
.common
,
40 dialogadvtab
= editor
.plugins
.dialogadvtab
;
42 title: iframeLang
.title
,
46 // Clear previously saved elements.
47 this.fakeImage
= this.iframeNode
= null;
49 var fakeImage
= this.getSelectedElement();
50 if ( fakeImage
&& fakeImage
.data( 'cke-real-element-type' ) && fakeImage
.data( 'cke-real-element-type' ) == 'iframe' ) {
51 this.fakeImage
= fakeImage
;
53 var iframeNode
= editor
.restoreRealElement( fakeImage
);
54 this.iframeNode
= iframeNode
;
56 this.setupContent( iframeNode
);
61 if ( !this.fakeImage
)
62 iframeNode
= new CKEDITOR
.dom
.element( 'iframe' );
64 iframeNode
= this.iframeNode
;
66 // A subset of the specified attributes/styles
67 // should also be applied on the fake element to
68 // have better visual effect. (http://dev.ckeditor.com/ticket/5240)
71 this.commitContent( iframeNode
, extraStyles
, extraAttributes
);
73 // Refresh the fake image.
74 var newFakeImage
= editor
.createFakeElement( iframeNode
, 'cke_iframe', 'iframe', true );
75 newFakeImage
.setAttributes( extraAttributes
);
76 newFakeImage
.setStyles( extraStyles
);
77 if ( this.fakeImage
) {
78 newFakeImage
.replace( this.fakeImage
);
79 editor
.getSelection().selectElement( newFakeImage
);
81 editor
.insertElement( newFakeImage
);
86 label: commonLang
.generalTab
,
94 label: commonLang
.url
,
96 validate: CKEDITOR
.dialog
.validate
.notEmpty( iframeLang
.noUrl
),
106 requiredContent: 'iframe[width]',
108 labelLayout: 'vertical',
109 label: commonLang
.width
,
110 validate: CKEDITOR
.dialog
.validate
.htmlLength( commonLang
.invalidHtmlLength
.replace( '%1', commonLang
.width
) ),
117 requiredContent: 'iframe[height]',
119 labelLayout: 'vertical',
120 label: commonLang
.height
,
121 validate: CKEDITOR
.dialog
.validate
.htmlLength( commonLang
.invalidHtmlLength
.replace( '%1', commonLang
.height
) ),
128 requiredContent: 'iframe[align]',
131 [ commonLang
.notSet
, '' ],
132 [ commonLang
.alignLeft
, 'left' ],
133 [ commonLang
.alignRight
, 'right' ],
134 [ commonLang
.alignTop
, 'top' ],
135 [ commonLang
.alignMiddle
, 'middle' ],
136 [ commonLang
.alignBottom
, 'bottom' ]
139 labelLayout: 'vertical',
140 label: commonLang
.align
,
141 setup: function( iframeNode
, fakeImage
) {
142 loadValue
.apply( this, arguments
);
144 var fakeImageAlign
= fakeImage
.getAttribute( 'align' );
145 this.setValue( fakeImageAlign
&& fakeImageAlign
.toLowerCase() || '' );
148 commit: function( iframeNode
, extraStyles
, extraAttributes
) {
149 commitValue
.apply( this, arguments
);
150 if ( this.getValue() )
151 extraAttributes
.align
= this.getValue();
157 widths: [ '50%', '50%' ],
161 requiredContent: 'iframe[scrolling]',
162 label: iframeLang
.scrolling
,
169 requiredContent: 'iframe[frameborder]',
170 label: iframeLang
.border
,
177 widths: [ '50%', '50%' ],
181 requiredContent: 'iframe[name]',
182 label: commonLang
.name
,
189 requiredContent: 'iframe[title]',
190 label: commonLang
.advisoryTitle
,
198 requiredContent: 'iframe[longdesc]',
199 label: commonLang
.longDescr
,
204 dialogadvtab
&& dialogadvtab
.createAdvancedTab( editor
, { id: 1, classes: 1, styles: 1 }, 'iframe' )