bmcmahen / react-wysiwyg

retain some control over contenteditable input
169 stars 37 forks source link

Pressing delete passed content defaults as back button #18

Closed CoreyTrombley closed 9 years ago

CoreyTrombley commented 9 years ago

While holding the delete button I was sent back to a empty tab.

Here is my example code that I was using:

var InlineEdit = require('react-wysiwyg');

var HeaderBrandDetail = React.createClass({
  displayName: 'HeaderBrandDetail',
  propTypes: {
    resourceDetail: React.PropTypes.object.isRequired
  },

  getInitialState: function() {
    return {
      text: '',
      editing: false
    };
  },

  enableEditing: function(){
    // contenteditable field set to edit mode.
    this.setState({ editing: true });
  },

  render: function() {

    return (
      <HeaderDetail>

                 ...
                  <InlineEdit text={this.props.resourceDetail.detail.name || 'hello'}
                              onChange={function(){console.log('changed')}}
                              onEnterKey={function(){console.log('enter pressed')}}
                              onEscapekey={function(){console.log('escape pressed')}}
                              autoFocus={true}
                              editing={this.state.editing}
                  />
                  <span onClick={this.enableEditing} className="fa fa-pencil hidden-xs"></span>
                  ...

      </HeaderDetail>
    );

  }
});

module.exports = HeaderBrandDetail;

weird

bmcmahen commented 9 years ago

Hmm. So this occurs when pressing delete without setting a placeholder attribute? Let me look into it...

bmcmahen commented 9 years ago

Also, which version of this are you using? The api looks old...

CoreyTrombley commented 9 years ago

Hey Ben on the move atm. But I just did npm install that was in your Readme On Aug 13, 2015 5:49 PM, "Ben McMahen" notifications@github.com wrote:

Also, which version of this are you using? The api looks old...

— Reply to this email directly or view it on GitHub https://github.com/bmcmahen/react-wysiwyg/issues/18#issuecomment-130857756 .

bmcmahen commented 9 years ago

okay, looking into it regardless. thanks for the bug report

bmcmahen commented 9 years ago

I'm fairly confident this issue has been resolved in recent releases of this module. Please make sure that you are running the latest version 2.0.4 and that your usage looks like that in the current readme / examples. I'm going to close this for now, but if you continue to have issues, let me know.