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

  • Home
  • SEARCH
  • 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 5979791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:42:33+00:00 2026-05-22T21:42:33+00:00

If I don’t click in the editor before clicking on my custom button, the

  • 0

If I don’t click in the editor before clicking on my custom button, the HTML CONTENT appear but everything else disapear… The thing is that I’m developping this plugin for public use so I don’t want that people erase them content by error, is there a way to set a insert point ? Here is the line that insert content code :

ed.execCommand('mceInsertContent', false, 'HTML CONTENT');

i’ve tried to add this before the mceInsertContent with no success :

tinyMCE.execInstanceCommand("mce_editor_0", "mceFocus");

Long code here :

(function() {
tinymce.create('tinymce.plugins.EmbedText', {
    init : function(ed, url) {
        ed.addButton('EmbedText', {
            title : 'Embed Text',
            image : url+'/../images/text.png',
            onclick : function() {
                var textprompt = prompt("Question", "Exemple");
                if (textprompt != null && textprompt != 'undefined')
                    tinyMCE.execInstanceCommand("mce_editor_0", "mceFocus"); //Tried this to set the focus to be shure to don't erase everything but still not working...
                    ed.execCommand('mceInsertContent', false, textprompt );
            }
        });
    },
    createControl : function(n, cm) {
        return null;
    },
    getInfo : function() {
        return {
            longname : "Embed Text",
            author : 'ME',
            authorurl : 'http://perdu.com/',
            infourl : 'http://perdu.com/',
            version : "1.0"
        };
    }
});
tinymce.PluginManager.add('EmbedText', tinymce.plugins.EmbedText);  })();

Thank you for those who’s helping !

  • 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-22T21:42:34+00:00Added an answer on May 22, 2026 at 9:42 pm

    After a couple of test, FF, IE, Safari and Opera working fine, the only browser who erase the content of the editor is Chrome… It’s the browser I use… that’s why I havn’t seen it’s a chrome issue sorry !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't want PHP errors to display /html, but I want them to display
Don't know where else to ask, but from one day to the other my
Don't know if this has been answered before. Have custom routes to users. If
I don't know if this has been asked before, but what i'd like to
Don't dismiss this as a newbie question! It's not, I'm not, I've tried everything,
Don't really know how to formulate the title, but it should be pretty obvious
Don't know how to google for such, but is there a way to query
Don't know if I worded the question right, but basically what I want to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this has been asked before, so point me to another question

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.