On 11/27/24 05:03, Carlos Villegas wrote:

But in the general case, I would need some interactive functionality on the client side.

Sure. Quite understandable.



Is there a way to provide access to the document element tree and receive document element events on the Javascript side?

No. The "Javascript side" is just the View/Controller[*] and has no direct access to the document/element/node tree, the Model[*], which is found in xxeserver, the back-end.

Available document events, see https://www.xmlmind.com/xmleditor/_web/doc/apidoc/XMLEditorEvent.html ,

XMLEditorEvent
DocumentOpenedEvent
DocumentSavedEvent
DocumentViewChangedEvent
EditingContextChangedEvent
etc

may be received by a client of yours integrating <xxe-client> by the means of standard JavaScript API addEventListener. Excerpts from our XMLEditorApp.js, the sample XML editor application included in the XMLmind XML Editor Web Edition distributions:

---
            this._xmlEditor = xxe;
            xxe.resourceStorage = new LocalFiles(xxe);
xxe.addEventListener("connected", this.onConnected.bind(this));
            xxe.addEventListener("disconnected",
                                 this.onDisconnected.bind(this));
            const docOpenedHandler = this.onDocumentOpened.bind(this);
            xxe.addEventListener("documentCreated", docOpenedHandler);
            xxe.addEventListener("documentOpened", docOpenedHandler);
            xxe.addEventListener("documentRecovered", docOpenedHandler);
            xxe.addEventListener("documentSavedAs",
                                 this.onDocumentSavedAs.bind(this));
            xxe.addEventListener("documentClosed",
                                 this.onDocumentClosed.bind(this));
            xxe.addEventListener("saveStateChanged",
                                 this.onSaveStateChanged.bind(this));
            xxe.addEventListener("readOnlyStateChanged",
                                this.onReadOnlyStateChanged.bind(this));
---


Or some way for the client to communicate with a custom Java extension in the backend?

May be there is a misunderstanding here.

In our mind, it's up to you
1) to develop *your* client,
2) to make *your* client communicate with *your* backend.

- xxeserver, our XML editor backend, is meant to run side by side with your backend (or even your multiple backends). See https://www.xmlmind.com/xmleditor/_web/doc/manual/xxeserver_reference.html#xxeserver_reference

- <xxe-app>, the sample XML editor application included in the XMLmind XML Editor Web Edition distributions is just that, a *sample* XML editor application, and as such, cannot be used as the client in any advanced use case. See https://www.xmlmind.com/xmleditor/_web/doc/manual/xxe-app_reference.html#xxe-app_reference

- <xxe-client> is a "WYSIWYG" XML editor *component* just like TinyMCE (https://www.tiny.cloud/) or CKEditor (https://ckeditor.com/) are WYSIWYG HTML editor components.

The main difference with TinyMCE or CKEditor is that <xxe-client> is not self-contained and needs xxeserver, the backend, to perform its tasks. Hence <xxe-client> communicates exclusively with xxeserver through a WebSocket. Making <xxe-client> communicate with the backends of our customers would simply not make sense.

<xxe-client> is meant to be integrated in a larger Web application developed by our customers. See https://www.xmlmind.com/xmleditor/_web/doc/manual/xxe-client_reference.html#xxe-client_reference

Here is an example of a Web application using <xxe-client> and which is totally different from <xxe-app>:

https://www.xmlmind.com/xmleditor/_web/demo/newsapp.html

More information: https://www.xmlmind.com/xmleditor/_web/doc/manual/integration_demo.html#integration_demo



If not now, is this or something similar planned for the future?


No, not at all, mainly because we don't understand your needs. It would help if you could give us examples of what you would like to implement.




---
[*] MVC, Model View Controller, https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to