Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE Editor adds data-mce-src to <img />

Tags:

html

tinymce

I'm using the TinyMCE 4.0.11 and it seems there is a Problem with the TinyMCE, because it adds a "data-mce-src" attribute to the img tag, which overwrites the "src" attribute. If i add an image with src attribute set to "http://example.com/img.jpg", the data-mce-src attribute contains "/http://example.com/img.jpg" with the "/" at the beginning. How can i prevent the tinymce adding the data-mce-src attribute?

I tried the following options for the TinyMCE configuration:

  • relative_urls: false,
  • inline: false,
  • content_css: false,
  • convert_urls: false

Nothing fixed the problem.

like image 982
user3571545 Avatar asked Apr 25 '14 05:04

user3571545


People also ask

How do I display TinyMCE content in HTML?

The TinyMCE getContent and setContent methods You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.

How do you insert a picture in TinyMCE editor?

tinyMCE. execCommand('mceInsertContent', false, '<img alt="Smiley face" height="42" width="42" src="' + sr + '"/>'); to insert the image in tinyMCE after extracting the URL from the image's src . Note that you need to pass the CSS style of the image to tinyMCE in the command.


1 Answers

This question solved this issue for me with tinymce 4

Tinymce editor image upload plugin add full image URL

    relative_urls: false,
remove_script_host: false
like image 116
ussher Avatar answered Nov 15 '22 18:11

ussher