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

No ability to provide available levels #14

Closed
proArtex opened this issue Dec 26, 2018 · 9 comments · Fixed by #17 or #37
Closed

No ability to provide available levels #14

proArtex opened this issue Dec 26, 2018 · 9 comments · Fixed by #17 or #37

Comments

@proArtex
Copy link

It seems like levels are hardcoded and cannot be set. What if I want to put H1 only?

@Farrien
Copy link

Farrien commented Apr 4, 2019

I was looking for how to prevent users from using some of the heading levels too.

@talyguryn
Copy link
Member

Sorry, my bad

@talyguryn talyguryn reopened this Apr 4, 2019
@nynevi
Copy link

nynevi commented May 31, 2019

ugly but works:

    .cdx-settings-button[data-level='1'],
    .cdx-settings-button[data-level='4'],
    .cdx-settings-button[data-level='5'],
    .cdx-settings-button[data-level='6'] {
      display: none;
    }

I used the same method for hiding image options but it had an explicity classname so using the above method with -settings- might break other plugin options that has levels

.image-tool__tune {
     display: none;
}

@igorivaniuk
Copy link

Or extend Header class

class MyHeader extends Header {
  get levels() {
    return super.levels.filter((l: any) => [2, 3, 4].includes(l.number));
  }

  get defaultLevel() {
    /**
     * Use H2 as default header
     */
    return this.levels[0];
  }
}

editorjs

@zizther
Copy link

zizther commented Aug 6, 2019

Even though it is possible to extend, it would be nice to see this built in as an option.

@damien-monni
Copy link

I agree, it would be nice!

@sandrooco
Copy link

sandrooco commented Nov 26, 2019

@igorivaniuk Extending like you did doesn't work for me:

Type 'typeof CustomHeading' is not assignable to type 'BaseToolConstructable'.
Property 'render' is missing in type 'CustomHeading' but required in type 'BaseTool'.

If I use heading: CustomHeading as BaseToolConstructable, it will build (and work..) but still throw an error in the terminal.

@neSpecc
Copy link
Contributor

neSpecc commented Dec 17, 2019

It can be done by adding a corresponding config option. You are welcome to implement this feature and send a PR.

@alexanderhorner
Copy link

Extending doesn't work for me

SyntaxError: Unexpected token ':'. Expected ')' to end a compound expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
10 participants