Skip to main content
Closed for Voting

Allow us to use HTML button tags in articles

Related products:Freshdesk
  • September 17, 2019
  • 3 replies
  • 42 views

Hi All,


I'm facing an issue in making articles where I want to make use of the HTML view inside of articles. Using this view you can directly add and remove the HTML used in your documents formatting.


However, when you use a <button> tag, it is removed upon saving or publishing.


I've already raised with support and it's marked as a feature request but who else has this need?


If you're wondering....why is this such a big deal then look below!


The main thing that's bugging me is that every time a user clicks an image in my articles, it opens in a new tab! 

This is so 2010 and it makes our portal look like old hack. I'd love to use "modal" classes in bootstrap to fix this so that an image is brought up of the top of my articles - like every other internet site - but am blocked because <button> tags don't work.


You also can't create forms and buttons do cool stuff in your articles really capturing your audience!


Let me know if you want this changing too!


3 replies

Forum|alt.badge.img+7
  • Community Manager
  • September 24, 2019

Hi Antony,


The following tags aren't supported in the HTML editor: <script>, <style>; form-related tags like <form>, <input>, <select> and event attributes like onclick, onmouseover as a security measure. Images showing up in a modal is a concept we’re thinking of as well. Thank you for your suggestions :)


Hi Antony Pain,


The main thing that's bugging me is that every time a user clicks an image in my articles, it opens in a new tab!


if you want to click any image and its open as popup you will be able to do it you can done only few things.


copy paste this css code in your support portal css part.

#myImg {
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}

#myImg:hover {opacity: 0.7;}

/* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}

/* Modal Content (image) */
.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
}

/* Caption of Modal Image */
#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}

/* Add Animation */
.modal-content, #caption {    
    -webkit-animation-name: zoom;
    -webkit-animation-duration: 0.6s;
    animation-name: zoom;
    animation-duration: 0.6s;
}

@-webkit-keyframes zoom {
    from {-webkit-transform:scale(0)} 
    to {-webkit-transform:scale(1)}
}

@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}

/* The Close Button */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
    .modal-content {
        width: 100%;
    }
}

copy paste this code in your footer bottom.

<script>
// Get the modal
var modal = document.getElementById('myModal');

// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById('myImg');
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption");
img.onclick = function(){
    modal.style.display = "block";
    modalImg.src = this.src;
    captionText.innerHTML = this.alt;
}

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on <span> (x), close the modal
span.onclick = function() { 
    modal.style.display = "none";
}
</script>

if you create any article so you need to add this code in your image

<img id="myImg" src="https://www.w3schools.com/howto/img_fjords.jpg" alt="Trolltunga, Norway" width="300" height="200">

<!-- The Modal -->
<div id="myModal" class="modal">
  <span class="close">&times;</span>
  <img class="modal-content" id="img01">
  <div id="caption"></div>
</div>


contact us:- info@helpdesktheme.com


our webiste:- Helpdesktheme


thanks

support team

(Experts in Freshdesk & Freshservice theme & plugin)




  • Author
  • Active Contributor
  • November 25, 2019

Hi,


In fact to get modal working I used fancybox instead as it was proving a pain.

https://fancyapps.com/fancybox/3/


Add the CDN in the header of your portal:

<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>

Add the following jQuery in the footer:

<script type='text/javascript'>
  jQuery("#article-body img").each(function () {
    if ( jQuery(this).hasClass("gallery") ) {
    jQuery(this).wrap(jQuery('<a/>', {
            href: jQuery(this).attr('src')
        }).attr('data-fancybox', 'gallery'));
        }
    else {
    jQuery(this).wrap(jQuery('<a/>', {
            href: jQuery(this).attr('src')
        }).attr('data-fancybox', ''));
        }
});
</script>


All images within your article now open nicely and not in a new tab!

image


AND as a bonus, if you add a class of "gallery" to any images in your article then you can can flick through them like a photo gallery.