Create MWLiveExtensionInspector base class

Most of the code stolen from MWMathInspector and genericised.

Also fix issues with fragment not wrapping the new node correctly.

Bug: 58286
Bug: 58045
Change-Id: I708c4cb012becf8c493d5b65a051c0b13f7a11ac
(cherry picked from commit e09e6c9f28ddb7135358867f01fa1f2ec64e7476)