I’m not quite understand what you need but I think that you trying to insert text as plain text from anywhere: Browser, M$ Word, Pages.
For this purpose you can use Advanced TinyMCE Configuration plugin. After download and activating this plugin requires manual configuration. This solution better than code you suggested in question section above).
Option name Value
paste_strip_class_attributes all
paste_remove_spans true
paste_remove_styles true
paste_as_text true
paste_text_sticky true
block_formats Paragraph=p;Header 2=h2;...
All of these parts (parameters) of config may be founded on Tiny MCE documentation pages.
paste_strip_class_attributes
— old attribute from 3.?.? version
for removing all tags attributes likehref
,alt
,class
,
onError
,..paste_remove_spans
— also from 3.?.? version. Enables you to
remove all span (inline?) elements while pasting.paste_remove_styles
— If true, removes all style information when
pasting, regardless of browser type. Pasting from Word 2000 will
cause tinyMCE to error.paste_as_text
— This option enables you to set the default state
of the “paste as text” edit menu option. It’s disabled by default
but can be forced on by default.paste_text_sticky
— Keeps Paste Text feature active until user
deselects the Paste as Text button.block_formats
— additional configuration for my site 🙂
This config working fine on my sites and I always insert text in TinyMCE like a plain text.
Also helpfull plugin for TinyMCE tuning TinyMCE Advanced.