Jump to content

TinyMCE (standard and Extended as per Vekia) stripping out the Href code in description


Recommended Posts

Hi guys

 

I need to insert the following code in the description of my products. It is a Call to Action button that contains a telephone number so that mobile users can simply press the button and call me.

 

The problem I have is that if I use the Editor (CKEditor) that is part of Store Commander (I use SC for my BO editing etc), it inserts the following code properly and everything works fine.

 

<p><a class="small button" href="tel:+61299731783"><img alt="" src="/img/cms/button(2).png" style="width:191px;height:47px;" /></a></p>

 

If I use the inbuilt TinyMCE editor of Prestashop (I extended it using Vekia's excellent tutorial (http://mypresta.eu/en/art/prestashop-16/extended-rich-text-editor.html) it is stripping out the "href" part of the code...

 

<p><a class="small button"><img alt="" src="../img/cms/button(2).png" style="width: 191px; height: 47px;" /></a></p>

 

If there a way to stop this happening???

 

Thanks

 

Regards

Greg

Edited by lateral (see edit history)
Link to comment
Share on other sites

Hi Vekia

 

This is the contents of my tinymce.inc.js file...it does not have a "valid_elements" section:

 

function tinySetup(config)
{
    if(!config)
        config = {};

    //var editor_selector = 'rte';
    //if (typeof config['editor_selector'] !== 'undefined')
        //var editor_selector = config['editor_selector'];
    if (typeof config['editor_selector'] != 'undefined')
        config['selector'] = '.'+config['editor_selector'];

//    safari,pagebreak,style,table,advimage,advlink,inlinepopups,media,contextmenu,paste,fullscreen,xhtmlxtras,preview
    default_config = {
        selector: ".rte" ,
        plugins : "colorpicker link image paste pagebreak table contextmenu filemanager table code media autoresize textcolor",
        toolbar1 : "code,|,bold,italic,underline,strikethrough,|,alignleft,aligncenter,alignright,alignfull,formatselect,|,blockquote,colorpicker,pasteword,|,bullist,numlist,|,outdent,indent,|,link,unlink,|,cleanup,|,media,image",
        toolbar2: "",
        external_filemanager_path: ad+"/filemanager/",
        filemanager_title: "File manager" ,
        external_plugins: { "filemanager" : ad+"/filemanager/plugin.min.js"},
        language: iso,
        skin: "prestashop",
        statusbar: false,
        relative_urls : false,
        convert_urls: false,
        extended_valid_elements : "em[class|name|id]",
        menu: {
            edit: {title: 'Edit', items: 'undo redo | cut copy paste | selectall'},
            insert: {title: 'Insert', items: 'media image link | pagebreak'},
            view: {title: 'View', items: 'visualaid'},
            format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
            table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
            tools: {title: 'Tools', items: 'code'}
        }

    }

    $.each(default_config, function(index, el)
    {
        if (config[index] === undefined )
            config[index] = el;
    });

    tinyMCE.init(config);

};

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

Nope, doesn't work. It isn't a TinyMCE problem, neither a JS problem. The default pass it trought with no problem.

 

The problems lie in the HTMLPurifier on the server side, tricky as hell. When an object with an HTML type field is passed to the database, it is Purified BEFORE. The purifier is not up to date in the last PS version (1.6.1.11 for the record), so it doesn't understand the "tel" uri scheme.

 

You need to update the HTMLPurifier located in the Tools directory.

 

https://www.prestashop.com/forums/topic/476763-add-a-link-tel123456789-in-cms/?p=2500535

 

Best regards,

Martin.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...