tableproperties.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/tableproperties
  7. */
  8. import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  9. import TablePropertiesEditing from './tableproperties/tablepropertiesediting';
  10. import TablePropertiesUI from './tableproperties/tablepropertiesui';
  11. /**
  12. * The table properties feature. Enables support for setting properties of tables (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/tablecellproperties~TableCellProperties} plugin.
  16. *
  17. * This is a "glue" plugin that loads the
  18. * {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing table properties editing feature} and
  19. * the {@link module:table/tableproperties/tablepropertiesui~TablePropertiesUI table properties UI feature}.
  20. *
  21. * @extends module:core/plugin~Plugin
  22. */
  23. export default class TableProperties extends Plugin {
  24. /**
  25. * @inheritDoc
  26. */
  27. static get pluginName() {
  28. return 'TableProperties';
  29. }
  30. /**
  31. * @inheritDoc
  32. */
  33. static get requires() {
  34. return [ TablePropertiesEditing, TablePropertiesUI ];
  35. }
  36. }
  37. /**
  38. * The configuration of the table properties user interface (balloon). It allows to define:
  39. *
  40. * * The color palette for the table border color style field (`tableProperties.borderColors`),
  41. * * The color palette for the table background style field (`tableProperties.backgroundColors`).
  42. *
  43. * const tableConfig = {
  44. * tableProperties: {
  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 table background and the table 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#tableProperties
  75. */