index.html.bak2 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CKEditor 5 – premium features sample</title>
  6. <style>
  7. .document-editor {
  8. border: 1px solid var(--ck-color-base-border);
  9. border-radius: var(--ck-border-radius);
  10. /* Set vertical boundaries for the document editor. */
  11. max-height: 700px;
  12. /* This element is a flex container for easier rendering. */
  13. display: flex;
  14. flex-flow: column nowrap;
  15. }
  16. .document-editor__toolbar {
  17. /* Make sure the toolbar container is always above the editable. */
  18. z-index: 1;
  19. /* Create the illusion of the toolbar floating over the editable. */
  20. box-shadow: 0 0 5px hsla( 0,0%,0%,.2 );
  21. /* Use the CKEditor CSS variables to keep the UI consistent. */
  22. border-bottom: 1px solid var(--ck-color-toolbar-border);
  23. }
  24. /* Adjust the look of the toolbar inside of the container. */
  25. .document-editor__toolbar .ck-toolbar {
  26. border: 0;
  27. border-radius: 0;
  28. }
  29. /* Make the editable container look like the inside of a native word processor app. */
  30. .document-editor__editable-container {
  31. padding: calc( 2 * var(--ck-spacing-large) );
  32. background: var(--ck-color-base-foreground);
  33. /* Make it possible to scroll the "page" of the edited content. */
  34. overflow-y: scroll;
  35. }
  36. .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  37. /* Set the dimensions of the "page". */
  38. width: 15.8cm;
  39. min-height: 21cm;
  40. /* Keep the "page" off the boundaries of the container. */
  41. padding: 1cm 2cm 2cm;
  42. border: 1px hsl( 0,0%,82.7% ) solid;
  43. border-radius: var(--ck-border-radius);
  44. background: white;
  45. /* The "page" should cast a slight shadow (3D illusion). */
  46. box-shadow: 0 0 5px hsla( 0,0%,0%,.1 );
  47. /* Center the "page". */
  48. margin: 0 auto;
  49. }
  50. /* Override the page's width in the "Examples" section which is wider. */
  51. .main__content-wide .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  52. width: 18cm;
  53. }
  54. /* Set the default font for the "page" of the content. */
  55. .document-editor .ck-content,
  56. .document-editor .ck-heading-dropdown .ck-list .ck-button__label {
  57. font: 16px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif;
  58. }
  59. /* Adjust the headings dropdown to host some larger heading styles. */
  60. .document-editor .ck-heading-dropdown .ck-list .ck-button__label {
  61. line-height: calc( 1.7 * var(--ck-line-height-base) * var(--ck-font-size-base) );
  62. min-width: 6em;
  63. }
  64. /* Scale down all heading previews because they are way too big to be presented in the UI.
  65. Preserve the relative scale, though. */
  66. .document-editor .ck-heading-dropdown .ck-list .ck-heading_heading1 .ck-button__label,
  67. .document-editor .ck-heading-dropdown .ck-list .ck-heading_heading2 .ck-button__label {
  68. transform: scale(0.8);
  69. transform-origin: left;
  70. }
  71. /* Set the styles for "Heading 1". */
  72. .document-editor .ck-content h2,
  73. .document-editor .ck-heading-dropdown .ck-heading_heading1 .ck-button__label {
  74. font-size: 2.18em;
  75. font-weight: normal;
  76. }
  77. .document-editor .ck-content h2 {
  78. line-height: 1.37em;
  79. padding-top: .342em;
  80. margin-bottom: .142em;
  81. }
  82. /* Set the styles for "Heading 2". */
  83. .document-editor .ck-content h3,
  84. .document-editor .ck-heading-dropdown .ck-heading_heading2 .ck-button__label {
  85. font-size: 1.75em;
  86. font-weight: normal;
  87. color: hsl( 203, 100%, 50% );
  88. }
  89. .document-editor .ck-heading-dropdown .ck-heading_heading2.ck-on .ck-button__label {
  90. color: var(--ck-color-list-button-on-text);
  91. }
  92. /* Set the styles for "Heading 2". */
  93. .document-editor .ck-content h3 {
  94. line-height: 1.86em;
  95. padding-top: .171em;
  96. margin-bottom: .357em;
  97. }
  98. /* Set the styles for "Heading 3". */
  99. .document-editor .ck-content h4,
  100. .document-editor .ck-heading-dropdown .ck-heading_heading3 .ck-button__label {
  101. font-size: 1.31em;
  102. font-weight: bold;
  103. }
  104. .document-editor .ck-content h4 {
  105. line-height: 1.24em;
  106. padding-top: .286em;
  107. margin-bottom: .952em;
  108. }
  109. /* Make the block quoted text serif with some additional spacing. */
  110. .document-editor .ck-content blockquote {
  111. font-family: Georgia, serif;
  112. margin-left: calc( 2 * var(--ck-spacing-large) );
  113. margin-right: calc( 2 * var(--ck-spacing-large) );
  114. }
  115. @media only screen and (max-width: 960px) {
  116. /* Because on mobile 2cm paddings are to big. */
  117. .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  118. padding: 1.5em;
  119. }
  120. }
  121. @media only screen and (max-width: 1200px) {
  122. .main__content-wide .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  123. width: 100%;
  124. }
  125. }
  126. /* Style document editor a'ka Google Docs.*/
  127. @media only screen and (min-width: 1360px) {
  128. .main .main__content.main__content-wide {
  129. padding-right: 0;
  130. }
  131. }
  132. @media only screen and (min-width: 1600px) {
  133. .main .main__content.main__content-wide {
  134. width: 24cm;
  135. }
  136. .main .main__content.main__content-wide .main__content-inner {
  137. width: auto;
  138. margin: 0 50px;
  139. }
  140. /* Keep "page" look based on viewport width. */
  141. .main__content-wide .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  142. width: 60%;
  143. }
  144. }
  145. </style>
  146. </head>
  147. <body>
  148. <h1>Document editor</h1>
  149. <div class="document-editor">
  150. <div class="document-editor__toolbar"></div>
  151. <div class="document-editor__editable-container">
  152. <div class="document-editor__editable">
  153. Editor content is inserted here.
  154. </div>
  155. </div>
  156. </div>
  157. <!--
  158. https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/ckbox.html
  159. -->
  160. <script src="https://cdn.ckbox.io/CKBox/1.3.2/ckbox.js"></script>
  161. <!--
  162. The "super-build" of CKEditor 5 served via CDN contains a large set of plugins and multiple editor types.
  163. See https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/quick-start.html#running-a-full-featured-editor-from-cdn
  164. -->
  165. <script src="https://cdn.ckeditor.com/ckeditor5/36.0.1/super-build/ckeditor.js"></script>
  166. <!--
  167. Uncomment to load the Spanish translation
  168. <script src="https://cdn.ckeditor.com/ckeditor5/36.0.1/super-build/translations/es.js"></script>
  169. -->
  170. <script>
  171. // This sample still does not showcase all CKEditor 5 features (!)
  172. // Visit https://ckeditor.com/docs/ckeditor5/latest/features/index.html to browse all the features.
  173. CKEDITOR.ClassicEditor.create( document.querySelector( '.document-editor__editable' ), {
  174. // https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/toolbar.html#extended-toolbar-configuration-format
  175. toolbar: {
  176. items: [
  177. 'ckbox', 'uploadImage', '|',
  178. 'exportPDF','exportWord', '|',
  179. 'comment', 'trackChanges', 'revisionHistory', '|',
  180. 'findAndReplace', 'selectAll', '|',
  181. 'bold', 'italic', 'strikethrough', 'underline', 'removeFormat', '|',
  182. 'bulletedList', 'numberedList', 'todoList', '|',
  183. 'outdent', 'indent', '|',
  184. 'undo', 'redo',
  185. '-',
  186. 'heading', '|',
  187. 'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor', 'highlight', '|',
  188. 'alignment', '|',
  189. 'link', 'blockQuote', 'insertTable', 'mediaEmbed', 'codeBlock', 'htmlEmbed', '|',
  190. 'specialCharacters', 'horizontalLine', 'pageBreak', '|',
  191. // Intentionally skipped buttons to keep the toolbar smaller, feel free to enable them:
  192. // 'code', 'subscript', 'superscript', 'textPartLanguage', '|',
  193. // ** To use source editing remember to disable real-time collaboration plugins **
  194. // 'sourceEditing'
  195. ],
  196. shouldNotGroupWhenFull: true
  197. },
  198. // Changing the language of the interface requires loading the language file using the <script> tag.
  199. // language: 'es',
  200. list: {
  201. properties: {
  202. styles: true,
  203. startIndex: true,
  204. reversed: true
  205. }
  206. },
  207. // https://ckeditor.com/docs/ckeditor5/latest/features/headings.html#configuration
  208. heading: {
  209. options: [
  210. { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
  211. { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
  212. { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
  213. { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
  214. { model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
  215. { model: 'heading5', view: 'h5', title: 'Heading 5', class: 'ck-heading_heading5' },
  216. { model: 'heading6', view: 'h6', title: 'Heading 6', class: 'ck-heading_heading6' }
  217. ]
  218. },
  219. // https://ckeditor.com/docs/ckeditor5/latest/features/font.html#configuring-the-font-family-feature
  220. fontFamily: {
  221. options: [
  222. 'default',
  223. 'Arial, Helvetica, sans-serif',
  224. 'Courier New, Courier, monospace',
  225. 'Georgia, serif',
  226. 'Lucida Sans Unicode, Lucida Grande, sans-serif',
  227. 'Tahoma, Geneva, sans-serif',
  228. 'Times New Roman, Times, serif',
  229. 'Trebuchet MS, Helvetica, sans-serif',
  230. 'Verdana, Geneva, sans-serif'
  231. ],
  232. supportAllValues: true
  233. },
  234. // https://ckeditor.com/docs/ckeditor5/latest/features/font.html#configuring-the-font-size-feature
  235. fontSize: {
  236. options: [ 10, 12, 14, 'default', 18, 20, 22 ],
  237. supportAllValues: true
  238. },
  239. // Be careful with the setting below. It instructs CKEditor to accept ALL HTML markup.
  240. // https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support.html#enabling-all-html-features
  241. // htmlSupport: {
  242. // allow: [
  243. // {
  244. // name: /.*/,
  245. // attributes: true,
  246. // classes: true,
  247. // styles: true
  248. // }
  249. // ]
  250. // },
  251. // Be careful with enabling previews
  252. // https://ckeditor.com/docs/ckeditor5/latest/features/html-embed.html#content-previews
  253. htmlEmbed: {
  254. showPreviews: true
  255. },
  256. // https://ckeditor.com/docs/ckeditor5/latest/features/mentions.html#configuration
  257. mention: {
  258. feeds: [
  259. {
  260. marker: '@',
  261. feed: [
  262. '@apple', '@bears', '@brownie', '@cake', '@cake', '@candy', '@canes', '@chocolate', '@cookie', '@cotton', '@cream',
  263. '@cupcake', '@danish', '@donut', '@dragée', '@fruitcake', '@gingerbread', '@gummi', '@ice', '@jelly-o',
  264. '@liquorice', '@macaroon', '@marzipan', '@oat', '@pie', '@plum', '@pudding', '@sesame', '@snaps', '@soufflé',
  265. '@sugar', '@sweet', '@topping', '@wafer'
  266. ],
  267. minimumCharacters: 1
  268. }
  269. ]
  270. },
  271. // https://ckeditor.com/docs/ckeditor5/latest/features/editor-placeholder.html#using-the-editor-configuration
  272. placeholder: 'Welcome to CKEditor 5!',
  273. // Used by real-time collaboration
  274. cloudServices: {
  275. // Be careful - do not use the development token endpoint on production systems!
  276. tokenUrl: 'https://95909.cke-cs.com/token/dev/31dad7RDKRwJrbhYZUOta7rT67FW5j53zqFh?limit=10',
  277. webSocketUrl: 'wss://95909.cke-cs.com/ws'
  278. },
  279. collaboration: {
  280. // Modify the channelId to simulate editing different documents
  281. // https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/real-time-collaboration/real-time-collaboration-integration.html#the-channelid-configuration-property
  282. channelId: 'document-id-2'
  283. },
  284. // https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/annotations/annotations-custom-configuration.html#sidebar-configuration
  285. sidebar: {
  286. container: document.querySelector( '#sidebar' )
  287. },
  288. // https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/real-time-collaboration/users-in-real-time-collaboration.html#users-presence-list
  289. presenceList: {
  290. container: document.querySelector( '#presence-list-container' )
  291. },
  292. // Add configuration for the comments editor if the Comments plugin is added.
  293. // https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/annotations/annotations-custom-configuration.html#comment-editor-configuration
  294. /* comments: {
  295. editorConfig: {
  296. extraPlugins: CKEDITOR.ClassicEditor.builtinPlugins.filter( plugin => {
  297. // Use e.g. Ctrl+B in the comments editor to bold text.
  298. return [ 'Bold', 'Italic', 'Underline', 'List', 'Autoformat', 'Mention' ].includes( plugin.pluginName );
  299. } ),
  300. // Combine mentions + Webhooks to notify users about new comments
  301. // https://ckeditor.com/docs/cs/latest/guides/webhooks/events.html
  302. mention: {
  303. feeds: [
  304. {
  305. marker: '@',
  306. feed: [
  307. '@Baby Doe', '@Joe Doe', '@Jane Doe', '@Jane Roe', '@Richard Roe'
  308. ],
  309. minimumCharacters: 1
  310. }
  311. ]
  312. },
  313. }
  314. }, */
  315. // Do not include revision history configuration if you do not want to integrate it.
  316. // Remember to remove the 'revisionHistory' button from the toolbar in such a case.
  317. /* revisionHistory: {
  318. editorContainer: document.querySelector( '#editor-container' ),
  319. viewerContainer: document.querySelector( '#revision-viewer-container' ),
  320. viewerEditorElement: document.querySelector( '#revision-viewer-editor' ),
  321. viewerSidebarContainer: document.querySelector( '#revision-viewer-sidebar' ),
  322. }, */
  323. // https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/ckbox.html
  324. ckbox: {
  325. // Be careful - do not use the development token endpoint on production systems!
  326. tokenUrl: 'https://95909.cke-cs.com/token/dev/31dad7RDKRwJrbhYZUOta7rT67FW5j53zqFh?limit=10'
  327. },
  328. // License key is required only by the Pagination plugin and non-realtime Comments/Track changes.
  329. licenseKey: 'R6gmTn3ENgbwV0S8ykY5ECgcDEA+WXk+Ykv/bsGF4gRDWQ2wVNfaJHW50w==',
  330. removePlugins: [
  331. // Before enabling Pagination plugin, make sure to provide proper configuration and add relevant buttons to the toolbar
  332. // https://ckeditor.com/docs/ckeditor5/latest/features/pagination/pagination.html
  333. 'Pagination',
  334. // Intentionally disabled, file uploads are handled by CKBox
  335. 'Base64UploadAdapter',
  336. // Intentionally disabled, file uploads are handled by CKBox
  337. 'CKFinder',
  338. // Intentionally disabled, file uploads are handled by CKBox
  339. 'EasyImage',
  340. // Requires additional license key
  341. 'WProofreader',
  342. // Incompatible with real-time collaboration
  343. 'SourceEditing',
  344. // Careful, with the Mathtype plugin CKEditor will not load when loading this sample
  345. // from a local file system (file://) - load this site via HTTP server if you enable MathType
  346. 'MathType',
  347. // If you would like to adjust enabled collaboration features:
  348. 'RealTimeCollaborativeComments',
  349. 'RealTimeCollaborativeTrackChanges',
  350. 'RealTimeCollaborativeRevisionHistory',
  351. 'PresenceList',
  352. 'Comments',
  353. 'TrackChanges',
  354. 'TrackChangesData',
  355. 'RevisionHistory'
  356. ]
  357. } )
  358. .then( editor => {
  359. window.editor = editor;
  360. // Example implementation to switch between different types of annotations according to the window size.
  361. // https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/annotations/annotations-display-mode.html
  362. /* const annotationsUIs = editor.plugins.get( 'AnnotationsUIs' );
  363. const sidebarElement = document.querySelector( '.sidebar' );
  364. let currentWidth;
  365. function refreshDisplayMode() {
  366. // Check the window width to avoid the UI switching when the mobile keyboard shows up.
  367. if ( window.innerWidth === currentWidth ) {
  368. return;
  369. }
  370. currentWidth = window.innerWidth;
  371. if ( currentWidth < 1000 ) {
  372. sidebarElement.classList.remove( 'narrow' );
  373. sidebarElement.classList.add( 'hidden' );
  374. annotationsUIs.switchTo( 'inline' );
  375. }
  376. else if ( currentWidth < 1300 ) {
  377. sidebarElement.classList.remove( 'hidden' );
  378. sidebarElement.classList.add( 'narrow' );
  379. annotationsUIs.switchTo( 'narrowSidebar' );
  380. }
  381. else {
  382. sidebarElement.classList.remove( 'hidden', 'narrow' );
  383. annotationsUIs.switchTo( 'wideSidebar' );
  384. }
  385. }
  386. editor.ui.view.listenTo( window, 'resize', refreshDisplayMode );
  387. refreshDisplayMode(); */
  388. const toolbarContainer = document.querySelector( '.document-editor__toolbar' );
  389. toolbarContainer.appendChild( editor.ui.view.toolbar.element );
  390. return editor;
  391. } )
  392. .catch( error => {
  393. console.error( 'There was a problem initializing the editor.', error );
  394. } );
  395. </script>
  396. </body>
  397. </html>