Skip to content
Permalink
Browse files

Merge branch 't/7987' into major

  • Loading branch information...
mlewand committed Sep 12, 2013
2 parents b7b070d + 72ec649 commit 32d0257da51e02315d242b87987a33a5e6afcd3b
@@ -3,6 +3,7 @@ CKEditor 4 Changelog

## CKEditor 4.3 beta

* [#7987](https://dev.ckeditor.com/ticket/7987): Implement Language toolbar button to support WCAG 3.1.2 Language of Parts.
* [#10708](http://dev.ckeditor.com/ticket/10708): New smileys.

## CKEditor 4.2.1
@@ -37,6 +37,7 @@ CKEDITOR.editorConfig = function( config ) {
'indentlist,' +
'indentblock,' +
'justify,' +
'languages,' +
'link,' +
'list,' +
'liststyle,' +
@@ -101,3 +101,8 @@ pre
.marker {
background-color: Yellow;
}

span[lang]
{
font-style: italic;
}
@@ -221,9 +221,6 @@

var lang = editor.lang.bidi;

if ( editor.ui.addToolbarGroup )
editor.ui.addToolbarGroup( 'bidi', 'align', 'paragraph' );

addButtonCommand( 'BidiLtr', lang.ltr, 'bidiltr', bidiCommand( 'ltr' ), 10 );
addButtonCommand( 'BidiRtl', lang.rtl, 'bidirtl', bidiCommand( 'rtl' ), 20 );

Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'languages', 'en', {
button: 'Set language'
} );
@@ -0,0 +1,117 @@
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/

/**
* @fileOverview Languages plugin.
*/

'use strict';

(function() {

var languagesButtonsGroup = 'languages',
allowedContent = 'span[!lang,!dir]',
requiredContent = 'span[lang,dir]';

CKEDITOR.plugins.add( 'languages', {
requires: 'menubutton',
lang: 'en', // %REMOVE_LINE_CORE%
icons: 'languages', // %REMOVE_LINE_CORE%
hidpi: true, // %REMOVE_LINE_CORE%

init: function( editor ) {
var languagesConfigStrings = ( editor.config.languages || [ 'ar:Arabic:rtl', 'fr:French', 'es:Spanish' ] ),
items = {},
parts,
curLanguageId, // 2-letter lanugage identifier.
i;

// Registers command.
editor.addCommand( 'language', {
allowedContent: allowedContent,
requiredContent: requiredContent,
exec: function( editor, languageId ) {
if ( items[ languageId ] )
editor.applyStyle( items[ languageId ].style );
}
} );

// Parse languagesConfigStrings, and create items entry for each lang.
for ( i = 0; i < languagesConfigStrings.length; i++ ) {
parts = languagesConfigStrings[ i ].split( ':' );
curLanguageId = parts[ 0 ];

items[ curLanguageId ] = {
label: parts[ 1 ],
langId: curLanguageId,
group: languagesButtonsGroup,
order: i,
// Tells if this language is left-to-right oriented (default: true).
ltr: ( String( parts[ 2 ] ).toLowerCase() != 'rtl' ),
// Style property will be assigned after object initialization.
style: null,
onClick: function() {
editor.execCommand( 'language', this.langId );
}
};

// Init style property.
items[ curLanguageId ].style = new CKEDITOR.style( {
element: 'span',
attributes: {
lang: curLanguageId,
dir: items[ curLanguageId ].ltr ? 'ltr' : 'rtl'
}
} );
}

// Initialize group/button.
editor.addMenuGroup( languagesButtonsGroup, 1 );
editor.addMenuItems( items );

editor.ui.add( 'Languages', CKEDITOR.UI_MENUBUTTON, {
label: editor.lang.languages.button,
// MenuButtons do not (yet) has toFeature method, so we cannot do this:
// toFeature: function( editor ) { return editor.getCommand( 'language' ); }
// Set feature's properties directly on button.
allowedContent: allowedContent,
requiredContent: requiredContent,
toolbar: 'bidi,30',
modes: { wysiwyg: 1 },
className: 'cke_button_languages',
onMenu: function() {
var activeItems = {};

for ( var prop in items )
activeItems[ prop ] = CKEDITOR.TRISTATE_ON;

return activeItems;
}
} );
}
} );

}());

/**
* Specifies the list of languages available in the languages plugin. Each entry
* should be a string in the following format:
*
* <languageCode>:<languageLabel>[:<textDirection>]
*
* * _languageCode_: language code used for the lang attribute in ISO 639 format.
* Codes can be found at http://www.loc.gov/standards/iso639-2/php/English_list.php.
* * _languageLabel_: label to show for this language in the list.
* * _textDirection_: (optional) one of following values `rtl` or `ltr`,
* indicating the reading direction for the language text direction. Defaults
* to `ltr`.
*
* For example:
*
* config.languages = [ 'ar:Arabic:rtl', 'fr:French', 'de:Spanish' ];
*
* @cfg {Array} [languages = [ 'ar:Arabic:rtl', 'fr:French', 'de:Spanish' ]]
* @member CKEDITOR.config
*/
@@ -615,7 +615,7 @@
{ name: 'forms' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'links' },
{ name: 'insert' },
'/',
@@ -693,7 +693,7 @@ CKEDITOR.config.toolbarLocation = 'top';
* { name: 'forms' },
* '/',
* { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
* { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ] },
* { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
* { name: 'links' },
* { name: 'insert' },
* '/',
BIN +586 Bytes (100%) skins/moono/dev/icons16.png
Binary file not shown.
Oops, something went wrong.

0 comments on commit 32d0257

Please sign in to comment.
You can’t perform that action at this time.