angular-editor icon indicating copy to clipboard operation
angular-editor copied to clipboard

Configuring toolbar

Open wahidhasan5790 opened this issue 8 years ago • 20 comments

Thanks for the hard work, this library save my times alot. Btw, is the toolbar content configurable? I want to only use some of them

Regards

wahidhasan5790 avatar Jul 11 '18 06:07 wahidhasan5790

Hi! Not yet... What do you want to configure?

kolkov avatar Jul 11 '18 06:07 kolkov

Hello,

I am writing here, but if you want to show less tools, as this is not possible through the configuration, you can use a CSS in order to hide unwanted tools:

HTML:

<app-text-editor [parent]="experienceItem" [teFormControlName]="'projects'" [height]="'7rem'" [placeholder]="'Enter projects here...'" class="te-basic-tools"></app-text-editor>

Note that I am using a CSS class te-basic-tools which I am using to cascade and to hide some of the tools that I don't need to show.

And CSS:

.te-basic-tools .angular-editor-button[title="Subscript"],
.te-basic-tools .angular-editor-button[title="Superscript"],
.te-basic-tools .angular-editor-button[title="Text Color"] {
   display: none;
}

This will cascade through the te-basic-tools CSS class and will hide the targeted tools. Note, that I am using a property selector that matches the button title attribute:

<button _ngcontent-c2="" class="angular-editor-button" title="Subscript" type="button" id="subscript-"><i _ngcontent-c2="" class="fa fa-subscript"></i></button>

Using the approach above, I was able to set up an editor with a few basic options.

capture

melhaer avatar Jul 11 '18 10:07 melhaer

Hi, melhaer...

Very smart solution, thanks

wahidhasan5790 avatar Aug 27 '18 03:08 wahidhasan5790

Btw @melhaer, unfortunately we can't set style to child component from it's parent

.angular-editor-button is in angular-editor-toolbar, so we can't apply style to it. Was it working on your project?

wahidhasan5790 avatar Aug 27 '18 04:08 wahidhasan5790

Hello, it still works on my side. Check the image attached, where I underlined the Subscript button, which you can see is missing visually in the Editor, because I set display: none through the CSS using its title property.

capture

This is the way you are hiding a single button.

You can also hide a whole set of tools, using something like that:

#angularEditor .angular-editor-toolbar-set:nth-child(6)

This will hide the sixth set of tools. I think that you need to check if #angularEditor id different on your side and use it to cascade though it. I used it in order to override some editor styles.

melhaer avatar Aug 27 '18 10:08 melhaer

Btw @melhaer, unfortunately we can't set style to child component from it's parent

.angular-editor-button is in angular-editor-toolbar, so we can't apply style to it. Was it working on your project?

I am doing this way and is working:

In html file put any id to the component editor, for example "myEditor"
<angular-editor id="myEditor"

In Css file put the code below:

:host /deep/ angular-editor#myEditor .angular-editor-button[title="Insert Image"]{ display: none }

If you want remove others buttons, just copy and paste the code and change the title.

Aleksluciano avatar Nov 15 '18 08:11 Aleksluciano

Bump. I would also like to see this implemented. A code configurable solution would be ideal rather than hiding with CSS. Perhaps a config property that on a null value displays the default or full set of buttons OR pass in an object listing of buttons with boolean values?

semicoloncharmedlife avatar Dec 13 '18 14:12 semicoloncharmedlife

Thank you very much! Yes, we need to think about a convenient configuration. Maybe config would be right decision.

kolkov avatar Dec 14 '18 07:12 kolkov

+1

DaGLiMiOuX avatar Jan 23 '19 08:01 DaGLiMiOuX

If you are using sass you can hide the image upload button, or any button really using:

/deep/ .angular-editor-button[title="Insert Image"] display: none

AldanisVigo avatar Jan 30 '19 03:01 AldanisVigo

Hi @kolkov

Thank you for the great text editor.

I see that there is a config for 'showToolbar' but I'm struggling to get it to toggle boolean values.

I have a button which calls the following method:

hideToolbar() { this.config.showToolbar = false; }

All seems well but it does not change anything, I'm fairly new to development so your help would be appreciated!

ghost avatar Mar 06 '19 13:03 ghost

Hi Kolkov,

Thanks for the component, I have a requirement wherein I have to add line breaks and insert tables. Do you have any plans to include these features?

Thanks again!

christane avatar May 29 '19 12:05 christane

Hi! @christane I think that we can add such functionality, but make it customizable.

kolkov avatar May 29 '19 12:05 kolkov

Bump. I would also like to see this implemented. A code configurable solution would be ideal rather than hiding with CSS. Perhaps a config property that on a null value displays the default or full set of buttons OR pass in an object listing of buttons with boolean values?

Is there a code solution to this yet?

Beena12 avatar Sep 16 '19 10:09 Beena12

This editor is really well

akshaygeek108 avatar Feb 14 '20 16:02 akshaygeek108

any luck with this issue? passing the array of strings still does not work.

I see each control has a unique ID which is suffixed with the id of the angular-editor component.

<angular-editor id="editor"></angular-editor>

#backgroundColorPicker-editor,
  #foregroundColorPicker-editor,
  #insertVideo-editor,
  #insertHorizontalRule-editor,
  #clearFormatting-editor,
  #indent-editor,
  #outdent-editor {
    display: none;
  }

talentedaamer avatar Feb 19 '20 16:02 talentedaamer

Hi, Actually I need to upload images to editor (internal application images) for that I need to add custom button by clicking that button we can get the required images to upload.

How can I add custom button to editor ?

Bhanu1225 avatar Mar 11 '20 11:03 Bhanu1225

@Bhanu1225 did you get you solution?

AdityaSrivastava21 avatar May 08 '20 04:05 AdityaSrivastava21

Hi, I doesn't want the font tag <font> to be in the HTML that gets generated while I type inside the editor. Is there a way to suppress the generation of that font tag instead which a <p> in its place will be enough. I actually use a parser to convert this HTML into a markdown so that parser doesn't support font tag. So, I want it to suppressed in the editor itself.

Eg: <p><font face="Times New Roman" size="3"><b>hello</b></font></p>
Which needs to be generated like the following
      <p><b>hello</b></p>

centhil747 avatar Jun 30 '20 10:06 centhil747

I face an issue with angular editor (HTML code) functionality. All html tags are working fine and getting tag as output. But for iframe tag, it's not working. I have a project dependency to include iframe embed code from Youtube.

I have put new issue in github.

https://github.com/kolkov/angular-editor/issues/298

Could anyone please suggest/advise ?

Deepak200981 avatar Nov 10 '20 06:11 Deepak200981