question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`enabled={false}` on `<Editor/>` does not take effect if `json` prop is set to `<Frame/>`

See original GitHub issue

Describe the bug This issue is similar to #373, but a little bit different.

enabled={false} prop on <Editor/> is working fine if there is no prop like json or data set on <Frame/>.

But things started to break if preloaded data is set to <Frame/> through json or data prop, any immediet elements inside <Element canvas/> can be dragable regardless of enabled prop on <Editor/>

Expected behavior There shouldn’t be anything dragable if enabled={false} and whether preloaded data is set or not.

My unsuccessful workarounds I tried using the following pieces of code but the issue still persists.

// force disabling editor on ComponentDidMount doesn't fix the issue
useEffect(()=>{
  actions.setOptions((options) => (options.enabled = false));
}, []);

or

// may be turning it on and off again can fix the issue but nothing fixed
useEffect(()=>{
  actions.setOptions((options) => (options.enabled = true));
  actions.setOptions((options) => (options.enabled = false));
}, []);

or

// force disabling dragable area doesn't fix the issue, immediet nodes can still be dragable
const { enabled } = useEditor(state => ({ enabled: state.options.enabled })); // when enabled is false
<Element canvas={enabled}>

Your environment

Software Version(s)
craft.js 0.2.0-beta.3
React 16.8.0
TypeScript -
Browser Chrome 99.0.4844.74 (Official Build) (64-bit)
npm/Yarn 8.5.0
Operating System Ubuntu 18.04

Thank you for making this amazing tool anyway. I appreciate your time.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
prevwongcommented, Apr 21, 2022

Released in v0.2.0-beta.4 🎉

0reactions
aptarmycommented, Apr 22, 2022

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON editing in Visual Studio Code
Edit JSON files in Visual Studio Code. ... JSON files can get large and we support quick navigation to properties using the Go...
Read more >
Project Config with vercel.json
A complete reference for Vercel project configurations using vercel.json.
Read more >
Advanced security options — Dataiku DSS 11 documentation
Edit the DATADIR/config/general-settings.json file. Locate the "security" top-level key in the JSON file. If it does not exist, create it as an empty...
Read more >
Using the JSON format in AWS Glue
If your data is stored or transported in the JSON data format, this document introduces you to available features for using your data...
Read more >
JSON Editor - GitHub
If true , JSON Editor will load external URLs in $ref via ajax. false. ajaxBase, Allows schema references to work either with or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found