Problems with several instances of xxeclient in same page

Carlos Villegas <[email protected]> Mon, 6 Oct 2025 17:55:52 +0900
Newsgroups gmane.editors.xxe.general
Message-ID <CAAQ46WYjzQ4NpQPjxb4xfWa2=eAzSmNBS6DGA=H2JxATOA_=nQ@mail.gmail.com>
--===============1034799601873551181==
Content-Type: multipart/alternative; boundary="00000000000008618b0640799fe2"

--00000000000008618b0640799fe2
Content-Type: text/plain; charset="UTF-8"

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

--00000000000008618b0640799fe2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;m trying to use several instances of the xxeclient=
=C2=A0in the same page and I&#39;m seeing &quot;cross talk&quot; between th=
e instances, well, what I mean, some CSS styles in the first instance chang=
e while I open the second instance, and then go back to what it was, when I=
 delete the second instance.<div><br></div><div>What I&#39;m trying to do i=
s to have my main editor in the page and open a second instance in an popup=
 dialog box, which is a component I&#39;m using from a 3rd party library, w=
hich I think just renders the dialog box over the page using a different zi=
ndex. In this second instance I open a different document that uses the sam=
e doctype and stylesheet, same XXE configuration, but in read only mode. Th=
e purpose is to select an element from this other document as an aid to cre=
ate a link. The popup doesn&#39;t cover the whole page so I can see part of=
 the main editor.=C2=A0</div><div>When I do this I see some styles in the m=
ain document change, for example, some title elements in my custom schema l=
ose their bold style=C2=A0and larger font size. When I close my popup windo=
w,=C2=A0 which deletes the=C2=A0second xxeclient=C2=A0instance, things go b=
ack to normal. I probably can live with this, but it&#39;s a bit confusing =
for the user, and I don&#39;t know if other internal things were also affec=
ted and mixed up between the instances.</div><div>=C2=A0</div><div>I tried =
to put my second instance in a shadowRoot to isolate the styles, but I had =
several problems, xxeclient&#39;s documentView running in the shadowRoot gi=
ves errors and it doesn&#39;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 runn=
ing in the shadowRoot. I did some changes to the xxeclient=C2=A0just to tes=
t 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 st=
yles in the other instance. Probably some styles are applied programmatical=
ly=C2=A0 globally and requires more effort to completely isolate the styles=
 in the instances. I&#39;m also wrapping the xxeclient in a React component=
 and creating 2 instances of this React component.=C2=A0 I don&#39;t know i=
f that is also part of the problem, but that just creates two instances of =
the xxeclient=C2=A0DOM element and the XMLEditor object.</div><div><br></di=
v><div>Any suggestions to have 2 completely separate xxeclient=C2=A0instanc=
es in the same page?=C2=A0</div><div><br></div><div>Another idea is to use =
an iframe to=C2=A0put the second instance, but iframes are also tricky espe=
cially in terms of security,=C2=A0sometimes they get restricted by the brow=
ser. But I&#39;ll give it a try next.</div><div><br></div><div>Carlos</div>=
<div><br><div><br></div></div></div>

--00000000000008618b0640799fe2--

--===============1034799601873551181==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


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

--===============1034799601873551181==--