Remote storagemanager not working
Question
Hello,
For 2 days I am fighting with the storageManager. I couldn't load template from remote file. Finaly I discovered that it is working only when I load grapesjs from https://unpkg.com/grapesjs. If I triy to load grapesjs from any min.js or dev dist files remote template load is not working. It is also working with the grapes.min.js file from dev dist folder but only if I rename the file to grapes.js. If I try to load it as grapes.min.js it is not working.
Answers (3)
I figured out what is going on. If you set contentTypeJson "true" the load is working but the store is not because it is trying to send json data as POST data and server didn't parse it. If you set contentTypeJson "false" load is not working because it is in json format but then store is working. I modified grapes.min.js by removing 'this.get("contentTypeJson")&&' from onResponse function and setting contentTypeJson:!1 on both places in the file. Now everything works perfectly.
server didn't parse it
The server should take the POST content from the body of the HTTP request
I fixed it by modifying this row: var res = parsable ? JSON.parse(text) : text;
If I set contentTypeJson to false it couldn't load template because it is JSON type but can store the data. If I set contentTypeJson to true then it reads the template but then send POST data as json, php didn't parse it and I receive an empty POST. So I set it to false and modified the upper row so It always parse the template as JSON.
On Wed, Feb 6, 2019 at 2:00 AM Artur Arseniev [email protected] wrote:
server didn't parse it
The server should take the POST content from the body of the HTTP request
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/artf/grapesjs/issues/1757#issuecomment-460853012, or mute the thread https://github.com/notifications/unsubscribe-auth/As8MgGqcih3yWxSeQurFlgZ9JC-lpMAXks5vKhsRgaJpZM4aWxH9 .
Related Questions and Answers
Continue research with similar issue discussions.
Issue #441
Ignore/avoid changeCount
Due to https://github.com/artf/grapesjs/issues/436, I cannot rely on StorageManager's Remote Load method to load a template from a REST end...
Issue #1700
Grapesjs-react
how to load an html file while starting the GrapesJs-react- editor I tried in this way but it is not working, editor.StorageManager.add('lo...
Issue #444
How to load css link into the head tag?
Hello, First of all, thanks for contributing such an amazing js framework. I am very new to grapesjs. And github too. https://github.com/ar...
Issue #1686
CMS: Grapesjs is not defined
I am trying to use basic Grapesjs editor to CMS. Here's my code: I have installed the grapesjs using NPM. Later I tried running this html f...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.