qms-angular 1.0.88 → 1.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/bundles/qms-angular.umd.js +199 -100
  2. package/bundles/qms-angular.umd.js.map +1 -1
  3. package/esm2015/lib/common/themes.const.js +3 -0
  4. package/esm2015/lib/components/banner/models/qms-banner.model.js +9 -1
  5. package/esm2015/lib/components/banner/qms-banner-confirm/qms-banner-confirm.component.js +4 -3
  6. package/esm2015/lib/components/banner/qms-banner-confirm/qms-banner-confirm.module.js +7 -4
  7. package/esm2015/lib/components/button/button-toggle.js +1 -1
  8. package/esm2015/lib/components/button/button.js +3 -3
  9. package/esm2015/lib/components/comment/comment.js +1 -1
  10. package/esm2015/lib/components/list/list.js +5 -3
  11. package/esm2015/lib/components/related/content/related-content.component.js +1 -1
  12. package/esm2015/lib/components/related/list-other-related/list-related.component.js +1 -1
  13. package/esm2015/lib/components/related/popup/related-popup.component.js +1 -1
  14. package/esm2015/lib/components/related/risk/analysis/analysis.component.js +1 -1
  15. package/esm2015/lib/components/related/risk/list/list.component.js +1 -1
  16. package/esm2015/lib/components/related/risk/result/result.component.js +1 -1
  17. package/esm2015/lib/components/rich-text/rich-text.js +1 -1
  18. package/esm2015/lib/components/select-dialog/select-dialog.js +1 -1
  19. package/esm2015/lib/components/select-include-children/select-include-children.component.js +1 -1
  20. package/esm2015/lib/components/select-one/select-one.component.js +1 -1
  21. package/esm2015/lib/components/select-process-document/select-process-document.component.js +1 -1
  22. package/esm2015/lib/components/table/table-action.js +2 -2
  23. package/esm2015/lib/components/tree/tree.component.js +1 -1
  24. package/esm2015/lib/components/treeNew/tree.component.js +1 -1
  25. package/esm2015/lib/directives/text-truncate/text-truncate.directive.js +7 -3
  26. package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.js +1 -1
  27. package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +32 -1
  28. package/esm2015/lib/qms-ckeditor-components/common/helper/fileHelper.js +15 -0
  29. package/esm2015/lib/qms-ckeditor-components/common/module/confirm/qms-ckeditor-confirm.component.js +1 -1
  30. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +1 -1
  31. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +5 -18
  32. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.js +9 -3
  33. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +1 -1
  34. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/attachments/link-attachment.component.js +1 -1
  35. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +1 -1
  36. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-load-template/qms-ckeditor-load-template.component.js +1 -1
  37. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-relation/qmsckeditor-related.component.js +1 -1
  38. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-template/qms-ckeditor-template.component.js +1 -1
  39. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +1 -1
  40. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +6 -4
  41. package/esm2015/lib/services/theming.service.js +36 -0
  42. package/esm2015/lib/shared.module.js +1 -1
  43. package/esm2015/public-api.js +3 -1
  44. package/fesm2015/qms-angular.js +157 -67
  45. package/fesm2015/qms-angular.js.map +1 -1
  46. package/lib/common/themes.const.d.ts +2 -0
  47. package/lib/components/banner/models/qms-banner.model.d.ts +7 -0
  48. package/lib/components/banner/qms-banner-confirm/qms-banner-confirm.component.d.ts +2 -1
  49. package/lib/components/list/list.d.ts +1 -1
  50. package/lib/directives/text-truncate/text-truncate.directive.d.ts +2 -1
  51. package/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.d.ts +1 -1
  52. package/lib/qms-ckeditor-components/common/functions/common.function.d.ts +12 -0
  53. package/lib/qms-ckeditor-components/common/helper/fileHelper.d.ts +1 -0
  54. package/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.d.ts +0 -1
  55. package/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.d.ts +3 -1
  56. package/lib/services/theming.service.d.ts +7 -0
  57. package/lib.theme.scss +11 -9
  58. package/package.json +1 -1
  59. package/public-api.d.ts +2 -0
  60. package/qms-angular.metadata.json +1 -1
  61. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
  62. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  63. package/src/assets/qms-ckeditor-plugin/build/translations/ar.js +1 -1
  64. package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
  65. package/src/assets/qms-ckeditor-plugin/build/translations/bg.js +1 -1
  66. package/src/assets/qms-ckeditor-plugin/build/translations/ca.js +1 -1
  67. package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
  68. package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
  69. package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
  70. package/src/assets/qms-ckeditor-plugin/build/translations/el.js +1 -1
  71. package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
  72. package/src/assets/qms-ckeditor-plugin/build/translations/en-gb.js +1 -1
  73. package/src/assets/qms-ckeditor-plugin/build/translations/eo.js +1 -1
  74. package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
  75. package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
  76. package/src/assets/qms-ckeditor-plugin/build/translations/eu.js +1 -1
  77. package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
  78. package/src/assets/qms-ckeditor-plugin/build/translations/fi.js +1 -1
  79. package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
  80. package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
  81. package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
  82. package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
  83. package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
  84. package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
  85. package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
  86. package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
  87. package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
  88. package/src/assets/qms-ckeditor-plugin/build/translations/km.js +1 -1
  89. package/src/assets/qms-ckeditor-plugin/build/translations/kn.js +1 -1
  90. package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
  91. package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
  92. package/src/assets/qms-ckeditor-plugin/build/translations/lt.js +1 -1
  93. package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
  94. package/src/assets/qms-ckeditor-plugin/build/translations/nb.js +1 -1
  95. package/src/assets/qms-ckeditor-plugin/build/translations/ne.js +1 -1
  96. package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
  97. package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
  98. package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
  99. package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
  100. package/src/assets/qms-ckeditor-plugin/build/translations/pt.js +1 -1
  101. package/src/assets/qms-ckeditor-plugin/build/translations/ro.js +1 -1
  102. package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
  103. package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
  104. package/src/assets/qms-ckeditor-plugin/build/translations/sl.js +1 -1
  105. package/src/assets/qms-ckeditor-plugin/build/translations/sq.js +1 -1
  106. package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
  107. package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
  108. package/src/assets/qms-ckeditor-plugin/build/translations/sv.js +1 -1
  109. package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
  110. package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
  111. package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
  112. package/src/assets/qms-ckeditor-plugin/build/translations/ug.js +1 -1
  113. package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
  114. package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
  115. package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
  116. package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
  117. package/src/assets/qms-ckeditor-plugin/package-lock.json +0 -1
  118. package/src/assets/qms-ckeditor-plugin/package.json +0 -1
  119. package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +1 -1
  120. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/heading.js +119 -0
  121. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingbuttonsui.js +103 -0
  122. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingcommand.js +96 -0
  123. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingediting.js +163 -0
  124. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +115 -0
  125. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/index.js +22 -0
  126. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/heading.css +35 -0
  127. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading1.svg +1 -0
  128. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading2.svg +1 -0
  129. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading3.svg +1 -0
  130. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading4.svg +1 -0
  131. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading5.svg +1 -0
  132. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading6.svg +1 -0
  133. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/title.js +598 -0
  134. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +42 -0
  135. package/src/lib/components/breadcrumb/breadcrumb.scss +2 -1
  136. package/src/lib/components/button/_button-base.scss +45 -52
  137. package/src/lib/components/button/_button-theme.scss +4 -2
  138. package/src/lib/components/button/button-icon.scss +17 -14
  139. package/src/lib/components/button/button-toggle.scss +64 -115
  140. package/src/lib/components/comment/comment.scss +3 -2
  141. package/src/lib/components/dialog/dialog.scss +2 -1
  142. package/src/lib/components/list/_list-base.scss +2 -2
  143. package/src/lib/components/list/_list-expansion.scss +37 -7
  144. package/src/lib/components/list/list.scss +21 -4
  145. package/src/lib/components/related/content/related-content.component.scss +4 -2
  146. package/src/lib/components/related/list-other-related/list-related.component.scss +7 -6
  147. package/src/lib/components/related/popup/related-popup.component.scss +10 -10
  148. package/src/lib/components/related/risk/analysis/analysis.component.scss +4 -3
  149. package/src/lib/components/related/risk/list/list.component.scss +7 -6
  150. package/src/lib/components/related/risk/result/result.component.scss +9 -8
  151. package/src/lib/components/rich-text/rich-text.scss +3 -2
  152. package/src/lib/components/select-dialog/select-dialog.scss +5 -5
  153. package/src/lib/components/select-include-children/select-include-children.component.scss +10 -10
  154. package/src/lib/components/select-one/select-one.component.scss +5 -4
  155. package/src/lib/components/select-process-document/select-process-document.component.scss +12 -13
  156. package/src/lib/components/substance-conflict/substance-conflict.component.scss +4 -3
  157. package/src/lib/components/table/table.scss +4 -3
  158. package/src/lib/components/tooltip/tooltip.scss +3 -1
  159. package/src/lib/components/tree/tree.component.scss +12 -12
  160. package/src/lib/components/treeNew/tree.component.scss +11 -18
  161. package/src/lib/qms-ckeditor-components/qms-ckeditor.component.scss +3 -2
  162. package/src/lib/qms-ckeditor-components/styles/_modules.scss +9 -0
  163. package/src/themes/_non-bg-scrollbar.scss +4 -3
  164. package/src/themes/core/_app-bar.scss +5 -4
  165. package/src/themes/core/_button.scss +14 -12
  166. package/src/themes/core/_checkbox.scss +9 -24
  167. package/src/themes/core/_chip-input.scss +29 -27
  168. package/src/themes/core/_chip.scss +12 -10
  169. package/src/themes/core/_date-picker.scss +9 -8
  170. package/src/themes/core/_dropdown-menu.scss +12 -11
  171. package/src/themes/core/_file-upload.scss +12 -11
  172. package/src/themes/core/_form-prefix.scss +6 -4
  173. package/src/themes/core/_form.scss +28 -27
  174. package/src/themes/core/_progress.scss +5 -3
  175. package/src/themes/core/_radio.scss +13 -15
  176. package/src/themes/core/_range-slider.scss +34 -33
  177. package/src/themes/core/_scrollbar.scss +25 -34
  178. package/src/themes/core/_search-field.scss +5 -3
  179. package/src/themes/core/_select.scss +5 -2
  180. package/src/themes/core/_slide-toggle.scss +10 -11
  181. package/src/themes/core/_styles.scss +19 -17
  182. package/src/themes/core/_tab.scss +88 -87
  183. package/src/themes/core/_table.scss +35 -19
  184. package/src/themes/core/_text-block.scss +3 -1
  185. package/src/themes/theme/_mixins.scss +18 -0
  186. package/src/themes/theme/_theme.scss +17 -0
  187. package/src/themes/theme/_variable.scss +303 -0
  188. package/src/themes/_color.scss +0 -61
  189. package/src/themes/_scrollbar.scss +0 -27
  190. package/src/themes/core/_colors.scss +0 -60
