Skip to content

Commit

Permalink
JSCS fixes in plugins till iframe.
Browse files Browse the repository at this point in the history
  • Loading branch information
adelura authored and Reinmar committed Nov 25, 2014
1 parent 2f0507b commit 4c8bc32
Show file tree
Hide file tree
Showing 29 changed files with 1,261 additions and 1,335 deletions.
16 changes: 6 additions & 10 deletions plugins/dialogadvtab/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
var defaultTabConfig = { id: 1, dir: 1, classes: 1, styles: 1 };

CKEDITOR.plugins.add( 'dialogadvtab', {
requires : 'dialog',
requires: 'dialog',

// Returns allowed content rule for the content created by this plugin.
allowedContent: function( tabConfig ) {
Expand Down Expand Up @@ -78,13 +78,11 @@
id: 'advanced',
label: lang.advancedTab,
title: lang.advancedTab,
elements: [
{
elements: [ {
type: 'vbox',
padding: 1,
children: []
}
]
} ]
};

var contents = [];
Expand Down Expand Up @@ -115,7 +113,7 @@
[ lang.notSet, '' ],
[ lang.langDirLTR, 'ltr' ],
[ lang.langDirRTL, 'rtl' ]
],
],
setup: setupAdvParams,
commit: commitAdvParams
} );
Expand Down Expand Up @@ -170,8 +168,7 @@
contents.push( {
type: 'hbox',
widths: [ '45%', '55%' ],
children: [
{
children: [ {
id: 'advCSSClasses',
att: 'class',
type: 'text',
Expand All @@ -181,8 +178,7 @@
setup: setupAdvParams,
commit: commitAdvParams

}
]
} ]
} );
}

