tablecolumnrowproperties.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @license Copyright (c) 2003-2019, 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/tablecolumnrowproperties
  7. */
  8. import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  9. import { downcastToStyle, upcastAttribute } from './tableproperties/utils';
  10. /**
  11. * The table column row properties feature.
  12. *
  13. * @extends module:core/plugin~Plugin
  14. */
  15. export default class TableColumnRowProperties extends Plugin {
  16. /**
  17. * @inheritDoc
  18. */
  19. static get pluginName() {
  20. return 'TableColumnRowProperties';
  21. }
  22. /**
  23. * @inheritDoc
  24. */
  25. afterInit() {
  26. const editor = this.editor;
  27. const schema = editor.model.schema;
  28. const conversion = editor.conversion;
  29. schema.extend( 'tableCell', {
  30. allowAttributes: [ 'height' ]
  31. } );
  32. upcastAttribute( conversion, 'tableCell', 'height', 'height' );
  33. downcastToStyle( conversion, 'tableCell', 'height', 'height' );
  34. schema.extend( 'tableCell', {
  35. allowAttributes: [ 'width' ]
  36. } );
  37. upcastAttribute( conversion, 'tableCell', 'width', 'width' );
  38. downcastToStyle( conversion, 'tableCell', 'width', 'width' );
  39. }
  40. }