table.js 2.8 KB

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