Could not resolve view with name /documenteditor/main/index.html

Hi,
I’m doing something wrong but i can’t figure it out. Can you help me?
i have a problem with onlyoffice (installed in docker) and alfresco (installed locally).
I have no problem editing the files from alfresco share (the “edit in only office” works well and either the options are well formed, i can regularly edit the documents in this way from the share page). I have no problem with the onlyoffice example too.
I have a problem with a custom view (javascript e html) where i want to show the onlyoffice editor.
The steps that i’m doing are:

  1. first i’m doing the prepare
    $.getJSON(URL+“parashift/onlyoffice/prepare?nodeRef=workspace://SpacesStore/ECC&alf_ticket=TICKET_ECC”)
    and this WORKS, i have the response with all the info that i need;
  2. then i do this where res is the response from the prepare and testplaceholder is my html element where i want to show the onlyoffice editor
    $.getScript(“http://localhost/web-apps/apps/api/documents/api.js”, function(){
    new DocsAPI.DocEditor(“testplaceholder”, res
    );});

if i go to the url http://localhost/web-apps/apps/api/documents/api.js i can see the api so this is correct, the problem is in in the DocEditor at the line
target.parentNode && target.parentNode.replaceChild(iframe, target);
and then my alfresco says
Could not resolve view with name /documenteditor/main/index.html

Hello @Ghug

I have a problem with a custom view (javascript e html) where i want to show the onlyoffice editor.

Please provide us with details on your desired goal. What exactly do you want to achieve? View mode of a file or something else? You can make screenshots or draw a scheme with your description.

Hi,
the problem was that the getScript did not load the script in time so the docsapi was not found. I solved this with

                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = res.onlyofficeUrl + '/web-apps/apps/api/documents/api.js';
                script.onload = function () {
                    new DocsAPI.DocEditor("testplaceholder", res.editorConfig);
                };
                document.getElementsByTagName('head')[0].appendChild(script);

Thank you by the way!

2 Likes

We are glad that you have managed the situation. Please feel free to contact us if you face any issues.