TinyMCE: delete ../ by images link - tinymce

I use TinyMCE Version 2.1 for my panel.
Sorry, how can I remove from the links of the images this symbol "../"?
<img src="../images/nameimage.jpg"...>
I would like these links:
<img src="https://www.site.it/images/nameimage.jpg"...>
and NO this link:
<img src="../images/nameimage.jpg"...>
Thanks a lot ;)
Alexander

Try this code in your init function
tinymce.init({
relative_urls : false,
remove_script_host : false,
convert_urls : true,
});

There are several configuration options that allow you to adjust how TinyMCE handles URLs:
https://www.tiny.cloud/docs-4x/configure/url-handling/

Related

TinyMCE deletes some <a> tags. Settings ignored

I've been trying to force TinyMCE to not delete my a tags with every setting that is available and have had no luck (also looked at 20+ posts here - most being over a decade old and no working solutions). I'm just going to post what I try to put into the editor and what it removes (along with every setting I've tried).
What the markup should look like:
<a href="#" class="hearmorelink" onclick="window.open('/Mini-Lots-audio.html', 'Voice Over', 'width=320,height=1,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');return false;">
<div>Want to hear more?<span style="margin-top: 60px;">CLICK HERE</span></div>
</a>
what tinyMCE does to it:
<div>Want to hear more?<span style="margin-top: 60px;">CLICK HERE</span></div>
Maybe not the prettiest HTML ever, but why does it disallow wrapping anything inside an A tag when it's perfectly acceptable HTML5 as per the RFC?
apply_source_formatting: false,
verify_html: false,
trim_span_elements: false,
cleanup: false,
convert_urls: false,
cleanup_on_startup: false,
force_br_newlines: true,
force_p_newlines: false,
allow_script_urls: true,
forced_root_block: false,
valid_elements: '+*[*]',
plugins: [
"advlist autolink autoresize directionality lists link image charmap preview anchor",
"searchreplace visualblocks code fullscreen textcolor",
"insertdatetime media table contextmenu paste"
],
All the settings seem to be working, but this problem still persists. Because this is needed for 50 or so pages and the HTML is stored and retrieved from a database, I can't hard-code anything in (also - non-HTML people/admins need to use this too).
I am not sure how I can make this work (and, yes, it MUST be a popup so the audio can play while people visit from page to page). Would a plugin help here?
okay - after doing a few more tweaks, I've found that TinyMCE is stuck in HTML4 (which does not allow block elements inside A tags). HTML5 supports DIV tags inside A tags.
I'll just change the markup and tweak the span tag to display like a block with CSS.

TINYMCE - How to turn off all auto replacements?

Is there any way to turn off all auto replacements in TINYMCE ?
Its replacing my <b> tags to <strong> and a
full url such as <a href="http://example.com" is getting turned into <a href="../example.com"
and so on.
I tried to use those 3:
extended_valid_elements : '*[*]',
cleanup : false,
verify_html : false
No luck so far.
If you want <b> and <i> tags instead of <strong> and <em> you can use this setting in your TinyMCE configuration:
extended_valid_elements: "b/strong,i/em", //force strong-->b and em-->i
TinyMCE also has a variety of options for managing URLs:
https://www.tiny.cloud/docs/configure/url-handling/
You should look at those options to see how they can help address your URL issue.

Ajax File Managerv Tinymce: How to change relative image url to absolute image in editor

I'm using TinyMCE with Ajax File Manager extension (http://www.phpletter.com/demo/tinymce-ajax-file-manager/).
All shows up fine, but when I go through the image button to upload and add an image to my WSYIWYG field, the image path look like
<img src="../../../images/hero.jpg" alt="" />
What I need to be getting is the following:
<img src="http://localhost/image/hero.jpg" alt="" />
what you need to change the "relative_urls : true" to "relative_urls : false" in tinyMCE.init
tinyMCE.init({
relative_urls : false,
});

How to integrate TinyMCE is Struts application

Can some one please explain how to do integrate TinyMCE in Struts application?
1.I have downloaded the tinyMCE
2.I added tiny_mce.js in my java script folder.
3. In my jsp , I added this line
< SCRIPT LANGUAGE="JavaScript" SRC="jsp/js/tiny_mce.js">
I have just one text area named "contactComments"
I still don't see rich text box.
Ps: Do I need to place entire tinymce folder in to my Javascript folder in the project setting?
I only put timy_mce.js
It should be something like:
<SCRIPT LANGUAGE="JavaScript" SRC="jsp/js/tiny_mce.js">
<SCRIPT LANGUAGE="JavaScript" SRC="jsp/js/tiny_mce_config.js">
And then you use the config file to specify the preferences of TinyMCE for that page. If you want TinyMCE to replace any textbox, you need the preference:
mode : "textareas",
My entire config for example is:
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "table,paste,fullscreen",
relative_urls : true,
convert_urls : false,
// So we can put the google maps in the page
extended_valid_elements : "iframe[src|width|height|name|align]",
// Theme options
theme_advanced_buttons1 : "code,|,cut,copy,pastetext,|,link,unlink,anchor,image,charmap,|,fullscreen",
theme_advanced_buttons2 : "bold, italic, underline,|, bullist, numlist,|,outdent,indent,|,formatselect",
theme_advanced_buttons3 : "tablecontrols",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left"
});
I think you should read the TinyMCE documentation a bit more carefully, this is all explained.

tinyMCE - source code editing in a textarea

I'm playing around with MCE, I was wondering if there was the possibility of letting the user enter source code into a post, much like the 101010 button in this form.
You'll need to add plugins: "code" to the initialization code as follows:
tinymce.init({
plugins: "code"
});
https://www.tinymce.com/docs/plugins/code/
The option exists. One of the optional buttons has 'html' written on it and can be used to go into HTML editing mode. You can see it in this full featured example - 6 places left of the top-right corner.
Try 'code' plugin along with tinymce.min.js
e.g.
<script src="~/Scripts/tinymce/tinymce.min.js"></script>
<script src="~/Scripts/tinymce/plugins/code/plugin.min.js"></script>
<script>
tinymce.init({
selector: 'textarea',
plugins: "code",
toolbar: "code" });
</script>