Hide kendoUI text editor button

Asked

Viewed 52 times

1

I’m using the kendoUI text editor

I need to remove the last button of the editor (insert image).

The rendered tag is the last, which has inside the image button.

I tried something like:

kendo-toolbar-renderer:last-of-type{
    display: none!important;
}

I also tried to:

kendo-toolbar-renderer:last-child{
    display: none!important;
}

But still appears the button in the editor, some alternative?

  • 1

    According to the documentation you can add or remove the buttons you want https://stackblitz.com/edit/angular-ubevv?file=app/app.component.ts

  • With JS you can remove on brute force: var kendobts = document.querySelectorAll("kendo-toolbar-renderer");
kendobts[kendobts.length-1].outerHTML = '';

  • Or try this in CSS: kendo-toolbar-renderer:last-child{
 display: none !important;
}

1 answer

1

The CSS rule that’s actually there is this, but notice that they put a display:inline-block right in the tag overwriting what’s in the CSS. What I point out to you is to make a stronger rule like

.kendo-toolbar.k-toolbar .kendo-toolbar-renderer:last-of-type{
    display: none !important;
}

inserir a descrição da imagem aqui

If this does not work a trick is to put the CSS after the JS is loaded for that you will have to put there at the end of the document as the last tag before the closing of the </body> a tag <style> to test if so this CSS will overwrite what was rendered before.

It would look something like this...

    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script>
    </script>

    <style>
        .kendo-toolbar.k-toolbar .kendo-toolbar-renderer:last-of-type {
            display: none !important;
        }
    </style>
</body>
</html>

But there is a side effect of putting the CSS at the end of the document that you can read in this other question It’s good practice to insert CSS tags at the end of the body of Body?

  • I tried it in global css and index.html, it keeps popping up.

  • Try putting this in css and see if the icon disappears [title="Insert image"] {&#xA; display: none !important;&#xA; }

  • It didn’t work, anyway I would need the button to disappear because I wanted you not to use this property

  • 1

    @Veronesecoms was actually just a test to see if it would work on the son and not on the father. But if still the CSS did not get it complicated.... I don’t think I can help you with much more than that :/

  • thanks anyway, if I get put here

  • @Veronesecoms if you get put there, it may be that a function with Document.ready you can put the property later by superimposing the class on a setTimeout

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.