table.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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/table
  7. */
  8. import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  9. import TableEditing from './tableediting';
  10. import TableUI from './tableui';
  11. import TableSelection from './tableselection';
  12. import TableClipboard from './tableclipboard';
  13. import Widget from '@ckeditor/ckeditor5-widget/src/widget';
  14. import '../theme/table.css';
  15. /**
  16. * The table plugin.
  17. *
  18. * For a detailed overview, check the {@glink features/table Table feature documentation}.
  19. *
  20. * This is a "glue" plugin that loads the following table features:
  21. *
  22. * * {@link module:table/tableediting~TableEditing editing feature},
  23. * * {@link module:table/tableselection~TableSelection selection feature},
  24. * * {@link module:table/tableclipboard~TableClipboard clipboard feature},
  25. * * {@link module:table/tableui~TableUI UI feature}.
  26. *
  27. * @extends module:core/plugin~Plugin
  28. */
  29. export default class Table extends Plugin {
  30. /**
  31. * @inheritDoc
  32. */
  33. static get requires() {
  34. return [ TableEditing, TableUI, TableSelection, TableClipboard, Widget ];
  35. }
  36. /**
  37. * @inheritDoc
  38. */
  39. static get pluginName() {
  40. return 'Table';
  41. }
  42. }
  43. /**
  44. * The configuration of the table feature. Used by the table feature in the `@ckeditor/ckeditor5-table` package.
  45. *
  46. * ClassicEditor
  47. * .create( editorElement, {
  48. * table: ... // Table feature options.
  49. * } )
  50. * .then( ... )
  51. * .catch( ... );
  52. *
  53. * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
  54. *
  55. * @interface TableConfig
  56. */
  57. /**
  58. * The configuration of the {@link module:table/table~Table} feature.
  59. *
  60. * Read more in {@link module:table/table~TableConfig}.
  61. *
  62. * @member {module:table/table~TableConfig} module:core/editor/editorconfig~EditorConfig#table
  63. */
  64. /**
  65. * An array of color definitions (either strings or objects).
  66. *
  67. * const colors = [
  68. * {
  69. * color: 'hsl(0, 0%, 60%)',
  70. * label: 'Grey'
  71. * },
  72. * 'hsl(0, 0%, 80%)',
  73. * {
  74. * color: 'hsl(0, 0%, 90%)',
  75. * label: 'Light grey'
  76. * },
  77. * {
  78. * color: 'hsl(0, 0%, 100%)',
  79. * label: 'White',
  80. * hasBorder: true
  81. * },
  82. * '#FF0000'
  83. * ]
  84. *
  85. * Usually used as a configuration parameter, for instance in
  86. * {@link module:table/table~TableConfig#tableProperties `config.table.tableProperties`}
  87. * or {@link module:table/table~TableConfig#tableCellProperties `config.table.tableCellProperties`}.
  88. *
  89. * @typedef {Array.<String|Object>} module:table/table~TableColorConfig
  90. */