editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

pasteConfig with sanitizer config for tag as function is not working

Open mrigne opened this issue 3 years ago • 1 comments

Example - i want my embed video tool can handle this html: <p><iframe src="..."></iframe></p>

in pasteConfig i have specified

static get pasteConfig(): PasteConfig | boolean | undefined {
    return {
      tags: [{
        iframe: true,
        p: function(el){
          return el.firstElementChild?.tagName === 'IFRAME';
        }
      }],
    };
  }

My expectation is that only iframe or iframe in p tag will be handled by my tool, but currently all p tags event without iframe inside are passed to my tool (like p: true in config)

Expected behavior: Allow use all functionality of sanitizerconfig for pasteconfig

Device, Browser, OS: PC, Chrome, Ubuntu 22.04

Editor.js version: 2.27.0-rc.3

mrigne avatar Apr 10 '23 12:04 mrigne

Sorry, seen in docs that it is just for sanitizing. But would be a great idea to have abiliti configure pasteConfig for more specific cases like described

mrigne avatar Apr 10 '23 12:04 mrigne