Attaching editor on existing object

106 views
Skip to first unread message

Michael Tsikerdekis

unread,
May 10, 2021, 2:29:03 PM5/10/21
to Ajax.org Cloud9 Editor (Ace)
I am trying to attach the editor on an element that already has attached the editor.

Specifically, on overleaf, I am trying to attach using ace.edit from an extension's content script on the existing editor.

Content scripts and the main page live in isolated worlds so I cannot access directly the existing ace session. When I use ace.edit on the existing element, I get an error

 Watch out!
  We had to undo some of your collaborators changes before we could undo yours.
  Dismiss

I cannot tell if this is an ace editor issue or some other javascript code that generates this error.

If anyone has any other idea on how I can work around this issue please let me know.

Harutyun Amirjanyan

unread,
May 10, 2021, 2:33:41 PM5/10/21
to ace-d...@googlegroups.com
If you create a new editor you will break the page. There are ways to run script in page context https://stackoverflow.com/a/9517879 so the only solution is to use one of them and use the env variable added by ace to the dom element to access the existing editor and session.
--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ace-discuss/0efa51c6-5431-4620-955d-4a433ce7cacfn%40googlegroups.com.

Michael Tsikerdekis

unread,
May 10, 2021, 6:49:54 PM5/10/21
to Ajax.org Cloud9 Editor (Ace)
So basically, only through running a script to access the window variable. Btw, you did mention the env variable is added in the DOM. I have access to the document so would that work?

On Monday, May 10, 2021 at 11:33:41 AM UTC-7 amirj...@gmail.com wrote:
If you create a new editor you will break the page. There are ways to run script in page context https://stackoverflow.com/a/9517879 so the only solution is to use one of them and use the env variable added by ace to the dom element to access the existing editor and session.

On Monday, May 10, 2021, Michael Tsikerdekis <tsike...@gmail.com> wrote:
I am trying to attach the editor on an element that already has attached the editor.

Specifically, on overleaf, I am trying to attach using ace.edit from an extension's content script on the existing editor.

Content scripts and the main page live in isolated worlds so I cannot access directly the existing ace session. When I use ace.edit on the existing element, I get an error

 Watch out!
  We had to undo some of your collaborators changes before we could undo yours.
  Dismiss

I cannot tell if this is an ace editor issue or some other javascript code that generates this error.

If anyone has any other idea on how I can work around this issue please let me know.

--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss...@googlegroups.com.

Harutyun Amirjanyan

unread,
May 11, 2021, 4:07:11 AM5/11/21
to ace-d...@googlegroups.com
I think modified properties of dom objects are accessible only in the context where they were modified, so yes, the only way is to use a script in the page.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ace-discuss/cb97d35c-13ff-4c57-9c4b-7cf91a7f7ff2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages