Summernote: Clicking "Code View" Toolbar button Dirties Form

650 views Asked by At

I have summernote contained as one of the inputs within an angular form. When switching to code view by clicking the "Code View" button in the toolbar the form becomes $dirty even though no real changes have been made.

I realize that the actual text contained within the editor changes when you switch between code view modes, which is causing the form state to become $dirty. For example large text with h1 styling appears big and bold in the regular view

Header 1

but becomes this in the code view:

<p><span style="font-weight: bold; color: inherit; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 36px; letter-spacing: -1px; line-height: 1.1;">Header 1</span></p>

I am wondering if there is any way to prevent this behavior from happening? Potentially by intercepting the "Code View" button click event and setting the form back to $pristine after the new text has been rendered.

0

There are 0 answers