I use the code below to create a new file and show it in the editor. There are two issues:
1.) Using onAppReady does not work unless its called using setTimeout with abt 1 second delay .
I reported this as a bug in github. ( getHashSettings hangs forever)
2.) initManager shows the default page with rooms etc. I do not want this to show, the user should be directed right to the new file. I tried to use initSystem but then it says getHashSettings is invalid.
The mode is set to system, this seems to do nothing ! Still shows the default screen. If I use initEditor i get a blank screen with no errors.
Firstly, please let me know version of DocSpace that is being used. Also, please elaborate on your usage scenario – do I understand that you are embedding an editor into your own application?
I am using version 1.0.1 and yes I am embedding the UI in my webpage.
My posted code was not 100% correct, I use also await on the create createHash method. But as mentioned, when I am not using the setTimeout, the getHashSettings method will never resolve its promise and hangs.
var hashSettings = await docSpaceManager.getHashSettings();
const passwordHash = await docSpaceManager.createHash(....
As I can see, DocSpace is also used as a storage for your files. Are you uploading files to DocSpace manually from your device or from another cloud storage?
I got this working, but there IS a bug in your code. You “onReady” event fires altought it is NOT ready.
Only if I add a timeout it works, otherwise createHash hangs forwever
async function onAppReadWithTimeout() {
try {
setTimeout(async () => {
var hashSettings = await docSpaceManager.getHashSettings();
const passwordHash = await docSpaceManager.createHash(password, hashSettings);
await docSpaceManager.login(userName, passwordHash);
console.log("Logged in for frame:" + frameId);
resolve();
}, 500);
}
catch (err) {
alert(`Error on login into docspace: ${err}`);
}
}
Version 1.1 of DocSpace was released back in 2021. I recommend updating it to the latest version 3.2.1 and see if the situation is resolved for your particular case.