Search code examples
callbacktinymceimageurl

Tinymce | how do I remove two point from the source path


I use Tinymce, I have two dots at the beginning of the url when I insert an image file, how can this be removed.Beacause

The project has been seamlessly integrated into the target file,

I register the HTML result in the database

I am undoing the record but there is a double dot in the image source

I need to remove double

how do I make that change img src="../Content/Images/Upload" > img src="/Content/Images/Upload"

  tinymce.init({
    selector: '#HTML',
    height: 500,
    menubar: false,
    plugins: [
        'advlist autolink lists link image charmap print preview anchor textcolor',
        'searchreplace visualblocks code fullscreen',
        'insertdatetime media table contextmenu paste code help'
    ],
    toolbar: 'insert | undo redo |  formatselect fontsizeselect | fontselect  bold italic backcolor forecolor  | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help | link image code',
    font_formats: "Andale Mono=andale mono, times;" +
    "Arial=arial,helvetica,sans-serif;" +
    "Arial Black=arial black,avant garde;" +
    "Book Antiqua=book antiqua,palatino;" +
    "Comic Sans MS=comic sans ms,sans-serif;" +
    "Courier New=courier new,courier;" +
    "Georgia=georgia,palatino;" +
    "Helvetica=helvetica;" +
    "Impact=impact,chicago;" +
    "Symbol=symbol;" +
    "Tahoma=tahoma,arial,helvetica,sans-serif;" +
    "Terminal=terminal,monaco;" +
    "Times New Roman=times new roman,times;" +
    "Trebuchet MS=trebuchet ms,geneva;" +
    "Verdana=verdana,geneva;" +
    "Webdings=webdings;" +
    "Wingdings=wingdings,zapf dingbats",

    fontsize_formats: '8pt 10pt 12pt 14pt 18pt 24pt 36pt 72pt',


    content_css: [
        '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
        '//www.tinymce.com/css/codepen.min.css'],
    paste_data_images: true,
    images_upload_url: '/UploadImage',
    images_upload_base_path: '/Upload',

    language: 'tr',

});

Solution

  • TinyMCE has a variety of configuration options to deal with URLs and how they are processed. Take a look at the following:

    https://www.tinymce.com/docs/configure/url-handling/

    ...and specifically the following on that page:

    The last of those (urlconverter_callback) allows you to implement your own logic if TinyMCE's built in options don't solve your issue.