Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: deleteUrl is not defined? #387

Open
arievanden opened this issue Oct 22, 2024 · 2 comments
Open

ReferenceError: deleteUrl is not defined? #387

arievanden opened this issue Oct 22, 2024 · 2 comments

Comments

@arievanden
Copy link

The editor is working great. I do have a problem with the calls for delete, rename, etc.

deleteUrl seems to be declared from editor.html

let deleteUrl = 'save.php?action=delete';

but from builder.js, it returns: ReferenceError: deleteUrl is not defined. What am I missing?

deletePage: function(element, e) {
...
fetch(deleteUrl, { method: "POST", body: new URLSearchParams({file:page.file}) })
.then((response) => {
if (!response.ok) { return Promise.reject(response); }
return response.text()
})

@givanz
Copy link
Owner

givanz commented Oct 24, 2024

I'm unable to reproduce this bug.

Can you please check if there is another js error before this one that might invalidate `let deleteUrl' declaration?

Can you also check on demo https://www.vvveb.com/vvvebjs/editor.html to rule out any browser issues?

@arievanden
Copy link
Author

I'm calling the libs from Yii2, and after testing it seems that $this->registerJs() breaks the variables. Not sure how, but it does. Tried different registerJs() params with the same result. The solution is to just use <script> tags and it works just fine. There's probably a rather elaborate way to make this work the "proper" way, but for now this works. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants