@oat-sa/tao-core-ui 2.0.0 → 2.1.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.
@@ -1,8 +1,9 @@
1
- define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'module', 'services/features'], function ($, _, dtdHandler, ckeditor, module, featuresService) { 'use strict';
1
+ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'module', 'services/features'], function ($, _, dtdHandler, ckeditor, context, module, featuresService) { 'use strict';
2
2
 
3
3
  $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
4
4
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
5
  dtdHandler = dtdHandler && Object.prototype.hasOwnProperty.call(dtdHandler, 'default') ? dtdHandler['default'] : dtdHandler;
6
+ context = context && Object.prototype.hasOwnProperty.call(context, 'default') ? context['default'] : context;
6
7
  module = module && Object.prototype.hasOwnProperty.call(module, 'default') ? module['default'] : module;
7
8
  featuresService = featuresService && Object.prototype.hasOwnProperty.call(featuresService, 'default') ? featuresService['default'] : featuresService;
8
9
 
@@ -413,6 +414,14 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'module', 'ser
413
414
  // add the toolbar
414
415
  if (typeof toolbars[toolbarType] !== 'undefined') {
415
416
  ckConfig.toolbar = toolbars[toolbarType];
417
+
418
+ //enable sourcedialog plugin upon featureflag (false by default)
419
+ if (context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_SOURCEDIALOG) {
420
+ ckConfig.toolbar.push({
421
+ name: 'sourcedialog',
422
+ items: ['Sourcedialog']
423
+ });
424
+ }
416
425
  }
417
426
 
418
427
  // ensures positionedPlugins has the right format
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -19,6 +19,7 @@ import $ from 'jquery';
19
19
  import _ from 'lodash';
20
20
  import dtdHandler from 'ui/ckeditor/dtdHandler';
21
21
  import 'ckeditor';
22
+ import context from 'context';
22
23
  import module from 'module';
23
24
  import featuresService from 'services/features';
24
25
 
@@ -56,7 +57,8 @@ const ckConfigurator = (function () {
56
57
  {
57
58
  name: 'links',
58
59
  items: ['Link']
59
- },{
60
+ },
61
+ {
60
62
  name: 'language',
61
63
  items: ['Language']
62
64
  }
@@ -454,7 +456,7 @@ const ckConfigurator = (function () {
454
456
  disableNativeTableHandles: true
455
457
  };
456
458
 
457
- if(moduleConfig && moduleConfig.specialChars) {
459
+ if (moduleConfig && moduleConfig.specialChars) {
458
460
  ckConfigDefault.specialChars = moduleConfig.specialChars;
459
461
  }
460
462
 
@@ -642,11 +644,11 @@ const ckConfigurator = (function () {
642
644
  }
643
645
  if (options.furiganaPlugin && featuresService.isVisible(furiganaPluginVisibilityKey, false)) {
644
646
  if (!options.toolbar || options.toolbar.find(el => el.items.includes('Superscript'))) {
645
- positionedPlugins.TaoFurigana = {insertAfter: 'Superscript'};
647
+ positionedPlugins.TaoFurigana = { insertAfter: 'Superscript' };
646
648
  } else {
647
649
  const lastGroup = options.toolbar[options.toolbar.length - 1];
648
650
  const firstPlugin = lastGroup.items[0];
649
- positionedPlugins.TaoFurigana = {insertBefore: firstPlugin};
651
+ positionedPlugins.TaoFurigana = { insertBefore: firstPlugin };
650
652
  }
651
653
  }
652
654
  }
@@ -666,6 +668,11 @@ const ckConfigurator = (function () {
666
668
  // add the toolbar
667
669
  if (typeof toolbars[toolbarType] !== 'undefined') {
668
670
  ckConfig.toolbar = toolbars[toolbarType];
671
+
672
+ //enable sourcedialog plugin upon featureflag (false by default)
673
+ if (context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_SOURCEDIALOG) {
674
+ ckConfig.toolbar.push({ name: 'sourcedialog', items: ['Sourcedialog'] });
675
+ }
669
676
  }
670
677
 
671
678
  // ensures positionedPlugins has the right format