surveyjs / surveyjs_angular_cli

SurveyJS + Angular CLI Quickstart Template
http://surveyjs.io/
41 stars 52 forks source link

continuousNodeArray is undefined #9

Open mkgn opened 6 years ago

mkgn commented 6 years ago

I am trying out the latest surveyjs with (Angluar 5, aspnet.core in Aspnetboilerplate template). Below are few issues that pops up which I think is not related to the integration with aspnetboilerplate.

1) When I navigate to the route with the component it loads the editor but in console it says: "unable to process binding "template: function(){return { name:'objecteditorproperty',afterRender:$parent.koAfterRender} }" window.CKEDITOR is undefined. So this may be because of missing CKEditor? is it a must to have CKEditor?

2) I add a control to the designer and click the delete button and the console gives the below error "TypeError: continuousNodeArray is undefined"

3) when you play around with control options the console logs "TypeError: this.koSelectedObject(...)" // I have knockout 3.4

Basically these were the main errors i encountered. Because of this I couldn't test other features since they don't work.

tsv2013 commented 6 years ago

It's hard to say what caused this errors without a code. CKEDITOR it not necessary for SurveyJS Editor. If you took code from this repo, the CKEDITOR is included here as a part of custom widgets demo.

mkgn commented 6 years ago

Well, removing the questions seems to be the only thing that doesn't work. The stack trace is attached. surveyjs-error.txt

Any insight to troubleshoot will be much appreciated.

tsv2013 commented 6 years ago

In this stack I found editor code that executes ok on our site in the editor (https://surveyjs.io/Survey/Builder/). But on our site it is not wrapped with Angular. Can you provide a working sample to investigate?

mkgn commented 6 years ago

Ok got it fixed. Nothing wrong with your code or mine. Just changed some configurations.

1) commented out registering the ck-editor. //SurveyEditor.SurveyPropertyModalEditor.registerCustomWidget("html", CkEditor_ModalEditor ); This is because I don't have the ckeditor plugin at this moment. This solved: "TypeError: continuousNodeArray is undefined" & "TypeError: this.koSelectedObject(...)" errors. Now I can delete questions from the canvas!!! Werid how things break!

2)Then i got TypeError: jsonObj.pos is undefined error and for that I commented out //this.editor.text = JSON.stringify(this.json); since I don't have a default json for a form.

Only thing that doesn't work now is : this.editor.saveSurveyFunc = this.saveMySurvey; this doesn't seem to call the method. As I understand this should fire when user press [complete] button right? When testing the survey, the [complete] button just take me to "Thank you for completing the survey!" message.

mkgn commented 6 years ago

The problem of saving is that the method signature should be; saveMySurvey = (saveNo, callback) => { console.log(JSON.stringify(this.editor.text)); //this.surveySaved.emit(JSON.parse(this.editor.text)); };

If you have; saveMySurvey = () => { console.log(JSON.stringify(this.editor.text)); //this.surveySaved.emit(JSON.parse(this.editor.text)); };

it doesn't work.

tsv2013 commented 6 years ago

@mkgn I'm doubt a method signature affects method call. I beleive the real cause is another.

mkgn commented 6 years ago

There is another strange behavior( I feel) which I cannot explain. If you want you can try it and see whether it happens to you as well.

In survey.editor.component.ts file in the ngOnInit(){

    this.editor.saveSurveyFunc = this.saveMySurvey;
    //this.editor.isAutoSave = true; //move this line above saveSurveyFunc and it won't show the [save] button

}

As I have commented above, if you move that line before saveSurveyFunc() it won't show the save() button. I was scratching my head for sometime.