I'm trying to use several instances of the xxeclient in the same page and
I'm seeing "cross talk" between the instances, well, what I mean, some CSS
styles in the first instance change while I open the second instance, and
then go back to what it was, when I delete the second instance.

What I'm trying to do is to have my main editor in the page and open a
second instance in an popup dialog box, which is a component I'm using from
a 3rd party library, which I think just renders the dialog box over the
page using a different zindex. In this second instance I open a different
document that uses the same doctype and stylesheet, same XXE configuration,
but in read only mode. The purpose is to select an element from this other
document as an aid to create a link. The popup doesn't cover the whole page
so I can see part of the main editor.
When I do this I see some styles in the main document change, for example,
some title elements in my custom schema lose their bold style and larger
font size. When I close my popup window,  which deletes the second
xxeclient instance, things go back to normal. I probably can live with
this, but it's a bit confusing for the user, and I don't know if other
internal things were also affected and mixed up between the instances.

I tried to put my second instance in a shadowRoot to isolate the styles,
but I had several problems, xxeclient's documentView running in the
shadowRoot gives errors and it doesn't find node views. I traced some of
the issues, for example, _domTree iin DocumentView s initialized to be the
global DOM document object which is disconnected from the xxeclient DOM
tree when running in the shadowRoot. I did some changes to the
xxeclient just to test if it would work, and I got it partially working,
enough to see that even in the shadowRoot, my original problem still
persists, it still affects styles in the other instance. Probably some
styles are applied programmatically  globally and requires more effort to
completely isolate the styles in the instances. I'm also wrapping the
xxeclient in a React component and creating 2 instances of this React
component.  I don't know if that is also part of the problem, but that just
creates two instances of the xxeclient DOM element and the XMLEditor object.

Any suggestions to have 2 completely separate xxeclient instances in the
same page?

Another idea is to use an iframe to put the second instance, but iframes
are also tricky especially in terms of security, sometimes they get
restricted by the browser. But I'll give it a try next.

Carlos
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to