@oat-sa/tao-core-ui 3.13.5 → 3.15.0

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.
@@ -31,6 +31,7 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
31
31
  const originalConfig = _.cloneDeep(window.CKEDITOR.config);
32
32
  const moduleConfig = module.config();
33
33
  const furiganaPluginVisibilityKey = 'ckeditor/TaoFurigana';
34
+ const decorationsOn = !!(context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_DECORATIONS);
34
35
  function getUserLanguage() {
35
36
  const documentLang = window.document.documentElement.getAttribute('lang');
36
37
  const documentLocale = documentLang && documentLang.split('-')[0];
@@ -130,7 +131,7 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
130
131
  }],
131
132
  htmlField: [{
132
133
  name: 'basicstyles',
133
- items: ['Bold', 'Italic', 'Strike', 'Underline']
134
+ items: ['Bold', 'Italic', 'Underline']
134
135
  }, {
135
136
  name: 'exponent',
136
137
  items: ['Subscript', 'Superscript']
@@ -203,6 +204,24 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
203
204
  class: 'txt-underline'
204
205
  }
205
206
  },
207
+ coreStyles_strike: {
208
+ element: 'span',
209
+ attributes: {
210
+ class: 'txt-strike'
211
+ }
212
+ },
213
+ coreStyles_subscript: {
214
+ element: 'sub',
215
+ attributes: {
216
+ class: decorationsOn ? 'txt-subscript' : ''
217
+ }
218
+ },
219
+ coreStyles_superscript: {
220
+ element: 'sup',
221
+ attributes: {
222
+ class: decorationsOn ? 'txt-superscript' : ''
223
+ }
224
+ },
206
225
  coreStyles_highlight: {
207
226
  element: 'span',
208
227
  attributes: {
@@ -241,9 +260,11 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
241
260
  ckConfig.extraPlugins = function (positionedPluginArr, extraPlugins) {
242
261
  let pluginIndex = positionedPluginArr.length;
243
262
  let extraPluginArr = extraPlugins.split(',');
263
+ const NATIVE_BUTTONS = new Set(['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'numberedlist', 'bulletedlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'justifyblock', 'link', 'unlink', 'image', 'specialchar', 'format', 'font', 'fontsize', 'textcolor', 'language']);
244
264
  while (pluginIndex--) {
245
265
  positionedPluginArr[pluginIndex] = positionedPluginArr[pluginIndex].toLowerCase();
246
266
  }
267
+ positionedPluginArr = positionedPluginArr.filter(p => !NATIVE_BUTTONS.has(p));
247
268
  extraPluginArr = _.compact(_.union(extraPluginArr, positionedPluginArr));
248
269
  return extraPluginArr.join(',');
249
270
  }(_.keys(positionedPlugins), ckConfig.extraPlugins);
@@ -379,22 +400,27 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
379
400
  insertAfter: 'SpecialChar'
380
401
  };
381
402
  }
