index.html.bak 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CKEditor 5 – Document editor</title>
  6. <script src="https://cdn.ckeditor.com/ckeditor5/35.4.0/decoupled-document/ckeditor.js"></script>
  7. <!-- <script th:src="@{/ckeditor.js}"></script> -->
  8. </head>
  9. <body>
  10. <h1>Document editor</h1>
  11. <div class="document-editor">
  12. <div class="document-editor__toolbar"></div>
  13. <div class="document-editor__editable-container">
  14. <div class="document-editor__editable">
  15. Editor content is inserted here.
  16. </div>
  17. </div>
  18. </div>
  19. <style>
  20. .document-editor {
  21. border: 1px solid var(--ck-color-base-border);
  22. border-radius: var(--ck-border-radius);
  23. /* Set vertical boundaries for the document editor. */
  24. max-height: 700px;
  25. /* This element is a flex container for easier rendering. */
  26. display: flex;
  27. flex-flow: column nowrap;
  28. }
  29. .document-editor__toolbar {
  30. /* Make sure the toolbar container is always above the editable. */
  31. z-index: 1;
  32. /* Create the illusion of the toolbar floating over the editable. */
  33. box-shadow: 0 0 5px hsla( 0,0%,0%,.2 );
  34. /* Use the CKEditor CSS variables to keep the UI consistent. */
  35. border-bottom: 1px solid var(--ck-color-toolbar-border);
  36. }
  37. /* Adjust the look of the toolbar inside of the container. */
  38. .document-editor__toolbar .ck-toolbar {
  39. border: 0;
  40. border-radius: 0;
  41. }
  42. /* Make the editable container look like the inside of a native word processor app. */
  43. .document-editor__editable-container {
  44. padding: calc( 2 * var(--ck-spacing-large) );
  45. background: var(--ck-color-base-foreground);
  46. /* Make it possible to scroll the "page" of the edited content. */
  47. overflow-y: scroll;
  48. }
  49. .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  50. /* Set the dimensions of the "page". */
  51. width: 15.8cm;
  52. min-height: 21cm;
  53. /* Keep the "page" off the boundaries of the container. */
  54. padding: 1cm 2cm 2cm;
  55. border: 1px hsl( 0,0%,82.7% ) solid;
  56. border-radius: var(--ck-border-radius);
  57. background: white;
  58. /* The "page" should cast a slight shadow (3D illusion). */
  59. box-shadow: 0 0 5px hsla( 0,0%,0%,.1 );
  60. /* Center the "page". */
  61. margin: 0 auto;
  62. }
  63. /* Override the page's width in the "Examples" section which is wider. */
  64. .main__content-wide .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  65. width: 18cm;
  66. }
  67. /* Set the default font for the "page" of the content. */
  68. .document-editor .ck-content,
  69. .document-editor .ck-heading-dropdown .ck-list .ck-button__label {
  70. font: 16px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif;
  71. }
  72. /* Adjust the headings dropdown to host some larger heading styles. */
  73. .document-editor .ck-heading-dropdown .ck-list .ck-button__label {
  74. line-height: calc( 1.7 * var(--ck-line-height-base) * var(--ck-font-size-base) );
  75. min-width: 6em;
  76. }
  77. /* Scale down all heading previews because they are way too big to be presented in the UI.
  78. Preserve the relative scale, though. */
  79. .document-editor .ck-heading-dropdown .ck-list .ck-heading_heading1 .ck-button__label,
  80. .document-editor .ck-heading-dropdown .ck-list .ck-heading_heading2 .ck-button__label {
  81. transform: scale(0.8);
  82. transform-origin: left;
  83. }
  84. /* Set the styles for "Heading 1". */
  85. .document-editor .ck-content h2,
  86. .document-editor .ck-heading-dropdown .ck-heading_heading1 .ck-button__label {
  87. font-size: 2.18em;
  88. font-weight: normal;
  89. }
  90. .document-editor .ck-content h2 {
  91. line-height: 1.37em;
  92. padding-top: .342em;
  93. margin-bottom: .142em;
  94. }
  95. /* Set the styles for "Heading 2". */
  96. .document-editor .ck-content h3,
  97. .document-editor .ck-heading-dropdown .ck-heading_heading2 .ck-button__label {
  98. font-size: 1.75em;
  99. font-weight: normal;
  100. color: hsl( 203, 100%, 50% );
  101. }
  102. .document-editor .ck-heading-dropdown .ck-heading_heading2.ck-on .ck-button__label {
  103. color: var(--ck-color-list-button-on-text);
  104. }
  105. /* Set the styles for "Heading 2". */
  106. .document-editor .ck-content h3 {
  107. line-height: 1.86em;
  108. padding-top: .171em;
  109. margin-bottom: .357em;
  110. }
  111. /* Set the styles for "Heading 3". */
  112. .document-editor .ck-content h4,
  113. .document-editor .ck-heading-dropdown .ck-heading_heading3 .ck-button__label {
  114. font-size: 1.31em;
  115. font-weight: bold;
  116. }
  117. .document-editor .ck-content h4 {
  118. line-height: 1.24em;
  119. padding-top: .286em;
  120. margin-bottom: .952em;
  121. }
  122. /* Make the block quoted text serif with some additional spacing. */
  123. .document-editor .ck-content blockquote {
  124. font-family: Georgia, serif;
  125. margin-left: calc( 2 * var(--ck-spacing-large) );
  126. margin-right: calc( 2 * var(--ck-spacing-large) );
  127. }
  128. @media only screen and (max-width: 960px) {
  129. /* Because on mobile 2cm paddings are to big. */
  130. .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  131. padding: 1.5em;
  132. }
  133. }
  134. @media only screen and (max-width: 1200px) {
  135. .main__content-wide .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  136. width: 100%;
  137. }
  138. }
  139. /* Style document editor a'ka Google Docs.*/
  140. @media only screen and (min-width: 1360px) {
  141. .main .main__content.main__content-wide {
  142. padding-right: 0;
  143. }
  144. }
  145. @media only screen and (min-width: 1600px) {
  146. .main .main__content.main__content-wide {
  147. width: 24cm;
  148. }
  149. .main .main__content.main__content-wide .main__content-inner {
  150. width: auto;
  151. margin: 0 50px;
  152. }
  153. /* Keep "page" look based on viewport width. */
  154. .main__content-wide .document-editor__editable-container .document-editor__editable.ck-editor__editable {
  155. width: 60%;
  156. }
  157. }
  158. </style>
  159. <script>
  160. DecoupledEditor
  161. .create( document.querySelector( '.document-editor__editable' ), {
  162. cloudServices: {
  163. // All predefined builds include the Easy Image feature.
  164. // Provide correct configuration values to use it.
  165. tokenUrl: 'https://95591.cke-cs.com/token/dev/KXsmgFFR0bgdv4h3A2Fu4Mvf6aa4Vd1bSSql?limit=10',
  166. uploadUrl: 'https://95591.cke-cs.com/easyimage/upload/'
  167. // Read more about Easy Image - https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/easy-image.html.
  168. // For other image upload methods see the guide - https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/image-upload.html.
  169. }
  170. } )
  171. .then( editor => {
  172. const toolbarContainer = document.querySelector( '.document-editor__toolbar' );
  173. toolbarContainer.appendChild( editor.ui.view.toolbar.element );
  174. window.editor = editor;
  175. } )
  176. .catch( err => {
  177. console.error( err );
  178. } );
  179. </script>
  180. </body>
  181. </html>