Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3335262
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:59:52+00:00 2026-05-17T23:59:52+00:00

This is one of the common issue with RTEs on web. Could you please

  • 0

This is one of the common issue with RTEs on web. Could you please guide me through how to:

  1. Paste as the PLAIN TEXT
  2. Retain the HTML but remove the WORD/HTML styling

I want to do it directly on paste (paste_preprocess callback), without opening the dialogs provided by Paste plugins.

Any thoughts/experiences ?

Thanks,

Imran

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:59:53+00:00Added an answer on May 17, 2026 at 11:59 pm

    This is what i do to get paste plain text.

    1. paste_preprocess setting (in tinymce init)

    paste_preprocess : function(pl, o) {
      //example: keep bold,italic,underline and paragraphs
      //o.content = strip_tags( o.content,'<b><u><i><p>' );
    
      // remove all tags => plain text
      o.content = strip_tags( o.content,'' );
    },
    

    2. function strip_tags (on the main document)

    // Strips HTML and PHP tags from a string 
    // returns 1: 'Kevin <b>van</b> <i>Zonneveld</i>'
    // example 2: strip_tags('<p>Kevin <img src="someimage.png" onmouseover="someFunction()">van <i>Zonneveld</i></p>', '<p>');
    // returns 2: '<p>Kevin van Zonneveld</p>'
    // example 3: strip_tags("<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>", "<a>");
    // returns 3: '<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>'
    // example 4: strip_tags('1 < 5 5 > 1');
    // returns 4: '1 < 5 5 > 1'
    function strip_tags (str, allowed_tags)
    {
    
        var key = '', allowed = false;
        var matches = [];    var allowed_array = [];
        var allowed_tag = '';
        var i = 0;
        var k = '';
        var html = ''; 
        var replacer = function (search, replace, str) {
            return str.split(search).join(replace);
        };
        // Build allowes tags associative array
        if (allowed_tags) {
            allowed_array = allowed_tags.match(/([a-zA-Z0-9]+)/gi);
        }
        str += '';
    
        // Match tags
        matches = str.match(/(<\/?[\S][^>]*>)/gi);
        // Go through all HTML tags
        for (key in matches) {
            if (isNaN(key)) {
                    // IE7 Hack
                continue;
            }
    
            // Save HTML tag
            html = matches[key].toString();
            // Is tag not in allowed list? Remove from str!
            allowed = false;
    
            // Go through all allowed tags
            for (k in allowed_array) {            // Init
                allowed_tag = allowed_array[k];
                i = -1;
    
                if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+'>');}
                if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+' ');}
                if (i != 0) { i = html.toLowerCase().indexOf('</'+allowed_tag)   ;}
    
                // Determine
                if (i == 0) {                allowed = true;
                    break;
                }
            }
            if (!allowed) {
                str = replacer(html, "", str); // Custom replace. No regexing
            }
        }
        return str;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run into the following issue, which seems to be a pretty common one.
I realise this is quite a common one, but I've been unable to rectify
Hopefully this is a common issue with JMeter testing. I setup a Proxy Server
This is one annoying issue and I can't figure out how to solve it.
This has to be a pretty common issue, and while we have answers, I'm
This one's a head scratcher. I've created a commented jsFiddle to demonstrate the phenomenon
This one's got me stumped and it's driving me nuts. I have a SiteFinity
This one has me pretty rattled so I thank you in advance for your
This one is a little tricky. Say I have this XmlDocument <Object> <Property1>1</Property1> <Property2>2</Property2>
This one is a little confusing to me. I'm running a LAMP server with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.