@@ -0,0 +1,598 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module heading/title
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+
12
+ import { first } from 'ckeditor5/src/utils';
13
+ import {
14
+ DowncastWriter,
15
+ needsPlaceholder,
16
+ showPlaceholder,
17
+ hidePlaceholder,
18
+ enablePlaceholder
19
+ } from 'ckeditor5/src/engine';
20
+
21
+ // A list of element names that should be treated by the Title plugin as title-like.
22
+ // This means that an element of a type from this list will be changed to a title element
23
+ // when it is the first element in the root.
24
+ const titleLikeElements = new Set( [ 'paragraph', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6' ] );
25
+
26
+ /**
27
+ * The Title plugin.
28
+ *
29
+ * It splits the document into `Title` and `Body` sections.
30
+ *
31
+ * @extends module:core/plugin~Plugin
32
+ */
33
+ export default class Title extends Plugin {
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static get pluginName() {
38
+ return 'Title';
39
+ }
40
+
41
+ /**
42
+ * @inheritDoc
43
+ */
44
+ static get requires() {
45
+ return [ 'Paragraph' ];
46
+ }
47
+
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ init() {
52
+ const editor = this.editor;
53
+ const model = editor.model;
54
+
55
+ /**
56
+ * A reference to an empty paragraph in the body
57
+ * created when there is no element in the body for the placeholder purposes.
58
+ *
59
+ * @private
60
+ * @type {null|module:engine/model/element~Element}
61
+ */
62
+ this._bodyPlaceholder = null;
63
+
64
+ // To use the schema for disabling some features when the selection is inside the title element
65
+ // it is needed to create the following structure:
66
+ //
67
+ // <title>
68
+ // <title-content>The title text</title-content>
69
+ // </title>
70
+ //
71
+ // See: https://github.com/ckeditor/ckeditor5/issues/2005.
72
+ model.schema.register( 'title', { isBlock: true, allowIn: '$root' } );
73
+ model.schema.register( 'title-content', { isBlock: true, allowIn: 'title', allowAttributes: [ 'alignment' ] } );
74
+ model.schema.extend( '$text', { allowIn: 'title-content' } );
75
+
76
+ // Disallow all attributes in `title-content`.
77
+ model.schema.addAttributeCheck( context => {
78
+ if ( context.endsWith( 'title-content $text' ) ) {
79
+ return false;
80
+ }
81
+ } );
82
+
83
+ // Because `title` is represented by two elements in the model
84
+ // but only one in the view, it is needed to adjust Mapper.
85
+ editor.editing.mapper.on( 'modelToViewPosition', mapModelPositionToView( editor.editing.view ) );
86
+ editor.data.mapper.on( 'modelToViewPosition', mapModelPositionToView( editor.editing.view ) );
87
+
88
+ // Conversion.
89
+ editor.conversion.for( 'downcast' ).elementToElement( { model: 'title-content', view: 'h1' } );
90
+ // Custom converter is used for data v -> m conversion to avoid calling post-fixer when setting data.
91
+ // See https://github.com/ckeditor/ckeditor5/issues/2036.
92
+ editor.data.upcastDispatcher.on( 'element:h1', dataViewModelH1Insertion, { priority: 'high' } );
93
+ editor.data.upcastDispatcher.on( 'element:h2', dataViewModelH1Insertion, { priority: 'high' } );
94
+ editor.data.upcastDispatcher.on( 'element:h3', dataViewModelH1Insertion, { priority: 'high' } );
95
+
96
+ // Take care about correct `title` element structure.
97
+ model.document.registerPostFixer( writer => this._fixTitleContent( writer ) );
98
+
99
+ // Create and take care of correct position of a `title` element.
100
+ model.document.registerPostFixer( writer => this._fixTitleElement( writer ) );
101
+
102
+ // Create element for `Body` placeholder if it is missing.
103
+ model.document.registerPostFixer( writer => this._fixBodyElement( writer ) );
104
+
105
+ // Prevent from adding extra at the end of the document.
106
+ model.document.registerPostFixer( writer => this._fixExtraParagraph( writer ) );
107
+
108
+ // Attach `Title` and `Body` placeholders to the empty title and/or content.
109
+ this._attachPlaceholders();
110
+
111
+ // Attach Tab handling.
112
+ this._attachTabPressHandling();
113
+ }
114
+
115
+ /**
116
+ * Returns the title of the document. Note that because this plugin does not allow any formatting inside
117
+ * the title element, the output of this method will be a plain text, with no HTML tags.
118
+ *
119
+ * It is not recommended to use this method together with features that insert markers to the
120
+ * data output, like comments or track changes features. If such markers start in the title and end in the
121
+ * body, the result of this method might be incorrect.
122
+ *
123
+ * @param {Object} [options] Additional configuration passed to the conversion process.
124
+ * See {@link module:engine/controller/datacontroller~DataController#get `DataController#get`}.
125
+ * @returns {String} The title of the document.
126
+ */
127
+ getTitle( options = {} ) {
128
+ const titleElement = this._getTitleElement();
129
+ const titleContentElement = titleElement.getChild( 0 );
130
+
131
+ return this.editor.data.stringify( titleContentElement, options );
132
+ }
133
+
134
+ /**
135
+ * Returns the body of the document.
136
+ *
137
+ * Note that it is not recommended to use this method together with features that insert markers to the
138
+ * data output, like comments or track changes features. If such markers start in the title and end in the
139
+ * body, the result of this method might be incorrect.
140
+ *
141
+ * @param {Object} [options] Additional configuration passed to the conversion process.
142
+ * See {@link module:engine/controller/datacontroller~DataController#get `DataController#get`}.
143
+ * @returns {String} The body of the document.
144
+ */
145
+ getBody( options = {} ) {
146
+ const editor = this.editor;
147
+ const data = editor.data;
148
+ const model = editor.model;
149
+ const root = editor.model.document.getRoot();
150
+ const view = editor.editing.view;
151
+ const viewWriter = new DowncastWriter( view.document );
152
+
153
+ const rootRange = model.createRangeIn( root );
154
+ const viewDocumentFragment = viewWriter.createDocumentFragment();
155
+
156
+ data.downcastDispatcher.conversionApi.options = options;
157
+
158
+ // Convert the entire root to view.
159
+ data.mapper.clearBindings();
160
+ data.mapper.bindElements( root, viewDocumentFragment );
161
+ data.downcastDispatcher.convertInsert( rootRange, viewWriter );
162
+
163
+ // Convert all markers that intersects with body.
164
+ const bodyStartPosition = model.createPositionAfter( root.getChild( 0 ) );
165
+ const bodyRange = model.createRange( bodyStartPosition, model.createPositionAt( root, 'end' ) );
166
+
167
+ for ( const marker of model.markers ) {
168
+ const intersection = bodyRange.getIntersection( marker.getRange() );
169
+
170
+ if ( intersection ) {
171
+ data.downcastDispatcher.convertMarkerAdd( marker.name, intersection, viewWriter );
172
+ }
173
+ }
174
+
175
+ // Clean `conversionApi`.
176
+ delete data.downcastDispatcher.conversionApi.options;
177
+
178
+ // Remove title element from view.
179
+ viewWriter.remove( viewWriter.createRangeOn( viewDocumentFragment.getChild( 0 ) ) );
180
+
181
+ // view -> data
182
+ return editor.data.processor.toData( viewDocumentFragment );
183
+ }
184
+
185
+ /**
186
+ * Returns the `title` element when it is in the document. Returns `undefined` otherwise.
187
+ *
188
+ * @private
189
+ * @returns {module:engine/model/element~Element|undefined}
190
+ */
191
+ _getTitleElement() {
192
+ const root = this.editor.model.document.getRoot();
193
+
194
+ for ( const child of root.getChildren() ) {
195
+ if ( isTitle( child ) ) {
196
+ return child;
197
+ }
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Model post-fixer callback that ensures that `title` has only one `title-content` child.
203
+ * All additional children should be moved after the `title` element and renamed to a paragraph.
204
+ *
205
+ * @private
206
+ * @param {module:engine/model/writer~Writer} writer
207
+ * @returns {Boolean}
208
+ */
209
+ _fixTitleContent( writer ) {
210
+ const title = this._getTitleElement();
211
+
212
+ // There's no title in the content - it will be created by _fixTitleElement post-fixer.
213
+ if ( !title || title.maxOffset === 1 ) {
214
+ return false;
215
+ }
216
+
217
+ const titleChildren = Array.from( title.getChildren() );
218
+
219
+ // Skip first child because it is an allowed element.
220
+ titleChildren.shift();
221
+
222
+ for ( const titleChild of titleChildren ) {
223
+ writer.move( writer.createRangeOn( titleChild ), title, 'after' );
224
+ writer.rename( titleChild, 'paragraph' );
225
+ }
226
+
227
+ return true;
228
+ }
229
+
230
+ /**
231
+ * Model post-fixer callback that creates a title element when it is missing,
232
+ * takes care of the correct position of it and removes additional title elements.
233
+ *
234
+ * @private
235
+ * @param {module:engine/model/writer~Writer} writer
236
+ * @returns {Boolean}
237
+ */
238
+ _fixTitleElement( writer ) {
239
+ const model = this.editor.model;
240
+ const modelRoot = model.document.getRoot();
241
+
242
+ const titleElements = Array.from( modelRoot.getChildren() ).filter( isTitle );
243
+ const firstTitleElement = titleElements[ 0 ];
244
+ const firstRootChild = modelRoot.getChild( 0 );
245
+
246
+ // When title element is at the beginning of the document then try to fix additional
247
+ // title elements (if there are any) and stop post-fixer as soon as possible.
248
+ if ( firstRootChild.is( 'element', 'title' ) ) {
249
+ return fixAdditionalTitleElements( titleElements, writer, model );
250
+ }
251
+
252
+ // When there is no title in the document and first element in the document cannot be changed
253
+ // to the title then create an empty title element at the beginning of the document.
254
+ if ( !firstTitleElement && !titleLikeElements.has( firstRootChild.name ) ) {
255
+ const title = writer.createElement( 'title' );
256
+
257
+ writer.insert( title, modelRoot );
258
+ writer.insertElement( 'title-content', title );
259
+
260
+ return true;
261
+ }
262
+
263
+ // At this stage, we are sure the title is somewhere in the content. It has to be fixed.
264
+
265
+ // Change the first element in the document to the title if it can be changed (is title-like).
266
+ if ( titleLikeElements.has( firstRootChild.name ) ) {
267
+ changeElementToTitle( firstRootChild, writer, model );
268
+ // Otherwise, move the first occurrence of the title element to the beginning of the document.
269
+ } else {
270
+ writer.move( writer.createRangeOn( firstTitleElement ), modelRoot, 0 );
271
+ }
272
+
273
+ fixAdditionalTitleElements( titleElements, writer, model );
274
+
275
+ return true;
276
+ }
277
+
278
+ /**
279
+ * Model post-fixer callback that adds an empty paragraph at the end of the document
280
+ * when it is needed for the placeholder purposes.
281
+ *
282
+ * @private
283
+ * @param {module:engine/model/writer~Writer} writer
284
+ * @returns {Boolean}
285
+ */
286
+ _fixBodyElement( writer ) {
287
+ const modelRoot = this.editor.model.document.getRoot();
288
+
289
+ if ( modelRoot.childCount < 2 ) {
290
+ this._bodyPlaceholder = writer.createElement( 'paragraph' );
291
+ writer.insert( this._bodyPlaceholder, modelRoot, 1 );
292
+
293
+ return true;
294
+ }
295
+
296
+ return false;
297
+ }
298
+
299
+ /**
300
+ * Model post-fixer callback that removes a paragraph from the end of the document
301
+ * if it was created for the placeholder purposes and is not needed anymore.
302
+ *
303
+ * @private
304
+ * @param {module:engine/model/writer~Writer} writer
305
+ * @returns {Boolean}
306
+ */
307
+ _fixExtraParagraph( writer ) {
308
+ const root = this.editor.model.document.getRoot();
309
+ const placeholder = this._bodyPlaceholder;
310
+
311
+ if ( shouldRemoveLastParagraph( placeholder, root ) ) {
312
+ this._bodyPlaceholder = null;
313
+ writer.remove( placeholder );
314
+
315
+ return true;
316
+ }
317
+
318
+ return false;
319
+ }
320
+
321
+ /**
322
+ * Attaches the `Title` and `Body` placeholders to the title and/or content.
323
+ *
324
+ * @private
325
+ */
326
+ _attachPlaceholders() {
327
+ const editor = this.editor;
328
+ const t = editor.t;
329
+ const view = editor.editing.view;
330
+ const viewRoot = view.document.getRoot();
331
+ const sourceElement = editor.sourceElement;
332
+
333
+ const titlePlaceholder = editor.config.get( 'title.placeholder' ) || t( 'Type your title' );
334
+ const bodyPlaceholder = editor.config.get( 'placeholder' ) ||
335
+ sourceElement && sourceElement.tagName.toLowerCase() === 'textarea' && sourceElement.getAttribute( 'placeholder' ) ||
336
+ t( 'Type or paste your content here.' );
337
+
338
+ // Attach placeholder to the view title element.
339
+ editor.editing.downcastDispatcher.on( 'insert:title-content', ( evt, data, conversionApi ) => {
340
+ enablePlaceholder( {
341
+ view,
342
+ element: conversionApi.mapper.toViewElement( data.item ),
343
+ text: titlePlaceholder,
344
+ keepOnFocus: true
345
+ } );
346
+ } );
347
+
348
+ // Attach placeholder to first element after a title element and remove it if it's not needed anymore.
349
+ // First element after title can change so we need to observe all changes keep placeholder in sync.
350
+ let oldBody;
351
+
352
+ // This post-fixer runs after the model post-fixer so we can assume that
353
+ // the second child in view root will always exist.
354
+ view.document.registerPostFixer( writer => {
355
+ const body = viewRoot.getChild( 1 );
356
+ let hasChanged = false;
357
+
358
+ // If body element has changed we need to disable placeholder on the previous element
359
+ // and enable on the new one.
360
+ if ( body !== oldBody ) {
361
+ if ( oldBody ) {
362
+ hidePlaceholder( writer, oldBody );
363
+ writer.removeAttribute( 'data-placeholder', oldBody );
364
+ }
365
+
366
+ writer.setAttribute( 'data-placeholder', bodyPlaceholder, body );
367
+ oldBody = body;
368
+ hasChanged = true;
369
+ }
370
+
371
+ // Then we need to display placeholder if it is needed.
372
+ // See: https://github.com/ckeditor/ckeditor5/issues/8689.
373
+ if ( needsPlaceholder( body, true ) && viewRoot.childCount === 2 && body.name === 'p' ) {
374
+ hasChanged = showPlaceholder( writer, body ) ? true : hasChanged;
375
+ // Or hide if it is not needed.
376
+ } else {
377
+ hasChanged = hidePlaceholder( writer, body ) ? true : hasChanged;
378
+ }
379
+
380
+ return hasChanged;
381
+ } );
382
+ }
383
+
384
+ /**
385
+ * Creates navigation between the title and body sections using <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
386
+ *
387
+ * @private
388
+ */
389
+ _attachTabPressHandling() {
390
+ const editor = this.editor;
391
+ const model = editor.model;
392
+
393
+ // Pressing <kbd>Tab</kbd> inside the title should move the caret to the body.
394
+ editor.keystrokes.set( 'TAB', ( data, cancel ) => {
395
+ model.change( writer => {
396
+ const selection = model.document.selection;
397
+ const selectedElements = Array.from( selection.getSelectedBlocks() );
398
+
399
+ if ( selectedElements.length === 1 && selectedElements[ 0 ].is( 'element', 'title-content' ) ) {
400
+ const firstBodyElement = model.document.getRoot().getChild( 1 );
401
+ writer.setSelection( firstBodyElement, 0 );
402
+ cancel();
403
+ }
404
+ } );
405
+ } );
406
+
407
+ // Pressing <kbd>Shift</kbd>+<kbd>Tab</kbd> at the beginning of the body should move the caret to the title.
408
+ editor.keystrokes.set( 'SHIFT + TAB', ( data, cancel ) => {
409
+ model.change( writer => {
410
+ const selection = model.document.selection;
411
+
412
+ if ( !selection.isCollapsed ) {
413
+ return;
414
+ }
415
+
416
+ const root = editor.model.document.getRoot();
417
+ const selectedElement = first( selection.getSelectedBlocks() );
418
+ const selectionPosition = selection.getFirstPosition();
419
+
420
+ const title = root.getChild( 0 );
421
+ const body = root.getChild( 1 );
422
+
423
+ if ( selectedElement === body && selectionPosition.isAtStart ) {
424
+ writer.setSelection( title.getChild( 0 ), 0 );
425
+ cancel();
426
+ }
427
+ } );
428
+ } );
429
+ }
430
+ }
431
+
432
+ // A view-to-model converter for the h1 that appears at the beginning of the document (a title element).
433
+ //
434
+ // @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
435
+ // @param {module:utils/eventinfo~EventInfo} evt An object containing information about the fired event.
436
+ // @param {Object} data An object containing conversion input, a placeholder for conversion output and possibly other values.
437
+ // @param {module:engine/conversion/upcastdispatcher~UpcastConversionApi} conversionApi Conversion interface to be used by the callback.
438
+ function dataViewModelH1Insertion( evt, data, conversionApi ) {
439
+ const modelCursor = data.modelCursor;
440
+ const viewItem = data.viewItem;
441
+
442
+ if ( !modelCursor.isAtStart || !modelCursor.parent.is( 'element', '$root' ) ) {
443
+ return;
444
+ }
445
+
446
+ if ( !conversionApi.consumable.consume( viewItem, { name: true } ) ) {
447
+ return;
448
+ }
449
+
450
+ const modelWriter = conversionApi.writer;
451
+
452
+ const title = modelWriter.createElement( 'title' );
453
+ const titleContent = modelWriter.createElement( 'title-content' );
454
+
455
+ modelWriter.append( titleContent, title );
456
+ modelWriter.insert( title, modelCursor );
457
+
458
+ conversionApi.convertChildren( viewItem, titleContent );
459
+
460
+ conversionApi.updateConversionResult( title, data );
461
+ }
462
+
463
+ // Maps position from the beginning of the model `title` element to the beginning of the view `h1` element.
464
+ //
465
+ // <title>^<title-content>Foo</title-content></title> -> <h1>^Foo</h1>
466
+ //
467
+ // @param {module:editor/view/view~View} editingView
468
+ function mapModelPositionToView( editingView ) {
469
+ return ( evt, data ) => {
470
+ const positionParent = data.modelPosition.parent;
471
+
472
+ if ( !positionParent.is( 'element', 'title' ) ) {
473
+ return;
474
+ }
475
+
476
+ const modelTitleElement = positionParent.parent;
477
+ const viewElement = data.mapper.toViewElement( modelTitleElement );
478
+
479
+ data.viewPosition = editingView.createPositionAt( viewElement, 0 );
480
+ evt.stop();
481
+ };
482
+ }
483
+
484
+ // Returns true when given element is a title. Returns false otherwise.
485
+ //
486
+ // @param {module:engine/model/element~Element} element
487
+ // @returns {Boolean}
488
+ function isTitle( element ) {
489
+ return element.is( 'element', 'title' );
490
+ }
491
+
492
+ // Changes the given element to the title element.
493
+ //
494
+ // @param {module:engine/model/element~Element} element
495
+ // @param {module:engine/model/writer~Writer} writer
496
+ // @param {module:engine/model/model~Model} model
497
+ function changeElementToTitle( element, writer, model ) {
498
+ const title = writer.createElement( 'title' );
499
+
500
+ writer.insert( title, element, 'before' );
501
+ writer.insert( element, title, 0 );
502
+ writer.rename( element, 'title-content' );
503
+ model.schema.removeDisallowedAttributes( [ element ], writer );
504
+ }
505
+
506
+ // Loops over the list of title elements and fixes additional ones.
507
+ //
508
+ // @param {Array.<module:engine/model/element~Element>} titleElements
509
+ // @param {module:engine/model/writer~Writer} writer
510
+ // @param {module:engine/model/model~Model} model
511
+ // @returns {Boolean} Returns true when there was any change. Returns false otherwise.
512
+ function fixAdditionalTitleElements( titleElements, writer, model ) {
513
+ let hasChanged = false;
514
+
515
+ for ( const title of titleElements ) {
516
+ if ( title.index !== 0 ) {
517
+ fixTitleElement( title, writer, model );
518
+ hasChanged = true;
519
+ }
520
+ }
521
+
522
+ return hasChanged;
523
+ }
524
+
525
+ // Changes given title element to a paragraph or removes it when it is empty.
526
+ //
527
+ // @param {module:engine/model/element~Element} title
528
+ // @param {module:engine/model/writer~Writer} writer
529
+ // @param {module:engine/model/model~Model} model
530
+ function fixTitleElement( title, writer, model ) {
531
+ const child = title.getChild( 0 );
532
+
533
+ // Empty title should be removed.
534
+ // It is created as a result of pasting to the title element.
535
+ if ( child.isEmpty ) {
536
+ writer.remove( title );
537
+
538
+ return;
539
+ }
540
+
541
+ writer.move( writer.createRangeOn( child ), title, 'before' );
542
+ writer.rename( child, 'paragraph' );
543
+ writer.remove( title );
544
+ model.schema.removeDisallowedAttributes( [ child ], writer );
545
+ }
546
+
547
+ // Returns true when the last paragraph in the document was created only for the placeholder
548
+ // purpose and it's not needed anymore. Returns false otherwise.
549
+ //
550
+ // @param {module:engine/model/rootelement~RootElement} root
551
+ // @param {module:engine/model/element~Element} placeholder
552
+ // @returns {Boolean}
553
+ function shouldRemoveLastParagraph( placeholder, root ) {
554
+ if ( !placeholder || !placeholder.is( 'element', 'paragraph' ) || placeholder.childCount ) {
555
+ return false;
556
+ }
557
+
558
+ if ( root.childCount <= 2 || root.getChild( root.childCount - 1 ) !== placeholder ) {
559
+ return false;
560
+ }
561
+
562
+ return true;
563
+ }
564
+
565
+ /**
566
+ * The configuration of the {@link module:heading/title~Title title feature}.
567
+ *
568
+ * Read more in {@link module:heading/title~TitleConfig}.
569
+ *
570
+ * @member {module:heading/title~TitleConfig} module:core/editor/editorconfig~EditorConfig#title
571
+ */
572
+
573
+ /**
574
+ * The configuration of the {@link module:heading/title~Title title feature}.
575
+ *
576
+ * ClassicEditor
577
+ * .create( document.querySelector( '#editor' ), {
578
+ * plugins: [ Title, ... ],
579
+ * title: {
580
+ * placeholder: 'My custom placeholder for the title'
581
+ * },
582
+ * placeholder: 'My custom placeholder for the body'
583
+ * } )
584
+ * .then( ... )
585
+ * .catch( ... );
586
+ *
587
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
588
+ *
589
+ * @interface TitleConfig
590
+ */
591
+
592
+ /**
593
+ * Defines a custom value of the placeholder for the title field.
594
+ *
595
+ * Read more in {@link module:heading/title~TitleConfig}.
596
+ *
597
+ * @member {String} module:heading/title~TitleConfig#placeholder
598
+ */
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module heading/utils
8
+ */
9
+
10
+ /**
11
+ * Returns heading options as defined in `config.heading.options` but processed to consider
12
+ * the editor localization, i.e. to display {@link module:heading/heading~HeadingOption}
13
+ * in the correct language.
14
+ *
15
+ * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}
16
+ * when the user configuration is defined because the editor does not exist yet.
17
+ *
18
+ * @param {module:core/editor/editor~Editor} editor
19
+ * @returns {Array.<module:heading/heading~HeadingOption>}.
20
+ */
21
+ export function getLocalizedOptions( editor ) {
22
+ const t = editor.t;
23
+ const localizedTitles = {
24
+ Paragraph: t( 'Paragraph' ),
25
+ 'Heading 1': t( 'Heading 1' ),
26
+ 'Heading 2': t( 'Heading 2' ),
27
+ 'Heading 3': t( 'Heading 3' ),
28
+ 'Heading 4': t( 'Heading 4' ),
29
+ 'Heading 5': t( 'Heading 5' ),
30
+ 'Heading 6': t( 'Heading 6' )
31
+ };
32
+
33
+ return editor.config.get( 'heading.options' ).map( option => {
34
+ const title = localizedTitles[ option.title ];
35
+
36
+ if ( title && title != option.title ) {
37
+ option.title = title;
38
+ }
39
+
40
+ return option;
41
+ } );
42
+ }
@@ -1,4 +1,5 @@
1
- @import "../../../themes/core/colors";
1
+ @import "../../../themes/theme/variable";
2
+ @import "../../../themes/theme/mixins";
2
3
 
3
4
  .breadcrumb-container{
4
5
  display: flex;