Exemple #1
0
 componentWillUnmount() {
   autosize.destroy(this.refs.input);
 }
import autosize from 'autosize';

export default Component.extend({
  value: null,
  placeholder: 'value',
  didInsertElement() {
    this._super(...arguments);
    autosize(this.element.querySelector('textarea'));
  },
  didUpdate() {
    this._super(...arguments);
    autosize.update(this.element.querySelector('textarea'));
  },
  willDestroyElement() {
    this._super(...arguments);
    autosize.destroy(this.element.querySelector('textarea'));
  },
  shouldObscure: computed('isMasked', 'isFocused', 'value', function() {
    if (this.get('value') === '') {
      return false;
    }
    if (this.get('isFocused') === true) {
      return false;
    }
    return this.get('isMasked');
  }),
  displayValue: computed('shouldObscure', function() {
    if (this.get('shouldObscure')) {
      return '■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■';
    } else {
      return this.get('value');
 componentWillUnmount() {
   autosize.destroy(this.embedCodeInput);
 }
import React from 'react';


const AutosizeTextarea = React.createClass({

  componentDidMount() {
    autosize(this.refs.textarea);
  },

  componentDidUpdate() {
    // Using setTimeout() for being able to support uncontrolled components
    setTimeout(() => autosize.update(this.refs.textarea), 0);
  },

  componentWillUnmount() {
    autosize.destroy(this.refs.textarea);
  },

  render() {
    return (
      <textarea
        ref="textarea"
        {...this.props}
      />
    );
  },

});


export default AutosizeTextarea;
Exemple #5
0
            if (this.reWidgetId !== null) {
                grecaptcha.reset(this.reWidgetId);
            }
        },

        cancel() {
            this.errors = null;

            if (this.parent) {
                this.show = false;
            } else {
                this.focus = false;
                this.content = '';
            }

            autosize.destroy($(this.$el).find('textarea'));
        },

        /**
         * Recall the author name, email and url from the browser local storage.
         */
        recallAuthor() {
            var author = window.localStorage.getItem(this.config.storageKey);

            try {
                author = JSON.parse(author);
            } catch (error) {}

            if (!author) return;

            if (author.name) {