﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
11472	Detection & initialisation of widgets in foreign injection of HTML	xmo		"I'm currently working on a system where the RTE is only part of the whole, and thus some tools interacting with the RTE are (mostly) independent from and unaware of the RTE.

For the most part things work great, but an issue I've encountered is when one of these separate components adds a DOM subtree without the RTE's root  *and* that subtree contains potential widgets.

As far as I understand the code, part of the widget processing pipeline (the detection of widget candidates via upcast calls and the creation of the wrapper) is performed during data processing, and the activation of the detected & wrapped widgets is a second step (performed via `repository#initOnAll()`. As a result, to get widgets to be detected in foreign-injected HTML my process is currently:
{{{
el.outerHTML = editor.dataProcessor.toHtml(el.outerHTML);

editor.widgets.initOnAll();
}}}
This *seems* to work correctly, but
1. I'm uncertain this is the right way to do it (if there's any such thing as a ""the right way"" to do this at the moment)
2. if any of the foreign (aka non-cke-aware) components added non-DOM data (e.g. event handlers, attributes on DOM nodes) it would be lost by the serialization-processing-deserialization (currently not the case for me)

Thus it would be nice if there were a blessed API through which one could tell the widgets plugin/repository ""here's a DOM subtree (DOM element), find out if there's any widget in it and initialise them in-place""."	New Feature	closed	Normal		UI : Widgets		invalid		
