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

How to delete non-required object over UI? #1167

Closed
Krivich opened this issue May 26, 2022 · 3 comments
Closed

How to delete non-required object over UI? #1167

Krivich opened this issue May 26, 2022 · 3 comments

Comments

@Krivich
Copy link
Contributor

Krivich commented May 26, 2022

General information

I'm using json-editor for editing my landing page config: create config; turn on/off section, edit fields in existing config.

export interface LandingBanner {
     id: number|string;
     text: string;
     starText?: string;
 }

 export interface LandingConfig {
  meta: {
      keywords: string;
      description: string;
      title: string
  };
  banner?: LandingBanner
  introduce: {
      motto?: string;
      multiMotto?: MultiMoto;
      description: string;
      authorizedAction: LandingAction;
      unauthorizedAction: LandingAction;
      subscribeHtml?: string;
      shareLink?: string
  };
  benefits?: {
      title?: string;
      items?: LandingBenefit[];
  }

There are two problems in usage of json-editor as composite objects editor:

  1. Add non-required field/object to existing object. I'm using my PR to be able to do that: Option for editing of undefined non-required fields (bug with tables of objects) #980

  2. How to completely delete non-required object from existing object? Is it possible to show "Delete" button to let used kill complete branch? For example, if user wants to delete optional banner from the example above.

I have idea to wrap optional objects with array where 0-1 items are allowed to use array's Delete button. But it will will bring rubbish into editable data model.

  • json-editor version: 2.8.0

Expected behavior

"Delete" button in the header of the non-required object.

Actual behavior

No such button.

Steps to reproduce the behavior

Direct link to example: https://json-editor.github.io/json-editor/?data=N4Ig9gDgLglmB2BnEAuUMDGCA2MBGqIAZglAIYDuApomALZUCsIANOHgFZUZQD62ZAJ5gArlELwwAJzplsrEIgwALKrNShYUbFUIAZMvAAmMeAHMFUQRF0p2XHgsiwEyNIuVgKvSfF5SqAEcRGACjXioTKGk3KCkRKjYTRDI8HV4sbAEIRFsiOVyAXzYA4NDI1ABtEAZyBVM4sCMRDF0AXTYIKUgqKVgaDRAYI0GrGwkROjxeyxhtWxAASQARJ2g4JEHlYaMqeFQ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udv9twt8ll8Db8llEtYNcs1B0t5hMsyDgtUlgBUt8tstCtis2BRdxcBUwBo9Y9Z8FB59xM18qgZM5DpMuD7M79RBoVTY8AmZb9j81CoANCtDihX9CATM49wCYA49DDlCFg5Anxb8dA+hmDk87BWC0sBRODkDnDeC8sCtChEt6J0FvBehug8ENttwe46M3hVAGBCBNDlpmxhJoIwQOl5I8BBBeBTgCppoIkg0kg9EcI0i2VeAcBwlIlg1JJvBnBeBTBUBSi2BJBo0llgY5BRtBkOoaiciQAyAOAZx2i3Fg1khAko0cFeAOBaAVl2RciUhI1QkshkE8gOiBjpi2p0c+QKRJjBjo0BUQl4kyRaiTg9ENiY0AhERCI9jFigkti0jdgdAUlsi+i2AI0LitFY0SiOiY0sdGg3FeAbFej3F9ipiniQlrjP8o05BsB/AvBA17j/jDjLj0ii1tx+Bt8+BugKBfiORCggA===

@germanbisurgi
Copy link
Collaborator

In the provided example the options disable_edit_json and disable_properties are set to true. That makes the editing of object editors less possible.

For the expected behaviour the property show_opt_in is best suited.

@schmunk42
Copy link
Collaborator

@Krivich See screenshot

Bildschirmfoto vom 2022-06-02 15-44-35

@Krivich
Copy link
Contributor Author

Krivich commented Jun 4, 2022

Thanks a lot! The show_opt_in options solved the problem

@Krivich Krivich closed this as completed Jun 4, 2022
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

3 participants