Smart.Editor iFrame Mode

iFrame Editor

Smart.Editor's content section can be easily stylied or modifed via CSS or Javascript. However the Editor has an additional iframe mode which places the Editor's content inside an iframe which provides an isolated DOM that does not allow styles and scripts to leak in.

The iframe mode is not enabled by default. A property of type object called iframeSettings that configures the iframe mode with the following settings:

  • enabled - determines whether iframe mode is enabled or not.
  • attributes - an object that defines attributes for the iframe, for example:
    attributes: {
        height: 500
    }

    All native iframe attributes are supported.

  • resources - an object that determines what styles and scripts should be imported into the iframe's DOM. For example:
      resources: {
          'style': {
              href: 'styles.css'
            },
            'script': {
                src: 'index.js',
                type: 'module'
            }
        }

    The href and src attributes should point to the file location and name.

    The type attribute determines whether the JS file should be loaded as a module or not.