How to prevent CKEditor trim plain text in source view I'm using Drupal 8,

In source view when I paste some plain text like this:

Hello sir.
&lt;br /&gt;
Hello  sir.


And submit node form, without toggling back to rich-text mode, text above is removed.

If I toggle back in rich-text mode before submitting, CKEditor automatically wraps my text in p tag, like this:

&lt;p&gt;Hello sir.&lt;br /&gt;
Hello sir.&lt;br /&gt;
Hello sir.&lt;br /&gt;
Hello sir.&lt;/p&gt;


So is it possible to make CKEditor wrap plain text in p without toggling back to rich-text view?

I have tried several things and failed in all of them, I have written custom CKEditor plugin which listens to submit button click and execute this editor.execCommand( 'source' ); but it isn't working, somehow data is submitted before I switch to rich-text mode. 

Is there any solution to this?
CKEditor distinguishes Output formatting from Source Code formatting.

You're essentially wanting to do output formatting inside the source code formatting. It seems this is currently not possible.

From the documentation:


  Configuring Source Code Format
  
  At the moment the only aspect of the source code view that you can configure is the tab-size CSS property of the source editing area. Use the CKEDITOR.config.sourceAreaTabSize option to set the width of the tab character. Enter an integer to denote the number of spaces that the tab will contain.
  
  http://docs.ckeditor.com/#!/guide/dev_sourcearea


You might play with using the popup source editor instead of the inline editor, I don't know if this would give you any more possibilities to plug into and alter the HTML in source-editing mode or not.