iFrame is always stripped out

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1606

    iFrame is always stripped out

    When I try to use an iFrame in WYSIWYG Editor, the tag ist stripped out, no matter how I try to implement it. How can I use an iFrame in espoCRM?
  • Kyle
    Senior Member
    • May 2020
    • 143

    #2
    Hi,
    It is not easy to override this I have had a look and its probably more work than its worth. I suggest creating a new field type to implement iFrame, you could even implement a new HTML field type that takes raw HTML. I have done this as a dashlet and there should be no barrier to doing it as a field.

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1606

      #3
      Hello, I have been thinking in using a dashlet, too. Could you provide your solution? I am not a programmer and I think it would help to learn something.

      Comment

      • Kyle
        Senior Member
        • May 2020
        • 143

        #4
        Hi,

        Here are the main pieces just use the how to create a dashlet help file here to build this out fully: https://docs.espocrm.com/development...ate-a-dashlet/

        Dashlet def: Resources/metadata/dashlets/html.json
        PHP Code:
        {
            "view": "custom:views/dashlets/html",
            "options": {
                "fields": {
                    "title": {
                        "type": "varchar",
                        "trim": true
                    },
                    "html": {
                        "type": "text",
                        "required": true,
                        "tooltip": true
                    }
                },
                "layout": [
                    {
                        "rows": [
                            [
                                {
                                    "name": "title"
                                }
                            ],
                            [
                                {
                                    "name": "html"
                                }
                            ]
                        ]
                    }
                ]
            }
        } 
        
        The view file:
        PHP Code:
        
        define('custom:views/dashlets/html', 'views/dashlets/abstract/base', function (Dep) {
            return Dep.extend({
                name: 'Html',
                templateContent: '<div></div>',
                afterRender: function () {
                    var $div = this.$el.find('div');
                    var html = this.getOption('html');
                    if (html) {
                        $div.html(html);
                    }
                    this.$el.addClass('no-padding');
                    this.$el.css('overflow', 'auto');
                    $div.css('width', '100%');
                },
                afterAdding: function () {
                    this.getParentView().actionOptions();
                },
            });
        }); 
        

        Comment

        Working...