tinymce: replace <img> tags on submit
Don't know if this is possible.
I'm using tinymce as a text editor and I want to allow user insert images. I achieved this, and tinymce inserts a tag with the proper src attribute.
The problem will come if later, I decide to change the path of the image or change its name, the text will still point to old location.
So I was wondering if tinymce can be configured to instead of generating a tag generate some kind of mark (as the ) so would let me relate it to a register in database and replace it by a tag image in server side.
This is easy too, what is not easy is to have both solutions running simultaneously: sh开发者_如何学编程ow the user the tag (while he/she is editing) but submiting to the server the "mark". Would tinymce support this?
I don't know if this exactly answers your question but you can set a callback on submit function in TinyMCE (usually used to make Tiny an AJAX editor) But you could grab the data with the callback and modify it
tinyMCE.init({
selector: "textarea",
valid_elements : '*[*]'
})
Use valid_elements field in configuration to allow tags.You can use specific tag too. Currently every tags are allowed in above configuration.
精彩评论