@ckeditor/ckeditor5-alignment
Advanced tools
Comparing version 11.1.3 to 11.2.0
Changelog | ||
========= | ||
## [11.2.0](https://github.com/ckeditor/ckeditor5-alignment/compare/v11.1.3...v11.2.0) (2019-08-26) | ||
### Features | ||
* Integrated the text alignment feature with different editor content directions (LTR and RTL). See [ckeditor/ckeditor5#1151](https://github.com/ckeditor/ckeditor5/issues/1151). ([edc7d8b](https://github.com/ckeditor/ckeditor5-alignment/commit/edc7d8b)) | ||
### Bug fixes | ||
* The UI buttons should be marked as toggleable for better assistive technologies support (see [ckeditor/ckeditor5#1403](https://github.com/ckeditor/ckeditor5/issues/1403)). ([599ea01](https://github.com/ckeditor/ckeditor5-alignment/commit/599ea01)) | ||
### Other changes | ||
* The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([54f81b3](https://github.com/ckeditor/ckeditor5-alignment/commit/54f81b3)) | ||
* The text alignment toolbar should have a proper `aria-label` attribute (see [ckeditor/ckeditor5#1404](https://github.com/ckeditor/ckeditor5/issues/1404)). ([3ed81de](https://github.com/ckeditor/ckeditor5-alignment/commit/3ed81de)) | ||
* Updated translations. ([feb4ab3](https://github.com/ckeditor/ckeditor5-alignment/commit/feb4ab3)) | ||
## [11.1.3](https://github.com/ckeditor/ckeditor5-alignment/compare/v11.1.2...v11.1.3) (2019-07-10) | ||
@@ -13,3 +30,3 @@ | ||
* Updated translations. ([bb7f494](https://github.com/ckeditor/ckeditor5-alignment/commit/bb7f494)) | ||
* Updated translations. ([bb7f494](https://github.com/ckeditor/ckeditor5-alignment/commit/bb7f494)) | ||
@@ -21,3 +38,3 @@ | ||
* Updated translations. ([32c32c1](https://github.com/ckeditor/ckeditor5-alignment/commit/32c32c1)) | ||
* Updated translations. ([32c32c1](https://github.com/ckeditor/ckeditor5-alignment/commit/32c32c1)) | ||
@@ -33,3 +50,3 @@ | ||
* Updated translations. ([78bfc40](https://github.com/ckeditor/ckeditor5-alignment/commit/78bfc40)) | ||
* Updated translations. ([78bfc40](https://github.com/ckeditor/ckeditor5-alignment/commit/78bfc40)) | ||
@@ -36,0 +53,0 @@ |
@@ -6,3 +6,4 @@ { | ||
"Justify": "Toolbar button tooltip for making the text justified.", | ||
"Text alignment": "Dropdown button tooltip for the text alignment feature." | ||
"Text alignment": "Dropdown button tooltip for the text alignment feature.", | ||
"Text alignment toolbar": "Label used by assistive technologies describing the text alignment feature toolbar." | ||
} |
{ | ||
"name": "@ckeditor/ckeditor5-alignment", | ||
"version": "11.1.3", | ||
"version": "11.2.0", | ||
"description": "Text alignment feature for CKEditor 5.", | ||
@@ -13,16 +13,16 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^12.2.1", | ||
"@ckeditor/ckeditor5-ui": "^13.0.2" | ||
"@ckeditor/ckeditor5-core": "^12.3.0", | ||
"@ckeditor/ckeditor5-ui": "^14.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-block-quote": "^11.1.2", | ||
"@ckeditor/ckeditor5-editor-classic": "^12.1.3", | ||
"@ckeditor/ckeditor5-engine": "^13.2.1", | ||
"@ckeditor/ckeditor5-enter": "^11.0.4", | ||
"@ckeditor/ckeditor5-heading": "^11.0.4", | ||
"@ckeditor/ckeditor5-image": "^13.1.2", | ||
"@ckeditor/ckeditor5-list": "^12.0.4", | ||
"@ckeditor/ckeditor5-paragraph": "^11.0.4", | ||
"@ckeditor/ckeditor5-typing": "^12.1.1", | ||
"@ckeditor/ckeditor5-utils": "^13.0.1", | ||
"@ckeditor/ckeditor5-block-quote": "^11.1.3", | ||
"@ckeditor/ckeditor5-editor-classic": "^12.1.4", | ||
"@ckeditor/ckeditor5-engine": "^14.0.0", | ||
"@ckeditor/ckeditor5-enter": "^11.1.0", | ||
"@ckeditor/ckeditor5-heading": "^11.0.5", | ||
"@ckeditor/ckeditor5-image": "^14.0.0", | ||
"@ckeditor/ckeditor5-list": "^12.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^11.0.5", | ||
"@ckeditor/ckeditor5-typing": "^12.2.0", | ||
"@ckeditor/ckeditor5-utils": "^14.0.0", | ||
"eslint": "^5.5.0", | ||
@@ -40,3 +40,3 @@ "eslint-config-ckeditor5": "^2.0.0", | ||
"homepage": "https://ckeditor.com/ckeditor-5", | ||
"bugs": "https://github.com/ckeditor/ckeditor5-alignment/issues", | ||
"bugs": "https://github.com/ckeditor/ckeditor5/issues", | ||
"repository": { | ||
@@ -43,0 +43,0 @@ "type": "git", |
@@ -72,4 +72,5 @@ /** | ||
* | ||
* **Note:** It is recommended to always use `'left'` as it is the default value which the user should | ||
* normally be able to choose. | ||
* **Note:** It is recommended to always use `'left'` or `'right'` as these are default values which the user should | ||
* normally be able to choose depending on the | ||
* {@glink features/ui-language#setting-the-language-of-the-content language of the editor content}. | ||
* | ||
@@ -76,0 +77,0 @@ * ClassicEditor |
@@ -27,2 +27,4 @@ /** | ||
refresh() { | ||
const editor = this.editor; | ||
const locale = editor.locale; | ||
const firstBlock = first( this.editor.model.document.selection.getSelectedBlocks() ); | ||
@@ -40,3 +42,7 @@ | ||
*/ | ||
this.value = ( this.isEnabled && firstBlock.hasAttribute( 'alignment' ) ) ? firstBlock.getAttribute( 'alignment' ) : 'left'; | ||
if ( this.isEnabled && firstBlock.hasAttribute( 'alignment' ) ) { | ||
this.value = firstBlock.getAttribute( 'alignment' ); | ||
} else { | ||
this.value = locale.contentLanguageDirection === 'rtl' ? 'right' : 'left'; | ||
} | ||
} | ||
@@ -55,2 +61,3 @@ | ||
const editor = this.editor; | ||
const locale = editor.locale; | ||
const model = editor.model; | ||
@@ -70,3 +77,3 @@ const doc = model.document; | ||
// - or no value is passed - denotes default alignment. | ||
const removeAlignment = isDefault( value ) || currentAlignment === value || !value; | ||
const removeAlignment = isDefault( value, locale ) || currentAlignment === value || !value; | ||
@@ -73,0 +80,0 @@ if ( removeAlignment ) { |
@@ -37,2 +37,3 @@ /** | ||
const editor = this.editor; | ||
const locale = editor.locale; | ||
const schema = editor.model.schema; | ||
@@ -47,3 +48,3 @@ | ||
const definition = _buildDefinition( enabledOptions.filter( option => !isDefault( option ) ) ); | ||
const definition = _buildDefinition( enabledOptions.filter( option => !isDefault( option, locale ) ) ); | ||
@@ -50,0 +51,0 @@ editor.conversion.attributeToAttribute( definition ); |
@@ -96,2 +96,3 @@ /** | ||
dropdownView.toolbarView.isVertical = true; | ||
dropdownView.toolbarView.ariaLabel = t( 'Text alignment toolbar' ); | ||
@@ -104,4 +105,4 @@ dropdownView.extendTemplate( { | ||
// The default icon is align left as we do not support RTL yet (see #3). | ||
const defaultIcon = alignLeftIcon; | ||
// The default icon depends on the direction of the content. | ||
const defaultIcon = locale.contentLanguageDirection === 'rtl' ? alignRightIcon : alignLeftIcon; | ||
@@ -145,3 +146,4 @@ // Change icon to reflect current selection's alignment. | ||
icon: icons.get( option ), | ||
tooltip: true | ||
tooltip: true, | ||
isToggleable: true | ||
} ); | ||
@@ -148,0 +150,0 @@ |
@@ -31,10 +31,17 @@ /** | ||
/** | ||
* Checks whether alignment is the default one. | ||
* Checks whether alignment is the default one considering the direction | ||
* of the editor content. | ||
* | ||
* @param {String} alignment The name of the alignment to check. | ||
* @param {module:utils/locale~Locale} locale The {@link module:core/editor/editor~Editor#locale} instance. | ||
* @returns {Boolean} | ||
*/ | ||
export function isDefault( alignment ) { | ||
export function isDefault( alignment, locale ) { | ||
// Right now only LTR is supported so the 'left' value is always the default one. | ||
return alignment === 'left'; | ||
if ( locale.contentLanguageDirection == 'rtl' ) { | ||
return alignment === 'right'; | ||
} else { | ||
return alignment === 'left'; | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
80650
55
420
9
+ Added@ckeditor/ckeditor5-ui@14.0.0(transitive)
- Removed@ckeditor/ckeditor5-ui@13.0.2(transitive)
- Removed@ckeditor/ckeditor5-utils@13.0.1(transitive)