Expand Down
108 changes: 66 additions & 42 deletions plugins/dialogui/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ CKEDITOR.plugins.add( 'dialogui', {
type: 'hbox',
widths: elementDefinition.widths,
padding: 0,
children: [
{
children: [ {
type: 'html',
html: '<label class="cke_dialog_ui_labeled_label' + requiredClass + '"' +
' id="' + _.labelId + '"' +
Expand All @@ -160,13 +159,12 @@ CKEDITOR.plugins.add( 'dialogui', {
CKEDITOR.tools.htmlEncode( elementDefinition.label ) +
'</span>'
},
{
{
type: 'html',
html: '<span class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + '>' +
contentHtml.call( this, dialog, elementDefinition ) +
'</span>'
}
]
} ]
};
CKEDITOR.dialog._.uiElementBuilders.hbox.build( dialog, hboxDefinition, html );
}
Expand Down Expand Up @@ -344,9 +342,14 @@ CKEDITOR.plugins.add( 'dialogui', {
this.validate = elementDefinition.validate;

var innerHTML = function() {
var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition, {
id: elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextId() + '_checkbox'
}, true ),
var myDefinition = CKEDITOR.tools.extend(
{},
elementDefinition,
{
id: elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextId() + '_checkbox'
},
true
),
html = [];

var labelId = CKEDITOR.tools.getNextId() + '_label';
Expand All @@ -359,7 +362,15 @@ CKEDITOR.plugins.add( 'dialogui', {
myDefinition.style = myDefinition.inputStyle;

_.checkbox = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'input', null, attributes );
html.push( ' <label id="', labelId, '" for="', attributes.id, '"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>', CKEDITOR.tools.htmlEncode( elementDefinition.label ), '</label>' );
html.push(
' <label id="',
labelId,
'" for="',
attributes.id,
'"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>',
CKEDITOR.tools.htmlEncode( elementDefinition.label ),
'</label>'
);
return html.join( '' );
};

Expand Down Expand Up @@ -572,9 +583,14 @@ CKEDITOR.plugins.add( 'dialogui', {
_.inputId = CKEDITOR.tools.getNextId() + '_select';

var innerHTML = function() {
var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition, {
id: elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextId() + '_select'
}, true ),
var myDefinition = CKEDITOR.tools.extend(
{},
elementDefinition,
{
id: ( elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextId() + '_select' )
},
true
),
html = [],
innerHTML = [],
attributes = { 'id': _.inputId, 'class': 'cke_dialog_ui_input_select', 'aria-labelledby': this._.labelId };
Expand Down Expand Up @@ -636,33 +652,37 @@ CKEDITOR.plugins.add( 'dialogui', {

/** @ignore */
var innerHTML = function() {
_.frameId = CKEDITOR.tools.getNextId() + '_fileInput';

var html = [
'<iframe' +
' frameborder="0"' +
' allowtransparency="0"' +
' class="cke_dialog_ui_input_file"' +
' role="presentation"' +
' id="', _.frameId, '"' +
' title="', elementDefinition.label, '"' +
' src="javascript:void(' ];

// Support for custom document.domain on IE. (#10165)
html.push( CKEDITOR.env.ie ?
'(function(){' + encodeURIComponent(
'document.open();' +
'(' + CKEDITOR.tools.fixDomain + ')();' +
'document.close();'
) + '})()'
:
'0' );

html.push( ')">' +
'</iframe>' );
_.frameId = CKEDITOR.tools.getNextId() + '_fileInput';

// jscs:disable validateIndentation
var html = [
'<iframe' +
' frameborder="0"' +
' allowtransparency="0"' +
' class="cke_dialog_ui_input_file"' +
' role="presentation"' +
' id="', _.frameId, '"' +
' title="', elementDefinition.label, '"' +
' src="javascript:void('
];

// Support for custom document.domain on IE. (#10165)
html.push( CKEDITOR.env.ie ?
'(function(){' + encodeURIComponent(
'document.open();' +
'(' + CKEDITOR.tools.fixDomain + ')();' +
'document.close();'
) + '})()'
:
'0'
);

html.push( ')">' +
'</iframe>' );
// jscs:enable validateIndentation

return html.join( '' );
};
return html.join( '' );
};

// IE BUG: Parent container does not resize to contain the iframe automatically.
dialog.on( 'load', function() {
Expand Down Expand Up @@ -1031,12 +1051,14 @@ CKEDITOR.plugins.add( 'dialogui', {
option.$.text = label;
option.$.value = ( value === undefined || value === null ) ? label : value;
if ( index === undefined || index === null ) {
if ( CKEDITOR.env.ie )
if ( CKEDITOR.env.ie ) {
selectElement.add( option.$ );
else
} else {
selectElement.add( option.$, null );
} else
}
} else {
selectElement.add( option.$, index );
}
return this;
},

Expand Down Expand Up @@ -1310,6 +1332,7 @@ CKEDITOR.plugins.add( 'dialogui', {

var inputId = _.frameId + '_input';

// jscs:disable validateIndentation
frameDocument.$.write( [
'<html dir="' + langDir + '" lang="' + langCode + '"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">',
'<form enctype="multipart/form-data" method="POST" dir="' + langDir + '" lang="' + langCode + '" action="',
Expand All @@ -1323,7 +1346,7 @@ CKEDITOR.plugins.add( 'dialogui', {
'<input style="width:100%" id="', inputId, '" aria-labelledby="', _.labelId, '" type="file" name="',
CKEDITOR.tools.htmlEncode( elementDefinition.id || 'cke_upload' ),
'" size="',
CKEDITOR.tools.htmlEncode( size > 0 ? size : "" ),
CKEDITOR.tools.htmlEncode( size > 0 ? size : '' ),
'" />',
'</form>',
'</body></html>',
Expand All @@ -1335,6 +1358,7 @@ CKEDITOR.plugins.add( 'dialogui', {
'window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(' + unloadNumber + ')}',
'</script>'
].join( '' ) );
// jscs:enable validateIndentation

frameDocument.$.close();

Expand Down
Loading

0 comments on commit 4c8bc32

Please sign in to comment.