382
- if (options.underline) {
383
- positionedPlugins.TaoUnderline = {
403
+ if (decorationsOn) {
404
+ positionedPlugins.Strike = {
384
405
  insertAfter: 'Italic'
385
406
  };
386
- }
387
- if (options.highlight) {
388
407
  if (options.underline) {
389
- positionedPlugins.TaoHighlight = {
390
- insertAfter: 'TaoUnderline'
408
+ positionedPlugins.TaoUnderline = {
409
+ insertAfter: 'Strike'
391
410
  };
392
- } else {
393
- positionedPlugins.TaoHighlight = {
411
+ }
412
+ } else {
413
+ if (options.underline) {
414
+ positionedPlugins.Underline = {
394
415
  insertAfter: 'Italic'
395
416
  };
396
417
  }
397
418
  }
419
+ if (options.highlight) {
420
+ positionedPlugins.TaoHighlight = {
421
+ insertAfter: decorationsOn && options.underline ? 'TaoUnderline' : options.underline ? 'Underline' : 'Italic'
422
+ };
423
+ }
398
424
  if (options.mathJax) {
399
425
  positionedPlugins.TaoQtiMaths = {
400
426
  insertAfter: 'SpecialChar'
@@ -458,7 +484,7 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
458
484
  }
459
485
 
460
486
  // forward the options to ckConfig, exclude local options
461
- config = _.assign({}, _.cloneDeep(originalConfig), ckConfig, _.omit(options, ['qtiImage', 'qtiInclude', 'underline', 'highlight', 'mathJax', 'toolbar', 'positionedPlugins']));
487
+ config = _.assign({}, _.cloneDeep(originalConfig), ckConfig, _.omit(options, ['qtiImage', 'qtiInclude', 'underline', 'strike', 'highlight', 'mathJax', 'toolbar', 'positionedPlugins']));
462
488
 
463
489
  // debugger: has this config been used?
464
490
  //config.aaaConfigurationHasBeenLoadedFromConfigurator = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "3.13.5",
3
+ "version": "3.15.0",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -96,6 +96,18 @@ legend.cke_voice_label {
96
96
  font-size : inherit;
97
97
  }
98
98
 
99
+ .txt-dashed {
100
+ text-decoration: underline dashed;
101
+ }
102
+
103
+ .txt-wavy {
104
+ text-decoration: underline wavy;
105
+ }
106
+
107
+ .txt-strike {
108
+ text-decoration: line-through;
109
+ }
110
+
99
111
  .txt-highlight {
100
112
  padding: 0 5px;
101
113
  background: #FF6416;
@@ -499,9 +499,44 @@ body {
499
499
  text-decoration: underline;
500
500
  font-size: inherit;
501
501
  }
502
- .writing-mode-vertical-rl .txt-underline {
503
- text-underline-position: right;
502
+ .txt-dashed {
503
+ text-decoration: underline dashed;
504
504
  }
505
+
506
+ .txt-wavy {
507
+ text-decoration: underline wavy;
508
+ }
509
+
510
+ .txt-strike {
511
+ text-decoration: line-through;
512
+ }
513
+
514
+ .writing-mode-vertical-rl {
515
+ .txt-dashed,
516
+ .txt-underline {
517
+ text-underline-offset: 0.2em;
518
+ }
519
+ .txt-underline {
520
+ text-underline-position: right;
521
+ }
522
+ .txt-subscript {
523
+ inset-block-start: -0.4em;
524
+ bottom: 0;
525
+ }
526
+ .txt-superscript {
527
+ inset-block-end: -0.4em;
528
+ top: 0;
529
+ }
530
+ .txt-underline,
531
+ .txt-dashed,
532
+ .txt-wavy {
533
+ ruby rt {
534
+ position: relative;
535
+ inset-block-start: -0.8em;
536
+ }
537
+ }
538
+ }
539
+
505
540
  .writing-mode-vertical-rl[data-useragent-browser='safari'] .txt-underline {
506
541
  // for Safari < 18.2 which doesn't support "text-underline-position: right"
507
542
  text-decoration: none;
@@ -29,6 +29,7 @@ import featuresService from 'services/features';
29
29
  const originalConfig = _.cloneDeep(window.CKEDITOR.config);
30
30
  const moduleConfig = module.config();
31
31
  const furiganaPluginVisibilityKey = 'ckeditor/TaoFurigana';
32
+ const decorationsOn = !!(context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_DECORATIONS);
32
33
 
33
34
  function getUserLanguage() {
34
35
  const documentLang = window.document.documentElement.getAttribute('lang');
@@ -61,7 +62,6 @@ const ckConfigurator = (function () {
61
62
  {
62
63
  name: 'language',
63
64
  items: ['Language']
64
-
65
65
  },
66
66
  {
67
67
  name: 'styles',
@@ -69,7 +69,16 @@ const ckConfigurator = (function () {
69
69
  },
70
70
  {
71
71
  name: 'paragraph',
72
- items: ['NumberedList', 'BulletedList', '-', 'Blockquote', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']
72
+ items: [
73
+ 'NumberedList',
74
+ 'BulletedList',
75
+ '-',
76
+ 'Blockquote',
77
+ 'JustifyLeft',
78
+ 'JustifyCenter',
79
+ 'JustifyRight',
80
+ 'JustifyBlock'
81
+ ]
73
82
  },
74
83
  {
75
84
  name: 'interactionsource',
@@ -174,7 +183,7 @@ const ckConfigurator = (function () {
174
183
  htmlField: [
175
184
  {
176
185
  name: 'basicstyles',
177
- items: ['Bold', 'Italic', 'Strike', 'Underline']
186
+ items: ['Bold', 'Italic', 'Underline']
178
187
  },
179
188
  {
180
189
  name: 'exponent',
@@ -262,6 +271,20 @@ const ckConfigurator = (function () {
262
271
  element: 'span',
263
272
  attributes: { class: 'txt-underline' }
264
273
  },
274
+ coreStyles_strike: {
275
+ element: 'span',
276
+ attributes: {
277
+ class: 'txt-strike'
278
+ }
279
+ },
280
+ coreStyles_subscript: {
281
+ element: 'sub',
282
+ attributes: { class: decorationsOn ? 'txt-subscript' : ''}
283
+ },
284
+ coreStyles_superscript: {
285
+ element: 'sup',
286
+ attributes: { class: decorationsOn ? 'txt-superscript': '' }
287
+ },
265
288
  coreStyles_highlight: {
266
289
  element: 'span',
267
290
  attributes: { class: 'txt-highlight' }
@@ -515,13 +538,22 @@ const ckConfigurator = (function () {
515
538
  let pluginIndex = positionedPluginArr.length;
516
539
  let extraPluginArr = extraPlugins.split(',');
517
540
 
541
+ const NATIVE_BUTTONS = new Set([
542
+ 'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
543
+ 'numberedlist', 'bulletedlist', 'blockquote',
544
+ 'justifyleft', 'justifycenter', 'justifyright', 'justifyblock',
545
+ 'link', 'unlink', 'image', 'specialchar', 'format', 'font', 'fontsize', 'textcolor', 'language'
546
+ ]);
547
+
518
548
  while (pluginIndex--) {
519
549
  positionedPluginArr[pluginIndex] = positionedPluginArr[pluginIndex].toLowerCase();
520
550
  }
521
551
 
552
+ positionedPluginArr = positionedPluginArr.filter(p => !NATIVE_BUTTONS.has(p));
553
+
522
554
  extraPluginArr = _.compact(_.union(extraPluginArr, positionedPluginArr));
523
555
  return extraPluginArr.join(',');
524
- })(_.keys(positionedPlugins), ckConfig.extraPlugins);
556
+ }(_.keys(positionedPlugins), ckConfig.extraPlugins));
525
557
 
526
558
  // capture line breaks (/) and such
527
559
  // and turn them into a objects temporarily
@@ -655,16 +687,21 @@ const ckConfigurator = (function () {
655
687
  if (options.qtiInclude) {
656
688
  positionedPlugins.TaoQtiInclude = { insertAfter: 'SpecialChar' };
657
689
  }
658
- if (options.underline) {
659
- positionedPlugins.TaoUnderline = { insertAfter: 'Italic' };
660
- }
661
- if (options.highlight) {
690
+ if (decorationsOn) {
691
+ positionedPlugins.Strike = { insertAfter: 'Italic' };
662
692
  if (options.underline) {
663
- positionedPlugins.TaoHighlight = { insertAfter: 'TaoUnderline' };
664
- } else {
665
- positionedPlugins.TaoHighlight = { insertAfter: 'Italic' };
693
+ positionedPlugins.TaoUnderline = { insertAfter: 'Strike' };
694
+ }
695
+ } else {
696
+ if (options.underline) {
697
+ positionedPlugins.Underline = { insertAfter: 'Italic' };
666
698
  }
667
699
  }
700
+ if (options.highlight) {
701
+ positionedPlugins.TaoHighlight = {
702
+ insertAfter: (decorationsOn && options.underline) ? 'TaoUnderline' : (options.underline ? 'Underline' : 'Italic')
703
+ };
704
+ }
668
705
  if (options.mathJax) {
669
706
  positionedPlugins.TaoQtiMaths = { insertAfter: 'SpecialChar' };
670
707
  }
@@ -725,6 +762,7 @@ const ckConfigurator = (function () {
725
762
  'qtiImage',
726
763
  'qtiInclude',
727
764
  'underline',
765
+ 'strike',
728
766
  'highlight',
729
767
  'mathJax',
730
768
  'toolbar',
package/src/css/basic.css CHANGED
@@ -1462,9 +1462,38 @@ html .txt-underline {
1462
1462
  text-decoration: underline;
1463
1463
  font-size: inherit;
1464
1464
  }
1465
+ html .txt-dashed {
1466
+ -webkit-text-decoration: underline dashed;
1467
+ text-decoration: underline dashed;
1468
+ }
1469
+ html .txt-wavy {
1470
+ -webkit-text-decoration: underline wavy;
1471
+ text-decoration: underline wavy;
1472
+ }
1473
+ html .txt-strike {
1474
+ text-decoration: line-through;
1475
+ }
1476
+ html .writing-mode-vertical-rl .txt-dashed,
1477
+ html .writing-mode-vertical-rl .txt-underline {
1478
+ text-underline-offset: 0.2em;
1479
+ }
1465
1480
  html .writing-mode-vertical-rl .txt-underline {
1466
1481
  text-underline-position: right;
1467
1482
  }
1483
+ html .writing-mode-vertical-rl .txt-subscript {
1484
+ inset-block-start: -0.4em;
1485
+ bottom: 0;
1486
+ }
1487
+ html .writing-mode-vertical-rl .txt-superscript {
1488
+ inset-block-end: -0.4em;
1489
+ top: 0;
1490
+ }
1491
+ html .writing-mode-vertical-rl .txt-underline ruby rt,
1492
+ html .writing-mode-vertical-rl .txt-dashed ruby rt,
1493
+ html .writing-mode-vertical-rl .txt-wavy ruby rt {
1494
+ position: relative;
1495
+ inset-block-start: -0.8em;
1496
+ }
1468
1497
  html .writing-mode-vertical-rl[data-useragent-browser=safari] .txt-underline {
1469
1498
  text-decoration: none;
1470
1499
  border-right: 1px solid currentColor;
@@ -5267,6 +5296,20 @@ legend.cke_voice_label {
5267
5296
  font-size: inherit;
5268
5297
  }
5269
5298
 
5299
+ .txt-dashed {
5300
+ -webkit-text-decoration: underline dashed;
5301
+ text-decoration: underline dashed;
5302
+ }
5303
+
5304
+ .txt-wavy {
5305
+ -webkit-text-decoration: underline wavy;
5306
+ text-decoration: underline wavy;
5307
+ }
5308
+
5309
+ .txt-strike {
5310
+ text-decoration: line-through;
5311
+ }
5312
+
5270
5313
  .txt-highlight {
5271
5314
  padding: 0 5px;
5272
5315
  background: #FF6416;