summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2014-06-07 07:55:00 +0100
committerlsces <lester@lsces.co.uk>2014-06-07 07:55:00 +0100
commitdf3b0a2f728f40b3a7cd7b9c8466027d70e34898 (patch)
tree92fefc3c23f4fe388b7a1eb22e66aaf4e9045a75 /plugins
parent090bb311ef748e4503645ebe6de881dcede15620 (diff)
downloadckeditor-df3b0a2f728f40b3a7cd7b9c8466027d70e34898.tar.gz
ckeditor-df3b0a2f728f40b3a7cd7b9c8466027d70e34898.tar.bz2
ckeditor-df3b0a2f728f40b3a7cd7b9c8466027d70e34898.zip
Upgrade to version 4.3
Diffstat (limited to 'plugins')
-rwxr-xr-x[-rw-r--r--]plugins/about/dialogs/about.js80
-rwxr-xr-x[-rw-r--r--]plugins/about/dialogs/logo_ckeditor.pngbin2759 -> 6757 bytes
-rwxr-xr-x[-rw-r--r--]plugins/clipboard/dialogs/paste.js239
-rwxr-xr-x[-rw-r--r--]plugins/colordialog/dialogs/colordialog.js353
-rwxr-xr-x[-rw-r--r--]plugins/dialog/dialogDefinition.js1010
-rwxr-xr-x[-rw-r--r--]plugins/div/dialogs/div.js466
-rwxr-xr-x[-rw-r--r--]plugins/find/dialogs/find.js809
-rwxr-xr-x[-rw-r--r--]plugins/flash/dialogs/flash.js692
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/button.js108
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/checkbox.js138
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/form.js159
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/hiddenfield.js93
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/radio.js123
13 files changed, 132 insertions, 4138 deletions
diff --git a/plugins/about/dialogs/about.js b/plugins/about/dialogs/about.js
index 8c1f2e1..d9b8194 100644..100755
--- a/plugins/about/dialogs/about.js
+++ b/plugins/about/dialogs/about.js
@@ -1,73 +1,7 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-CKEDITOR.dialog.add( 'about', function( editor ) {
- var lang = editor.lang.about;
-
- return {
- title: CKEDITOR.env.ie ? lang.dlgTitle : lang.title,
- minWidth: 390,
- minHeight: 230,
- contents: [
- {
- id: 'tab1',
- label: '',
- title: '',
- expand: true,
- padding: 0,
- elements: [
- {
- type: 'html',
- html: '<style type="text/css">' +
- '.cke_about_container' +
- '{' +
- 'color:#000 !important;' +
- 'padding:10px 10px 0;' +
- 'margin-top:5px' +
- '}' +
- '.cke_about_container p' +
- '{' +
- 'margin: 0 0 10px;' +
- '}' +
- '.cke_about_container .cke_about_logo' +
- '{' +
- 'height:81px;' +
- 'background-color:#fff;' +
- 'background-image:url(' + CKEDITOR.plugins.get( 'about' ).path + 'dialogs/logo_ckeditor.png);' +
- 'background-position:center; ' +
- 'background-repeat:no-repeat;' +
- 'margin-bottom:10px;' +
- '}' +
- '.cke_about_container a' +
- '{' +
- 'cursor:pointer !important;' +
- 'color:#00B2CE !important;' +
- 'text-decoration:underline !important;' +
- '}' +
- '</style>' +
- '<div class="cke_about_container">' +
- '<div class="cke_about_logo"></div>' +
- '<p>' +
- 'CKEditor ' + CKEDITOR.version + ' (revision ' + CKEDITOR.revision + ')<br>' +
- '<a href="http://ckeditor.com/">http://ckeditor.com</a>' +
- '</p>' +
- '<p>' +
- lang.help.replace( '$1', '<a href="http://docs.ckeditor.com/user">' + lang.userGuide + '</a>' ) +
- '</p>' +
- '<p>' +
- lang.moreInfo + '<br>' +
- '<a href="http://ckeditor.com/about/license">http://ckeditor.com/about/license</a>' +
- '</p>' +
- '<p>' +
- lang.copy.replace( '$1', '<a href="http://cksource.com/">CKSource</a> - Frederico Knabben' ) +
- '</p>' +
- '</div>'
- }
- ]
- }
- ],
- buttons: [ CKEDITOR.dialog.cancelButton ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("about",function(a){var a=a.lang.about,b=CKEDITOR.plugins.get("about").path+"dialogs/"+(CKEDITOR.env.hidpi?"hidpi/":"")+"logo_ckeditor.png";return{title:CKEDITOR.env.ie?a.dlgTitle:a.title,minWidth:390,minHeight:230,contents:[{id:"tab1",label:"",title:"",expand:!0,padding:0,elements:[{type:"html",html:'<style type="text/css">.cke_about_container{color:#000 !important;padding:10px 10px 0;margin-top:5px}.cke_about_container p{margin: 0 0 10px;}.cke_about_container .cke_about_logo{height:81px;background-color:#fff;background-image:url('+
+b+");"+(CKEDITOR.env.hidpi?"background-size:163px 58px;":"")+'background-position:center; background-repeat:no-repeat;margin-bottom:10px;}.cke_about_container a{cursor:pointer !important;color:#00B2CE !important;text-decoration:underline !important;}</style><div class="cke_about_container"><div class="cke_about_logo"></div><p>CKEditor '+CKEDITOR.version+" (revision "+CKEDITOR.revision+')<br><a href="http://ckeditor.com/">http://ckeditor.com</a></p><p>'+a.help.replace("$1",'<a href="http://docs.ckeditor.com/user">'+
+a.userGuide+"</a>")+"</p><p>"+a.moreInfo+'<br><a href="http://ckeditor.com/about/license">http://ckeditor.com/about/license</a></p><p>'+a.copy.replace("$1",'<a href="http://cksource.com/">CKSource</a> - Frederico Knabben')+"</p></div>"}]}],buttons:[CKEDITOR.dialog.cancelButton]}}); \ No newline at end of file
diff --git a/plugins/about/dialogs/logo_ckeditor.png b/plugins/about/dialogs/logo_ckeditor.png
index ad01902..f186eb8 100644..100755
--- a/plugins/about/dialogs/logo_ckeditor.png
+++ b/plugins/about/dialogs/logo_ckeditor.png
Binary files differ
diff --git a/plugins/clipboard/dialogs/paste.js b/plugins/clipboard/dialogs/paste.js
index 892c6c3..0c7e256 100644..100755
--- a/plugins/clipboard/dialogs/paste.js
+++ b/plugins/clipboard/dialogs/paste.js
@@ -1,228 +1,11 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-CKEDITOR.dialog.add( 'paste', function( editor ) {
- var lang = editor.lang.clipboard;
-
- function onPasteFrameLoad( win ) {
- var doc = new CKEDITOR.dom.document( win.document ),
- body = doc.getBody(),
- script = doc.getById( 'cke_actscrpt' );
-
- script && script.remove();
-
- body.setAttribute( 'contenteditable', true );
-
- // IE before version 8 will leave cursor blinking inside the document after
- // editor blurred unless we clean up the selection. (#4716)
- if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) {
- doc.getWindow().on( 'blur', function() {
- doc.$.selection.empty();
- });
- }
-
- doc.on( 'keydown', function( e ) {
- var domEvent = e.data,
- key = domEvent.getKeystroke(),
- processed;
-
- switch ( key ) {
- case 27:
- this.hide();
- processed = 1;
- break;
-
- case 9:
- case CKEDITOR.SHIFT + 9:
- this.changeFocus( 1 );
- processed = 1;
- }
-
- processed && domEvent.preventDefault();
- }, this );
-
- editor.fire( 'ariaWidget', new CKEDITOR.dom.element( win.frameElement ) );
-
- // Handle pending focus.
- if ( doc.getWindow().getFrame().removeCustomData( 'pendingFocus' ) )
- body.focus();
- }
-
- // If pasteDialogCommit wasn't canceled by e.g. editor.getClipboardData
- // then fire paste event.
- // Do not use editor#paste, because it would start from beforePaste event.
- editor.on( 'pasteDialogCommit', function( evt ) {
- if ( evt.data )
- editor.fire( 'paste', { type: 'auto', dataValue: evt.data } );
- }, null, null, 1000 );
-
- return {
- title: lang.title,
-
- minWidth: CKEDITOR.env.ie && CKEDITOR.env.quirks ? 370 : 350,
- minHeight: CKEDITOR.env.quirks ? 250 : 245,
- onShow: function() {
- // FIREFOX BUG: Force the browser to render the dialog to make the to-be-
- // inserted iframe editable. (#3366)
- this.parts.dialog.$.offsetHeight;
-
- this.setupContent();
-
- // Set dialog title to the custom value (set e.g. in editor.openDialog callback) and reset this value.
- // If custom title not set, use default one.
- this.parts.title.setHtml( this.customTitle || lang.title );
- this.customTitle = null;
- },
-
- onLoad: function() {
- if ( ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) && editor.lang.dir == 'rtl' )
- this.parts.contents.setStyle( 'overflow', 'hidden' );
- },
-
- onOk: function() {
- this.commitContent();
- },
-
- contents: [
- {
- id: 'general',
- label: editor.lang.common.generalTab,
- elements: [
- {
- type: 'html',
- id: 'securityMsg',
- html: '<div style="white-space:normal;width:340px">' + lang.securityMsg + '</div>'
- },
- {
- type: 'html',
- id: 'pasteMsg',
- html: '<div style="white-space:normal;width:340px">' + lang.pasteMsg + '</div>'
- },
- {
- type: 'html',
- id: 'editing_area',
- style: 'width:100%;height:100%',
- html: '',
- focus: function() {
- var iframe = this.getInputElement(),
- doc = iframe.getFrameDocument(),
- body = doc.getBody();
-
- // Frame content may not loaded at the moment.
- if ( !body || body.isReadOnly() )
- iframe.setCustomData( 'pendingFocus', 1 );
- else
- body.focus();
- },
- setup: function() {
- var dialog = this.getDialog();
- var htmlToLoad = '<html dir="' + editor.config.contentsLangDirection + '"' +
- ' lang="' + ( editor.config.contentsLanguage || editor.langCode ) + '">' +
- '<head><style>body{margin:3px;height:95%}</style></head><body>' +
- '<script id="cke_actscrpt" type="text/javascript">' +
- 'window.parent.CKEDITOR.tools.callFunction(' + CKEDITOR.tools.addFunction( onPasteFrameLoad, dialog ) + ',this);' +
- '</script></body>' +
- '</html>';
-
- var src =
- CKEDITOR.env.air ?
- 'javascript:void(0)' :
- CKEDITOR.env.ie ?
- 'javascript:void((function(){' + encodeURIComponent(
- 'document.open();' +
- '(' + CKEDITOR.tools.fixDomain + ')();' +
- 'document.close();'
- ) + '})())"'
- : '';
-
- var iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +
- ' class="cke_pasteframe"' +
- ' frameborder="0" ' +
- ' allowTransparency="true"' +
- ' src="' + src + '"' +
- ' role="region"' +
- ' aria-label="' + lang.pasteArea + '"' +
- ' aria-describedby="' + dialog.getContentElement( 'general', 'pasteMsg' ).domId + '"' +
- ' aria-multiple="true"' +
- '></iframe>' );
-
- iframe.on( 'load', function( e ) {
- e.removeListener();
-
- var doc = iframe.getFrameDocument();
- doc.write( htmlToLoad );
-
- editor.focusManager.add( doc.getBody() );
-
- if ( CKEDITOR.env.air )
- onPasteFrameLoad.call( this, doc.getWindow().$ );
- }, dialog );
-
- iframe.setCustomData( 'dialog', dialog );
-
- var container = this.getElement();
- container.setHtml( '' );
- container.append( iframe );
-
- // IE need a redirect on focus to make
- // the cursor blinking inside iframe. (#5461)
- if ( CKEDITOR.env.ie ) {
- var focusGrabber = CKEDITOR.dom.element.createFromHtml( '<span tabindex="-1" style="position:absolute" role="presentation"></span>' );
- focusGrabber.on( 'focus', function() {
- // Since fixDomain is called in src attribute,
- // IE needs some slight delay to correctly move focus.
- setTimeout( function() {
- iframe.$.contentWindow.focus();
- } );
- } );
- container.append( focusGrabber );
-
- // Override focus handler on field.
- this.focus = function() {
- focusGrabber.focus();
- this.fire( 'focus' );
- };
- }
-
- this.getInputElement = function() {
- return iframe;
- };
-
- // Force container to scale in IE.
- if ( CKEDITOR.env.ie ) {
- container.setStyle( 'display', 'block' );
- container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' );
- }
- },
- commit: function( data ) {
- var editor = this.getDialog().getParentEditor(),
- body = this.getInputElement().getFrameDocument().getBody(),
- bogus = body.getBogus(),
- html;
- bogus && bogus.remove();
-
- // Saving the contents so changes until paste is complete will not take place (#7500)
- html = body.getHtml();
-
- // Opera needs some time to think about what has happened and what it should do now.
- setTimeout( function() {
- editor.fire( 'pasteDialogCommit', html );
- }, 0 );
- }
- }
- ]
- }
- ]
- };
-});
-
-/**
- * Internal event to pass paste dialog's data to the listeners.
- *
- * @private
- * @event pasteDialogCommit
- * @member CKEDITOR.editor
- * @param {CKEDITOR.editor} editor This editor instance.
- */
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("paste",function(c){function h(a){var b=new CKEDITOR.dom.document(a.document),f=b.getBody(),d=b.getById("cke_actscrpt");d&&d.remove();f.setAttribute("contenteditable",!0);if(CKEDITOR.env.ie&&8>CKEDITOR.env.version)b.getWindow().on("blur",function(){b.$.selection.empty()});b.on("keydown",function(a){var a=a.data,b;switch(a.getKeystroke()){case 27:this.hide();b=1;break;case 9:case CKEDITOR.SHIFT+9:this.changeFocus(1),b=1}b&&a.preventDefault()},this);c.fire("ariaWidget",new CKEDITOR.dom.element(a.frameElement));
+b.getWindow().getFrame().removeCustomData("pendingFocus")&&f.focus()}var e=c.lang.clipboard;c.on("pasteDialogCommit",function(a){a.data&&c.fire("paste",{type:"auto",dataValue:a.data})},null,null,1E3);return{title:e.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.quirks?250:245,onShow:function(){this.parts.dialog.$.offsetHeight;this.setupContent();this.parts.title.setHtml(this.customTitle||e.title);this.customTitle=null},onLoad:function(){(CKEDITOR.env.ie7Compat||
+CKEDITOR.env.ie6Compat)&&"rtl"==c.lang.dir&&this.parts.contents.setStyle("overflow","hidden")},onOk:function(){this.commitContent()},contents:[{id:"general",label:c.lang.common.generalTab,elements:[{type:"html",id:"securityMsg",html:'<div style="white-space:normal;width:340px">'+e.securityMsg+"</div>"},{type:"html",id:"pasteMsg",html:'<div style="white-space:normal;width:340px">'+e.pasteMsg+"</div>"},{type:"html",id:"editing_area",style:"width:100%;height:100%",html:"",focus:function(){var a=this.getInputElement(),
+b=a.getFrameDocument().getBody();!b||b.isReadOnly()?a.setCustomData("pendingFocus",1):b.focus()},setup:function(){var a=this.getDialog(),b='<html dir="'+c.config.contentsLangDirection+'" lang="'+(c.config.contentsLanguage||c.langCode)+'"><head><style>body{margin:3px;height:95%}</style></head><body><script id="cke_actscrpt" type="text/javascript">window.parent.CKEDITOR.tools.callFunction('+CKEDITOR.tools.addFunction(h,a)+",this);<\/script></body></html>",f=CKEDITOR.env.air?"javascript:void(0)":CKEDITOR.env.ie?
+"javascript:void((function(){"+encodeURIComponent("document.open();("+CKEDITOR.tools.fixDomain+")();document.close();")+'})())"':"",d=CKEDITOR.dom.element.createFromHtml('<iframe class="cke_pasteframe" frameborder="0" allowTransparency="true" src="'+f+'" role="region" aria-label="'+e.pasteArea+'" aria-describedby="'+a.getContentElement("general","pasteMsg").domId+'" aria-multiple="true"></iframe>');d.on("load",function(a){a.removeListener();a=d.getFrameDocument();a.write(b);c.focusManager.add(a.getBody());
+CKEDITOR.env.air&&h.call(this,a.getWindow().$)},a);d.setCustomData("dialog",a);a=this.getElement();a.setHtml("");a.append(d);if(CKEDITOR.env.ie){var g=CKEDITOR.dom.element.createFromHtml('<span tabindex="-1" style="position:absolute" role="presentation"></span>');g.on("focus",function(){setTimeout(function(){d.$.contentWindow.focus()})});a.append(g);this.focus=function(){g.focus();this.fire("focus")}}this.getInputElement=function(){return d};CKEDITOR.env.ie&&(a.setStyle("display","block"),a.setStyle("height",
+d.$.offsetHeight+2+"px"))},commit:function(){var a=this.getDialog().getParentEditor(),b=this.getInputElement().getFrameDocument().getBody(),c=b.getBogus(),d;c&&c.remove();d=b.getHtml();setTimeout(function(){a.fire("pasteDialogCommit",d)},0)}}]}]}}); \ No newline at end of file
diff --git a/plugins/colordialog/dialogs/colordialog.js b/plugins/colordialog/dialogs/colordialog.js
index 7021434..f3137d1 100644..100755
--- a/plugins/colordialog/dialogs/colordialog.js
+++ b/plugins/colordialog/dialogs/colordialog.js
@@ -1,340 +1,13 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-CKEDITOR.dialog.add( 'colordialog', function( editor ) {
- // Define some shorthands.
- var $el = CKEDITOR.dom.element,
- $doc = CKEDITOR.document,
- lang = editor.lang.colordialog;
-
- // Reference the dialog.
- var dialog;
-
- var spacer = {
- type: 'html',
- html: '&nbsp;'
- };
-
- var selected;
-
- function clearSelected() {
- $doc.getById( selHiColorId ).removeStyle( 'background-color' );
- dialog.getContentElement( 'picker', 'selectedColor' ).setValue( '' );
- selected && selected.removeAttribute( 'aria-selected' );
- selected = null;
- }
-
- function updateSelected( evt ) {
- var target = evt.data.getTarget(),
- color;
-
- if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) {
- selected = target;
- selected.setAttribute( 'aria-selected', true );
- dialog.getContentElement( 'picker', 'selectedColor' ).setValue( color );
- }
- }
-
- // Basing black-white decision off of luma scheme using the Rec. 709 version
- function whiteOrBlack( color ) {
- color = color.replace( /^#/, '' );
- for ( var i = 0, rgb = []; i <= 2; i++ )
- rgb[ i ] = parseInt( color.substr( i * 2, 2 ), 16 );
- var luma = ( 0.2126 * rgb[ 0 ] ) + ( 0.7152 * rgb[ 1 ] ) + ( 0.0722 * rgb[ 2 ] );
- return '#' + ( luma >= 165 ? '000' : 'fff' );
- }
-
- // Distinguish focused and hover states.
- var focused, hovered;
-
- // Apply highlight style.
- function updateHighlight( event ) {
- // Convert to event.
- !event.name && ( event = new CKEDITOR.event( event ) );
-
- var isFocus = !( /mouse/ ).test( event.name ),
- target = event.data.getTarget(),
- color;
-
- if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) {
- removeHighlight( event );
-
- isFocus ? focused = target : hovered = target;
-
- // Apply outline style to show focus.
- if ( isFocus ) {
- target.setStyle( 'border-color', whiteOrBlack( color ) );
- target.setStyle( 'border-style', 'dotted' );
- }
-
- $doc.getById( hicolorId ).setStyle( 'background-color', color );
- $doc.getById( hicolorTextId ).setHtml( color );
- }
- }
-
- function clearHighlight() {
- var color = focused.getChild( 0 ).getHtml();
- focused.setStyle( 'border-color', color );
- focused.setStyle( 'border-style', 'solid' );
- $doc.getById( hicolorId ).removeStyle( 'background-color' );
- $doc.getById( hicolorTextId ).setHtml( '&nbsp;' );
- focused = null;
- }
-
- // Remove previously focused style.
- function removeHighlight( event ) {
- var isFocus = !( /mouse/ ).test( event.name ),
- target = isFocus && focused;
-
- if ( target ) {
- var color = target.getChild( 0 ).getHtml();
- target.setStyle( 'border-color', color );
- target.setStyle( 'border-style', 'solid' );
- }
-
- if ( !( focused || hovered ) ) {
- $doc.getById( hicolorId ).removeStyle( 'background-color' );
- $doc.getById( hicolorTextId ).setHtml( '&nbsp;' );
- }
- }
-
- function onKeyStrokes( evt ) {
- var domEvt = evt.data;
-
- var element = domEvt.getTarget();
- var relative, nodeToMove;
- var keystroke = domEvt.getKeystroke(),
- rtl = editor.lang.dir == 'rtl';
-
- switch ( keystroke ) {
- // UP-ARROW
- case 38:
- // relative is TR
- if ( ( relative = element.getParent().getPrevious() ) ) {
- nodeToMove = relative.getChild( [ element.getIndex() ] );
- nodeToMove.focus();
- }
- domEvt.preventDefault();
- break;
- // DOWN-ARROW
- case 40:
- // relative is TR
- if ( ( relative = element.getParent().getNext() ) ) {
- nodeToMove = relative.getChild( [ element.getIndex() ] );
- if ( nodeToMove && nodeToMove.type == 1 ) {
- nodeToMove.focus();
- }
- }
- domEvt.preventDefault();
- break;
-
- // SPACE
- // ENTER
- case 32:
- case 13:
- updateSelected( evt );
- domEvt.preventDefault();
- break;
-
- // RIGHT-ARROW
- case rtl ? 37:
- 39 :
- // relative is TD
- if ( ( nodeToMove = element.getNext() ) ) {
- if ( nodeToMove.type == 1 ) {
- nodeToMove.focus();
- domEvt.preventDefault( true );
- }
- }
- // relative is TR
- else if ( ( relative = element.getParent().getNext() ) ) {
- nodeToMove = relative.getChild( [ 0 ] );
- if ( nodeToMove && nodeToMove.type == 1 ) {
- nodeToMove.focus();
- domEvt.preventDefault( true );
- }
- }
- break;
-
- // LEFT-ARROW
- case rtl ? 39:
- 37 :
- // relative is TD
- if ( ( nodeToMove = element.getPrevious() ) ) {
- nodeToMove.focus();
- domEvt.preventDefault( true );
- }
- // relative is TR
- else if ( ( relative = element.getParent().getPrevious() ) ) {
- nodeToMove = relative.getLast();
- nodeToMove.focus();
- domEvt.preventDefault( true );
- }
- break;
- default:
- // Do not stop not handled events.
- return;
- }
- }
-
- function createColorTable() {
- table = CKEDITOR.dom.element.createFromHtml( '<table tabIndex="-1" aria-label="' + lang.options + '"' +
- ' role="grid" style="border-collapse:separate;" cellspacing="0">' +
- '<caption class="cke_voice_label">' + lang.options + '</caption>' +
- '<tbody role="presentation"></tbody></table>' );
-
- table.on( 'mouseover', updateHighlight );
- table.on( 'mouseout', removeHighlight );
-
- // Create the base colors array.
- var aColors = [ '00', '33', '66', '99', 'cc', 'ff' ];
-
- // This function combines two ranges of three values from the color array into a row.
- function appendColorRow( rangeA, rangeB ) {
- for ( var i = rangeA; i < rangeA + 3; i++ ) {
- var row = new $el( table.$.insertRow( -1 ) );
- row.setAttribute( 'role', 'row' );
-
- for ( var j = rangeB; j < rangeB + 3; j++ ) {
- for ( var n = 0; n < 6; n++ ) {
- appendColorCell( row.$, '#' + aColors[ j ] + aColors[ n ] + aColors[ i ] );
- }
- }
- }
- }
-
- // This function create a single color cell in the color table.
- function appendColorCell( targetRow, color ) {
- var cell = new $el( targetRow.insertCell( -1 ) );
- cell.setAttribute( 'class', 'ColorCell' );
- cell.setAttribute( 'tabIndex', -1 );
- cell.setAttribute( 'role', 'gridcell' );
-
- cell.on( 'keydown', onKeyStrokes );
- cell.on( 'click', updateSelected );
- cell.on( 'focus', updateHighlight );
- cell.on( 'blur', removeHighlight );
-
- cell.setStyle( 'background-color', color );
- cell.setStyle( 'border', '1px solid ' + color );
-
- cell.setStyle( 'width', '14px' );
- cell.setStyle( 'height', '14px' );
-
- var colorLabel = numbering( 'color_table_cell' );
- cell.setAttribute( 'aria-labelledby', colorLabel );
- cell.append( CKEDITOR.dom.element.createFromHtml( '<span id="' + colorLabel + '" class="cke_voice_label">' + color + '</span>', CKEDITOR.document ) );
- }
-
- appendColorRow( 0, 0 );
- appendColorRow( 3, 0 );
- appendColorRow( 0, 3 );
- appendColorRow( 3, 3 );
-
- // Create the last row.
- var oRow = new $el( table.$.insertRow( -1 ) );
- oRow.setAttribute( 'role', 'row' );
-
- // Create the gray scale colors cells.
- for ( var n = 0; n < 6; n++ ) {
- appendColorCell( oRow.$, '#' + aColors[ n ] + aColors[ n ] + aColors[ n ] );
- }
-
- // Fill the row with black cells.
- for ( var i = 0; i < 12; i++ ) {
- appendColorCell( oRow.$, '#000000' );
- }
- }
-
- var numbering = function( id ) {
- return CKEDITOR.tools.getNextId() + '_' + id;
- },
- hicolorId = numbering( 'hicolor' ),
- hicolorTextId = numbering( 'hicolortext' ),
- selHiColorId = numbering( 'selhicolor' ),
- table;
-
- createColorTable();
-
- return {
- title: lang.title,
- minWidth: 360,
- minHeight: 220,
- onLoad: function() {
- // Update reference.
- dialog = this;
- },
- onHide: function() {
- clearSelected();
- clearHighlight();
- },
- contents: [
- {
- id: 'picker',
- label: lang.title,
- accessKey: 'I',
- elements: [
- {
- type: 'hbox',
- padding: 0,
- widths: [ '70%', '10%', '30%' ],
- children: [
- {
- type: 'html',
- html: '<div></div>',
- onLoad: function() {
- CKEDITOR.document.getById( this.domId ).append( table );
- },
- focus: function() {
- // Restore the previously focused cell,
- // otherwise put the initial focus on the first table cell.
- ( focused || this.getElement().getElementsByTag( 'td' ).getItem( 0 ) ).focus();
- }
- },
- spacer,
- {
- type: 'vbox',
- padding: 0,
- widths: [ '70%', '5%', '25%' ],
- children: [
- {
- type: 'html',
- html: '<span>' + lang.highlight + '</span>\
- <div id="' + hicolorId + '" style="border: 1px solid; height: 74px; width: 74px;"></div>\
- <div id="' + hicolorTextId + '">&nbsp;</div><span>' + lang.selected + '</span>\
- <div id="' + selHiColorId + '" style="border: 1px solid; height: 20px; width: 74px;"></div>'
- },
- {
- type: 'text',
- label: lang.selected,
- labelStyle: 'display:none',
- id: 'selectedColor',
- style: 'width: 74px',
- onChange: function() {
- // Try to update color preview with new value. If fails, then set it no none.
- try {
- $doc.getById( selHiColorId ).setStyle( 'background-color', this.getValue() );
- } catch ( e ) {
- clearSelected();
- }
- }
- },
- spacer,
- {
- type: 'button',
- id: 'clear',
- style: 'margin-top: 5px',
- label: lang.clear,
- onClick: clearSelected
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("colordialog",function(t){function n(){f.getById(o).removeStyle("background-color");p.getContentElement("picker","selectedColor").setValue("");j&&j.removeAttribute("aria-selected");j=null}function u(a){var a=a.data.getTarget(),b;if("td"==a.getName()&&(b=a.getChild(0).getHtml()))j=a,j.setAttribute("aria-selected",!0),p.getContentElement("picker","selectedColor").setValue(b)}function y(a){for(var a=a.replace(/^#/,""),b=0,c=[];2>=b;b++)c[b]=parseInt(a.substr(2*b,2),16);return"#"+
+(165<=0.2126*c[0]+0.7152*c[1]+0.0722*c[2]?"000":"fff")}function v(a){!a.name&&(a=new CKEDITOR.event(a));var b=!/mouse/.test(a.name),c=a.data.getTarget(),e;if("td"==c.getName()&&(e=c.getChild(0).getHtml()))q(a),b?g=c:w=c,b&&(c.setStyle("border-color",y(e)),c.setStyle("border-style","dotted")),f.getById(k).setStyle("background-color",e),f.getById(l).setHtml(e)}function q(a){if(a=!/mouse/.test(a.name)&&g){var b=a.getChild(0).getHtml();a.setStyle("border-color",b);a.setStyle("border-style","solid")}!g&&
+!w&&(f.getById(k).removeStyle("background-color"),f.getById(l).setHtml("&nbsp;"))}function z(a){var b=a.data,c=b.getTarget(),e=b.getKeystroke(),d="rtl"==t.lang.dir;switch(e){case 38:if(a=c.getParent().getPrevious())a=a.getChild([c.getIndex()]),a.focus();b.preventDefault();break;case 40:if(a=c.getParent().getNext())(a=a.getChild([c.getIndex()]))&&1==a.type&&a.focus();b.preventDefault();break;case 32:case 13:u(a);b.preventDefault();break;case d?37:39:if(a=c.getNext())1==a.type&&(a.focus(),b.preventDefault(!0));
+else if(a=c.getParent().getNext())if((a=a.getChild([0]))&&1==a.type)a.focus(),b.preventDefault(!0);break;case d?39:37:if(a=c.getPrevious())a.focus(),b.preventDefault(!0);else if(a=c.getParent().getPrevious())a=a.getLast(),a.focus(),b.preventDefault(!0)}}var r=CKEDITOR.dom.element,f=CKEDITOR.document,h=t.lang.colordialog,p,x={type:"html",html:"&nbsp;"},j,g,w,m=function(a){return CKEDITOR.tools.getNextId()+"_"+a},k=m("hicolor"),l=m("hicolortext"),o=m("selhicolor"),i;(function(){function a(a,d){for(var s=
+a;s<a+3;s++){var e=new r(i.$.insertRow(-1));e.setAttribute("role","row");for(var f=d;f<d+3;f++)for(var g=0;6>g;g++)b(e.$,"#"+c[f]+c[g]+c[s])}}function b(a,c){var b=new r(a.insertCell(-1));b.setAttribute("class","ColorCell");b.setAttribute("tabIndex",-1);b.setAttribute("role","gridcell");b.on("keydown",z);b.on("click",u);b.on("focus",v);b.on("blur",q);b.setStyle("background-color",c);b.setStyle("border","1px solid "+c);b.setStyle("width","14px");b.setStyle("height","14px");var d=m("color_table_cell");
+b.setAttribute("aria-labelledby",d);b.append(CKEDITOR.dom.element.createFromHtml('<span id="'+d+'" class="cke_voice_label">'+c+"</span>",CKEDITOR.document))}i=CKEDITOR.dom.element.createFromHtml('<table tabIndex="-1" aria-label="'+h.options+'" role="grid" style="border-collapse:separate;" cellspacing="0"><caption class="cke_voice_label">'+h.options+'</caption><tbody role="presentation"></tbody></table>');i.on("mouseover",v);i.on("mouseout",q);var c="00 33 66 99 cc ff".split(" ");a(0,0);a(3,0);a(0,
+3);a(3,3);var e=new r(i.$.insertRow(-1));e.setAttribute("role","row");for(var d=0;6>d;d++)b(e.$,"#"+c[d]+c[d]+c[d]);for(d=0;12>d;d++)b(e.$,"#000000")})();return{title:h.title,minWidth:360,minHeight:220,onLoad:function(){p=this},onHide:function(){n();var a=g.getChild(0).getHtml();g.setStyle("border-color",a);g.setStyle("border-style","solid");f.getById(k).removeStyle("background-color");f.getById(l).setHtml("&nbsp;");g=null},contents:[{id:"picker",label:h.title,accessKey:"I",elements:[{type:"hbox",
+padding:0,widths:["70%","10%","30%"],children:[{type:"html",html:"<div></div>",onLoad:function(){CKEDITOR.document.getById(this.domId).append(i)},focus:function(){(g||this.getElement().getElementsByTag("td").getItem(0)).focus()}},x,{type:"vbox",padding:0,widths:["70%","5%","25%"],children:[{type:"html",html:"<span>"+h.highlight+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+k+'" style="border: 1px solid; height: 74px; width: 74px;"></div>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+l+'">&nbsp;</div><span>'+h.selected+
+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+o+'" style="border: 1px solid; height: 20px; width: 74px;"></div>'},{type:"text",label:h.selected,labelStyle:"display:none",id:"selectedColor",style:"width: 74px",onChange:function(){try{f.getById(o).setStyle("background-color",this.getValue())}catch(a){n()}}},x,{type:"button",id:"clear",style:"margin-top: 5px",label:h.clear,onClick:n}]}]}]}]}}); \ No newline at end of file
diff --git a/plugins/dialog/dialogDefinition.js b/plugins/dialog/dialogDefinition.js
index 6810a90..2186b29 100644..100755
--- a/plugins/dialog/dialogDefinition.js
+++ b/plugins/dialog/dialogDefinition.js
@@ -1,1006 +1,4 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-/**
- * @fileOverview Defines the "virtual" dialog, dialog content and dialog button
- * definition classes.
- */
-
-/**
- * The definition of a dialog window.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create dialogs.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * CKEDITOR.dialog.add( 'testOnly', function( editor ) {
- * return {
- * title: 'Test Dialog',
- * resizable: CKEDITOR.DIALOG_RESIZE_BOTH,
- * minWidth: 500,
- * minHeight: 400,
- * contents: [
- * {
- * id: 'tab1',
- * label: 'First Tab',
- * title: 'First Tab Title',
- * accessKey: 'Q',
- * elements: [
- * {
- * type: 'text',
- * label: 'Test Text 1',
- * id: 'testText1',
- * 'default': 'hello world!'
- * }
- * ]
- * }
- * ]
- * };
- * } );
- *
- * @class CKEDITOR.dialog.definition
- */
-
-/**
- * The dialog title, displayed in the dialog's header. Required.
- *
- * @property {String} title
- */
-
-/**
- * How the dialog can be resized, must be one of the four contents defined below.
- *
- * * {@link CKEDITOR#DIALOG_RESIZE_NONE}
- * * {@link CKEDITOR#DIALOG_RESIZE_WIDTH}
- * * {@link CKEDITOR#DIALOG_RESIZE_HEIGHT}
- * * {@link CKEDITOR#DIALOG_RESIZE_BOTH}
- *
- * @property {Number} [resizable=CKEDITOR.DIALOG_RESIZE_NONE]
- */
-
-/**
- * The minimum width of the dialog, in pixels.
- *
- * @property {Number} [minWidth=600]
- */
-
-/**
- * The minimum height of the dialog, in pixels.
- *
- * @property {Number} [minHeight=400]
- */
-
-
-/**
- * The initial width of the dialog, in pixels.
- *
- * @since 3.5.3
- * @property {Number} [width=CKEDITOR.dialog.definition#minWidth]
- */
-
-/**
- * The initial height of the dialog, in pixels.
- *
- * @since 3.5.3
- * @property {Number} [height=CKEDITOR.dialog.definition.minHeight]
- */
-
-/**
- * The buttons in the dialog, defined as an array of
- * {@link CKEDITOR.dialog.definition.button} objects.
- *
- * @property {Array} [buttons=[ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ]]
- */
-
-/**
- * The contents in the dialog, defined as an array of
- * {@link CKEDITOR.dialog.definition.content} objects. Required.
- *
- * @property {Array} contents
- */
-
-/**
- * The function to execute when OK is pressed.
- *
- * @property {Function} onOk
- */
-
-/**
- * The function to execute when Cancel is pressed.
- *
- * @property {Function} onCancel
- */
-
-/**
- * The function to execute when the dialog is displayed for the first time.
- *
- * @property {Function} onLoad
- */
-
-/**
- * The function to execute when the dialog is loaded (executed every time the dialog is opened).
- *
- * @property {Function} onShow
- */
-
-/**
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create dialog content pages.
- *
- * @class CKEDITOR.dialog.definition.content.
- */
-
-/**
- * The id of the content page.
- *
- * @property {String} id
- */
-
-/**
- * The tab label of the content page.
- *
- * @property {String} label
- */
-
-/**
- * The popup message of the tab label.
- *
- * @property {String} title
- */
-
-/**
- * The CTRL hotkey for switching to the tab.
- *
- * contentDefinition.accessKey = 'Q'; // Switch to this page when CTRL-Q is pressed.
- *
- * @property {String} accessKey
- */
-
-/**
- * The UI elements contained in this content page, defined as an array of
- * {@link CKEDITOR.dialog.definition.uiElement} objects.
- *
- * @property {Array} elements
- */
-
-/**
- * The definition of user interface element (textarea, radio etc).
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create dialog UI elements.
- *
- * @class CKEDITOR.dialog.definition.uiElement
- * @see CKEDITOR.ui.dialog.uiElement
- */
-
-/**
- * The id of the UI element.
- *
- * @property {String} id
- */
-
-/**
- * The type of the UI element. Required.
- *
- * @property {String} type
- */
-
-/**
- * The popup label of the UI element.
- *
- * @property {String} title
- */
-
-/**
- * The content that needs to be allowed to enable this UI element.
- * All formats accepted by {@link CKEDITOR.filter#check} may be used.
- *
- * When all UI elements in a tab are disabled, this tab will be disabled automatically.
- *
- * @property {String/Object/CKEDITOR.style} requiredContent
- */
-
-/**
- * CSS class names to append to the UI element.
- *
- * @property {String} className
- */
-
-/**
- * Inline CSS classes to append to the UI element.
- *
- * @property {String} style
- */
-
-/**
- * Horizontal alignment (in container) of the UI element.
- *
- * @property {String} align
- */
-
-/**
- * Function to execute the first time the UI element is displayed.
- *
- * @property {Function} onLoad
- */
-
-/**
- * Function to execute whenever the UI element's parent dialog is displayed.
- *
- * @property {Function} onShow
- */
-
-/**
- * Function to execute whenever the UI element's parent dialog is closed.
- *
- * @property {Function} onHide
- */
-
-/**
- * Function to execute whenever the UI element's parent
- * dialog's {@link CKEDITOR.dialog#setupContent} method is executed.
- * It usually takes care of the respective UI element as a standalone element.
- *
- * @property {Function} setup
- */
-
-/**
- * Function to execute whenever the UI element's parent
- * dialog's {@link CKEDITOR.dialog#commitContent} method is executed.
- * It usually takes care of the respective UI element as a standalone element.
- *
- * @property {Function} commit
- */
-
-// ----- hbox -----------------------------------------------------------------
-
-/**
- * Horizontal layout box for dialog UI elements, auto-expends to available width of container.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create horizontal layouts.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.hbox} object and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example:
- * {
- * type: 'hbox',
- * widths: [ '25%', '25%', '50%' ],
- * children: [
- * {
- * type: 'text',
- * id: 'id1',
- * width: '40px',
- * },
- * {
- * type: 'text',
- * id: 'id2',
- * width: '40px',
- * },
- * {
- * type: 'text',
- * id: 'id3'
- * }
- * ]
- * }
- *
- * @class CKEDITOR.dialog.definition.hbox
- * @extends CKEDITOR.dialog.definition.uiElement
- */
-
-/**
- * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this container.
- *
- * @property {Array} children
- */
-
-/**
- * (Optional) The widths of child cells.
- *
- * @property {Array} widths
- */
-
-/**
- * (Optional) The height of the layout.
- *
- * @property {Number} height
- */
-
-/**
- * The CSS styles to apply to this element.
- *
- * @property {String} styles
- */
-
-/**
- * (Optional) The padding width inside child cells. Example: 0, 1.
- *
- * @property {Number} padding
- */
-
-/**
- * (Optional) The alignment of the whole layout. Example: center, top.
- *
- * @property {String} align
- */
-
-// ----- vbox -----------------------------------------------------------------
-
-/**
- * Vertical layout box for dialog UI elements.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create vertical layouts.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.vbox} object and can
- * be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example:
- * {
- * type: 'vbox',
- * align: 'right',
- * width: '200px',
- * children: [
- * {
- * type: 'text',
- * id: 'age',
- * label: 'Age'
- * },
- * {
- * type: 'text',
- * id: 'sex',
- * label: 'Sex'
- * },
- * {
- * type: 'text',
- * id: 'nationality',
- * label: 'Nationality'
- * }
- * ]
- * }
- *
- * @class CKEDITOR.dialog.definition.vbox
- * @extends CKEDITOR.dialog.definition.uiElement
- */
-
-/**
- * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this container.
- *
- * @property {Array} children
- */
-
-/**
- * (Optional) The width of the layout.
- *
- * @property {Array} width
- */
-
-/**
- * (Optional) The heights of individual cells.
- *
- * @property {Number} heights
- */
-
-/**
- * The CSS styles to apply to this element.
- *
- * @property {String} styles
- */
-
-/**
- * (Optional) The padding width inside child cells. Example: 0, 1.
- *
- * @property {Number} padding
- */
-
-/**
- * (Optional) The alignment of the whole layout. Example: center, top.
- *
- * @property {String} align
- */
-
-/**
- * (Optional) Whether the layout should expand vertically to fill its container.
- *
- * @property {Boolean} expand
- */
-
-// ----- labeled element ------------------------------------------------------
-
-/**
- * The definition of labeled user interface element (textarea, textInput etc).
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create dialog UI elements.
- *
- * @class CKEDITOR.dialog.definition.labeledElement
- * @extends CKEDITOR.dialog.definition.uiElement
- * @see CKEDITOR.ui.dialog.labeledElement
- */
-
-/**
- * The label of the UI element.
- *
- * {
- * type: 'text',
- * label: 'My Label'
- * }
- *
- * @property {String} label
- */
-
-/**
- * (Optional) Specify the layout of the label. Set to `'horizontal'` for horizontal layout.
- * The default layout is vertical.
- *
- * {
- * type: 'text',
- * label: 'My Label',
- * labelLayout: 'horizontal'
- * }
- *
- * @property {String} labelLayout
- */
-
-/**
- * (Optional) Applies only to horizontal layouts: a two elements array of lengths to specify the widths of the
- * label and the content element. See also {@link CKEDITOR.dialog.definition.labeledElement#labelLayout}.
- *
- * {
- * type: 'text',
- * label: 'My Label',
- * labelLayout: 'horizontal',
- * widths: [100, 200]
- * }
- *
- * @property {Array} widths
- */
-
-/**
- * Specify the inline style of the uiElement label.
- *
- * {
- * type: 'text',
- * label: 'My Label',
- * labelStyle: 'color: red'
- * }
- *
- * @property {String} labelStyle
- */
-
-
-/**
- * Specify the inline style of the input element.
- *
- * {
- * type: 'text',
- * label: 'My Label',
- * inputStyle: 'text-align: center'
- * }
- *
- * @since 3.6.1
- * @property {String} inputStyle
- */
-
-/**
- * Specify the inline style of the input element container.
- *
- * {
- * type: 'text',
- * label: 'My Label',
- * controlStyle: 'width: 3em'
- * }
- *
- * @since 3.6.1
- * @property {String} controlStyle
- */
-
-// ----- button ---------------------------------------------------------------
-
-/**
- * The definition of a button.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create buttons.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.button} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example:
- * {
- * type: 'button',
- * id: 'buttonId',
- * label: 'Click me',
- * title: 'My title',
- * onClick: function() {
- * // this = CKEDITOR.ui.dialog.button
- * alert( 'Clicked: ' + this.id );
- * }
- * }
- *
- * @class CKEDITOR.dialog.definition.button
- * @extends CKEDITOR.dialog.definition.uiElement
- */
-
-/**
- * Whether the button is disabled.
- *
- * @property {Boolean} disabled
- */
-
-/**
- * The label of the UI element.
- *
- * @property {String} label
- */
-
-// ----- checkbox ------
-/**
- * The definition of a checkbox element.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create groups of checkbox buttons.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.checkbox} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example:
- * {
- * type: 'checkbox',
- * id: 'agree',
- * label: 'I agree',
- * 'default': 'checked',
- * onClick: function() {
- * // this = CKEDITOR.ui.dialog.checkbox
- * alert( 'Checked: ' + this.getValue() );
- * }
- * }
- *
- * @class CKEDITOR.dialog.definition.checkbox
- * @extends CKEDITOR.dialog.definition.uiElement
- */
-
-/**
- * (Optional) The validation function.
- *
- * @property {Function} validate
- */
-
-/**
- * The label of the UI element.
- *
- * @property {String} label
- */
-
-/**
- * The default state.
- *
- * @property {String} [default='' (unchecked)]
- */
-
-// ----- file -----------------------------------------------------------------
-
-/**
- * The definition of a file upload input.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create file upload elements.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.file} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example:
- * {
- * type: 'file',
- * id: 'upload',
- * label: 'Select file from your computer',
- * size: 38
- * },
- * {
- * type: 'fileButton',
- * id: 'fileId',
- * label: 'Upload file',
- * 'for': [ 'tab1', 'upload' ],
- * filebrowser: {
- * onSelect: function( fileUrl, data ) {
- * alert( 'Successfully uploaded: ' + fileUrl );
- * }
- * }
- * }
- *
- * @class CKEDITOR.dialog.definition.file
- * @extends CKEDITOR.dialog.definition.labeledElement
- */
-
-/**
- * (Optional) The validation function.
- *
- * @property {Function} validate
- */
-
-/**
- * (Optional) The action attribute of the form element associated with this file upload input.
- * If empty, CKEditor will use path to server connector for currently opened folder.
- *
- * @property {String} action
- */
-
-/**
- * The size of the UI element.
- *
- * @property {Number} size
- */
-
-// ----- fileButton -----------------------------------------------------------
-
-/**
- * The definition of a button for submitting the file in a file upload input.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create a button for submitting the file in a file upload input.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.fileButton} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
- * @class CKEDITOR.dialog.definition.fileButton
- * @extends CKEDITOR.dialog.definition.uiElement
- */
-
-/**
- * (Optional) The validation function.
- *
- * @property {Function} validate
- */
-
-/**
- * The label of the UI element.
- *
- * @property {String} label
- */
-
-/**
- * The instruction for CKEditor how to deal with file upload.
- * By default, the file and fileButton elements will not work "as expected" if this attribute is not set.
- *
- * // Update field with id 'txtUrl' in the 'tab1' tab when file is uploaded.
- * filebrowser: 'tab1:txtUrl'
- *
- * // Call custom onSelect function when file is successfully uploaded.
- * filebrowser: {
- * onSelect: function( fileUrl, data ) {
- * alert( 'Successfully uploaded: ' + fileUrl );
- * }
- * }
- *
- * @property {String} filebrowser/Object
- */
-
-/**
- * An array that contains pageId and elementId of the file upload input element for which this button is created.
- *
- * [ pageId, elementId ]
- *
- * @property {String} for
- */
-
-// ----- html -----------------------------------------------------------------
-
-/**
- * The definition of a raw HTML element.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create elements made from raw HTML code.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.html} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- * To access HTML elements use {@link CKEDITOR.dom.document#getById}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example 1:
- * {
- * type: 'html',
- * html: '<h3>This is some sample HTML content.</h3>'
- * }
- *
- * // Example 2:
- * // Complete sample with document.getById() call when the "Ok" button is clicked.
- * var dialogDefinition = {
- * title: 'Sample dialog',
- * minWidth: 300,
- * minHeight: 200,
- * onOk: function() {
- * // "this" is now a CKEDITOR.dialog object.
- * var document = this.getElement().getDocument();
- * // document = CKEDITOR.dom.document
- * var element = <b>document.getById( 'myDiv' );</b>
- * if ( element )
- * alert( element.getHtml() );
- * },
- * contents: [
- * {
- * id: 'tab1',
- * label: '',
- * title: '',
- * elements: [
- * {
- * type: 'html',
- * html: '<div id="myDiv">Sample <b>text</b>.</div><div id="otherId">Another div.</div>'
- * }
- * ]
- * }
- * ],
- * buttons: [ CKEDITOR.dialog.cancelButton, CKEDITOR.dialog.okButton ]
- * };
- *
- * @class CKEDITOR.dialog.definition.html
- * @extends CKEDITOR.dialog.definition.uiElement
- */
-
-/**
- * (Required) HTML code of this element.
- *
- * @property {String} html
- */
-
-// ----- radio ----------------------------------------------------------------
-
-/**
- * The definition of a radio group.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create groups of radio buttons.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.radio} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example:
- * {
- * type: 'radio',
- * id: 'country',
- * label: 'Which country is bigger',
- * items: [ [ 'France', 'FR' ], [ 'Germany', 'DE' ] ],
- * style: 'color: green',
- * 'default': 'DE',
- * onClick: function() {
- * // this = CKEDITOR.ui.dialog.radio
- * alert( 'Current value: ' + this.getValue() );
- * }
- * }
- *
- * @class CKEDITOR.dialog.definition.radio
- * @extends CKEDITOR.dialog.definition.labeledElement
- */
-
-/**
- * The default value.
- *
- * @property {String} default
- */
-
-/**
- * (Optional) The validation function.
- *
- * @property {Function} validate
- */
-
-/**
- * An array of options. Each option is a 1- or 2-item array of format `[ 'Description', 'Value' ]`.
- * If `'Value'` is missing, then the value would be assumed to be the same as the description.
- *
- * @property {Array} items
- */
-
-// ----- selectElement --------------------------------------------------------
-
-/**
- * The definition of a select element.
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create select elements.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.select} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * // Example:
- * {
- * type: 'select',
- * id: 'sport',
- * label: 'Select your favourite sport',
- * items: [ [ 'Basketball' ], [ 'Baseball' ], [ 'Hockey' ], [ 'Football' ] ],
- * 'default': 'Football',
- * onChange: function( api ) {
- * // this = CKEDITOR.ui.dialog.select
- * alert( 'Current value: ' + this.getValue() );
- * }
- * }
- *
- * @class CKEDITOR.dialog.definition.select
- * @extends CKEDITOR.dialog.definition.labeledElement
- */
-
-/**
- * The default value.
- *
- * @property {String} default
- */
-
-/**
- * (Optional) The validation function.
- *
- * @property {Function} validate
- */
-
-/**
- * An array of options. Each option is a 1- or 2-item array of format `[ 'Description', 'Value' ]`.
- * If `'Value'` is missing, then the value would be assumed to be the same as the description.
- *
- * @property {Array} items
- */
-
-/**
- * (Optional) Set this to true if you'd like to have a multiple-choice select box.
- *
- * @property {Boolean} [multiple=false]
- */
-
-/**
- * (Optional) The number of items to display in the select box.
- *
- * @property {Number} size
- */
-
-// ----- textInput ------------------------------------------------------------
-
-/**
- * The definition of a text field (single line).
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create text fields.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.textInput} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
- * // There is no constructor for this class, the user just has to define an
- * // object with the appropriate properties.
- *
- * {
- * type: 'text',
- * id: 'name',
- * label: 'Your name',
- * 'default': '',
- * validate: function() {
- * if ( !this.getValue() ) {
- * api.openMsgDialog( '', 'Name cannot be empty.' );
- * return false;
- * }
- * }
- * }
- *
- * @class CKEDITOR.dialog.definition.textInput
- * @extends CKEDITOR.dialog.definition.labeledElement
- */
-
-/**
- * The default value.
- *
- * @property {String} default
- */
-
-/**
- * (Optional) The maximum length.
- *
- * @property {Number} maxLength
- */
-
-/**
- * (Optional) The size of the input field.
- *
- * @property {Number} size
- */
-
-/**
- * (Optional) The validation function.
- *
- * @property {Function} validate
- */
-
-// ----- textarea -------------------------------------------------------------
-
-/**
- * The definition of a text field (multiple lines).
- *
- * This class is not really part of the API. It just illustrates the properties
- * that developers can use to define and create textarea.
- *
- * Once the dialog is opened, the created element becomes a {@link CKEDITOR.ui.dialog.textarea} object
- * and can be accessed with {@link CKEDITOR.dialog#getContentElement}.
- *
- * For a complete example of dialog definition, please check {@link CKEDITOR.dialog#add}.
- *
-* // There is no constructor for this class, the user just has to define an
-* // object with the appropriate properties.
-*
-* // Example:
-* {
-* type: 'textarea',
-* id: 'message',
-* label: 'Your comment',
-* 'default': '',
-* validate: function() {
-* if ( this.getValue().length < 5 ) {
-* api.openMsgDialog( 'The comment is too short.' );
-* return false;
-* }
-* }
-* }
- *
- * @class CKEDITOR.dialog.definition.textarea
- * @extends CKEDITOR.dialog.definition.labeledElement
- */
-
-/**
- * The number of rows.
- *
- * @property {Number} rows
- */
-
-/**
- * The number of columns.
- *
- * @property {Number} cols
- */
-
-/**
- * (Optional) The validation function.
- *
- * @property {Function} validate
- */
-
-/**
- * The default value.
- *
- * @property {String} default
- */
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
diff --git a/plugins/div/dialogs/div.js b/plugins/div/dialogs/div.js
index 1e39816..2e6d5fe 100644..100755
--- a/plugins/div/dialogs/div.js
+++ b/plugins/div/dialogs/div.js
@@ -1,457 +1,9 @@
-/*
- * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-(function() {
-
- // Add to collection with DUP examination.
- // @param {Object} collection
- // @param {Object} element
- // @param {Object} database
- function addSafely( collection, element, database ) {
- // 1. IE doesn't support customData on text nodes;
- // 2. Text nodes never get chance to appear twice;
- if ( !element.is || !element.getCustomData( 'block_processed' ) ) {
- element.is && CKEDITOR.dom.element.setMarker( database, element, 'block_processed', true );
- collection.push( element );
- }
- }
-
- function getNonEmptyChildren( element ) {
- var retval = [];
- var children = element.getChildren();
- for ( var i = 0; i < children.count(); i++ ) {
- var child = children.getItem( i );
- if ( !( child.type === CKEDITOR.NODE_TEXT && ( /^[ \t\n\r]+$/ ).test( child.getText() ) ) )
- retval.push( child );
- }
- return retval;
- }
-
- // Dialog reused by both 'creatediv' and 'editdiv' commands.
- // @param {Object} editor
- // @param {String} command The command name which indicate what the current command is.
- function divDialog( editor, command ) {
- // Definition of elements at which div operation should stopped.
- var divLimitDefinition = (function() {
-
- // Customzie from specialize blockLimit elements
- var definition = CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$blockLimit );
-
- if ( editor.config.div_wrapTable ) {
- delete definition.td;
- delete definition.th;
- }
- return definition;
- })();
-
- // DTD of 'div' element
- var dtd = CKEDITOR.dtd.div;
-
- // Get the first div limit element on the element's path.
- // @param {Object} element
- function getDivContainer( element ) {
- var container = editor.elementPath( element ).blockLimit;
-
- // Dont stop at 'td' and 'th' when div should wrap entire table.
- if ( editor.config.div_wrapTable && container.is( [ 'td', 'th' ] ) ) {
- var parentPath = editor.elementPath( container.getParent() );
- container = parentPath.blockLimit;
- }
-
- return container;
- }
-
- // Init all fields' setup/commit function.
- // @memberof divDialog
- function setupFields() {
- this.foreach( function( field ) {
- // Exclude layout container elements
- if ( /^(?!vbox|hbox)/.test( field.type ) ) {
- if ( !field.setup ) {
- // Read the dialog fields values from the specified
- // element attributes.
- field.setup = function( element ) {
- field.setValue( element.getAttribute( field.id ) || '', 1 );
- };
- }
- if ( !field.commit ) {
- // Set element attributes assigned by the dialog
- // fields.
- field.commit = function( element ) {
- var fieldValue = this.getValue();
- // ignore default element attribute values
- if ( 'dir' == field.id && element.getComputedStyle( 'direction' ) == fieldValue )
- return;
-
- if ( fieldValue )
- element.setAttribute( field.id, fieldValue );
- else
- element.removeAttribute( field.id );
- };
- }
- }
- });
- }
-
- // Wrapping 'div' element around appropriate blocks among the selected ranges.
- // @param {Object} editor
- function createDiv( editor ) {
- // new adding containers OR detected pre-existed containers.
- var containers = [];
- // node markers store.
- var database = {};
- // All block level elements which contained by the ranges.
- var containedBlocks = [],
- block;
-
- // Get all ranges from the selection.
- var selection = editor.getSelection(),
- ranges = selection.getRanges();
- var bookmarks = selection.createBookmarks();
- var i, iterator;
-
- // Calcualte a default block tag if we need to create blocks.
- var blockTag = editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p';
-
- // collect all included elements from dom-iterator
- for ( i = 0; i < ranges.length; i++ ) {
- iterator = ranges[ i ].createIterator();
- while ( ( block = iterator.getNextParagraph() ) ) {
- // include contents of blockLimit elements.
- if ( block.getName() in divLimitDefinition ) {
- var j,
- childNodes = block.getChildren();
- for ( j = 0; j < childNodes.count(); j++ )
- addSafely( containedBlocks, childNodes.getItem( j ), database );
- } else {
- while ( !dtd[ block.getName() ] && !block.equals( ranges[ i ].root ) )
- block = block.getParent();
- addSafely( containedBlocks, block, database );
- }
- }
- }
-
- CKEDITOR.dom.element.clearAllMarkers( database );
-
- var blockGroups = groupByDivLimit( containedBlocks );
- var ancestor, blockEl, divElement;
-
- for ( i = 0; i < blockGroups.length; i++ ) {
- var currentNode = blockGroups[ i ][ 0 ];
-
- // Calculate the common parent node of all contained elements.
- ancestor = currentNode.getParent();
- for ( j = 1; j < blockGroups[ i ].length; j++ )
- ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] );
-
- divElement = new CKEDITOR.dom.element( 'div', editor.document );
-
- // Normalize the blocks in each group to a common parent.
- for ( j = 0; j < blockGroups[ i ].length; j++ ) {
- currentNode = blockGroups[ i ][ j ];
-
- while ( !currentNode.getParent().equals( ancestor ) )
- currentNode = currentNode.getParent();
-
- // This could introduce some duplicated elements in array.
- blockGroups[ i ][ j ] = currentNode;
- }
-
- // Wrapped blocks counting
- var fixedBlock = null;
- for ( j = 0; j < blockGroups[ i ].length; j++ ) {
- currentNode = blockGroups[ i ][ j ];
-
- // Avoid DUP elements introduced by grouping.
- if ( !( currentNode.getCustomData && currentNode.getCustomData( 'block_processed' ) ) ) {
- currentNode.is && CKEDITOR.dom.element.setMarker( database, currentNode, 'block_processed', true );
-
- // Establish new container, wrapping all elements in this group.
- if ( !j )
- divElement.insertBefore( currentNode );
-
- divElement.append( currentNode );
- }
- }
-
- CKEDITOR.dom.element.clearAllMarkers( database );
- containers.push( divElement );
- }
-
- selection.selectBookmarks( bookmarks );
- return containers;
- }
-
- // Divide a set of nodes to different groups by their path's blocklimit element.
- // Note: the specified nodes should be in source order naturally, which mean they are supposed to producea by following class:
- // * CKEDITOR.dom.range.Iterator
- // * CKEDITOR.dom.domWalker
- // @returns {Array[]} the grouped nodes
- function groupByDivLimit( nodes ) {
- var groups = [],
- lastDivLimit = null,
- path, block;
- for ( var i = 0; i < nodes.length; i++ ) {
- block = nodes[ i ];
- var limit = getDivContainer( block );
- if ( !limit.equals( lastDivLimit ) ) {
- lastDivLimit = limit;
- groups.push( [] );
- }
- groups[ groups.length - 1 ].push( block );
- }
- return groups;
- }
-
- // Synchronous field values to other impacted fields is required, e.g. div styles
- // change should also alter inline-style text.
- function commitInternally( targetFields ) {
- var dialog = this.getDialog(),
- element = dialog._element && dialog._element.clone() || new CKEDITOR.dom.element( 'div', editor.document );
-
- // Commit this field and broadcast to target fields.
- this.commit( element, true );
-
- targetFields = [].concat( targetFields );
- var length = targetFields.length,
- field;
- for ( var i = 0; i < length; i++ ) {
- field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) );
- field && field.setup && field.setup( element, true );
- }
- }
-
-
- // Registered 'CKEDITOR.style' instances.
- var styles = {};
-
- // Hold a collection of created block container elements.
- var containers = [];
-
- // @type divDialog
- return {
- title: editor.lang.div.title,
- minWidth: 400,
- minHeight: 165,
- contents: [
- {
- id: 'info',
- label: editor.lang.common.generalTab,
- title: editor.lang.common.generalTab,
- elements: [
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'elementStyle',
- type: 'select',
- style: 'width: 100%;',
- label: editor.lang.div.styleSelectLabel,
- 'default': '',
- // Options are loaded dynamically.
- items: [
- [ editor.lang.common.notSet, '' ]
- ],
- onChange: function() {
- commitInternally.call( this, [ 'info:elementStyle', 'info:class', 'advanced:dir', 'advanced:style' ] );
- },
- setup: function( element ) {
- for ( var name in styles )
- styles[ name ].checkElementRemovable( element, true ) && this.setValue( name, 1 );
- },
- commit: function( element ) {
- var styleName;
- if ( ( styleName = this.getValue() ) ) {
- var style = styles[ styleName ];
- style.applyToObject( element );
- }
- else
- element.removeAttribute( 'style' );
- }
- },
- {
- id: 'class',
- type: 'text',
- requiredContent: 'div(cke-xyz)', // Random text like 'xyz' will check if all are allowed.
- label: editor.lang.common.cssClass,
- 'default': ''
- }
- ]
- }
- ]
- },
- {
- id: 'advanced',
- label: editor.lang.common.advancedTab,
- title: editor.lang.common.advancedTab,
- elements: [
- {
- type: 'vbox',
- padding: 1,
- children: [
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- type: 'text',
- id: 'id',
- requiredContent: 'div[id]',
- label: editor.lang.common.id,
- 'default': ''
- },
- {
- type: 'text',
- id: 'lang',
- requiredContent: 'div[lang]',
- label: editor.lang.common.langCode,
- 'default': ''
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- type: 'text',
- id: 'style',
- requiredContent: 'div{cke-xyz}', // Random text like 'xyz' will check if all are allowed.
- style: 'width: 100%;',
- label: editor.lang.common.cssStyle,
- 'default': '',
- commit: function( element ) {
- element.setAttribute( 'style', this.getValue() );
- }
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- type: 'text',
- id: 'title',
- requiredContent: 'div[title]',
- style: 'width: 100%;',
- label: editor.lang.common.advisoryTitle,
- 'default': ''
- }
- ]
- },
- {
- type: 'select',
- id: 'dir',
- requiredContent: 'div[dir]',
- style: 'width: 100%;',
- label: editor.lang.common.langDir,
- 'default': '',
- items: [
- [ editor.lang.common.notSet, '' ],
- [
- editor.lang.common.langDirLtr,
- 'ltr'
- ],
- [
- editor.lang.common.langDirRtl,
- 'rtl'
- ]
- ]
- }
- ]
- }
- ]
- }
- ],
- onLoad: function() {
- setupFields.call( this );
-
- // Preparing for the 'elementStyle' field.
- var dialog = this,
- stylesField = this.getContentElement( 'info', 'elementStyle' );
-
- // Reuse the 'stylescombo' plugin's styles definition.
- editor.getStylesSet( function( stylesDefinitions ) {
- var styleName, style;
-
- if ( stylesDefinitions ) {
- // Digg only those styles that apply to 'div'.
- for ( var i = 0; i < stylesDefinitions.length; i++ ) {
- var styleDefinition = stylesDefinitions[ i ];
- if ( styleDefinition.element && styleDefinition.element == 'div' ) {
- styleName = styleDefinition.name;
- styles[ styleName ] = style = new CKEDITOR.style( styleDefinition );
-
- if ( editor.filter.check( style ) ) {
- // Populate the styles field options with style name.
- stylesField.items.push( [ styleName, styleName ] );
- stylesField.add( styleName, styleName );
- }
- }
- }
- }
-
- // We should disable the content element
- // it if no options are available at all.
- stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ]();
-
- // Now setup the field value manually if dialog was opened on element. (#9689)
- setTimeout( function() {
- dialog._element && stylesField.setup( dialog._element );
- }, 0 );
- });
- },
- onShow: function() {
- // Whether always create new container regardless of existed
- // ones.
- if ( command == 'editdiv' ) {
- // Try to discover the containers that already existed in
- // ranges
- // update dialog field values
- this.setupContent( this._element = CKEDITOR.plugins.div.getSurroundDiv( editor ) );
- }
- },
- onOk: function() {
- if ( command == 'editdiv' )
- containers = [ this._element ];
- else
- containers = createDiv( editor, true );
-
- // Update elements attributes
- var size = containers.length;
- for ( var i = 0; i < size; i++ ) {
- this.commitContent( containers[ i ] );
-
- // Remove empty 'style' attribute.
- !containers[ i ].getAttribute( 'style' ) && containers[ i ].removeAttribute( 'style' );
- }
-
- this.hide();
- },
- onHide: function() {
- // Remove style only when editing existing DIV. (#6315)
- if ( command == 'editdiv' )
- this._element.removeCustomData( 'elementStyle' );
- delete this._element;
- }
- };
- }
-
- CKEDITOR.dialog.add( 'creatediv', function( editor ) {
- return divDialog( editor, 'creatediv' );
- });
- CKEDITOR.dialog.add( 'editdiv', function( editor ) {
- return divDialog( editor, 'editdiv' );
- });
-})();
-
-/**
- * Whether to wrap the whole table instead of indivisual cells when created `<div>` in table cell.
- *
- * config.div_wrapTable = true;
- *
- * @cfg {Boolean} [div_wrapTable=false]
- * @member CKEDITOR.config
- */
+(function(){function p(a,k,o){if(!k.is||!k.getCustomData("block_processed"))k.is&&CKEDITOR.dom.element.setMarker(o,k,"block_processed",!0),a.push(k)}function n(a,k){function o(){this.foreach(function(d){if(/^(?!vbox|hbox)/.test(d.type)&&(d.setup||(d.setup=function(c){d.setValue(c.getAttribute(d.id)||"",1)}),!d.commit))d.commit=function(c){var a=this.getValue();"dir"==d.id&&c.getComputedStyle("direction")==a||(a?c.setAttribute(d.id,a):c.removeAttribute(d.id))}})}var n=function(){var d=CKEDITOR.tools.extend({},
+CKEDITOR.dtd.$blockLimit);a.config.div_wrapTable&&(delete d.td,delete d.th);return d}(),q=CKEDITOR.dtd.div,l={},m=[];return{title:a.lang.div.title,minWidth:400,minHeight:165,contents:[{id:"info",label:a.lang.common.generalTab,title:a.lang.common.generalTab,elements:[{type:"hbox",widths:["50%","50%"],children:[{id:"elementStyle",type:"select",style:"width: 100%;",label:a.lang.div.styleSelectLabel,"default":"",items:[[a.lang.common.notSet,""]],onChange:function(){var d=["info:elementStyle","info:class",
+"advanced:dir","advanced:style"],c=this.getDialog(),h=c._element&&c._element.clone()||new CKEDITOR.dom.element("div",a.document);this.commit(h,!0);for(var d=[].concat(d),b=d.length,i,f=0;f<b;f++)(i=c.getContentElement.apply(c,d[f].split(":")))&&i.setup&&i.setup(h,!0)},setup:function(a){for(var c in l)l[c].checkElementRemovable(a,!0)&&this.setValue(c,1)},commit:function(a){var c;(c=this.getValue())?l[c].applyToObject(a):a.removeAttribute("style")}},{id:"class",type:"text",requiredContent:"div(cke-xyz)",
+label:a.lang.common.cssClass,"default":""}]}]},{id:"advanced",label:a.lang.common.advancedTab,title:a.lang.common.advancedTab,elements:[{type:"vbox",padding:1,children:[{type:"hbox",widths:["50%","50%"],children:[{type:"text",id:"id",requiredContent:"div[id]",label:a.lang.common.id,"default":""},{type:"text",id:"lang",requiredContent:"div[lang]",label:a.lang.common.langCode,"default":""}]},{type:"hbox",children:[{type:"text",id:"style",requiredContent:"div{cke-xyz}",style:"width: 100%;",label:a.lang.common.cssStyle,
+"default":"",commit:function(a){a.setAttribute("style",this.getValue())}}]},{type:"hbox",children:[{type:"text",id:"title",requiredContent:"div[title]",style:"width: 100%;",label:a.lang.common.advisoryTitle,"default":""}]},{type:"select",id:"dir",requiredContent:"div[dir]",style:"width: 100%;",label:a.lang.common.langDir,"default":"",items:[[a.lang.common.notSet,""],[a.lang.common.langDirLtr,"ltr"],[a.lang.common.langDirRtl,"rtl"]]}]}]}],onLoad:function(){o.call(this);var d=this,c=this.getContentElement("info",
+"elementStyle");a.getStylesSet(function(h){var b,i;if(h)for(var f=0;f<h.length;f++)i=h[f],i.element&&"div"==i.element&&(b=i.name,l[b]=i=new CKEDITOR.style(i),a.filter.check(i)&&(c.items.push([b,b]),c.add(b,b)));c[1<c.items.length?"enable":"disable"]();setTimeout(function(){d._element&&c.setup(d._element)},0)})},onShow:function(){"editdiv"==k&&this.setupContent(this._element=CKEDITOR.plugins.div.getSurroundDiv(a))},onOk:function(){if("editdiv"==k)m=[this._element];else{var d=[],c={},h=[],b,i=a.getSelection(),
+f=i.getRanges(),l=i.createBookmarks(),g,j;for(g=0;g<f.length;g++)for(j=f[g].createIterator();b=j.getNextParagraph();)if(b.getName()in n&&!b.isReadOnly()){var e=b.getChildren();for(b=0;b<e.count();b++)p(h,e.getItem(b),c)}else{for(;!q[b.getName()]&&!b.equals(f[g].root);)b=b.getParent();p(h,b,c)}CKEDITOR.dom.element.clearAllMarkers(c);f=[];g=null;for(j=0;j<h.length;j++)b=h[j],e=a.elementPath(b).blockLimit,e.isReadOnly()&&(e=e.getParent()),a.config.div_wrapTable&&e.is(["td","th"])&&(e=a.elementPath(e.getParent()).blockLimit),
+e.equals(g)||(g=e,f.push([])),f[f.length-1].push(b);for(g=0;g<f.length;g++){e=f[g][0];h=e.getParent();for(b=1;b<f[g].length;b++)h=h.getCommonAncestor(f[g][b]);j=new CKEDITOR.dom.element("div",a.document);for(b=0;b<f[g].length;b++){for(e=f[g][b];!e.getParent().equals(h);)e=e.getParent();f[g][b]=e}for(b=0;b<f[g].length;b++)if(e=f[g][b],!e.getCustomData||!e.getCustomData("block_processed"))e.is&&CKEDITOR.dom.element.setMarker(c,e,"block_processed",!0),b||j.insertBefore(e),j.append(e);CKEDITOR.dom.element.clearAllMarkers(c);
+d.push(j)}i.selectBookmarks(l);m=d}d=m.length;for(c=0;c<d;c++)this.commitContent(m[c]),!m[c].getAttribute("style")&&m[c].removeAttribute("style");this.hide()},onHide:function(){"editdiv"==k&&this._element.removeCustomData("elementStyle");delete this._element}}}CKEDITOR.dialog.add("creatediv",function(a){return n(a,"creatediv")});CKEDITOR.dialog.add("editdiv",function(a){return n(a,"editdiv")})})(); \ No newline at end of file
diff --git a/plugins/find/dialogs/find.js b/plugins/find/dialogs/find.js
index a7168c7..0d64b3c 100644..100755
--- a/plugins/find/dialogs/find.js
+++ b/plugins/find/dialogs/find.js
@@ -1,785 +1,24 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-(function() {
- var isReplace;
-
- function findEvaluator( node ) {
- return node.type == CKEDITOR.NODE_TEXT && node.getLength() > 0 && ( !isReplace || !node.isReadOnly() );
- }
-
- // Elements which break characters been considered as sequence.
- function nonCharactersBoundary( node ) {
- return !( node.type == CKEDITOR.NODE_ELEMENT && node.isBlockBoundary( CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$empty, CKEDITOR.dtd.$nonEditable ) ) );
- }
-
- // Get the cursor object which represent both current character and it's dom
- // position thing.
- var cursorStep = function() {
- return {
- textNode: this.textNode,
- offset: this.offset,
- character: this.textNode ? this.textNode.getText().charAt( this.offset ) : null,
- hitMatchBoundary: this._.matchBoundary
- };
- };
-
- var pages = [ 'find', 'replace' ],
- fieldsMapping = [
- [ 'txtFindFind', 'txtFindReplace' ],
- [ 'txtFindCaseChk', 'txtReplaceCaseChk' ],
- [ 'txtFindWordChk', 'txtReplaceWordChk' ],
- [ 'txtFindCyclic', 'txtReplaceCyclic' ] ];
-
- // Synchronize corresponding filed values between 'replace' and 'find' pages.
- // @param {String} currentPageId The page id which receive values.
- function syncFieldsBetweenTabs( currentPageId ) {
- var sourceIndex, targetIndex, sourceField, targetField;
-
- sourceIndex = currentPageId === 'find' ? 1 : 0;
- targetIndex = 1 - sourceIndex;
- var i,
- l = fieldsMapping.length;
- for ( i = 0; i < l; i++ ) {
- sourceField = this.getContentElement( pages[ sourceIndex ], fieldsMapping[ i ][ sourceIndex ] );
- targetField = this.getContentElement( pages[ targetIndex ], fieldsMapping[ i ][ targetIndex ] );
-
- targetField.setValue( sourceField.getValue() );
- }
- }
-
- var findDialog = function( editor, startupPage ) {
- // Style object for highlights: (#5018)
- // 1. Defined as full match style to avoid compromising ordinary text color styles.
- // 2. Must be apply onto inner-most text to avoid conflicting with ordinary text color styles visually.
- var highlightStyle = new CKEDITOR.style( CKEDITOR.tools.extend({
- attributes: { 'data-cke-highlight':1 },
- fullMatch: 1, ignoreReadonly: 1, childRule: function() {
- return 0;
- } }, editor.config.find_highlight, true ) );
-
- // Iterator which walk through the specified range char by char. By
- // default the walking will not stop at the character boundaries, until
- // the end of the range is encountered.
- // @param { CKEDITOR.dom.range } range
- // @param {Boolean} matchWord Whether the walking will stop at character boundary.
- var characterWalker = function( range, matchWord ) {
- var self = this;
- var walker = new CKEDITOR.dom.walker( range );
- walker.guard = matchWord ? nonCharactersBoundary : function( node ) {
- !nonCharactersBoundary( node ) && ( self._.matchBoundary = true );
- };
- walker[ 'evaluator' ] = findEvaluator;
- walker.breakOnFalse = 1;
-
- if ( range.startContainer.type == CKEDITOR.NODE_TEXT ) {
- this.textNode = range.startContainer;
- this.offset = range.startOffset - 1;
- }
-
- this._ = {
- matchWord: matchWord,
- walker: walker,
- matchBoundary: false
- };
- };
-
- characterWalker.prototype = {
- next: function() {
- return this.move();
- },
-
- back: function() {
- return this.move( true );
- },
-
- move: function( rtl ) {
- var currentTextNode = this.textNode;
- // Already at the end of document, no more character available.
- if ( currentTextNode === null )
- return cursorStep.call( this );
-
- this._.matchBoundary = false;
-
- // There are more characters in the text node, step forward.
- if ( currentTextNode && rtl && this.offset > 0 ) {
- this.offset--;
- return cursorStep.call( this );
- } else if ( currentTextNode && this.offset < currentTextNode.getLength() - 1 ) {
- this.offset++;
- return cursorStep.call( this );
- } else {
- currentTextNode = null;
- // At the end of the text node, walking foward for the next.
- while ( !currentTextNode ) {
- currentTextNode = this._.walker[ rtl ? 'previous' : 'next' ].call( this._.walker );
-
- // Stop searching if we're need full word match OR
- // already reach document end.
- if ( this._.matchWord && !currentTextNode || this._.walker._.end )
- break;
- }
- // Found a fresh text node.
- this.textNode = currentTextNode;
- if ( currentTextNode )
- this.offset = rtl ? currentTextNode.getLength() - 1 : 0;
- else
- this.offset = 0;
- }
-
- return cursorStep.call( this );
- }
-
- };
-
- /**
- * A range of cursors which represent a trunk of characters which try to
- * match, it has the same length as the pattern string.
- *
- * **Note:** This class isn't accessible from global scope.
- *
- * @private
- * @class CKEDITOR.plugins.find.characterRange
- * @constructor Creates a characterRange class instance.
- */
- var characterRange = function( characterWalker, rangeLength ) {
- this._ = {
- walker: characterWalker,
- cursors: [],
- rangeLength: rangeLength,
- highlightRange: null,
- isMatched: 0
- };
- };
-
- characterRange.prototype = {
- /**
- * Translate this range to {@link CKEDITOR.dom.range}.
- */
- toDomRange: function() {
- var range = editor.createRange();
- var cursors = this._.cursors;
- if ( cursors.length < 1 ) {
- var textNode = this._.walker.textNode;
- if ( textNode )
- range.setStartAfter( textNode );
- else
- return null;
- } else {
- var first = cursors[ 0 ],
- last = cursors[ cursors.length - 1 ];
-
- range.setStart( first.textNode, first.offset );
- range.setEnd( last.textNode, last.offset + 1 );
- }
-
- return range;
- },
-
- /**
- * Reflect the latest changes from dom range.
- */
- updateFromDomRange: function( domRange ) {
- var cursor,
- walker = new characterWalker( domRange );
- this._.cursors = [];
- do {
- cursor = walker.next();
- if ( cursor.character ) this._.cursors.push( cursor );
- }
- while ( cursor.character );
- this._.rangeLength = this._.cursors.length;
- },
-
- setMatched: function() {
- this._.isMatched = true;
- },
-
- clearMatched: function() {
- this._.isMatched = false;
- },
-
- isMatched: function() {
- return this._.isMatched;
- },
-
- /**
- * Hightlight the current matched chunk of text.
- */
- highlight: function() {
- // Do not apply if nothing is found.
- if ( this._.cursors.length < 1 )
- return;
-
- // Remove the previous highlight if there's one.
- if ( this._.highlightRange )
- this.removeHighlight();
-
- // Apply the highlight.
- var range = this.toDomRange(),
- bookmark = range.createBookmark();
- highlightStyle.applyToRange( range );
- range.moveToBookmark( bookmark );
- this._.highlightRange = range;
-
- // Scroll the editor to the highlighted area.
- var element = range.startContainer;
- if ( element.type != CKEDITOR.NODE_ELEMENT )
- element = element.getParent();
- element.scrollIntoView();
-
- // Update the character cursors.
- this.updateFromDomRange( range );
- },
-
- /**
- * Remove highlighted find result.
- */
- removeHighlight: function() {
- if ( !this._.highlightRange )
- return;
-
- var bookmark = this._.highlightRange.createBookmark();
- highlightStyle.removeFromRange( this._.highlightRange );
- this._.highlightRange.moveToBookmark( bookmark );
- this.updateFromDomRange( this._.highlightRange );
- this._.highlightRange = null;
- },
-
- isReadOnly: function() {
- if ( !this._.highlightRange )
- return 0;
-
- return this._.highlightRange.startContainer.isReadOnly();
- },
-
- moveBack: function() {
- var retval = this._.walker.back(),
- cursors = this._.cursors;
-
- if ( retval.hitMatchBoundary )
- this._.cursors = cursors = [];
-
- cursors.unshift( retval );
- if ( cursors.length > this._.rangeLength )
- cursors.pop();
-
- return retval;
- },
-
- moveNext: function() {
- var retval = this._.walker.next(),
- cursors = this._.cursors;
-
- // Clear the cursors queue if we've crossed a match boundary.
- if ( retval.hitMatchBoundary )
- this._.cursors = cursors = [];
-
- cursors.push( retval );
- if ( cursors.length > this._.rangeLength )
- cursors.shift();
-
- return retval;
- },
-
- getEndCharacter: function() {
- var cursors = this._.cursors;
- if ( cursors.length < 1 )
- return null;
-
- return cursors[ cursors.length - 1 ].character;
- },
-
- getNextCharacterRange: function( maxLength ) {
- var lastCursor, nextRangeWalker,
- cursors = this._.cursors;
-
- if ( ( lastCursor = cursors[ cursors.length - 1 ] ) && lastCursor.textNode )
- nextRangeWalker = new characterWalker( getRangeAfterCursor( lastCursor ) );
- // In case it's an empty range (no cursors), figure out next range from walker (#4951).
- else
- nextRangeWalker = this._.walker;
-
- return new characterRange( nextRangeWalker, maxLength );
- },
-
- getCursors: function() {
- return this._.cursors;
- }
- };
-
-
- // The remaining document range after the character cursor.
- function getRangeAfterCursor( cursor, inclusive ) {
- var range = editor.createRange();
- range.setStart( cursor.textNode, ( inclusive ? cursor.offset : cursor.offset + 1 ) );
- range.setEndAt( editor.editable(), CKEDITOR.POSITION_BEFORE_END );
- return range;
- }
-
- // The document range before the character cursor.
- function getRangeBeforeCursor( cursor ) {
- var range = editor.createRange();
- range.setStartAt( editor.editable(), CKEDITOR.POSITION_AFTER_START );
- range.setEnd( cursor.textNode, cursor.offset );
- return range;
- }
-
- var KMP_NOMATCH = 0,
- KMP_ADVANCED = 1,
- KMP_MATCHED = 2;
-
- // Examination the occurrence of a word which implement KMP algorithm.
- var kmpMatcher = function( pattern, ignoreCase ) {
- var overlap = [ -1 ];
- if ( ignoreCase )
- pattern = pattern.toLowerCase();
- for ( var i = 0; i < pattern.length; i++ ) {
- overlap.push( overlap[ i ] + 1 );
- while ( overlap[ i + 1 ] > 0 && pattern.charAt( i ) != pattern.charAt( overlap[ i + 1 ] - 1 ) )
- overlap[ i + 1 ] = overlap[ overlap[ i + 1 ] - 1 ] + 1;
- }
-
- this._ = {
- overlap: overlap,
- state: 0,
- ignoreCase: !!ignoreCase,
- pattern: pattern
- };
- };
-
- kmpMatcher.prototype = {
- feedCharacter: function( c ) {
- if ( this._.ignoreCase )
- c = c.toLowerCase();
-
- while ( true ) {
- if ( c == this._.pattern.charAt( this._.state ) ) {
- this._.state++;
- if ( this._.state == this._.pattern.length ) {
- this._.state = 0;
- return KMP_MATCHED;
- }
- return KMP_ADVANCED;
- } else if ( !this._.state )
- return KMP_NOMATCH;
- else
- this._.state = this._.overlap[ this._.state ];
- }
-
- return null;
- },
-
- reset: function() {
- this._.state = 0;
- }
- };
-
- var wordSeparatorRegex = /[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/;
-
- var isWordSeparator = function( c ) {
- if ( !c )
- return true;
- var code = c.charCodeAt( 0 );
- return ( code >= 9 && code <= 0xd ) || ( code >= 0x2000 && code <= 0x200a ) || wordSeparatorRegex.test( c );
- };
-
- var finder = {
- searchRange: null,
- matchRange: null,
- find: function( pattern, matchCase, matchWord, matchCyclic, highlightMatched, cyclicRerun ) {
- if ( !this.matchRange )
- this.matchRange = new characterRange( new characterWalker( this.searchRange ), pattern.length );
- else {
- this.matchRange.removeHighlight();
- this.matchRange = this.matchRange.getNextCharacterRange( pattern.length );
- }
-
- var matcher = new kmpMatcher( pattern, !matchCase ),
- matchState = KMP_NOMATCH,
- character = '%';
-
- while ( character !== null ) {
- this.matchRange.moveNext();
- while ( ( character = this.matchRange.getEndCharacter() ) ) {
- matchState = matcher.feedCharacter( character );
- if ( matchState == KMP_MATCHED )
- break;
- if ( this.matchRange.moveNext().hitMatchBoundary )
- matcher.reset();
- }
-
- if ( matchState == KMP_MATCHED ) {
- if ( matchWord ) {
- var cursors = this.matchRange.getCursors(),
- tail = cursors[ cursors.length - 1 ],
- head = cursors[ 0 ];
-
- var rangeBefore = getRangeBeforeCursor( head ),
- rangeAfter = getRangeAfterCursor( tail );
-
- // The word boundary checks requires to trim the text nodes. (#9036)
- rangeBefore.trim();
- rangeAfter.trim();
-
- var headWalker = new characterWalker( rangeBefore, true ),
- tailWalker = new characterWalker( rangeAfter, true );
-
- if ( !( isWordSeparator( headWalker.back().character ) && isWordSeparator( tailWalker.next().character ) ) )
- continue;
- }
- this.matchRange.setMatched();
- if ( highlightMatched !== false )
- this.matchRange.highlight();
- return true;
- }
- }
-
- this.matchRange.clearMatched();
- this.matchRange.removeHighlight();
- // Clear current session and restart with the default search
- // range.
- // Re-run the finding once for cyclic.(#3517)
- if ( matchCyclic && !cyclicRerun ) {
- this.searchRange = getSearchRange( 1 );
- this.matchRange = null;
- return arguments.callee.apply( this, Array.prototype.slice.call( arguments ).concat( [ true ] ) );
- }
-
- return false;
- },
-
- // Record how much replacement occurred toward one replacing.
- replaceCounter: 0,
-
- replace: function( dialog, pattern, newString, matchCase, matchWord, matchCyclic, isReplaceAll ) {
- isReplace = 1;
-
- // Successiveness of current replace/find.
- var result = 0;
-
- // 1. Perform the replace when there's already a match here.
- // 2. Otherwise perform the find but don't replace it immediately.
- if ( this.matchRange && this.matchRange.isMatched() && !this.matchRange._.isReplaced && !this.matchRange.isReadOnly() ) {
- // Turn off highlight for a while when saving snapshots.
- this.matchRange.removeHighlight();
- var domRange = this.matchRange.toDomRange();
- var text = editor.document.createText( newString );
- if ( !isReplaceAll ) {
- // Save undo snaps before and after the replacement.
- var selection = editor.getSelection();
- selection.selectRanges( [ domRange ] );
- editor.fire( 'saveSnapshot' );
- }
- domRange.deleteContents();
- domRange.insertNode( text );
- if ( !isReplaceAll ) {
- selection.selectRanges( [ domRange ] );
- editor.fire( 'saveSnapshot' );
- }
- this.matchRange.updateFromDomRange( domRange );
- if ( !isReplaceAll )
- this.matchRange.highlight();
- this.matchRange._.isReplaced = true;
- this.replaceCounter++;
- result = 1;
- } else
- result = this.find( pattern, matchCase, matchWord, matchCyclic, !isReplaceAll );
-
- isReplace = 0;
-
- return result;
- }
- };
-
- // The range in which find/replace happened, receive from user
- // selection prior.
- function getSearchRange( isDefault ) {
- var searchRange,
- sel = editor.getSelection(),
- editable = editor.editable();
-
- if ( sel && !isDefault ) {
- searchRange = sel.getRanges()[ 0 ].clone();
- searchRange.collapse( true );
- } else {
- searchRange = editor.createRange();
- searchRange.setStartAt( editable, CKEDITOR.POSITION_AFTER_START );
- }
- searchRange.setEndAt( editable, CKEDITOR.POSITION_BEFORE_END );
- return searchRange;
- }
-
- var lang = editor.lang.find;
- return {
- title: lang.title,
- resizable: CKEDITOR.DIALOG_RESIZE_NONE,
- minWidth: 350,
- minHeight: 170,
- buttons: [ CKEDITOR.dialog.cancelButton ], // Cancel button only.
- contents: [
- {
- id: 'find',
- label: lang.find,
- title: lang.find,
- accessKey: '',
- elements: [
- {
- type: 'hbox',
- widths: [ '230px', '90px' ],
- children: [
- {
- type: 'text',
- id: 'txtFindFind',
- label: lang.findWhat,
- isChanged: false,
- labelLayout: 'horizontal',
- accessKey: 'F'
- },
- {
- type: 'button',
- id: 'btnFind',
- align: 'left',
- style: 'width:100%',
- label: lang.find,
- onClick: function() {
- var dialog = this.getDialog();
- if ( !finder.find( dialog.getValueOf( 'find', 'txtFindFind' ), dialog.getValueOf( 'find', 'txtFindCaseChk' ), dialog.getValueOf( 'find', 'txtFindWordChk' ), dialog.getValueOf( 'find', 'txtFindCyclic' ) ) )
- alert( lang.notFoundMsg );
- }
- }
- ]
- },
- {
- type: 'fieldset',
- label: CKEDITOR.tools.htmlEncode( lang.findOptions ),
- style: 'margin-top:29px',
- children: [
- {
- type: 'vbox',
- padding: 0,
- children: [
- {
- type: 'checkbox',
- id: 'txtFindCaseChk',
- isChanged: false,
- label: lang.matchCase
- },
- {
- type: 'checkbox',
- id: 'txtFindWordChk',
- isChanged: false,
- label: lang.matchWord
- },
- {
- type: 'checkbox',
- id: 'txtFindCyclic',
- isChanged: false,
- 'default': true,
- label: lang.matchCyclic
- }
- ]
- }
- ]
- }
- ]
- },
- {
- id: 'replace',
- label: lang.replace,
- accessKey: 'M',
- elements: [
- {
- type: 'hbox',
- widths: [ '230px', '90px' ],
- children: [
- {
- type: 'text',
- id: 'txtFindReplace',
- label: lang.findWhat,
- isChanged: false,
- labelLayout: 'horizontal',
- accessKey: 'F'
- },
- {
- type: 'button',
- id: 'btnFindReplace',
- align: 'left',
- style: 'width:100%',
- label: lang.replace,
- onClick: function() {
- var dialog = this.getDialog();
- if ( !finder.replace( dialog, dialog.getValueOf( 'replace', 'txtFindReplace' ), dialog.getValueOf( 'replace', 'txtReplace' ), dialog.getValueOf( 'replace', 'txtReplaceCaseChk' ), dialog.getValueOf( 'replace', 'txtReplaceWordChk' ), dialog.getValueOf( 'replace', 'txtReplaceCyclic' ) ) )
- alert( lang.notFoundMsg );
- }
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '230px', '90px' ],
- children: [
- {
- type: 'text',
- id: 'txtReplace',
- label: lang.replaceWith,
- isChanged: false,
- labelLayout: 'horizontal',
- accessKey: 'R'
- },
- {
- type: 'button',
- id: 'btnReplaceAll',
- align: 'left',
- style: 'width:100%',
- label: lang.replaceAll,
- isChanged: false,
- onClick: function() {
- var dialog = this.getDialog();
- var replaceNums;
-
- finder.replaceCounter = 0;
-
- // Scope to full document.
- finder.searchRange = getSearchRange( 1 );
- if ( finder.matchRange ) {
- finder.matchRange.removeHighlight();
- finder.matchRange = null;
- }
- editor.fire( 'saveSnapshot' );
- while ( finder.replace( dialog, dialog.getValueOf( 'replace', 'txtFindReplace' ), dialog.getValueOf( 'replace', 'txtReplace' ), dialog.getValueOf( 'replace', 'txtReplaceCaseChk' ), dialog.getValueOf( 'replace', 'txtReplaceWordChk' ), false, true ) ) {
- /*jsl:pass*/
- }
-
- if ( finder.replaceCounter ) {
- alert( lang.replaceSuccessMsg.replace( /%1/, finder.replaceCounter ) );
- editor.fire( 'saveSnapshot' );
- } else
- alert( lang.notFoundMsg );
- }
- }
- ]
- },
- {
- type: 'fieldset',
- label: CKEDITOR.tools.htmlEncode( lang.findOptions ),
- children: [
- {
- type: 'vbox',
- padding: 0,
- children: [
- {
- type: 'checkbox',
- id: 'txtReplaceCaseChk',
- isChanged: false,
- label: lang.matchCase
- },
- {
- type: 'checkbox',
- id: 'txtReplaceWordChk',
- isChanged: false,
- label: lang.matchWord
- },
- {
- type: 'checkbox',
- id: 'txtReplaceCyclic',
- isChanged: false,
- 'default': true,
- label: lang.matchCyclic
- }
- ]
- }
- ]
- }
- ]
- }
- ],
- onLoad: function() {
- var dialog = this;
-
- // Keep track of the current pattern field in use.
- var patternField, wholeWordChkField;
-
- // Ignore initial page select on dialog show
- var isUserSelect = 0;
- this.on( 'hide', function() {
- isUserSelect = 0;
- });
- this.on( 'show', function() {
- isUserSelect = 1;
- });
-
- this.selectPage = CKEDITOR.tools.override( this.selectPage, function( originalFunc ) {
- return function( pageId ) {
- originalFunc.call( dialog, pageId );
-
- var currPage = dialog._.tabs[ pageId ];
- var patternFieldInput, patternFieldId, wholeWordChkFieldId;
- patternFieldId = pageId === 'find' ? 'txtFindFind' : 'txtFindReplace';
- wholeWordChkFieldId = pageId === 'find' ? 'txtFindWordChk' : 'txtReplaceWordChk';
-
- patternField = dialog.getContentElement( pageId, patternFieldId );
- wholeWordChkField = dialog.getContentElement( pageId, wholeWordChkFieldId );
-
- // Prepare for check pattern text filed 'keyup' event
- if ( !currPage.initialized ) {
- patternFieldInput = CKEDITOR.document.getById( patternField._.inputId );
- currPage.initialized = true;
- }
-
- // Synchronize fields on tab switch.
- if ( isUserSelect )
- syncFieldsBetweenTabs.call( this, pageId );
- };
- });
-
- },
- onShow: function() {
- // Establish initial searching start position.
- finder.searchRange = getSearchRange();
-
- // Fill in the find field with selected text.
- var selectedText = this.getParentEditor().getSelection().getSelectedText(),
- patternFieldId = ( startupPage == 'find' ? 'txtFindFind' : 'txtFindReplace' );
-
- var field = this.getContentElement( startupPage, patternFieldId );
- field.setValue( selectedText );
- field.select();
-
- this.selectPage( startupPage );
-
- this[ ( startupPage == 'find' && this._.editor.readOnly ? 'hide' : 'show' ) + 'Page' ]( 'replace' );
- },
- onHide: function() {
- var range;
- if ( finder.matchRange && finder.matchRange.isMatched() ) {
- finder.matchRange.removeHighlight();
- editor.focus();
-
- range = finder.matchRange.toDomRange();
- if ( range )
- editor.getSelection().selectRanges( [ range ] );
- }
-
- // Clear current session before dialog close
- delete finder.matchRange;
- },
- onFocus: function() {
- if ( startupPage == 'replace' )
- return this.getContentElement( 'replace', 'txtFindReplace' );
- else
- return this.getContentElement( 'find', 'txtFindFind' );
- }
- };
- };
-
- CKEDITOR.dialog.add( 'find', function( editor ) {
- return findDialog( editor, 'find' );
- });
-
- CKEDITOR.dialog.add( 'replace', function( editor ) {
- return findDialog( editor, 'replace' );
- });
-})();
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+(function(){function y(c){return c.type==CKEDITOR.NODE_TEXT&&0<c.getLength()&&(!o||!c.isReadOnly())}function s(c){return!(c.type==CKEDITOR.NODE_ELEMENT&&c.isBlockBoundary(CKEDITOR.tools.extend({},CKEDITOR.dtd.$empty,CKEDITOR.dtd.$nonEditable)))}var o,t=function(){return{textNode:this.textNode,offset:this.offset,character:this.textNode?this.textNode.getText().charAt(this.offset):null,hitMatchBoundary:this._.matchBoundary}},u=["find","replace"],p=[["txtFindFind","txtFindReplace"],["txtFindCaseChk",
+"txtReplaceCaseChk"],["txtFindWordChk","txtReplaceWordChk"],["txtFindCyclic","txtReplaceCyclic"]],n=function(c,g){function n(a,b){var d=c.createRange();d.setStart(a.textNode,b?a.offset:a.offset+1);d.setEndAt(c.editable(),CKEDITOR.POSITION_BEFORE_END);return d}function q(a){var b=c.getSelection(),d=c.editable();b&&!a?(a=b.getRanges()[0].clone(),a.collapse(!0)):(a=c.createRange(),a.setStartAt(d,CKEDITOR.POSITION_AFTER_START));a.setEndAt(d,CKEDITOR.POSITION_BEFORE_END);return a}var v=new CKEDITOR.style(CKEDITOR.tools.extend({attributes:{"data-cke-highlight":1},
+fullMatch:1,ignoreReadonly:1,childRule:function(){return 0}},c.config.find_highlight,!0)),l=function(a,b){var d=this,c=new CKEDITOR.dom.walker(a);c.guard=b?s:function(a){!s(a)&&(d._.matchBoundary=!0)};c.evaluator=y;c.breakOnFalse=1;a.startContainer.type==CKEDITOR.NODE_TEXT&&(this.textNode=a.startContainer,this.offset=a.startOffset-1);this._={matchWord:b,walker:c,matchBoundary:!1}};l.prototype={next:function(){return this.move()},back:function(){return this.move(!0)},move:function(a){var b=this.textNode;
+if(null===b)return t.call(this);this._.matchBoundary=!1;if(b&&a&&0<this.offset)this.offset--;else if(b&&this.offset<b.getLength()-1)this.offset++;else{for(b=null;!b&&!(b=this._.walker[a?"previous":"next"].call(this._.walker),this._.matchWord&&!b||this._.walker._.end););this.offset=(this.textNode=b)?a?b.getLength()-1:0:0}return t.call(this)}};var r=function(a,b){this._={walker:a,cursors:[],rangeLength:b,highlightRange:null,isMatched:0}};r.prototype={toDomRange:function(){var a=c.createRange(),b=this._.cursors;
+if(1>b.length){var d=this._.walker.textNode;if(d)a.setStartAfter(d);else return null}else d=b[0],b=b[b.length-1],a.setStart(d.textNode,d.offset),a.setEnd(b.textNode,b.offset+1);return a},updateFromDomRange:function(a){var b=new l(a);this._.cursors=[];do a=b.next(),a.character&&this._.cursors.push(a);while(a.character);this._.rangeLength=this._.cursors.length},setMatched:function(){this._.isMatched=!0},clearMatched:function(){this._.isMatched=!1},isMatched:function(){return this._.isMatched},highlight:function(){if(!(1>
+this._.cursors.length)){this._.highlightRange&&this.removeHighlight();var a=this.toDomRange(),b=a.createBookmark();v.applyToRange(a);a.moveToBookmark(b);this._.highlightRange=a;b=a.startContainer;b.type!=CKEDITOR.NODE_ELEMENT&&(b=b.getParent());b.scrollIntoView();this.updateFromDomRange(a)}},removeHighlight:function(){if(this._.highlightRange){var a=this._.highlightRange.createBookmark();v.removeFromRange(this._.highlightRange);this._.highlightRange.moveToBookmark(a);this.updateFromDomRange(this._.highlightRange);
+this._.highlightRange=null}},isReadOnly:function(){return!this._.highlightRange?0:this._.highlightRange.startContainer.isReadOnly()},moveBack:function(){var a=this._.walker.back(),b=this._.cursors;a.hitMatchBoundary&&(this._.cursors=b=[]);b.unshift(a);b.length>this._.rangeLength&&b.pop();return a},moveNext:function(){var a=this._.walker.next(),b=this._.cursors;a.hitMatchBoundary&&(this._.cursors=b=[]);b.push(a);b.length>this._.rangeLength&&b.shift();return a},getEndCharacter:function(){var a=this._.cursors;
+return 1>a.length?null:a[a.length-1].character},getNextCharacterRange:function(a){var b,d;d=this._.cursors;d=(b=d[d.length-1])&&b.textNode?new l(n(b)):this._.walker;return new r(d,a)},getCursors:function(){return this._.cursors}};var w=function(a,b){var d=[-1];b&&(a=a.toLowerCase());for(var c=0;c<a.length;c++)for(d.push(d[c]+1);0<d[c+1]&&a.charAt(c)!=a.charAt(d[c+1]-1);)d[c+1]=d[d[c+1]-1]+1;this._={overlap:d,state:0,ignoreCase:!!b,pattern:a}};w.prototype={feedCharacter:function(a){for(this._.ignoreCase&&
+(a=a.toLowerCase());;){if(a==this._.pattern.charAt(this._.state))return this._.state++,this._.state==this._.pattern.length?(this._.state=0,2):1;if(this._.state)this._.state=this._.overlap[this._.state];else return 0}return null},reset:function(){this._.state=0}};var z=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,x=function(a){if(!a)return!0;var b=a.charCodeAt(0);return 9<=b&&13>=b||8192<=b&&8202>=b||z.test(a)},e={searchRange:null,matchRange:null,find:function(a,b,d,f,e,A){this.matchRange?
+(this.matchRange.removeHighlight(),this.matchRange=this.matchRange.getNextCharacterRange(a.length)):this.matchRange=new r(new l(this.searchRange),a.length);for(var i=new w(a,!b),j=0,k="%";null!==k;){for(this.matchRange.moveNext();k=this.matchRange.getEndCharacter();){j=i.feedCharacter(k);if(2==j)break;this.matchRange.moveNext().hitMatchBoundary&&i.reset()}if(2==j){if(d){var h=this.matchRange.getCursors(),m=h[h.length-1],h=h[0],g=c.createRange();g.setStartAt(c.editable(),CKEDITOR.POSITION_AFTER_START);
+g.setEnd(h.textNode,h.offset);h=g;m=n(m);h.trim();m.trim();h=new l(h,!0);m=new l(m,!0);if(!x(h.back().character)||!x(m.next().character))continue}this.matchRange.setMatched();!1!==e&&this.matchRange.highlight();return!0}}this.matchRange.clearMatched();this.matchRange.removeHighlight();return f&&!A?(this.searchRange=q(1),this.matchRange=null,arguments.callee.apply(this,Array.prototype.slice.call(arguments).concat([!0]))):!1},replaceCounter:0,replace:function(a,b,d,f,e,g,i){o=1;a=0;if(this.matchRange&&
+this.matchRange.isMatched()&&!this.matchRange._.isReplaced&&!this.matchRange.isReadOnly()){this.matchRange.removeHighlight();b=this.matchRange.toDomRange();d=c.document.createText(d);if(!i){var j=c.getSelection();j.selectRanges([b]);c.fire("saveSnapshot")}b.deleteContents();b.insertNode(d);i||(j.selectRanges([b]),c.fire("saveSnapshot"));this.matchRange.updateFromDomRange(b);i||this.matchRange.highlight();this.matchRange._.isReplaced=!0;this.replaceCounter++;a=1}else a=this.find(b,f,e,g,!i);o=0;return a}},
+f=c.lang.find;return{title:f.title,resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:350,minHeight:170,buttons:[CKEDITOR.dialog.cancelButton(c,{label:c.lang.common.close})],contents:[{id:"find",label:f.find,title:f.find,accessKey:"",elements:[{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtFindFind",label:f.findWhat,isChanged:!1,labelLayout:"horizontal",accessKey:"F"},{type:"button",id:"btnFind",align:"left",style:"width:100%",label:f.find,onClick:function(){var a=this.getDialog();
+e.find(a.getValueOf("find","txtFindFind"),a.getValueOf("find","txtFindCaseChk"),a.getValueOf("find","txtFindWordChk"),a.getValueOf("find","txtFindCyclic"))||alert(f.notFoundMsg)}}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(f.findOptions),style:"margin-top:29px",children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"txtFindCaseChk",isChanged:!1,label:f.matchCase},{type:"checkbox",id:"txtFindWordChk",isChanged:!1,label:f.matchWord},{type:"checkbox",id:"txtFindCyclic",isChanged:!1,"default":!0,
+label:f.matchCyclic}]}]}]},{id:"replace",label:f.replace,accessKey:"M",elements:[{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtFindReplace",label:f.findWhat,isChanged:!1,labelLayout:"horizontal",accessKey:"F"},{type:"button",id:"btnFindReplace",align:"left",style:"width:100%",label:f.replace,onClick:function(){var a=this.getDialog();e.replace(a,a.getValueOf("replace","txtFindReplace"),a.getValueOf("replace","txtReplace"),a.getValueOf("replace","txtReplaceCaseChk"),a.getValueOf("replace",
+"txtReplaceWordChk"),a.getValueOf("replace","txtReplaceCyclic"))||alert(f.notFoundMsg)}}]},{type:"hbox",widths:["230px","90px"],children:[{type:"text",id:"txtReplace",label:f.replaceWith,isChanged:!1,labelLayout:"horizontal",accessKey:"R"},{type:"button",id:"btnReplaceAll",align:"left",style:"width:100%",label:f.replaceAll,isChanged:!1,onClick:function(){var a=this.getDialog();e.replaceCounter=0;e.searchRange=q(1);e.matchRange&&(e.matchRange.removeHighlight(),e.matchRange=null);for(c.fire("saveSnapshot");e.replace(a,
+a.getValueOf("replace","txtFindReplace"),a.getValueOf("replace","txtReplace"),a.getValueOf("replace","txtReplaceCaseChk"),a.getValueOf("replace","txtReplaceWordChk"),!1,!0););e.replaceCounter?(alert(f.replaceSuccessMsg.replace(/%1/,e.replaceCounter)),c.fire("saveSnapshot")):alert(f.notFoundMsg)}}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(f.findOptions),children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"txtReplaceCaseChk",isChanged:!1,label:f.matchCase},{type:"checkbox",id:"txtReplaceWordChk",
+isChanged:!1,label:f.matchWord},{type:"checkbox",id:"txtReplaceCyclic",isChanged:!1,"default":!0,label:f.matchCyclic}]}]}]}],onLoad:function(){var a=this,b,c=0;this.on("hide",function(){c=0});this.on("show",function(){c=1});this.selectPage=CKEDITOR.tools.override(this.selectPage,function(f){return function(e){f.call(a,e);var g=a._.tabs[e],i;i="find"===e?"txtFindWordChk":"txtReplaceWordChk";b=a.getContentElement(e,"find"===e?"txtFindFind":"txtFindReplace");a.getContentElement(e,i);g.initialized||(CKEDITOR.document.getById(b._.inputId),
+g.initialized=!0);if(c){var j,e="find"===e?1:0,g=1-e,k,h=p.length;for(k=0;k<h;k++)i=this.getContentElement(u[e],p[k][e]),j=this.getContentElement(u[g],p[k][g]),j.setValue(i.getValue())}}})},onShow:function(){e.searchRange=q();var a=this.getParentEditor().getSelection().getSelectedText(),b=this.getContentElement(g,"find"==g?"txtFindFind":"txtFindReplace");b.setValue(a);b.select();this.selectPage(g);this[("find"==g&&this._.editor.readOnly?"hide":"show")+"Page"]("replace")},onHide:function(){var a;e.matchRange&&
+e.matchRange.isMatched()&&(e.matchRange.removeHighlight(),c.focus(),(a=e.matchRange.toDomRange())&&c.getSelection().selectRanges([a]));delete e.matchRange},onFocus:function(){return"replace"==g?this.getContentElement("replace","txtFindReplace"):this.getContentElement("find","txtFindFind")}}};CKEDITOR.dialog.add("find",function(c){return n(c,"find")});CKEDITOR.dialog.add("replace",function(c){return n(c,"replace")})})(); \ No newline at end of file
diff --git a/plugins/flash/dialogs/flash.js b/plugins/flash/dialogs/flash.js
index e0e60e8..5de7a82 100644..100755
--- a/plugins/flash/dialogs/flash.js
+++ b/plugins/flash/dialogs/flash.js
@@ -1,668 +1,24 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-(function() {
- // It is possible to set things in three different places.
- // 1. As attributes in the object tag.
- // 2. As param tags under the object tag.
- // 3. As attributes in the embed tag.
- // It is possible for a single attribute to be present in more than one place.
- // So let's define a mapping between a sementic attribute and its syntactic
- // equivalents.
- // Then we'll set and retrieve attribute values according to the mapping,
- // instead of having to check and set each syntactic attribute every time.
- //
- // Reference: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701
- var ATTRTYPE_OBJECT = 1,
- ATTRTYPE_PARAM = 2,
- ATTRTYPE_EMBED = 4;
-
- var attributesMap = {
- id: [ {
- type: ATTRTYPE_OBJECT, name: 'id'
- }],
- classid: [ {
- type: ATTRTYPE_OBJECT, name: 'classid'
- }],
- codebase: [ {
- type: ATTRTYPE_OBJECT, name: 'codebase'
- }],
- pluginspage: [ {
- type: ATTRTYPE_EMBED, name: 'pluginspage'
- }],
- src: [ {
- type: ATTRTYPE_PARAM, name: 'movie'
- }, {
- type: ATTRTYPE_EMBED, name: 'src'
- }, {
- type: ATTRTYPE_OBJECT, name: 'data'
- }],
- name: [ {
- type: ATTRTYPE_EMBED, name: 'name'
- }],
- align: [ {
- type: ATTRTYPE_OBJECT, name: 'align'
- }],
- 'class': [ {
- type: ATTRTYPE_OBJECT, name: 'class'
- }, {
- type: ATTRTYPE_EMBED, name: 'class'
- }],
- width: [ {
- type: ATTRTYPE_OBJECT, name: 'width'
- }, {
- type: ATTRTYPE_EMBED, name: 'width'
- }],
- height: [ {
- type: ATTRTYPE_OBJECT, name: 'height'
- }, {
- type: ATTRTYPE_EMBED, name: 'height'
- }],
- hSpace: [ {
- type: ATTRTYPE_OBJECT, name: 'hSpace'
- }, {
- type: ATTRTYPE_EMBED, name: 'hSpace'
- }],
- vSpace: [ {
- type: ATTRTYPE_OBJECT, name: 'vSpace'
- }, {
- type: ATTRTYPE_EMBED, name: 'vSpace'
- }],
- style: [ {
- type: ATTRTYPE_OBJECT, name: 'style'
- }, {
- type: ATTRTYPE_EMBED, name: 'style'
- }],
- type: [ {
- type: ATTRTYPE_EMBED, name: 'type'
- }]
- };
-
- var names = [ 'play', 'loop', 'menu', 'quality', 'scale', 'salign', 'wmode', 'bgcolor', 'base', 'flashvars', 'allowScriptAccess', 'allowFullScreen' ];
- for ( var i = 0; i < names.length; i++ )
- attributesMap[ names[ i ] ] = [ {
- type: ATTRTYPE_EMBED, name: names[ i ]
- }, {
- type: ATTRTYPE_PARAM, name: names[ i ]
- }];
- names = [ 'allowFullScreen', 'play', 'loop', 'menu' ];
- for ( i = 0; i < names.length; i++ )
- attributesMap[ names[ i ] ][ 0 ][ 'default' ] = attributesMap[ names[ i ] ][ 1 ][ 'default' ] = true;
-
- var defaultToPixel = CKEDITOR.tools.cssLength;
-
- function loadValue( objectNode, embedNode, paramMap ) {
- var attributes = attributesMap[ this.id ];
- if ( !attributes )
- return;
-
- var isCheckbox = ( this instanceof CKEDITOR.ui.dialog.checkbox );
- for ( var i = 0; i < attributes.length; i++ ) {
- var attrDef = attributes[ i ];
- switch ( attrDef.type ) {
- case ATTRTYPE_OBJECT:
- if ( !objectNode )
- continue;
- if ( objectNode.getAttribute( attrDef.name ) !== null ) {
- var value = objectNode.getAttribute( attrDef.name );
- if ( isCheckbox )
- this.setValue( value.toLowerCase() == 'true' );
- else
- this.setValue( value );
- return;
- } else if ( isCheckbox )
- this.setValue( !!attrDef[ 'default' ] );
- break;
- case ATTRTYPE_PARAM:
- if ( !objectNode )
- continue;
- if ( attrDef.name in paramMap ) {
- value = paramMap[ attrDef.name ];
- if ( isCheckbox )
- this.setValue( value.toLowerCase() == 'true' );
- else
- this.setValue( value );
- return;
- } else if ( isCheckbox )
- this.setValue( !!attrDef[ 'default' ] );
- break;
- case ATTRTYPE_EMBED:
- if ( !embedNode )
- continue;
- if ( embedNode.getAttribute( attrDef.name ) ) {
- value = embedNode.getAttribute( attrDef.name );
- if ( isCheckbox )
- this.setValue( value.toLowerCase() == 'true' );
- else
- this.setValue( value );
- return;
- } else if ( isCheckbox )
- this.setValue( !!attrDef[ 'default' ] );
- }
- }
- }
-
- function commitValue( objectNode, embedNode, paramMap ) {
- var attributes = attributesMap[ this.id ];
- if ( !attributes )
- return;
-
- var isRemove = ( this.getValue() === '' ),
- isCheckbox = ( this instanceof CKEDITOR.ui.dialog.checkbox );
-
- for ( var i = 0; i < attributes.length; i++ ) {
- var attrDef = attributes[ i ];
- switch ( attrDef.type ) {
- case ATTRTYPE_OBJECT:
- // Avoid applying the data attribute when not needed (#7733)
- if ( !objectNode || ( attrDef.name == 'data' && embedNode && !objectNode.hasAttribute( 'data' ) ) )
- continue;
- var value = this.getValue();
- if ( isRemove || isCheckbox && value === attrDef[ 'default' ] )
- objectNode.removeAttribute( attrDef.name );
- else
- objectNode.setAttribute( attrDef.name, value );
- break;
- case ATTRTYPE_PARAM:
- if ( !objectNode )
- continue;
- value = this.getValue();
- if ( isRemove || isCheckbox && value === attrDef[ 'default' ] ) {
- if ( attrDef.name in paramMap )
- paramMap[ attrDef.name ].remove();
- } else {
- if ( attrDef.name in paramMap )
- paramMap[ attrDef.name ].setAttribute( 'value', value );
- else {
- var param = CKEDITOR.dom.element.createFromHtml( '<cke:param></cke:param>', objectNode.getDocument() );
- param.setAttributes({ name: attrDef.name, value: value } );
- if ( objectNode.getChildCount() < 1 )
- param.appendTo( objectNode );
- else
- param.insertBefore( objectNode.getFirst() );
- }
- }
- break;
- case ATTRTYPE_EMBED:
- if ( !embedNode )
- continue;
- value = this.getValue();
- if ( isRemove || isCheckbox && value === attrDef[ 'default' ] )
- embedNode.removeAttribute( attrDef.name );
- else
- embedNode.setAttribute( attrDef.name, value );
- }
- }
- }
-
- CKEDITOR.dialog.add( 'flash', function( editor ) {
- var makeObjectTag = !editor.config.flashEmbedTagOnly,
- makeEmbedTag = editor.config.flashAddEmbedTag || editor.config.flashEmbedTagOnly;
-
- var previewPreloader,
- previewAreaHtml = '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) + '<br>' +
- '<div id="cke_FlashPreviewLoader' + CKEDITOR.tools.getNextNumber() + '" style="display:none"><div class="loading">&nbsp;</div></div>' +
- '<div id="cke_FlashPreviewBox' + CKEDITOR.tools.getNextNumber() + '" class="FlashPreviewBox"></div></div>';
-
- return {
- title: editor.lang.flash.title,
- minWidth: 420,
- minHeight: 310,
- onShow: function() {
- // Clear previously saved elements.
- this.fakeImage = this.objectNode = this.embedNode = null;
- previewPreloader = new CKEDITOR.dom.element( 'embed', editor.document );
-
- // Try to detect any embed or object tag that has Flash parameters.
- var fakeImage = this.getSelectedElement();
- if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'flash' ) {
- this.fakeImage = fakeImage;
-
- var realElement = editor.restoreRealElement( fakeImage ),
- objectNode = null,
- embedNode = null,
- paramMap = {};
- if ( realElement.getName() == 'cke:object' ) {
- objectNode = realElement;
- var embedList = objectNode.getElementsByTag( 'embed', 'cke' );
- if ( embedList.count() > 0 )
- embedNode = embedList.getItem( 0 );
- var paramList = objectNode.getElementsByTag( 'param', 'cke' );
- for ( var i = 0, length = paramList.count(); i < length; i++ ) {
- var item = paramList.getItem( i ),
- name = item.getAttribute( 'name' ),
- value = item.getAttribute( 'value' );
- paramMap[ name ] = value;
- }
- } else if ( realElement.getName() == 'cke:embed' )
- embedNode = realElement;
-
- this.objectNode = objectNode;
- this.embedNode = embedNode;
-
- this.setupContent( objectNode, embedNode, paramMap, fakeImage );
- }
- },
- onOk: function() {
- // If there's no selected object or embed, create one. Otherwise, reuse the
- // selected object and embed nodes.
- var objectNode = null,
- embedNode = null,
- paramMap = null;
- if ( !this.fakeImage ) {
- if ( makeObjectTag ) {
- objectNode = CKEDITOR.dom.element.createFromHtml( '<cke:object></cke:object>', editor.document );
- var attributes = {
- classid: 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
- codebase: 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'
- };
- objectNode.setAttributes( attributes );
- }
- if ( makeEmbedTag ) {
- embedNode = CKEDITOR.dom.element.createFromHtml( '<cke:embed></cke:embed>', editor.document );
- embedNode.setAttributes({
- type: 'application/x-shockwave-flash',
- pluginspage: 'http://www.macromedia.com/go/getflashplayer'
- });
- if ( objectNode )
- embedNode.appendTo( objectNode );
- }
- } else {
- objectNode = this.objectNode;
- embedNode = this.embedNode;
- }
-
- // Produce the paramMap if there's an object tag.
- if ( objectNode ) {
- paramMap = {};
- var paramList = objectNode.getElementsByTag( 'param', 'cke' );
- for ( var i = 0, length = paramList.count(); i < length; i++ )
- paramMap[ paramList.getItem( i ).getAttribute( 'name' ) ] = paramList.getItem( i );
- }
-
- // A subset of the specified attributes/styles
- // should also be applied on the fake element to
- // have better visual effect. (#5240)
- var extraStyles = {},
- extraAttributes = {};
- this.commitContent( objectNode, embedNode, paramMap, extraStyles, extraAttributes );
-
- // Refresh the fake image.
- var newFakeImage = editor.createFakeElement( objectNode || embedNode, 'cke_flash', 'flash', true );
- newFakeImage.setAttributes( extraAttributes );
- newFakeImage.setStyles( extraStyles );
- if ( this.fakeImage ) {
- newFakeImage.replace( this.fakeImage );
- editor.getSelection().selectElement( newFakeImage );
- } else
- editor.insertElement( newFakeImage );
- },
-
- onHide: function() {
- if ( this.preview )
- this.preview.setHtml( '' );
- },
-
- contents: [
- {
- id: 'info',
- label: editor.lang.common.generalTab,
- accessKey: 'I',
- elements: [
- {
- type: 'vbox',
- padding: 0,
- children: [
- {
- type: 'hbox',
- widths: [ '280px', '110px' ],
- align: 'right',
- children: [
- {
- id: 'src',
- type: 'text',
- label: editor.lang.common.url,
- required: true,
- validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.flash.validateSrc ),
- setup: loadValue,
- commit: commitValue,
- onLoad: function() {
- var dialog = this.getDialog(),
- updatePreview = function( src ) {
- // Query the preloader to figure out the url impacted by based href.
- previewPreloader.setAttribute( 'src', src );
- dialog.preview.setHtml( '<embed height="100%" width="100%" src="' + CKEDITOR.tools.htmlEncode( previewPreloader.getAttribute( 'src' ) )
- + '" type="application/x-shockwave-flash"></embed>' );
- };
- // Preview element
- dialog.preview = dialog.getContentElement( 'info', 'preview' ).getElement().getChild( 3 );
-
- // Sync on inital value loaded.
- this.on( 'change', function( evt ) {
-
- if ( evt.data && evt.data.value )
- updatePreview( evt.data.value );
- });
- // Sync when input value changed.
- this.getInputElement().on( 'change', function( evt ) {
-
- updatePreview( this.getValue() );
- }, this );
- }
- },
- {
- type: 'button',
- id: 'browse',
- filebrowser: 'info:src',
- hidden: true,
- // v-align with the 'src' field.
- // TODO: We need something better than a fixed size here.
- style: 'display:inline-block;margin-top:10px;',
- label: editor.lang.common.browseServer
- }
- ]
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '25%', '25%', '25%', '25%', '25%' ],
- children: [
- {
- type: 'text',
- id: 'width',
- requiredContent: 'embed[width]',
- style: 'width:95px',
- label: editor.lang.common.width,
- validate: CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.width ) ),
- setup: loadValue,
- commit: commitValue
- },
- {
- type: 'text',
- id: 'height',
- requiredContent: 'embed[height]',
- style: 'width:95px',
- label: editor.lang.common.height,
- validate: CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.height ) ),
- setup: loadValue,
- commit: commitValue
- },
- {
- type: 'text',
- id: 'hSpace',
- requiredContent: 'embed[hspace]',
- style: 'width:95px',
- label: editor.lang.flash.hSpace,
- validate: CKEDITOR.dialog.validate.integer( editor.lang.flash.validateHSpace ),
- setup: loadValue,
- commit: commitValue
- },
- {
- type: 'text',
- id: 'vSpace',
- requiredContent: 'embed[vspace]',
- style: 'width:95px',
- label: editor.lang.flash.vSpace,
- validate: CKEDITOR.dialog.validate.integer( editor.lang.flash.validateVSpace ),
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
-
- {
- type: 'vbox',
- children: [
- {
- type: 'html',
- id: 'preview',
- style: 'width:95%;',
- html: previewAreaHtml
- }
- ]
- }
- ]
- },
- {
- id: 'Upload',
- hidden: true,
- filebrowser: 'uploadButton',
- label: editor.lang.common.upload,
- elements: [
- {
- type: 'file',
- id: 'upload',
- label: editor.lang.common.upload,
- size: 38
- },
- {
- type: 'fileButton',
- id: 'uploadButton',
- label: editor.lang.common.uploadSubmit,
- filebrowser: 'info:src',
- 'for': [ 'Upload', 'upload' ]
- }
- ]
- },
- {
- id: 'properties',
- label: editor.lang.flash.propertiesTab,
- elements: [
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'scale',
- type: 'select',
- requiredContent: 'embed[scale]',
- label: editor.lang.flash.scale,
- 'default': '',
- style: 'width : 100%;',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.flash.scaleAll, 'showall' ],
- [ editor.lang.flash.scaleNoBorder, 'noborder' ],
- [ editor.lang.flash.scaleFit, 'exactfit' ]
- ],
- setup: loadValue,
- commit: commitValue
- },
- {
- id: 'allowScriptAccess',
- type: 'select',
- requiredContent: 'embed[allowscriptaccess]',
- label: editor.lang.flash.access,
- 'default': '',
- style: 'width : 100%;',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.flash.accessAlways, 'always' ],
- [ editor.lang.flash.accessSameDomain, 'samedomain' ],
- [ editor.lang.flash.accessNever, 'never' ]
- ],
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'wmode',
- type: 'select',
- requiredContent: 'embed[wmode]',
- label: editor.lang.flash.windowMode,
- 'default': '',
- style: 'width : 100%;',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.flash.windowModeWindow, 'window' ],
- [ editor.lang.flash.windowModeOpaque, 'opaque' ],
- [ editor.lang.flash.windowModeTransparent, 'transparent' ]
- ],
- setup: loadValue,
- commit: commitValue
- },
- {
- id: 'quality',
- type: 'select',
- requiredContent: 'embed[quality]',
- label: editor.lang.flash.quality,
- 'default': 'high',
- style: 'width : 100%;',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.flash.qualityBest, 'best' ],
- [ editor.lang.flash.qualityHigh, 'high' ],
- [ editor.lang.flash.qualityAutoHigh, 'autohigh' ],
- [ editor.lang.flash.qualityMedium, 'medium' ],
- [ editor.lang.flash.qualityAutoLow, 'autolow' ],
- [ editor.lang.flash.qualityLow, 'low' ]
- ],
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'align',
- type: 'select',
- requiredContent: 'object[align]',
- label: editor.lang.common.align,
- 'default': '',
- style: 'width : 100%;',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.common.alignLeft, 'left' ],
- [ editor.lang.flash.alignAbsBottom, 'absBottom' ],
- [ editor.lang.flash.alignAbsMiddle, 'absMiddle' ],
- [ editor.lang.flash.alignBaseline, 'baseline' ],
- [ editor.lang.common.alignBottom, 'bottom' ],
- [ editor.lang.common.alignMiddle, 'middle' ],
- [ editor.lang.common.alignRight, 'right' ],
- [ editor.lang.flash.alignTextTop, 'textTop' ],
- [ editor.lang.common.alignTop, 'top' ]
- ],
- setup: loadValue,
- commit: function( objectNode, embedNode, paramMap, extraStyles, extraAttributes ) {
- var value = this.getValue();
- commitValue.apply( this, arguments );
- value && ( extraAttributes.align = value );
- }
- },
- {
- type: 'html',
- html: '<div></div>'
- }
- ]
- },
- {
- type: 'fieldset',
- label: CKEDITOR.tools.htmlEncode( editor.lang.flash.flashvars ),
- children: [
- {
- type: 'vbox',
- padding: 0,
- children: [
- {
- type: 'checkbox',
- id: 'menu',
- label: editor.lang.flash.chkMenu,
- 'default': true,
- setup: loadValue,
- commit: commitValue
- },
- {
- type: 'checkbox',
- id: 'play',
- label: editor.lang.flash.chkPlay,
- 'default': true,
- setup: loadValue,
- commit: commitValue
- },
- {
- type: 'checkbox',
- id: 'loop',
- label: editor.lang.flash.chkLoop,
- 'default': true,
- setup: loadValue,
- commit: commitValue
- },
- {
- type: 'checkbox',
- id: 'allowFullScreen',
- label: editor.lang.flash.chkFull,
- 'default': true,
- setup: loadValue,
- commit: commitValue
- }
- ]
- }
- ]
- }
- ]
- },
- {
- id: 'advanced',
- label: editor.lang.common.advancedTab,
- elements: [
- {
- type: 'hbox',
- children: [
- {
- type: 'text',
- id: 'id',
- requiredContent: 'object[id]',
- label: editor.lang.common.id,
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '45%', '55%' ],
- children: [
- {
- type: 'text',
- id: 'bgcolor',
- requiredContent: 'embed[bgcolor]',
- label: editor.lang.flash.bgcolor,
- setup: loadValue,
- commit: commitValue
- },
- {
- type: 'text',
- id: 'class',
- requiredContent: 'embed(cke-xyz)', // Random text like 'xyz' will check if all are allowed.
- label: editor.lang.common.cssClass,
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- {
- type: 'text',
- id: 'style',
- requiredContent: 'embed{cke-xyz}', // Random text like 'xyz' will check if all are allowed.
- validate: CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),
- label: editor.lang.common.cssStyle,
- setup: loadValue,
- commit: commitValue
- }
- ]
- }
- ]
- };
- });
-})();
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+(function(){function b(a,b,c){var k=n[this.id];if(k)for(var f=this instanceof CKEDITOR.ui.dialog.checkbox,e=0;e<k.length;e++){var d=k[e];switch(d.type){case g:if(!a)continue;if(null!==a.getAttribute(d.name)){a=a.getAttribute(d.name);f?this.setValue("true"==a.toLowerCase()):this.setValue(a);return}f&&this.setValue(!!d["default"]);break;case o:if(!a)continue;if(d.name in c){a=c[d.name];f?this.setValue("true"==a.toLowerCase()):this.setValue(a);return}f&&this.setValue(!!d["default"]);break;case i:if(!b)continue;
+if(b.getAttribute(d.name)){a=b.getAttribute(d.name);f?this.setValue("true"==a.toLowerCase()):this.setValue(a);return}f&&this.setValue(!!d["default"])}}}function c(a,b,c){var k=n[this.id];if(k)for(var f=""===this.getValue(),e=this instanceof CKEDITOR.ui.dialog.checkbox,d=0;d<k.length;d++){var h=k[d];switch(h.type){case g:if(!a||"data"==h.name&&b&&!a.hasAttribute("data"))continue;var l=this.getValue();f||e&&l===h["default"]?a.removeAttribute(h.name):a.setAttribute(h.name,l);break;case o:if(!a)continue;
+l=this.getValue();if(f||e&&l===h["default"])h.name in c&&c[h.name].remove();else if(h.name in c)c[h.name].setAttribute("value",l);else{var p=CKEDITOR.dom.element.createFromHtml("<cke:param></cke:param>",a.getDocument());p.setAttributes({name:h.name,value:l});1>a.getChildCount()?p.appendTo(a):p.insertBefore(a.getFirst())}break;case i:if(!b)continue;l=this.getValue();f||e&&l===h["default"]?b.removeAttribute(h.name):b.setAttribute(h.name,l)}}}for(var g=1,o=2,i=4,n={id:[{type:g,name:"id"}],classid:[{type:g,
+name:"classid"}],codebase:[{type:g,name:"codebase"}],pluginspage:[{type:i,name:"pluginspage"}],src:[{type:o,name:"movie"},{type:i,name:"src"},{type:g,name:"data"}],name:[{type:i,name:"name"}],align:[{type:g,name:"align"}],"class":[{type:g,name:"class"},{type:i,name:"class"}],width:[{type:g,name:"width"},{type:i,name:"width"}],height:[{type:g,name:"height"},{type:i,name:"height"}],hSpace:[{type:g,name:"hSpace"},{type:i,name:"hSpace"}],vSpace:[{type:g,name:"vSpace"},{type:i,name:"vSpace"}],style:[{type:g,
+name:"style"},{type:i,name:"style"}],type:[{type:i,name:"type"}]},m="play loop menu quality scale salign wmode bgcolor base flashvars allowScriptAccess allowFullScreen".split(" "),j=0;j<m.length;j++)n[m[j]]=[{type:i,name:m[j]},{type:o,name:m[j]}];m=["allowFullScreen","play","loop","menu"];for(j=0;j<m.length;j++)n[m[j]][0]["default"]=n[m[j]][1]["default"]=!0;CKEDITOR.dialog.add("flash",function(a){var g=!a.config.flashEmbedTagOnly,i=a.config.flashAddEmbedTag||a.config.flashEmbedTagOnly,k,f="<div>"+
+CKEDITOR.tools.htmlEncode(a.lang.common.preview)+'<br><div id="cke_FlashPreviewLoader'+CKEDITOR.tools.getNextNumber()+'" style="display:none"><div class="loading">&nbsp;</div></div><div id="cke_FlashPreviewBox'+CKEDITOR.tools.getNextNumber()+'" class="FlashPreviewBox"></div></div>';return{title:a.lang.flash.title,minWidth:420,minHeight:310,onShow:function(){this.fakeImage=this.objectNode=this.embedNode=null;k=new CKEDITOR.dom.element("embed",a.document);var e=this.getSelectedElement();if(e&&e.data("cke-real-element-type")&&
+"flash"==e.data("cke-real-element-type")){this.fakeImage=e;var d=a.restoreRealElement(e),h=null,b=null,c={};if("cke:object"==d.getName()){h=d;d=h.getElementsByTag("embed","cke");0<d.count()&&(b=d.getItem(0));for(var d=h.getElementsByTag("param","cke"),g=0,i=d.count();g<i;g++){var f=d.getItem(g),j=f.getAttribute("name"),f=f.getAttribute("value");c[j]=f}}else"cke:embed"==d.getName()&&(b=d);this.objectNode=h;this.embedNode=b;this.setupContent(h,b,c,e)}},onOk:function(){var e=null,d=null,b=null;if(this.fakeImage)e=
+this.objectNode,d=this.embedNode;else if(g&&(e=CKEDITOR.dom.element.createFromHtml("<cke:object></cke:object>",a.document),e.setAttributes({classid:"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",codebase:"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"})),i)d=CKEDITOR.dom.element.createFromHtml("<cke:embed></cke:embed>",a.document),d.setAttributes({type:"application/x-shockwave-flash",pluginspage:"http://www.macromedia.com/go/getflashplayer"}),e&&d.appendTo(e);
+if(e)for(var b={},c=e.getElementsByTag("param","cke"),f=0,j=c.count();f<j;f++)b[c.getItem(f).getAttribute("name")]=c.getItem(f);c={};f={};this.commitContent(e,d,b,c,f);e=a.createFakeElement(e||d,"cke_flash","flash",!0);e.setAttributes(f);e.setStyles(c);this.fakeImage?(e.replace(this.fakeImage),a.getSelection().selectElement(e)):a.insertElement(e)},onHide:function(){this.preview&&this.preview.setHtml("")},contents:[{id:"info",label:a.lang.common.generalTab,accessKey:"I",elements:[{type:"vbox",padding:0,
+children:[{type:"hbox",widths:["280px","110px"],align:"right",children:[{id:"src",type:"text",label:a.lang.common.url,required:!0,validate:CKEDITOR.dialog.validate.notEmpty(a.lang.flash.validateSrc),setup:b,commit:c,onLoad:function(){var a=this.getDialog(),b=function(b){k.setAttribute("src",b);a.preview.setHtml('<embed height="100%" width="100%" src="'+CKEDITOR.tools.htmlEncode(k.getAttribute("src"))+'" type="application/x-shockwave-flash"></embed>')};a.preview=a.getContentElement("info","preview").getElement().getChild(3);
+this.on("change",function(a){a.data&&a.data.value&&b(a.data.value)});this.getInputElement().on("change",function(){b(this.getValue())},this)}},{type:"button",id:"browse",filebrowser:"info:src",hidden:!0,style:"display:inline-block;margin-top:10px;",label:a.lang.common.browseServer}]}]},{type:"hbox",widths:["25%","25%","25%","25%","25%"],children:[{type:"text",id:"width",requiredContent:"embed[width]",style:"width:95px",label:a.lang.common.width,validate:CKEDITOR.dialog.validate.htmlLength(a.lang.common.invalidHtmlLength.replace("%1",
+a.lang.common.width)),setup:b,commit:c},{type:"text",id:"height",requiredContent:"embed[height]",style:"width:95px",label:a.lang.common.height,validate:CKEDITOR.dialog.validate.htmlLength(a.lang.common.invalidHtmlLength.replace("%1",a.lang.common.height)),setup:b,commit:c},{type:"text",id:"hSpace",requiredContent:"embed[hspace]",style:"width:95px",label:a.lang.flash.hSpace,validate:CKEDITOR.dialog.validate.integer(a.lang.flash.validateHSpace),setup:b,commit:c},{type:"text",id:"vSpace",requiredContent:"embed[vspace]",
+style:"width:95px",label:a.lang.flash.vSpace,validate:CKEDITOR.dialog.validate.integer(a.lang.flash.validateVSpace),setup:b,commit:c}]},{type:"vbox",children:[{type:"html",id:"preview",style:"width:95%;",html:f}]}]},{id:"Upload",hidden:!0,filebrowser:"uploadButton",label:a.lang.common.upload,elements:[{type:"file",id:"upload",label:a.lang.common.upload,size:38},{type:"fileButton",id:"uploadButton",label:a.lang.common.uploadSubmit,filebrowser:"info:src","for":["Upload","upload"]}]},{id:"properties",
+label:a.lang.flash.propertiesTab,elements:[{type:"hbox",widths:["50%","50%"],children:[{id:"scale",type:"select",requiredContent:"embed[scale]",label:a.lang.flash.scale,"default":"",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.flash.scaleAll,"showall"],[a.lang.flash.scaleNoBorder,"noborder"],[a.lang.flash.scaleFit,"exactfit"]],setup:b,commit:c},{id:"allowScriptAccess",type:"select",requiredContent:"embed[allowscriptaccess]",label:a.lang.flash.access,"default":"",style:"width : 100%;",
+items:[[a.lang.common.notSet,""],[a.lang.flash.accessAlways,"always"],[a.lang.flash.accessSameDomain,"samedomain"],[a.lang.flash.accessNever,"never"]],setup:b,commit:c}]},{type:"hbox",widths:["50%","50%"],children:[{id:"wmode",type:"select",requiredContent:"embed[wmode]",label:a.lang.flash.windowMode,"default":"",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.flash.windowModeWindow,"window"],[a.lang.flash.windowModeOpaque,"opaque"],[a.lang.flash.windowModeTransparent,"transparent"]],
+setup:b,commit:c},{id:"quality",type:"select",requiredContent:"embed[quality]",label:a.lang.flash.quality,"default":"high",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.flash.qualityBest,"best"],[a.lang.flash.qualityHigh,"high"],[a.lang.flash.qualityAutoHigh,"autohigh"],[a.lang.flash.qualityMedium,"medium"],[a.lang.flash.qualityAutoLow,"autolow"],[a.lang.flash.qualityLow,"low"]],setup:b,commit:c}]},{type:"hbox",widths:["50%","50%"],children:[{id:"align",type:"select",requiredContent:"object[align]",
+label:a.lang.common.align,"default":"",style:"width : 100%;",items:[[a.lang.common.notSet,""],[a.lang.common.alignLeft,"left"],[a.lang.flash.alignAbsBottom,"absBottom"],[a.lang.flash.alignAbsMiddle,"absMiddle"],[a.lang.flash.alignBaseline,"baseline"],[a.lang.common.alignBottom,"bottom"],[a.lang.common.alignMiddle,"middle"],[a.lang.common.alignRight,"right"],[a.lang.flash.alignTextTop,"textTop"],[a.lang.common.alignTop,"top"]],setup:b,commit:function(a,b,f,g,i){var j=this.getValue();c.apply(this,arguments);
+j&&(i.align=j)}},{type:"html",html:"<div></div>"}]},{type:"fieldset",label:CKEDITOR.tools.htmlEncode(a.lang.flash.flashvars),children:[{type:"vbox",padding:0,children:[{type:"checkbox",id:"menu",label:a.lang.flash.chkMenu,"default":!0,setup:b,commit:c},{type:"checkbox",id:"play",label:a.lang.flash.chkPlay,"default":!0,setup:b,commit:c},{type:"checkbox",id:"loop",label:a.lang.flash.chkLoop,"default":!0,setup:b,commit:c},{type:"checkbox",id:"allowFullScreen",label:a.lang.flash.chkFull,"default":!0,
+setup:b,commit:c}]}]}]},{id:"advanced",label:a.lang.common.advancedTab,elements:[{type:"hbox",children:[{type:"text",id:"id",requiredContent:"object[id]",label:a.lang.common.id,setup:b,commit:c}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",id:"bgcolor",requiredContent:"embed[bgcolor]",label:a.lang.flash.bgcolor,setup:b,commit:c},{type:"text",id:"class",requiredContent:"embed(cke-xyz)",label:a.lang.common.cssClass,setup:b,commit:c}]},{type:"text",id:"style",requiredContent:"embed{cke-xyz}",
+validate:CKEDITOR.dialog.validate.inlineStyle(a.lang.common.invalidInlineStyle),label:a.lang.common.cssStyle,setup:b,commit:c}]}]}})})(); \ No newline at end of file
diff --git a/plugins/forms/dialogs/button.js b/plugins/forms/dialogs/button.js
index 0abc6eb..16ea846 100644..100755
--- a/plugins/forms/dialogs/button.js
+++ b/plugins/forms/dialogs/button.js
@@ -1,100 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'button', function( editor ) {
- function commitAttributes( element ) {
- var val = this.getValue();
- if ( val ) {
- element.attributes[ this.id ] = val;
- if ( this.id == 'name' )
- element.attributes[ 'data-cke-saved-name' ] = val;
- } else {
- delete element.attributes[ this.id ];
- if ( this.id == 'name' )
- delete element.attributes[ 'data-cke-saved-name' ];
- }
- }
-
- return {
- title: editor.lang.forms.button.title,
- minWidth: 350,
- minHeight: 150,
- onShow: function() {
- delete this.button;
- var element = this.getParentEditor().getSelection().getSelectedElement();
- if ( element && element.is( 'input' ) ) {
- var type = element.getAttribute( 'type' );
- if ( type in { button:1,reset:1,submit:1 } ) {
- this.button = element;
- this.setupContent( element );
- }
- }
- },
- onOk: function() {
- var editor = this.getParentEditor(),
- element = this.button,
- isInsertMode = !element;
-
- var fake = element ? CKEDITOR.htmlParser.fragment.fromHtml( element.getOuterHtml() ).children[ 0 ] : new CKEDITOR.htmlParser.element( 'input' );
- this.commitContent( fake );
-
- var writer = new CKEDITOR.htmlParser.basicWriter();
- fake.writeHtml( writer );
- var newElement = CKEDITOR.dom.element.createFromHtml( writer.getHtml(), editor.document );
-
- if ( isInsertMode )
- editor.insertElement( newElement );
- else {
- newElement.replace( element );
- editor.getSelection().selectElement( newElement );
- }
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.button.title,
- title: editor.lang.forms.button.title,
- elements: [
- {
- id: 'name',
- type: 'text',
- label: editor.lang.common.name,
- 'default': '',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: commitAttributes
- },
- {
- id: 'value',
- type: 'text',
- label: editor.lang.forms.button.text,
- accessKey: 'V',
- 'default': '',
- setup: function( element ) {
- this.setValue( element.getAttribute( 'value' ) || '' );
- },
- commit: commitAttributes
- },
- {
- id: 'type',
- type: 'select',
- label: editor.lang.forms.button.type,
- 'default': 'button',
- accessKey: 'T',
- items: [
- [ editor.lang.forms.button.typeBtn, 'button' ],
- [ editor.lang.forms.button.typeSbm, 'submit' ],
- [ editor.lang.forms.button.typeRst, 'reset' ]
- ],
- setup: function( element ) {
- this.setValue( element.getAttribute( 'type' ) || '' );
- },
- commit: commitAttributes
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("button",function(b){function d(a){var b=this.getValue();b?(a.attributes[this.id]=b,"name"==this.id&&(a.attributes["data-cke-saved-name"]=b)):(delete a.attributes[this.id],"name"==this.id&&delete a.attributes["data-cke-saved-name"])}return{title:b.lang.forms.button.title,minWidth:350,minHeight:150,onShow:function(){delete this.button;var a=this.getParentEditor().getSelection().getSelectedElement();a&&a.is("input")&&a.getAttribute("type")in{button:1,reset:1,submit:1}&&(this.button=
+a,this.setupContent(a))},onOk:function(){var a=this.getParentEditor(),b=this.button,d=!b,c=b?CKEDITOR.htmlParser.fragment.fromHtml(b.getOuterHtml()).children[0]:new CKEDITOR.htmlParser.element("input");this.commitContent(c);var e=new CKEDITOR.htmlParser.basicWriter;c.writeHtml(e);c=CKEDITOR.dom.element.createFromHtml(e.getHtml(),a.document);d?a.insertElement(c):(c.replace(b),a.getSelection().selectElement(c))},contents:[{id:"info",label:b.lang.forms.button.title,title:b.lang.forms.button.title,elements:[{id:"name",
+type:"text",label:b.lang.common.name,"default":"",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:d},{id:"value",type:"text",label:b.lang.forms.button.text,accessKey:"V","default":"",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:d},{id:"type",type:"select",label:b.lang.forms.button.type,"default":"button",accessKey:"T",items:[[b.lang.forms.button.typeBtn,"button"],[b.lang.forms.button.typeSbm,"submit"],[b.lang.forms.button.typeRst,
+"reset"]],setup:function(a){this.setValue(a.getAttribute("type")||"")},commit:d}]}]}}); \ No newline at end of file
diff --git a/plugins/forms/dialogs/checkbox.js b/plugins/forms/dialogs/checkbox.js
index b24656a..1a0d463 100644..100755
--- a/plugins/forms/dialogs/checkbox.js
+++ b/plugins/forms/dialogs/checkbox.js
@@ -1,130 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'checkbox', function( editor ) {
- return {
- title: editor.lang.forms.checkboxAndRadio.checkboxTitle,
- minWidth: 350,
- minHeight: 140,
- onShow: function() {
- delete this.checkbox;
-
- var element = this.getParentEditor().getSelection().getSelectedElement();
-
- if ( element && element.getAttribute( 'type' ) == 'checkbox' ) {
- this.checkbox = element;
- this.setupContent( element );
- }
- },
- onOk: function() {
- var editor,
- element = this.checkbox,
- isInsertMode = !element;
-
- if ( isInsertMode ) {
- editor = this.getParentEditor();
- element = editor.document.createElement( 'input' );
- element.setAttribute( 'type', 'checkbox' );
- editor.insertElement( element );
- }
- this.commitContent({ element: element } );
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.checkboxAndRadio.checkboxTitle,
- title: editor.lang.forms.checkboxAndRadio.checkboxTitle,
- startupFocus: 'txtName',
- elements: [
- {
- id: 'txtName',
- type: 'text',
- label: editor.lang.common.name,
- 'default': '',
- accessKey: 'N',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: function( data ) {
- var element = data.element;
-
- // IE failed to update 'name' property on input elements, protect it now.
- if ( this.getValue() )
- element.data( 'cke-saved-name', this.getValue() );
- else {
- element.data( 'cke-saved-name', false );
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- id: 'txtValue',
- type: 'text',
- label: editor.lang.forms.checkboxAndRadio.value,
- 'default': '',
- accessKey: 'V',
- setup: function( element ) {
- var value = element.getAttribute( 'value' );
- // IE Return 'on' as default attr value.
- this.setValue( CKEDITOR.env.ie && value == 'on' ? '' : value );
- },
- commit: function( data ) {
- var element = data.element,
- value = this.getValue();
-
- if ( value && !( CKEDITOR.env.ie && value == 'on' ) )
- element.setAttribute( 'value', value );
- else {
- if ( CKEDITOR.env.ie ) {
- // Remove attribute 'value' of checkbox (#4721).
- var checkbox = new CKEDITOR.dom.element( 'input', element.getDocument() );
- element.copyAttributes( checkbox, { value:1 } );
- checkbox.replace( element );
- editor.getSelection().selectElement( checkbox );
- data.element = checkbox;
- } else
- element.removeAttribute( 'value' );
- }
- }
- },
- {
- id: 'cmbSelected',
- type: 'checkbox',
- label: editor.lang.forms.checkboxAndRadio.selected,
- 'default': '',
- accessKey: 'S',
- value: "checked",
- setup: function( element ) {
- this.setValue( element.getAttribute( 'checked' ) );
- },
- commit: function( data ) {
- var element = data.element;
-
- if ( CKEDITOR.env.ie ) {
- var isElementChecked = !!element.getAttribute( 'checked' ),
- isChecked = !!this.getValue();
-
- if ( isElementChecked != isChecked ) {
- var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"' + ( isChecked ? ' checked="checked"' : '' )
- + '/>', editor.document );
-
- element.copyAttributes( replace, { type:1,checked:1 } );
- replace.replace( element );
- editor.getSelection().selectElement( replace );
- data.element = replace;
- }
- } else {
- var value = this.getValue();
- if ( value )
- element.setAttribute( 'checked', 'checked' );
- else
- element.removeAttribute( 'checked' );
- }
- }
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("checkbox",function(d){return{title:d.lang.forms.checkboxAndRadio.checkboxTitle,minWidth:350,minHeight:140,onShow:function(){delete this.checkbox;var a=this.getParentEditor().getSelection().getSelectedElement();a&&"checkbox"==a.getAttribute("type")&&(this.checkbox=a,this.setupContent(a))},onOk:function(){var a,b=this.checkbox;b||(a=this.getParentEditor(),b=a.document.createElement("input"),b.setAttribute("type","checkbox"),a.insertElement(b));this.commitContent({element:b})},contents:[{id:"info",
+label:d.lang.forms.checkboxAndRadio.checkboxTitle,title:d.lang.forms.checkboxAndRadio.checkboxTitle,startupFocus:"txtName",elements:[{id:"txtName",type:"text",label:d.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){a=a.element;this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"txtValue",type:"text",label:d.lang.forms.checkboxAndRadio.value,
+"default":"",accessKey:"V",setup:function(a){a=a.getAttribute("value");this.setValue(CKEDITOR.env.ie&&"on"==a?"":a)},commit:function(a){var b=a.element,c=this.getValue();c&&!(CKEDITOR.env.ie&&"on"==c)?b.setAttribute("value",c):CKEDITOR.env.ie?(c=new CKEDITOR.dom.element("input",b.getDocument()),b.copyAttributes(c,{value:1}),c.replace(b),d.getSelection().selectElement(c),a.element=c):b.removeAttribute("value")}},{id:"cmbSelected",type:"checkbox",label:d.lang.forms.checkboxAndRadio.selected,"default":"",
+accessKey:"S",value:"checked",setup:function(a){this.setValue(a.getAttribute("checked"))},commit:function(a){var b=a.element;if(CKEDITOR.env.ie){var c=!!b.getAttribute("checked"),e=!!this.getValue();c!=e&&(c=CKEDITOR.dom.element.createFromHtml('<input type="checkbox"'+(e?' checked="checked"':"")+"/>",d.document),b.copyAttributes(c,{type:1,checked:1}),c.replace(b),d.getSelection().selectElement(c),a.element=c)}else this.getValue()?b.setAttribute("checked","checked"):b.removeAttribute("checked")}}]}]}}); \ No newline at end of file
diff --git a/plugins/forms/dialogs/form.js b/plugins/forms/dialogs/form.js
index 58bf9a3..f19cf1e 100644..100755
--- a/plugins/forms/dialogs/form.js
+++ b/plugins/forms/dialogs/form.js
@@ -1,151 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'form', function( editor ) {
- var autoAttributes = { action:1,id:1,method:1,enctype:1,target:1 };
-
- return {
- title: editor.lang.forms.form.title,
- minWidth: 350,
- minHeight: 200,
- onShow: function() {
- delete this.form;
-
- var path = this.getParentEditor().elementPath(),
- form = path.contains( 'form', 1 );
-
- if ( form ) {
- this.form = form;
- this.setupContent( form );
- }
- },
- onOk: function() {
- var editor,
- element = this.form,
- isInsertMode = !element;
-
- if ( isInsertMode ) {
- editor = this.getParentEditor();
- element = editor.document.createElement( 'form' );
- !CKEDITOR.env.ie && element.append( editor.document.createElement( 'br' ) );
- }
-
- if ( isInsertMode )
- editor.insertElement( element );
- this.commitContent( element );
- },
- onLoad: function() {
- function autoSetup( element ) {
- this.setValue( element.getAttribute( this.id ) || '' );
- }
-
- function autoCommit( element ) {
- if ( this.getValue() )
- element.setAttribute( this.id, this.getValue() );
- else
- element.removeAttribute( this.id );
- }
-
- this.foreach( function( contentObj ) {
- if ( autoAttributes[ contentObj.id ] ) {
- contentObj.setup = autoSetup;
- contentObj.commit = autoCommit;
- }
- });
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.form.title,
- title: editor.lang.forms.form.title,
- elements: [
- {
- id: 'txtName',
- type: 'text',
- label: editor.lang.common.name,
- 'default': '',
- accessKey: 'N',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.data( 'cke-saved-name', this.getValue() );
- else {
- element.data( 'cke-saved-name', false );
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- id: 'action',
- type: 'text',
- label: editor.lang.forms.form.action,
- 'default': '',
- accessKey: 'T'
- },
- {
- type: 'hbox',
- widths: [ '45%', '55%' ],
- children: [
- {
- id: 'id',
- type: 'text',
- label: editor.lang.common.id,
- 'default': '',
- accessKey: 'I'
- },
- {
- id: 'enctype',
- type: 'select',
- label: editor.lang.forms.form.encoding,
- style: 'width:100%',
- accessKey: 'E',
- 'default': '',
- items: [
- [ '' ],
- [ 'text/plain' ],
- [ 'multipart/form-data' ],
- [ 'application/x-www-form-urlencoded' ]
- ]
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '45%', '55%' ],
- children: [
- {
- id: 'target',
- type: 'select',
- label: editor.lang.common.target,
- style: 'width:100%',
- accessKey: 'M',
- 'default': '',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.common.targetNew, '_blank' ],
- [ editor.lang.common.targetTop, '_top' ],
- [ editor.lang.common.targetSelf, '_self' ],
- [ editor.lang.common.targetParent, '_parent' ]
- ]
- },
- {
- id: 'method',
- type: 'select',
- label: editor.lang.forms.form.method,
- accessKey: 'M',
- 'default': 'GET',
- items: [
- [ 'GET', 'get' ],
- [ 'POST', 'post' ]
- ]
- }
- ]
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("form",function(a){var d={action:1,id:1,method:1,enctype:1,target:1};return{title:a.lang.forms.form.title,minWidth:350,minHeight:200,onShow:function(){delete this.form;var b=this.getParentEditor().elementPath().contains("form",1);b&&(this.form=b,this.setupContent(b))},onOk:function(){var b,a=this.form,c=!a;c&&(b=this.getParentEditor(),a=b.document.createElement("form"),a.appendBogus());c&&b.insertElement(a);this.commitContent(a)},onLoad:function(){function a(b){this.setValue(b.getAttribute(this.id)||
+"")}function e(a){this.getValue()?a.setAttribute(this.id,this.getValue()):a.removeAttribute(this.id)}this.foreach(function(c){d[c.id]&&(c.setup=a,c.commit=e)})},contents:[{id:"info",label:a.lang.forms.form.title,title:a.lang.forms.form.title,elements:[{id:"txtName",type:"text",label:a.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",
+!1),a.removeAttribute("name"))}},{id:"action",type:"text",label:a.lang.forms.form.action,"default":"",accessKey:"T"},{type:"hbox",widths:["45%","55%"],children:[{id:"id",type:"text",label:a.lang.common.id,"default":"",accessKey:"I"},{id:"enctype",type:"select",label:a.lang.forms.form.encoding,style:"width:100%",accessKey:"E","default":"",items:[[""],["text/plain"],["multipart/form-data"],["application/x-www-form-urlencoded"]]}]},{type:"hbox",widths:["45%","55%"],children:[{id:"target",type:"select",
+label:a.lang.common.target,style:"width:100%",accessKey:"M","default":"",items:[[a.lang.common.notSet,""],[a.lang.common.targetNew,"_blank"],[a.lang.common.targetTop,"_top"],[a.lang.common.targetSelf,"_self"],[a.lang.common.targetParent,"_parent"]]},{id:"method",type:"select",label:a.lang.forms.form.method,accessKey:"M","default":"GET",items:[["GET","get"],["POST","post"]]}]}]}]}}); \ No newline at end of file
diff --git a/plugins/forms/dialogs/hiddenfield.js b/plugins/forms/dialogs/hiddenfield.js
index 601a088..540ed42 100644..100755
--- a/plugins/forms/dialogs/hiddenfield.js
+++ b/plugins/forms/dialogs/hiddenfield.js
@@ -1,85 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'hiddenfield', function( editor ) {
- return {
- title: editor.lang.forms.hidden.title,
- hiddenField: null,
- minWidth: 350,
- minHeight: 110,
- onShow: function() {
- delete this.hiddenField;
-
- var editor = this.getParentEditor(),
- selection = editor.getSelection(),
- element = selection.getSelectedElement();
-
- if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == 'hiddenfield' ) {
- this.hiddenField = element;
- element = editor.restoreRealElement( this.hiddenField );
- this.setupContent( element );
- selection.selectElement( this.hiddenField );
- }
- },
- onOk: function() {
- var name = this.getValueOf( 'info', '_cke_saved_name' ),
- value = this.getValueOf( 'info', 'value' ),
- editor = this.getParentEditor(),
- element = CKEDITOR.env.ie && !( CKEDITOR.document.$.documentMode >= 8 ) ? editor.document.createElement( '<input name="' + CKEDITOR.tools.htmlEncode( name ) + '">' ) : editor.document.createElement( 'input' );
-
- element.setAttribute( 'type', 'hidden' );
- this.commitContent( element );
- var fakeElement = editor.createFakeElement( element, 'cke_hidden', 'hiddenfield' );
- if ( !this.hiddenField )
- editor.insertElement( fakeElement );
- else {
- fakeElement.replace( this.hiddenField );
- editor.getSelection().selectElement( fakeElement );
- }
- return true;
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.hidden.title,
- title: editor.lang.forms.hidden.title,
- elements: [
- {
- id: '_cke_saved_name',
- type: 'text',
- label: editor.lang.forms.hidden.name,
- 'default': '',
- accessKey: 'N',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'name', this.getValue() );
- else {
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- id: 'value',
- type: 'text',
- label: editor.lang.forms.hidden.value,
- 'default': '',
- accessKey: 'V',
- setup: function( element ) {
- this.setValue( element.getAttribute( 'value' ) || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'value', this.getValue() );
- else
- element.removeAttribute( 'value' );
- }
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("hiddenfield",function(d){return{title:d.lang.forms.hidden.title,hiddenField:null,minWidth:350,minHeight:110,onShow:function(){delete this.hiddenField;var a=this.getParentEditor(),b=a.getSelection(),c=b.getSelectedElement();c&&(c.data("cke-real-element-type")&&"hiddenfield"==c.data("cke-real-element-type"))&&(this.hiddenField=c,c=a.restoreRealElement(this.hiddenField),this.setupContent(c),b.selectElement(this.hiddenField))},onOk:function(){var a=this.getValueOf("info","_cke_saved_name");
+this.getValueOf("info","value");var b=this.getParentEditor(),a=CKEDITOR.env.ie&&!(8<=CKEDITOR.document.$.documentMode)?b.document.createElement('<input name="'+CKEDITOR.tools.htmlEncode(a)+'">'):b.document.createElement("input");a.setAttribute("type","hidden");this.commitContent(a);a=b.createFakeElement(a,"cke_hidden","hiddenfield");this.hiddenField?(a.replace(this.hiddenField),b.getSelection().selectElement(a)):b.insertElement(a);return!0},contents:[{id:"info",label:d.lang.forms.hidden.title,title:d.lang.forms.hidden.title,
+elements:[{id:"_cke_saved_name",type:"text",label:d.lang.forms.hidden.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.setAttribute("name",this.getValue()):a.removeAttribute("name")}},{id:"value",type:"text",label:d.lang.forms.hidden.value,"default":"",accessKey:"V",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:function(a){this.getValue()?a.setAttribute("value",this.getValue()):
+a.removeAttribute("value")}}]}]}}); \ No newline at end of file
diff --git a/plugins/forms/dialogs/radio.js b/plugins/forms/dialogs/radio.js
index ebdf951..d9e2832 100644..100755
--- a/plugins/forms/dialogs/radio.js
+++ b/plugins/forms/dialogs/radio.js
@@ -1,115 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'radio', function( editor ) {
- return {
- title: editor.lang.forms.checkboxAndRadio.radioTitle,
- minWidth: 350,
- minHeight: 140,
- onShow: function() {
- delete this.radioButton;
-
- var element = this.getParentEditor().getSelection().getSelectedElement();
- if ( element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'radio' ) {
- this.radioButton = element;
- this.setupContent( element );
- }
- },
- onOk: function() {
- var editor,
- element = this.radioButton,
- isInsertMode = !element;
-
- if ( isInsertMode ) {
- editor = this.getParentEditor();
- element = editor.document.createElement( 'input' );
- element.setAttribute( 'type', 'radio' );
- }
-
- if ( isInsertMode )
- editor.insertElement( element );
- this.commitContent({ element: element } );
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.checkboxAndRadio.radioTitle,
- title: editor.lang.forms.checkboxAndRadio.radioTitle,
- elements: [
- {
- id: 'name',
- type: 'text',
- label: editor.lang.common.name,
- 'default': '',
- accessKey: 'N',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: function( data ) {
- var element = data.element;
-
- if ( this.getValue() )
- element.data( 'cke-saved-name', this.getValue() );
- else {
- element.data( 'cke-saved-name', false );
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- id: 'value',
- type: 'text',
- label: editor.lang.forms.checkboxAndRadio.value,
- 'default': '',
- accessKey: 'V',
- setup: function( element ) {
- this.setValue( element.getAttribute( 'value' ) || '' );
- },
- commit: function( data ) {
- var element = data.element;
-
- if ( this.getValue() )
- element.setAttribute( 'value', this.getValue() );
- else
- element.removeAttribute( 'value' );
- }
- },
- {
- id: 'checked',
- type: 'checkbox',
- label: editor.lang.forms.checkboxAndRadio.selected,
- 'default': '',
- accessKey: 'S',
- value: "checked",
- setup: function( element ) {
- this.setValue( element.getAttribute( 'checked' ) );
- },
- commit: function( data ) {
- var element = data.element;
-
- if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera ) ) {
- if ( this.getValue() )
- element.setAttribute( 'checked', 'checked' );
- else
- element.removeAttribute( 'checked' );
- } else {
- var isElementChecked = element.getAttribute( 'checked' );
- var isChecked = !!this.getValue();
-
- if ( isElementChecked != isChecked ) {
- var replace = CKEDITOR.dom.element.createFromHtml( '<input type="radio"' + ( isChecked ? ' checked="checked"' : '' )
- + '></input>', editor.document );
- element.copyAttributes( replace, { type:1,checked:1 } );
- replace.replace( element );
- editor.getSelection().selectElement( replace );
- data.element = replace;
- }
- }
- }
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("radio",function(d){return{title:d.lang.forms.checkboxAndRadio.radioTitle,minWidth:350,minHeight:140,onShow:function(){delete this.radioButton;var a=this.getParentEditor().getSelection().getSelectedElement();a&&("input"==a.getName()&&"radio"==a.getAttribute("type"))&&(this.radioButton=a,this.setupContent(a))},onOk:function(){var a,b=this.radioButton,c=!b;c&&(a=this.getParentEditor(),b=a.document.createElement("input"),b.setAttribute("type","radio"));c&&a.insertElement(b);this.commitContent({element:b})},
+contents:[{id:"info",label:d.lang.forms.checkboxAndRadio.radioTitle,title:d.lang.forms.checkboxAndRadio.radioTitle,elements:[{id:"name",type:"text",label:d.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){a=a.element;this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"value",type:"text",label:d.lang.forms.checkboxAndRadio.value,"default":"",
+accessKey:"V",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:function(a){a=a.element;this.getValue()?a.setAttribute("value",this.getValue()):a.removeAttribute("value")}},{id:"checked",type:"checkbox",label:d.lang.forms.checkboxAndRadio.selected,"default":"",accessKey:"S",value:"checked",setup:function(a){this.setValue(a.getAttribute("checked"))},commit:function(a){var b=a.element;if(!CKEDITOR.env.ie&&!CKEDITOR.env.opera)this.getValue()?b.setAttribute("checked","checked"):b.removeAttribute("checked");
+else{var c=b.getAttribute("checked"),e=!!this.getValue();c!=e&&(c=CKEDITOR.dom.element.createFromHtml('<input type="radio"'+(e?' checked="checked"':"")+"></input>",d.document),b.copyAttributes(c,{type:1,checked:1}),c.replace(b),d.getSelection().selectElement(c),a.element=c)}}}]}]}}); \ No newline at end of file