+++ /dev/null
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-(function()\r
-{\r
- // Map 'true' and 'false' values to match W3C's specifications\r
- // http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5\r
- var checkboxValues =\r
- {\r
- scrolling : { 'true' : 'yes', 'false' : 'no' },\r
- frameborder : { 'true' : '1', 'false' : '0' }\r
- };\r
-\r
- function loadValue( iframeNode )\r
- {\r
- var isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox;\r
- if ( iframeNode.hasAttribute( this.id ) )\r
- {\r
- var value = iframeNode.getAttribute( this.id );\r
- if ( isCheckbox )\r
- this.setValue( checkboxValues[ this.id ][ 'true' ] == value.toLowerCase() );\r
- else\r
- this.setValue( value );\r
- }\r
- }\r
-\r
- function commitValue( iframeNode )\r
- {\r
- var isRemove = this.getValue() === '',\r
- isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox,\r
- value = this.getValue();\r
- if ( isRemove )\r
- iframeNode.removeAttribute( this.att || this.id );\r
- else if ( isCheckbox )\r
- iframeNode.setAttribute( this.id, checkboxValues[ this.id ][ value ] );\r
- else\r
- iframeNode.setAttribute( this.att || this.id, value );\r
- }\r
-\r
- CKEDITOR.dialog.add( 'iframe', function( editor )\r
- {\r
- var iframeLang = editor.lang.iframe,\r
- commonLang = editor.lang.common,\r
- dialogadvtab = editor.plugins.dialogadvtab;\r
- return {\r
- title : iframeLang.title,\r
- minWidth : 350,\r
- minHeight : 260,\r
- onShow : function()\r
- {\r
- // Clear previously saved elements.\r
- this.fakeImage = this.iframeNode = null;\r
-\r
- var fakeImage = this.getSelectedElement();\r
- if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'iframe' )\r
- {\r
- this.fakeImage = fakeImage;\r
-\r
- var iframeNode = editor.restoreRealElement( fakeImage );\r
- this.iframeNode = iframeNode;\r
-\r
- this.setupContent( iframeNode );\r
- }\r
- },\r
- onOk : function()\r
- {\r
- var iframeNode;\r
- if ( !this.fakeImage )\r
- iframeNode = new CKEDITOR.dom.element( 'iframe' );\r
- else\r
- iframeNode = this.iframeNode;\r
-\r
- // A subset of the specified attributes/styles\r
- // should also be applied on the fake element to\r
- // have better visual effect. (#5240)\r
- var extraStyles = {}, extraAttributes = {};\r
- this.commitContent( iframeNode, extraStyles, extraAttributes );\r
-\r
- // Refresh the fake image.\r
- var newFakeImage = editor.createFakeElement( iframeNode, 'cke_iframe', 'iframe', true );\r
- newFakeImage.setAttributes( extraAttributes );\r
- newFakeImage.setStyles( extraStyles );\r
- if ( this.fakeImage )\r
- {\r
- newFakeImage.replace( this.fakeImage );\r
- editor.getSelection().selectElement( newFakeImage );\r
- }\r
- else\r
- editor.insertElement( newFakeImage );\r
- },\r
- contents : [\r
- {\r
- id : 'info',\r
- label : commonLang.generalTab,\r
- accessKey : 'I',\r
- elements :\r
- [\r
- {\r
- type : 'vbox',\r
- padding : 0,\r
- children :\r
- [\r
- {\r
- id : 'src',\r
- type : 'text',\r
- label : commonLang.url,\r
- required : true,\r
- validate : CKEDITOR.dialog.validate.notEmpty( iframeLang.noUrl ),\r
- setup : loadValue,\r
- commit : commitValue\r
- }\r
- ]\r
- },\r
- {\r
- type : 'hbox',\r
- children :\r
- [\r
- {\r
- id : 'width',\r
- type : 'text',\r
- style : 'width:100%',\r
- labelLayout : 'vertical',\r
- label : commonLang.width,\r
- validate : CKEDITOR.dialog.validate.htmlLength( commonLang.invalidHtmlLength.replace( '%1', commonLang.width ) ),\r
- setup : loadValue,\r
- commit : commitValue\r
- },\r
- {\r
- id : 'height',\r
- type : 'text',\r
- style : 'width:100%',\r
- labelLayout : 'vertical',\r
- label : commonLang.height,\r
- validate : CKEDITOR.dialog.validate.htmlLength( commonLang.invalidHtmlLength.replace( '%1', commonLang.height ) ),\r
- setup : loadValue,\r
- commit : commitValue\r
- },\r
- {\r
- id : 'align',\r
- type : 'select',\r
- 'default' : '',\r
- items :\r
- [\r
- [ commonLang.notSet , '' ],\r
- [ commonLang.alignLeft , 'left' ],\r
- [ commonLang.alignRight , 'right' ],\r
- [ commonLang.alignTop , 'top' ],\r
- [ commonLang.alignMiddle , 'middle' ],\r
- [ commonLang.alignBottom , 'bottom' ]\r
- ],\r
- style : 'width:100%',\r
- labelLayout : 'vertical',\r
- label : commonLang.align,\r
- setup : function( iframeNode, fakeImage )\r
- {\r
- loadValue.apply( this, arguments );\r
- if ( fakeImage )\r
- {\r
- var fakeImageAlign = fakeImage.getAttribute( 'align' );\r
- this.setValue( fakeImageAlign && fakeImageAlign.toLowerCase() || '' );\r
- }\r
- },\r
- commit : function( iframeNode, extraStyles, extraAttributes )\r
- {\r
- commitValue.apply( this, arguments );\r
- if ( this.getValue() )\r
- extraAttributes.align = this.getValue();\r
- }\r
- }\r
- ]\r
- },\r
- {\r
- type : 'hbox',\r
- widths : [ '50%', '50%' ],\r
- children :\r
- [\r
- {\r
- id : 'scrolling',\r
- type : 'checkbox',\r
- label : iframeLang.scrolling,\r
- setup : loadValue,\r
- commit : commitValue\r
- },\r
- {\r
- id : 'frameborder',\r
- type : 'checkbox',\r
- label : iframeLang.border,\r
- setup : loadValue,\r
- commit : commitValue\r
- }\r
- ]\r
- },\r
- {\r
- type : 'hbox',\r
- widths : [ '50%', '50%' ],\r
- children :\r
- [\r
- {\r
- id : 'name',\r
- type : 'text',\r
- label : commonLang.name,\r
- setup : loadValue,\r
- commit : commitValue\r
- },\r
- {\r
- id : 'title',\r
- type : 'text',\r
- label : commonLang.advisoryTitle,\r
- setup : loadValue,\r
- commit : commitValue\r
- }\r
- ]\r
- },\r
- {\r
- id : 'longdesc',\r
- type : 'text',\r
- label : commonLang.longDescr,\r
- setup : loadValue,\r
- commit : commitValue\r
- }\r
- ]\r
- },\r
- dialogadvtab && dialogadvtab.createAdvancedTab( editor, { id:1, classes:1, styles:1 })\r
- ]\r
- };\r
- });\r
-})();\r