usando tinymce en la extensión de cromo

I want to use TinyMCE in chrome extension.

In simple example, insert TinyMCE into textarea, when i click browseraction.

No funciona.

Por favor, ayúdame!

This is my code. (I use jquery. when click browseraction, insert textarea and apply TinyMCE) just insert textarea.. not apply TinyMCE..

Mi carpeta

  • background.html
  • content.js
  • manifest.json
  • icon.png
  • tinymce(folder)
  • jquery-1.7.1.min.js


chrome.browserAction.onClicked.addListener(function(tab) {
        chrome.tabs.executeScript(null, { file: "jquery-1.7.1.min.js" }, function() {
            chrome.tabs.executeScript(null, { file: "tinymce/jscripts/tiny_mce/tiny_mce.js" }, function() {
                chrome.tabs.executeScript(null, { file: "content.js" });


        mode : "textareas",
        theme : "simple"        



    "name": "NNNyang",
    "description": "TinyMCE test",
    "version": "0.1",
    "permissions": ["tabs", "http://*/", "https://*/"],
    "background_page": "background.html",
    "browser_action": {
        "default_icon": "icon.png",
        "default_title": "insert TinyMCE"

preguntado el 31 de enero de 12 a las 08:01

I can tell you that you should select $(body) and not $("body") -

that's not problem. ""$("body").append("<textarea>hello</textarea>");"" is operate well. -

Were you ever able to figure this out? I need to do the same thing and I'm running to the exact same issues. -

2 Respuestas

You doing it in the wrong order. You need to have the textarea on your page when you try to call the tinymce initialization. Try this



        mode : "textareas",
        theme : "simple"        

Respondido el 31 de enero de 12 a las 14:01

sry, put it the wrong way too, try again using my updated code - Thariama

still not working.. I think that this 'background.html'code cannot load all TinyMCE's js files, load only 'tinymce/jscripts/tiny_mce/tiny_mce.js'.. How can load all TinyMCE's js files in chrome extension? I'm crazing now. - NNNyang

This looks like quite an old question, trying to inject TinyMCE into an existing page.

In order to do this in current chrome, you'll need to:

a) use the content_scripts manifest directive, to inject every script you want access to in the page. (in this case, jquery, tinymce, and your own script)

b) in your content.js, setup a chrome RPC receiver, to receive a message action from your background script, using chrome.extension.onRequest.AddListener(...)

c) in your background script, use chrome.browserAction.onClicked.AddListener(..) to setup a trigger function for your browser button which sends an RPC message to your content.js script using chrome.tabs.sendRequest(...)

I have an extension which does this kind of thing with a context menu. You should be able to extrapolate this to a browser-action button..

Respondido 24 Feb 13, 08:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.