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

Feature/custom buttons #435

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Raiper34
Copy link
Contributor

I created PR for support for custom buttons in the toolbar. In our company, we needed this functionality and thus we needed to choose to pick fate-editor instead of this. But Fate is not under maintenance.

Usage is simple: You can define your custom buttons with custom actions using executeCommandFn. It accepts commands from execCommand.
The first argument of this method is aCommandName and the second argument is aValueArgument. Example shows a button that adds Angular editor logo into the editor.

<angular-editor id="editor1" formControlName="htmlContent1" [config]="editorConfig">
  <ng-template #customButtons let-executeCommandFn="executeCommandFn">
    <ae-toolbar-set>
      <ae-button iconClass="fa fa-html5" title="Angular editor logo"
                 (buttonClick)="executeCommandFn('insertHtml', angularEditorLogo)">
      </ae-button>
    </ae-toolbar-set>
  </ng-template>
</angular-editor>

@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 20.91%. Comparing base (df050a9) to head (733e52c).
Report is 36 commits behind head on master.

Files Patch % Lines
...angular-editor/src/lib/angular-editor.component.ts 50.00% 1 Missing ⚠️
...s/angular-editor/src/lib/angular-editor.service.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #435      +/-   ##
==========================================
+ Coverage   19.57%   20.91%   +1.33%     
==========================================
  Files           6        8       +2     
  Lines         475      483       +8     
  Branches      104      104              
==========================================
+ Hits           93      101       +8     
  Misses        379      379              
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kolkov
Copy link
Owner

kolkov commented Jan 31, 2022

Hi! Thanks for the PR. I will check it soon as possible.

@kolkov
Copy link
Owner

kolkov commented Jan 31, 2022

If we introduced a new component ae-toolbar-set, then immediately change all matching elements to it in the toolbar in this PR?
like this:


wouldn't that break compatibility for the future?

@Raiper34
Copy link
Contributor Author

Raiper34 commented Feb 3, 2022

If we introduced a new component ae-toolbar-set, then immediately change all matching elements to it in the toolbar in this PR? like this:

wouldn't that break compatibility for the future?

Why do you think it should break compatibility? I do not think so. Also, I refactor the toolbar as you wish :). I do not think, that Encapsulation.None is ideal, but you used it also in the project.

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

Successfully merging this pull request may close these issues.

2 participants