`enabled={false}` on `<Editor/>` does not take effect if `json` prop is set to `<Frame/>`
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Released in v0.2.0-beta.4 🎉
Thank you!