iconset.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. /* global document */
  6. import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
  7. import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
  8. import Locale from '@ckeditor/ckeditor5-utils/src/locale';
  9. import bold from '@ckeditor/ckeditor5-basic-styles/theme/icons/bold.svg';
  10. import italic from '@ckeditor/ckeditor5-basic-styles/theme/icons/italic.svg';
  11. import underline from '@ckeditor/ckeditor5-basic-styles/theme/icons/underline.svg';
  12. import code from '@ckeditor/ckeditor5-basic-styles/theme/icons/code.svg';
  13. import strikethrough from '@ckeditor/ckeditor5-basic-styles/theme/icons/strikethrough.svg';
  14. import subscript from '@ckeditor/ckeditor5-basic-styles/theme/icons/subscript.svg';
  15. import superscript from '@ckeditor/ckeditor5-basic-styles/theme/icons/superscript.svg';
  16. import browseFiles from '@ckeditor/ckeditor5-ckfinder/theme/icons/browse-files.svg';
  17. import codeBlock from '@ckeditor/ckeditor5-code-block/theme/icons/codeblock.svg';
  18. import cancel from '@ckeditor/ckeditor5-core/theme/icons/cancel.svg';
  19. import check from '@ckeditor/ckeditor5-core/theme/icons/check.svg';
  20. import eraser from '@ckeditor/ckeditor5-core/theme/icons/eraser.svg';
  21. import lowVision from '@ckeditor/ckeditor5-core/theme/icons/low-vision.svg';
  22. import image from '@ckeditor/ckeditor5-core/theme/icons/image.svg';
  23. import alignBottom from '@ckeditor/ckeditor5-core/theme/icons/align-bottom.svg';
  24. import alignMiddle from '@ckeditor/ckeditor5-core/theme/icons/align-middle.svg';
  25. import alignTop from '@ckeditor/ckeditor5-core/theme/icons/align-top.svg';
  26. import alignLeft from '@ckeditor/ckeditor5-core/theme/icons/align-left.svg';
  27. import alignCenter from '@ckeditor/ckeditor5-core/theme/icons/align-center.svg';
  28. import alignRight from '@ckeditor/ckeditor5-core/theme/icons/align-right.svg';
  29. import alignJustify from '@ckeditor/ckeditor5-core/theme/icons/align-justify.svg';
  30. import objectLeft from '@ckeditor/ckeditor5-core/theme/icons/object-left.svg';
  31. import objectCenter from '@ckeditor/ckeditor5-core/theme/icons/object-center.svg';
  32. import objectRight from '@ckeditor/ckeditor5-core/theme/icons/object-right.svg';
  33. import objectFullWidth from '@ckeditor/ckeditor5-core/theme/icons/object-full-width.svg';
  34. import objectSizeFull from '@ckeditor/ckeditor5-core/theme/icons/object-size-full.svg';
  35. import objectSizeLarge from '@ckeditor/ckeditor5-core/theme/icons/object-size-large.svg';
  36. import objectSizeSmall from '@ckeditor/ckeditor5-core/theme/icons/object-size-small.svg';
  37. import objectSizeMedium from '@ckeditor/ckeditor5-core/theme/icons/object-size-medium.svg';
  38. import pencil from '@ckeditor/ckeditor5-core/theme/icons/pencil.svg';
  39. import pilcrow from '@ckeditor/ckeditor5-core/theme/icons/pilcrow.svg';
  40. import quote from '@ckeditor/ckeditor5-core/theme/icons/quote.svg';
  41. import threeVerticalDots from '@ckeditor/ckeditor5-core/theme/icons/three-vertical-dots.svg';
  42. import fontFamily from '@ckeditor/ckeditor5-font/theme/icons/font-family.svg';
  43. import fontSize from '@ckeditor/ckeditor5-font/theme/icons/font-size.svg';
  44. import fontColor from '@ckeditor/ckeditor5-font/theme/icons/font-color.svg';
  45. import fontBackground from '@ckeditor/ckeditor5-font/theme/icons/font-background.svg';
  46. import heading1 from '@ckeditor/ckeditor5-heading/theme/icons/heading1.svg';
  47. import heading2 from '@ckeditor/ckeditor5-heading/theme/icons/heading2.svg';
  48. import heading3 from '@ckeditor/ckeditor5-heading/theme/icons/heading3.svg';
  49. import heading4 from '@ckeditor/ckeditor5-heading/theme/icons/heading4.svg';
  50. import heading5 from '@ckeditor/ckeditor5-heading/theme/icons/heading5.svg';
  51. import heading6 from '@ckeditor/ckeditor5-heading/theme/icons/heading6.svg';
  52. import indent from '@ckeditor/ckeditor5-indent/theme/icons/indent.svg';
  53. import outdent from '@ckeditor/ckeditor5-indent/theme/icons/outdent.svg';
  54. import marker from '@ckeditor/ckeditor5-highlight/theme/icons/marker.svg';
  55. import pen from '@ckeditor/ckeditor5-highlight/theme/icons/pen.svg';
  56. import htmlEmbed from '@ckeditor/ckeditor5-html-embed/theme/icons/html.svg';
  57. import eyeIcon from '@ckeditor/ckeditor5-html-embed/theme/icons/eye.svg';
  58. import link from '@ckeditor/ckeditor5-link/theme/icons/link.svg';
  59. import unlink from '@ckeditor/ckeditor5-link/theme/icons/unlink.svg';
  60. import bulletedList from '@ckeditor/ckeditor5-list/theme/icons/bulletedlist.svg';
  61. import numberedList from '@ckeditor/ckeditor5-list/theme/icons/numberedlist.svg';
  62. import todoList from '@ckeditor/ckeditor5-list/theme/icons/todolist.svg';
  63. import media from '@ckeditor/ckeditor5-media-embed/theme/icons/media.svg';
  64. import pageBreak from '@ckeditor/ckeditor5-page-break/theme/icons/pagebreak.svg';
  65. import paragraph from '@ckeditor/ckeditor5-paragraph/theme/icons/paragraph.svg';
  66. import removeFormat from '@ckeditor/ckeditor5-remove-format/theme/icons/remove-format.svg';
  67. import contentLock from '@ckeditor/ckeditor5-restricted-editing/theme/icons/contentlock.svg';
  68. import contentUnlock from '@ckeditor/ckeditor5-restricted-editing/theme/icons/contentunlock.svg';
  69. import selectAll from '@ckeditor/ckeditor5-select-all/theme/icons/select-all.svg';
  70. import specialCharacters from '@ckeditor/ckeditor5-special-characters/theme/icons/specialcharacters.svg';
  71. import table from '@ckeditor/ckeditor5-table/theme/icons/table.svg';
  72. import tableRow from '@ckeditor/ckeditor5-table/theme/icons/table-row.svg';
  73. import tableColumn from '@ckeditor/ckeditor5-table/theme/icons/table-column.svg';
  74. import tableMergeCell from '@ckeditor/ckeditor5-table/theme/icons/table-merge-cell.svg';
  75. import tableCellProperties from '@ckeditor/ckeditor5-table/theme/icons/table-cell-properties.svg';
  76. import tableProperties from '@ckeditor/ckeditor5-table/theme/icons/table-properties.svg';
  77. import nextArrow from '@ckeditor/ckeditor5-ui/theme/icons/next-arrow.svg';
  78. import previousArrow from '@ckeditor/ckeditor5-ui/theme/icons/previous-arrow.svg';
  79. import undo from '@ckeditor/ckeditor5-undo/theme/icons/undo.svg';
  80. import redo from '@ckeditor/ckeditor5-undo/theme/icons/redo.svg';
  81. import '../../theme/ckeditor5-ui/components/editorui/editorui.css';
  82. const icons = {
  83. // basic-styles
  84. bold, italic, underline, code, strikethrough, subscript, superscript,
  85. // ckfinder
  86. browseFiles,
  87. // code block
  88. codeBlock,
  89. // core
  90. alignTop, alignBottom, alignMiddle, alignLeft, alignCenter, alignRight,
  91. alignJustify, cancel, check, eraser, image, lowVision, objectCenter,
  92. objectFullWidth, objectLeft, objectRight, objectSizeFull, objectSizeLarge,
  93. objectSizeSmall, objectSizeMedium, pencil, pilcrow, quote, threeVerticalDots,
  94. // font
  95. fontFamily, fontSize, fontColor, fontBackground,
  96. // heading
  97. heading1, heading2, heading3, heading4, heading5, heading6,
  98. // highlight
  99. marker, pen,
  100. // html-embed,
  101. htmlEmbed, eyeIcon,
  102. // indent
  103. indent, outdent,
  104. // link
  105. link, unlink,
  106. // list
  107. bulletedList, numberedList, todoList,
  108. // media-embed
  109. media,
  110. // page-break
  111. pageBreak,
  112. // paragraph
  113. paragraph,
  114. // remove-format
  115. removeFormat,
  116. // restricted-editing
  117. contentLock, contentUnlock,
  118. // select-all
  119. selectAll,
  120. // special-characters
  121. specialCharacters,
  122. // table
  123. table, tableRow, tableColumn, tableMergeCell,
  124. tableCellProperties, tableProperties,
  125. // ui
  126. nextArrow, previousArrow,
  127. // undo
  128. undo, redo
  129. };
  130. const toolbar = new ToolbarView( new Locale() );
  131. for ( const i in icons ) {
  132. const button = new ButtonView();
  133. button.set( {
  134. label: i,
  135. icon: icons[ i ],
  136. tooltip: true
  137. } );
  138. button.iconView.fillColor = '#FFDA51';
  139. toolbar.items.add( button );
  140. }
  141. toolbar.class = 'ck-editor-toolbar ck-reset_all';
  142. toolbar.render();
  143. document.body.appendChild( toolbar.element );