@oat-sa/tao-core-ui 3.14.0 → 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];
@@ -212,13 +213,13 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
212
213
  coreStyles_subscript: {
213
214
  element: 'sub',
214
215
  attributes: {
215
- class: 'txt-subscript'
216
+ class: decorationsOn ? 'txt-subscript' : ''
216
217
  }
217
218
  },
218
219
  coreStyles_superscript: {
219
220
  element: 'sup',
220
221
  attributes: {
221
- class: 'txt-superscript'
222
+ class: decorationsOn ? 'txt-superscript' : ''
222
223
  }
223
224
  },
224
225
  coreStyles_highlight: {
@@ -259,9 +260,11 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
259
260
  ckConfig.extraPlugins = function (positionedPluginArr, extraPlugins) {
260
261
  let pluginIndex = positionedPluginArr.length;
261
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']);
262
264
  while (pluginIndex--) {
263
265
  positionedPluginArr[pluginIndex] = positionedPluginArr[pluginIndex].toLowerCase();
264
266
  }
267
+ positionedPluginArr = positionedPluginArr.filter(p => !NATIVE_BUTTONS.has(p));
265
268
  extraPluginArr = _.compact(_.union(extraPluginArr, positionedPluginArr));
266
269
  return extraPluginArr.join(',');
267
270
  }(_.keys(positionedPlugins), ckConfig.extraPlugins);
@@ -397,29 +400,27 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
397
400
  insertAfter: 'SpecialChar'
398
401
  };
399
402
  }
