Skip to content

Conversation

@cordery
Copy link
Contributor

@cordery cordery commented May 22, 2018

If pop is used to get the value of 'summernote' on self.attrs, then the html returned by render() may change after the first call. For example:

w=SummernoteWidget(attrs={'summernote':{'height':'123px'}})
w.render('test','',attrs={'id':'test'})

Will render the iframe height as '123px', however a second call

w.render('test','',attrs={'id':'test'})

will render whatever the default value for height is instead of '123px' because the summernote value of attrs was popped in the first call and therefore is no longer available for subsequent calls.

This PR fixes that by chaning the self.attrs.pop('summernote', {}) calls in both widgets to self.attrs.get('summernote', {})

If pop is used to get the value of 'summernote' on self.attrs, then the html returned by render() may change after the first call.  For example:
```python
w=SummernoteWidget(attrs={'summernote':{'height':'123px'}})
w.render('test','',attrs={'id':'test'})
```
Will render the iframe height as '123px', however a second call 
```python
w.render('test','',attrs={'id':'test'})
```
will render whatever the default value for height is instead of '123px' because the summernote value of attrs was popped in the first call and therefore is no longer available for subsequent calls.

This PR fixes that by chaning the self.attrs.pop('summernote', {}) calls in both widgets to self.attrs.get('summernote', {})
@coveralls
Copy link

coveralls commented May 22, 2018

Coverage Status

Coverage remained the same at 99.174% when pulling 052dd7d on cordery:patch-1 into 54c966e on summernote:master.

@lqez lqez merged commit 0838bee into lqez:master Sep 4, 2018
@lqez
Copy link
Owner

lqez commented Sep 4, 2018

Thank you for contributing, @cordery !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants