editorconfig.js 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import CKEDITOR from '../../ckeditor.js';
  7. import Config from './config.js';
  8. /**
  9. * Handles a configuration dictionary for an editor instance.
  10. *
  11. * The basic difference between {@link EditorConfig} and {@link Config} is that {@link EditorConfig#get} retrieves
  12. * configurations from {@link CKEDITOR#config} if they are not found.
  13. *
  14. * @class EditorConfig
  15. * @extends Config
  16. */
  17. export default class EditorConfig extends Config {
  18. /**
  19. * @inheritdoc core.Config#get
  20. */
  21. get() {
  22. // Try to take it from this editor instance.
  23. let value = super.get.apply( this, arguments );
  24. // If the configuration is not defined in the instance, try to take it from CKEDITOR.config.
  25. if ( typeof value == 'undefined' ) {
  26. value = super.get.apply( CKEDITOR.config, arguments );
  27. }
  28. return value;
  29. }
  30. }