Chris@0: /** Chris@0: * @file Chris@0: * A Backbone Model for the state of a CKEditor toolbar configuration . Chris@0: */ Chris@0: Chris@17: (function(Drupal, Backbone) { Chris@0: /** Chris@0: * Backbone model for the CKEditor toolbar configuration state. Chris@0: * Chris@0: * @constructor Chris@0: * Chris@0: * @augments Backbone.Model Chris@0: */ Chris@17: Drupal.ckeditor.Model = Backbone.Model.extend( Chris@17: /** @lends Drupal.ckeditor.Model# */ { Chris@17: /** Chris@17: * Default values. Chris@17: * Chris@17: * @type {object} Chris@17: */ Chris@17: defaults: /** @lends Drupal.ckeditor.Model# */ { Chris@17: /** Chris@17: * The CKEditor configuration that is being manipulated through the UI. Chris@17: */ Chris@17: activeEditorConfig: null, Chris@0: Chris@17: /** Chris@17: * The textarea that contains the serialized representation of the active Chris@17: * CKEditor configuration. Chris@17: */ Chris@17: $textarea: null, Chris@17: Chris@17: /** Chris@17: * Tracks whether the active toolbar DOM structure has been changed. When Chris@17: * true, activeEditorConfig needs to be updated, and when that is updated, Chris@17: * $textarea will also be updated. Chris@17: */ Chris@17: isDirty: false, Chris@17: Chris@17: /** Chris@17: * The configuration for the hidden CKEditor instance that is used to Chris@17: * build the features metadata. Chris@17: */ Chris@17: hiddenEditorConfig: null, Chris@17: Chris@17: /** Chris@17: * A hash that maps buttons to features. Chris@17: */ Chris@17: buttonsToFeatures: null, Chris@17: Chris@17: /** Chris@17: * A hash, keyed by a feature name, that details CKEditor plugin features. Chris@17: */ Chris@17: featuresMetadata: null, Chris@17: Chris@17: /** Chris@17: * Whether the button group names are currently visible. Chris@17: */ Chris@17: groupNamesVisible: false, Chris@17: }, Chris@0: Chris@0: /** Chris@17: * @method Chris@0: */ Chris@17: sync() { Chris@17: // Push the settings into the textarea. Chris@17: this.get('$textarea').val( Chris@17: JSON.stringify(this.get('activeEditorConfig')), Chris@17: ); Chris@17: }, Chris@0: }, Chris@17: ); Chris@17: })(Drupal, Backbone);