json-editor icon indicating copy to clipboard operation
json-editor copied to clipboard

headerTemplate HTML doesn't update again after first html code

Open minideezel opened this issue 3 years ago • 0 comments

General information

When using headerTemplate and DOMPurify to render html from source of another input, the html will only render once and then will not update again with further input changes.

  • json-editor version: 2.6.0

Expected behavior

Changes to the watched input should be re-rendered in the template title.

Actual behavior

The input will work fine for text updating, then I put in html and it renders fine, then further html or text changes in that input are no longer updated in the template.

Steps to reproduce the behavior

  1. Make sure DOMPurify library is loaded
  2. put in text value in iconHTML, see that it is updated in iconRender
  3. put in html (ex. <button>TestButton</button>) in iconHTML, see that it is rendered in iconRender
  4. change iconHTML to anything else (html or not), see that the iconRender does not change.

schema: {
  title: "HTML Example",
  type: "object",
  properties: {
    iconHTML: {
        title: "HTML Input",
        type: "string",
    },
    iconRender: {
        title: "Icon Preview",
        watch: {
            "html": "iconHTML"
        },
        headerTemplate: "{{html}}",
        type: "info",
    }
  }
}

minideezel avatar Oct 26 '21 16:10 minideezel