|
|
@@ -67,10 +67,10 @@ export default class TableCellPropertiesView extends View {
|
|
|
* The value of the cell border style.
|
|
|
*
|
|
|
* @observable
|
|
|
- * @default 'none'
|
|
|
+ * @default ''
|
|
|
* @member #borderStyle
|
|
|
*/
|
|
|
- borderStyle: 'none',
|
|
|
+ borderStyle: '',
|
|
|
|
|
|
/**
|
|
|
* The value of the cell border width style.
|
|
|
@@ -130,19 +130,19 @@ export default class TableCellPropertiesView extends View {
|
|
|
* The value of the horizontal text alignment style.
|
|
|
*
|
|
|
* @observable
|
|
|
- * @default 'left'
|
|
|
+ * @default ''
|
|
|
* @member #horizontalAlignment
|
|
|
*/
|
|
|
- horizontalAlignment: 'left',
|
|
|
+ horizontalAlignment: '',
|
|
|
|
|
|
/**
|
|
|
* The value of the vertical text alignment style.
|
|
|
*
|
|
|
* @observable
|
|
|
- * @default 'middle'
|
|
|
+ * @default ''
|
|
|
* @member #verticalAlignment
|
|
|
*/
|
|
|
- verticalAlignment: 'middle'
|
|
|
+ verticalAlignment: ''
|
|
|
} );
|
|
|
|
|
|
const { borderStyleDropdown, borderWidthInput, borderColorInput, borderRowLabel } = this._createBorderFields();
|
|
|
@@ -455,7 +455,7 @@ export default class TableCellPropertiesView extends View {
|
|
|
} );
|
|
|
|
|
|
borderStyleDropdown.view.buttonView.bind( 'label' ).to( this, 'borderStyle', value => {
|
|
|
- return styleLabels[ value ];
|
|
|
+ return styleLabels[ value ? value : 'none' ];
|
|
|
} );
|
|
|
|
|
|
borderStyleDropdown.view.on( 'execute', evt => {
|
|
|
@@ -470,13 +470,11 @@ export default class TableCellPropertiesView extends View {
|
|
|
|
|
|
borderWidthInput.set( {
|
|
|
label: t( 'Width' ),
|
|
|
- class: 'ck-table-form__border-width',
|
|
|
+ class: 'ck-table-form__border-width'
|
|
|
} );
|
|
|
|
|
|
borderWidthInput.view.bind( 'value' ).to( this, 'borderWidth' );
|
|
|
- borderWidthInput.bind( 'isEnabled' ).to( this, 'borderStyle', value => {
|
|
|
- return value !== 'none';
|
|
|
- } );
|
|
|
+ borderWidthInput.bind( 'isEnabled' ).to( this, 'borderStyle', isBorderStyleSet );
|
|
|
borderWidthInput.view.on( 'input', () => {
|
|
|
this.borderWidth = borderWidthInput.view.element.value;
|
|
|
} );
|
|
|
@@ -486,9 +484,7 @@ export default class TableCellPropertiesView extends View {
|
|
|
const borderColorInput = new LabeledView( locale, createLabeledInputText );
|
|
|
borderColorInput.label = t( 'Color' );
|
|
|
borderColorInput.view.bind( 'value' ).to( this, 'borderColor' );
|
|
|
- borderColorInput.bind( 'isEnabled' ).to( this, 'borderStyle', value => {
|
|
|
- return value !== 'none';
|
|
|
- } );
|
|
|
+ borderColorInput.bind( 'isEnabled' ).to( this, 'borderStyle', isBorderStyleSet );
|
|
|
|
|
|
borderColorInput.view.on( 'input', () => {
|
|
|
this.borderColor = borderColorInput.view.element.value;
|
|
|
@@ -497,7 +493,7 @@ export default class TableCellPropertiesView extends View {
|
|
|
// Reset the border color and width fields when style is "none".
|
|
|
// https://github.com/ckeditor/ckeditor5/issues/6227
|
|
|
this.on( 'change:borderStyle', ( evt, name, value ) => {
|
|
|
- if ( value === 'none' ) {
|
|
|
+ if ( !isBorderStyleSet( value ) ) {
|
|
|
this.borderColor = '';
|
|
|
this.borderWidth = '';
|
|
|
}
|
|
|
@@ -665,7 +661,10 @@ export default class TableCellPropertiesView extends View {
|
|
|
icons: ALIGNMENT_ICONS,
|
|
|
toolbar: horizontalAlignmentToolbar,
|
|
|
labels: this._horizontalAlignmentLabels,
|
|
|
- propertyName: 'horizontalAlignment'
|
|
|
+ propertyName: 'horizontalAlignment',
|
|
|
+ nameToValue: name => {
|
|
|
+ return name === 'left' ? '' : name;
|
|
|
+ }
|
|
|
} );
|
|
|
|
|
|
// -- Vertical -----------------------------------------------------
|
|
|
@@ -682,7 +681,10 @@ export default class TableCellPropertiesView extends View {
|
|
|
icons: ALIGNMENT_ICONS,
|
|
|
toolbar: verticalAlignmentToolbar,
|
|
|
labels: this._verticalAlignmentLabels,
|
|
|
- propertyName: 'verticalAlignment'
|
|
|
+ propertyName: 'verticalAlignment',
|
|
|
+ nameToValue: name => {
|
|
|
+ return name === 'middle' ? '' : name;
|
|
|
+ }
|
|
|
} );
|
|
|
|
|
|
return {
|
|
|
@@ -773,3 +775,7 @@ export default class TableCellPropertiesView extends View {
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+function isBorderStyleSet( value ) {
|
|
|
+ return !!value;
|
|
|
+}
|