table.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 Widget from '@ckeditor/ckeditor5-widget/src/widget';
  12. import '../theme/table.css';
  13. /**
  14. * The table plugin.
  15. *
  16. * For a detailed overview, check the {@glink features/table Table feature documentation}.
  17. *
  18. * This is a "glue" plugin which loads the {@link module:table/tableediting~TableEditing table editing feature}
  19. * and {@link module:table/tableui~TableUI table UI feature}.
  20. *
  21. * @extends module:core/plugin~Plugin
  22. */
  23. export default class Table extends Plugin {
  24. /**
  25. * @inheritDoc
  26. */
  27. static get requires() {
  28. return [ TableEditing, TableUI, Widget ];
  29. }
  30. /**
  31. * @inheritDoc
  32. */
  33. static get pluginName() {
  34. return 'Table';
  35. }
  36. }
  37. /**
  38. * The configuration of the table features. Used by the table features in the `@ckeditor/ckeditor5-table` package.
  39. *
  40. * ClassicEditor
  41. * .create( editorElement, {
  42. * table: ... // Table feature options.
  43. * } )
  44. * .then( ... )
  45. * .catch( ... );
  46. *
  47. * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
  48. *
  49. * @interface TableConfig
  50. */
  51. /**
  52. * The configuration of the {@link module:table/table~Table} feature.
  53. *
  54. * Read more in {@link module:table/table~TableConfig}.
  55. *
  56. * @member {module:table/table~TableConfig} module:core/editor/editorconfig~EditorConfig#table
  57. */
  58. /**
  59. * Available font colors defined as an array of strings or objects.
  60. *
  61. * The default value registers the following colors:
  62. *
  63. * const fontColorConfig = {
  64. * colors: [
  65. * {
  66. * color: 'hsl(0, 0%, 0%)',
  67. * label: 'Black'
  68. * },
  69. * {
  70. * color: 'hsl(0, 0%, 30%)',
  71. * label: 'Dim grey'
  72. * },
  73. * {
  74. * color: 'hsl(0, 0%, 60%)',
  75. * label: 'Grey'
  76. * },
  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. * {
  87. * color: 'hsl(0, 75%, 60%)',
  88. * label: 'Red'
  89. * },
  90. * {
  91. * color: 'hsl(30, 75%, 60%)',
  92. * label: 'Orange'
  93. * },
  94. * {
  95. * color: 'hsl(60, 75%, 60%)',
  96. * label: 'Yellow'
  97. * },
  98. * {
  99. * color: 'hsl(90, 75%, 60%)',
  100. * label: 'Light green'
  101. * },
  102. * {
  103. * color: 'hsl(120, 75%, 60%)',
  104. * label: 'Green'
  105. * },
  106. * {
  107. * color: 'hsl(150, 75%, 60%)',
  108. * label: 'Aquamarine'
  109. * },
  110. * {
  111. * color: 'hsl(180, 75%, 60%)',
  112. * label: 'Turquoise'
  113. * },
  114. * {
  115. * color: 'hsl(210, 75%, 60%)',
  116. * label: 'Light blue'
  117. * },
  118. * {
  119. * color: 'hsl(240, 75%, 60%)',
  120. * label: 'Blue'
  121. * },
  122. * {
  123. * color: 'hsl(270, 75%, 60%)',
  124. * label: 'Purple'
  125. * }
  126. * ]
  127. * };
  128. *
  129. * @typedef {Array.<String|Object>} module:table/table~TableColorConfig
  130. */