<commit_before>import Ember from 'ember';
import layout from '../templates/components/froala-editor';
import isHTMLSafe from 'ember-string-ishtmlsafe-polyfill';
import assign from 'ember-assign-polyfill';


const FroalaEditorComponent = Ember.Component.extend({
  layout,




  // Enable the ability to .extend() this Component
  // to define "default" options that will get merged
  // with any options passed in as an attribute
  mergedProperties: [
    'defaultOptions'
  ],




  // Empty options hash, .extend() this Component
  // to define defaults. Ex: `defaultOptions:{ heightMin:200 }`
  defaultOptions: {},




  // Froala Editor prefixes all event names,
  // which is technically NOT a namespace,
  // and should be used when attaching event handlers
  // Note: Include the trailing dot
  eventPrefix: 'froalaEditor.',




  // Froala Editor event name that will trigger the
  // `update` action, mainly used to update the `content` value
  // and takes a cue from ember-one-way-controls
  updateEvent: 'contentChanged',




  // Option to return a SafeString when using on-*-getHtml event actions
  // By default, look at the current type of `content`
  returnSafeString: Ember.computed('content', function(){
    return isHTMLSafe( this.get('content') );
  }),




  // Private, internal Computed Property to handle SafeString support
  // and it will always return a string, even if `content` is null or undefined
  // Note: Both Strings and SafeStrings have a .toString() function
  _content: Ember.computed('content', {
    get() {
      let content = this.get('content');
      return (
        content && typeof content.toString === 'function' ?
        content.toString() :
        ''
      );
    }
  }),




  // Private, internal Computed Property to merge all the possible "options"
  _options: Ember.computed('defaultOptions', 'options', {
    get() {
      return assign(
        {},
        this.getWithDefault('defaultOptions', {}),
        this.getWithDefault('options', {})
      );
    }
  }),




  // Public facing API's for editor instance and state information
  // Note: The referenced properties are .set() on the init() hook
  editor            : Ember.computed.readOnly( '_editor'             ),
  editorInitializing: Ember.computed.readOnly( '_editorInitializing' ),
  editorInitialized : Ember.computed.readOnly( '_editorInitialized'  ),
  editorDestroying  : Ember.computed.readOnly( '_editorDestroying'   ),
  editorDestroyed   : Ember.computed.not(      'editorInitialized'   ),




  /**********
   * Ember Lifecycle Hooks
   *
   * These will basically get everything going, from setup to tear down.
   * They are listed in the order they are typically called.
   **********/




  // Initialize the per-instance property defaults,
  // mainly for internal state flags and details.
  // https://guides.emberjs.com/v2.9.0/object-model/classes-and-instances/#toc_initializing-instances
  init() {
    this._super( ...arguments );
    this.set( '_editor'            , null  );
    this.set( '_editorInitializing', false );
    this.set( '_editorInitialized' , false );
    this.set( '_editorDestroying'  , false );
  }, // init()



<commit_msg>Few depreciations to help with the 2.3.5 to 2.3.6 transition<commit_after>import Ember from 'ember';
import layout from '../templates/components/froala-editor';
import isHTMLSafe from 'ember-string-ishtmlsafe-polyfill';
import assign from 'ember-assign-polyfill';


const FroalaEditorComponent = Ember.Component.extend({
  layout,




  // Enable the ability to .extend() this Component
  // to define "default" options that will get merged
  // with any options passed in as an attribute
  mergedProperties: [
    'defaultOptions'
  ],




  // Empty options hash, .extend() this Component
  // to define defaults. Ex: `defaultOptions:{ heightMin:200 }`
  defaultOptions: {},




  // Froala Editor prefixes all event names,
  // which is technically NOT a namespace,
  // and should be used when attaching event handlers
  // Note: Include the trailing dot
  eventPrefix: 'froalaEditor.',




  // Froala Editor event name that will trigger the
  // `update` action, mainly used to update the `content` value
  // and takes a cue from ember-one-way-controls
  updateEvent: 'contentChanged',




  // Option to return a SafeString when using on-*-getHtml event actions
  // By default, look at the current type of `content`
  returnSafeString: Ember.computed('content', function(){
    return isHTMLSafe( this.get('content') );
  }),




  // Few depreciations to help with the 2.3.5 to 2.3.6 transition
  contentBindingEvent: Ember.computed.deprecatingAlias('updateEvent', {
    id    : 'ember-froala-editor.contentBindingEvent',
    until : '2.3.7',
    url   : 'https://github.com/froala/ember-froala-editor/releases/tag/v2.3.6-beta.1'
  }),
  isSafeString: Ember.computed.deprecatingAlias('returnSafeString', {
    id    : 'ember-froala-editor.isSafeString',
    until : '2.3.7',
    url   : 'https://github.com/froala/ember-froala-editor/releases/tag/v2.3.6-beta.1'
  }),
  _optionsChanged: Ember.computed('options', {
    get() {
      // Skip the first "get" from the `init()` hook
      if ( !this.get('_optionsChangedFirst') ) {
        this.set('_optionsChangedFirst', true);
      } else {
        Ember.deprecate(
          "froala-editor 'options' changed post-initialization no longer updates the editor, instead use the related froala-editor methods",
          this.get('_optionsChangedWarned'),
          {
            id    : 'ember-froala-editor.optionsChanged',
            until : '2.3.7',
            url   : 'https://github.com/froala/ember-froala-editor/releases/tag/v2.3.6-beta.1'
          }
        );
        this.set('_optionsChangedWarned', true);
      }
    }
  }),




  // Private, internal Computed Property to handle SafeString support
  // and it will always return a string, even if `content` is null or undefined
  // Note: Both Strings and SafeStrings have a .toString() function
  _content: Ember.computed('content', {
    get() {
      let content = this.get('content');
      return (
        content && typeof content.toString === 'function' ?
        content.toString() :
        ''
      );
    }
  }),




  // Private, internal Computed Property to merge all the possible "options"
  _options: Ember.computed('defaultOptions', 'options', {
    get() {
      return assign(
        {},
        this.getWithDefault('defaultOptions', {}),
        this.getWithDefault('options', {})
      );
    }
  }),




  // Public facing API's for editor instance and state information
  // Note: The referenced properties are .set() on the init() hook
  editor            : Ember.computed.readOnly( '_editor'             ),
  editorInitializing: Ember.computed.readOnly( '_editorInitializing' ),
  editorInitialized : Ember.computed.readOnly( '_editorInitialized'  ),
  editorDestroying  : Ember.computed.readOnly( '_editorDestroying'   ),
  editorDestroyed   : Ember.computed.not(      'editorInitialized'   ),




  /**********
   * Ember Lifecycle Hooks
   *
   * These will basically get everything going, from setup to tear down.
   * They are listed in the order they are typically called.
   **********/




  // Initialize the per-instance property defaults,
  // mainly for internal state flags and details.
  // https://guides.emberjs.com/v2.9.0/object-model/classes-and-instances/#toc_initializing-instances
  init() {
    this._super( ...arguments );
    this.set( '_editor'            , null  );
    this.set( '_editorInitializing', false );
    this.set( '_editorInitialized' , false );
    this.set( '_editorDestroying'  , false );
    this.get( '_optionsChanged' ); // To monitor changes for depreciation notices
  }, // init()




{'fraction_non_alphanumeric': 0.123793591558358, 'fraction_numerical': 0.0057907605198816115, 'mean_word_length': 2.9035660472124563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '105683', 'n_tokens_mistral': 2326, 'n_tokens_neox': 2194, 'n_words': 650}