400
- if (context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_DECORATIONS) {
401
- if (options.strike) {
402
- positionedPlugins.TaoStrike = {
403
- insertAfter: 'Italic'
404
- };
405
- }
403
+ if (decorationsOn) {
404
+ positionedPlugins.Strike = {
405
+ insertAfter: 'Italic'
406
+ };
406
407
  if (options.underline) {
407
408
  positionedPlugins.TaoUnderline = {
408
- insertAfter: options.strike ? 'TaoStrike' : 'Italic'
409
+ insertAfter: 'Strike'
409
410
  };
410
411
  }
411
- }
412
- if (options.highlight) {
412
+ } else {
413
413
  if (options.underline) {
414
- positionedPlugins.TaoHighlight = {
415
- insertAfter: 'TaoUnderline'
416
- };
417
- } else {
418
- positionedPlugins.TaoHighlight = {
414
+ positionedPlugins.Underline = {
419
415
  insertAfter: 'Italic'
420
416
  };
421
417
  }
422
418
  }
419
+ if (options.highlight) {
420
+ positionedPlugins.TaoHighlight = {
421
+ insertAfter: decorationsOn && options.underline ? 'TaoUnderline' : options.underline ? 'Underline' : 'Italic'
422
+ };
423
+ }
423
424
  if (options.mathJax) {
424
425
  positionedPlugins.TaoQtiMaths = {
425
426
  insertAfter: 'SpecialChar'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -93,18 +93,15 @@ legend.cke_voice_label {
93
93
  // added to make _u_ in ck QTI compatible
94
94
  .txt-underline {
95
95
  text-decoration: underline;
96
- text-underline-offset: 0.4em;
97
96
  font-size : inherit;
98
97
  }
99
98
 
100
99
  .txt-dashed {
101
100
  text-decoration: underline dashed;
102
- text-underline-offset: 0.4em;
103
101
  }
104
102
 
105
103
  .txt-wavy {
106
104
  text-decoration: underline wavy;
107
- text-underline-offset: 0.4em;
108
105
  }
109
106
 
110
107
  .txt-strike {
@@ -501,27 +501,39 @@ body {
501
501
  }
502
502
  .txt-dashed {
503
503
  text-decoration: underline dashed;
504
- text-underline-offset: 0.4em;
505
504
  }
506
505
 
507
506
  .txt-wavy {
508
507
  text-decoration: underline wavy;
509
- text-underline-offset: 0.4em;
510
508
  }
511
509
 
512
510
  .txt-strike {
513
511
  text-decoration: line-through;
514
512
  }
515
-
513
+
516
514
  .writing-mode-vertical-rl {
515
+ .txt-dashed,
516
+ .txt-underline {
517
+ text-underline-offset: 0.2em;
518
+ }
517
519
  .txt-underline {
518
520
  text-underline-position: right;
519
521
  }
520
522
  .txt-subscript {
521
- right: -0.6em;
523
+ inset-block-start: -0.4em;
524
+ bottom: 0;
522
525
  }
523
526
  .txt-superscript {
524
- left: -0.6em;
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
+ }
525
537
  }
526
538
  }
527
539
 
@@ -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');
@@ -278,11 +279,11 @@ const ckConfigurator = (function () {
278
279
  },
279
280
  coreStyles_subscript: {
280
281
  element: 'sub',
281
- attributes: { class: 'txt-subscript' }
282
+ attributes: { class: decorationsOn ? 'txt-subscript' : ''}
282
283
  },
283
284
  coreStyles_superscript: {
284
285
  element: 'sup',
285
- attributes: { class: 'txt-superscript' }
286
+ attributes: { class: decorationsOn ? 'txt-superscript': '' }
286
287
  },
287
288
  coreStyles_highlight: {
288
289
  element: 'span',
@@ -537,13 +538,22 @@ const ckConfigurator = (function () {
537
538
  let pluginIndex = positionedPluginArr.length;
538
539
  let extraPluginArr = extraPlugins.split(',');
539
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
+
540
548
  while (pluginIndex--) {
541
549
  positionedPluginArr[pluginIndex] = positionedPluginArr[pluginIndex].toLowerCase();
542
550
  }
543
551
 
552
+ positionedPluginArr = positionedPluginArr.filter(p => !NATIVE_BUTTONS.has(p));
553
+
544
554
  extraPluginArr = _.compact(_.union(extraPluginArr, positionedPluginArr));
545
555
  return extraPluginArr.join(',');
546
- })(_.keys(positionedPlugins), ckConfig.extraPlugins);
556
+ }(_.keys(positionedPlugins), ckConfig.extraPlugins));
547
557
 
548
558
  // capture line breaks (/) and such
549
559
  // and turn them into a objects temporarily
@@ -677,24 +687,20 @@ const ckConfigurator = (function () {
677
687
  if (options.qtiInclude) {
678
688
  positionedPlugins.TaoQtiInclude = { insertAfter: 'SpecialChar' };
679
689
  }
680
- if (context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_DECORATIONS) {
681
- if (options.strike) {
682
- positionedPlugins.TaoStrike = {
683
- insertAfter: 'Italic'
684
- };
690
+ if (decorationsOn) {
691
+ positionedPlugins.Strike = { insertAfter: 'Italic' };
692
+ if (options.underline) {
693
+ positionedPlugins.TaoUnderline = { insertAfter: 'Strike' };
685
694
  }
695
+ } else {
686
696
  if (options.underline) {
687
- positionedPlugins.TaoUnderline = {
688
- insertAfter: options.strike ? 'TaoStrike' : 'Italic'
689
- };
697
+ positionedPlugins.Underline = { insertAfter: 'Italic' };
690
698
  }
691
699
  }
692
700
  if (options.highlight) {
693
- if (options.underline) {
694
- positionedPlugins.TaoHighlight = { insertAfter: 'TaoUnderline' };
695
- } else {
696
- positionedPlugins.TaoHighlight = { insertAfter: 'Italic' };
697
- }
701
+ positionedPlugins.TaoHighlight = {
702
+ insertAfter: (decorationsOn && options.underline) ? 'TaoUnderline' : (options.underline ? 'Underline' : 'Italic')
703
+ };
698
704
  }
699
705
  if (options.mathJax) {
700
706
  positionedPlugins.TaoQtiMaths = { insertAfter: 'SpecialChar' };
package/src/css/basic.css CHANGED
@@ -1465,24 +1465,34 @@ html .txt-underline {
1465
1465
  html .txt-dashed {
1466
1466
  -webkit-text-decoration: underline dashed;
1467
1467
  text-decoration: underline dashed;
1468
- text-underline-offset: 0.4em;
1469
1468
  }
1470
1469
  html .txt-wavy {
1471
1470
  -webkit-text-decoration: underline wavy;
1472
1471
  text-decoration: underline wavy;
1473
- text-underline-offset: 0.4em;
1474
1472
  }
1475
1473
  html .txt-strike {
1476
1474
  text-decoration: line-through;
1477
1475
  }
1476
+ html .writing-mode-vertical-rl .txt-dashed,
1477
+ html .writing-mode-vertical-rl .txt-underline {
1478
+ text-underline-offset: 0.2em;
1479
+ }
1478
1480
  html .writing-mode-vertical-rl .txt-underline {
1479
1481
  text-underline-position: right;
1480
1482
  }
1481
1483
  html .writing-mode-vertical-rl .txt-subscript {
1482
- right: -0.6em;
1484
+ inset-block-start: -0.4em;
1485
+ bottom: 0;
1483
1486
  }
1484
1487
  html .writing-mode-vertical-rl .txt-superscript {
1485
- left: -0.6em;
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;
1486
1496
  }
1487
1497
  html .writing-mode-vertical-rl[data-useragent-browser=safari] .txt-underline {
1488
1498
  text-decoration: none;
@@ -5283,20 +5293,17 @@ legend.cke_voice_label {
5283
5293
 
5284
5294
  .txt-underline {
5285
5295
  text-decoration: underline;
5286
- text-underline-offset: 0.4em;
5287
5296
  font-size: inherit;
5288
5297
  }
5289
5298
 
5290
5299
  .txt-dashed {
5291
5300
  -webkit-text-decoration: underline dashed;
5292
5301
  text-decoration: underline dashed;
5293
- text-underline-offset: 0.4em;
5294
5302
  }
5295
5303
 
5296
5304
  .txt-wavy {
5297
5305
  -webkit-text-decoration: underline wavy;
5298
5306
  text-decoration: underline wavy;
5299
- text-underline-offset: 0.4em;
5300
5307
  }
5301
5308
 
5302
5309
  .txt-strike {