I’ve added a custom editor block to NetlifyCMS to display a 2-cols layout with an image and some text. Everything was working fine on local dev until the editor stopped parsing correctly the block from the md file. As a consequence, the block is empty in the edit pane of the Editor, preventing editors from updating its content.
I’ve tried to simplify as much as possible the block to reproduce the issue as its core.
Here is the simplified content in the .md file:
Here is the regex in the editorComponent:
pattern: /^<TwoCols text="(\S+)">/g
The regex is working in Regex101: regex101: build, test, and debug regex
But the editor is not getting the capture group for the text prop. Instead it’s taking the whole match. Here the output of a console.log showing the parameter of fromBlock :
It should be something like:
["<TwoCols text="Test">", "Test"]
This is driving me nuts, because everything was working fine until I tried to add a new field in my custom block. I’ve tried to roll back to my previous code, then restart everything (gatsby server and netlify-cms-proxy-server) and delete node_modules, to no avail. I don’t understand…
I’m using these versions:
- “netlify-cms-app”: “^2.15.1”
- “gatsby-plugin-netlify-cms”: “^4.0.0”,
- “gatsby”: “^2.25.0”,