tablecellproperties.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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
  7. */
  8. import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  9. import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui';
  10. import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting';
  11. /**
  12. * The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
  13. *
  14. * Read more in the {@glink features/table#table-and-cell-styling-tools Table and cell styling tools} section.
  15. * See also the {@link module:table/tableproperties~TableProperties} plugin.
  16. *
  17. * This is a "glue" plugin that loads the
  18. * {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
  19. * the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
  20. *
  21. * @extends module:core/plugin~Plugin
  22. */
  23. export default class TableCellProperties extends Plugin {
  24. /**
  25. * @inheritDoc
  26. */
  27. static get pluginName() {
  28. return 'TableCellProperties';
  29. }
  30. /**
  31. * @inheritDoc
  32. */
  33. static get requires() {
  34. return [ TableCellPropertiesEditing, TableCellPropertiesUI ];
  35. }
  36. }
  37. /**
  38. * The configuration of the table cell properties user interface (balloon). It allows to define:
  39. *
  40. * * The color palette for the cell border color style field (`tableCellProperties.borderColors`),
  41. * * The color palette for the cell background style field (`tableCellProperties.backgroundColors`).
  42. *
  43. * const tableConfig = {
  44. * tableCellProperties: {
  45. * borderColors: [
  46. * {
  47. * color: 'hsl(0, 0%, 90%)',
  48. * label: 'Light grey'
  49. * },
  50. * // ...
  51. * ],
  52. * backgroundColors: [
  53. * {
  54. * color: 'hsl(120, 75%, 60%)',
  55. * label: 'Green'
  56. * },
  57. * // ...
  58. * ]
  59. * }
  60. * };
  61. *
  62. * **Note**: The configurations do not impact the data loaded into the editor,
  63. * i.e. they do not limit or filter the colors in the data. They are used only in the user interface
  64. * allowing users to pick colors in a more convenient way.
  65. *
  66. * The default color palettes for the cell background and the cell border are the same
  67. * ({@link module:table/ui/utils~defaultColors check out their content}).
  68. *
  69. * Both color palette configurations must follow the
  70. * {@link module:table/table~TableColorConfig table color configuration format}.
  71. *
  72. * Read more about configuring the table feature in {@link module:table/table~TableConfig}.
  73. *
  74. * @member {Object} module:table/table~TableConfig#tableCellProperties
  75. */