8
0

tablecellborderstylecommand.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /**
  6. * @module table/tablecellproperties/commands/tablecellborderstylecommand
  7. */
  8. import TableCellPropertyCommand from './tablecellpropertycommand';
  9. import { getSingleValue } from '../../commands/utils';
  10. /**
  11. * The table cell border style command.
  12. *
  13. * The command is registered by {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as
  14. * `'tableCellBorderStyle'` editor command.
  15. *
  16. * To change cell border style of the selected cell, execute the command:
  17. *
  18. * editor.execute( 'tableCellBorderStyle', {
  19. * value: 'dashed'
  20. * } );
  21. *
  22. * @extends module:core/command~Command
  23. */
  24. export default class TableCellBorderStyleCommand extends TableCellPropertyCommand {
  25. /**
  26. * Creates a new `TableCellBorderWidthCommand` instance.
  27. *
  28. * @param {module:core/editor/editor~Editor} editor Editor on which this command will be used.
  29. */
  30. constructor( editor ) {
  31. super( editor, 'borderStyle' );
  32. }
  33. /**
  34. * @inheritDoc
  35. */
  36. _getAttribute( tableCell ) {
  37. if ( !tableCell ) {
  38. return;
  39. }
  40. return getSingleValue( tableCell.getAttribute( this.attributeName ) );
  41. }
  42. }