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

Fix: Export InjectionToken editor configuration #398

Merged
merged 1 commit into from
May 11, 2022

Conversation

ludoviccarretti
Copy link
Contributor

@ludoviccarretti ludoviccarretti commented May 10, 2022

Export NGX_EDITOR_CONFIG_TOKEN to enable editor configuration by using a provider instead of static configuration.

This PR contains:

  • bugfix
  • feature
  • refactor
  • tests
  • documentation
  • others

Breaking Changes?

  • yes
  • no

Checklist

  • commit messages follow the Conventional Commits pattern
    • A feature commit message is prefixed "feat:"
    • A bugfix commit message is prefixed "fix:"
    • A document related commit is prefixed "docs:"
  • docs have been added / updated (for bug fixes / features)

Describe Your Changes

Add the ability to provide NGX_EDITOR_CONFIG_TOKEN by using a provider. Just below an example when using @ngx-translate package for internationalization :

export function ngxEditorConfigFactory(translateService: TranslateService): NgxEditorConfig {
  return {
    locals: {
      italic: translateService.instant('styles.italic'),
      bold: translateService.instant('styles.bold'),
    },
  };
}

@NgModule({
  imports: [CommonModule, ReactiveFormsModule, NgxEditorModule.forRoot()],
  providers: [
    {
      useFactory: ngxEditorConfigFactory,
      provide: NGX_EDITOR_CONFIG_TOKEN,
      deps: [TranslateService],
    },
  ],
})
export class MyModule {}

Does this PR affects any existing issues?

  • yes
  • no

Export NGX_EDITOR_CONFIG_TOKEN to enable editor configuration by using a provider
@sibiraj-s
Copy link
Owner

Thanks @ludoviccarretti . Will this fix #397?

@ludoviccarretti
Copy link
Contributor Author

Thanks @ludoviccarretti . Will this fix #397?

Yes it will !

@sibiraj-s sibiraj-s merged commit c996665 into sibiraj-s:master May 11, 2022
@sibiraj-s
Copy link
Owner

Published in v12.4.0

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants