开发者

How to load TinyMCE properly in a Google Chrome Extension?

I want to use TinyMCE in my chrome extension, but it is not working, because it's trying to load all the .js files from the visited web page 开发者_运维百科(http://www.xxx.com) and not from the extension's path, which is something like this: chrome-extension://opioichmojlbogmkmoobbhckcaachnof/. I tried to add document_base_url parameter, but it did not work. What's the proper way to load TinyMCE in a Chrome extension as a content script?

We also tried to modify tiny_mce.js and at this point the .js files were loaded from the extension, but we got another error message: "tinymce is not defined".

Thanks in advance.


Within your content script, you inject all the JavaScript files. In your case, all your injecting is just a single one. There is like 249 files.

Within your manifest:

 "content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["tiny_mce.js", "utils/mctabs.js", " ... .."] 
    }
  ],

You need to import everything under tiny_mce in your content script. Isn't that a bit overkill for every website to get? Do you really need that for every website. Can you change your design and offload that description to an extension page and include tiny_mce just there, that would be better.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