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

Using Classic Build, it doesn't apply styles in toolbar #77

Closed
futbolsalas15 opened this issue Mar 1, 2019 · 9 comments
Closed

Using Classic Build, it doesn't apply styles in toolbar #77

futbolsalas15 opened this issue Mar 1, 2019 · 9 comments
Assignees
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket).

Comments

@futbolsalas15
Copy link

When I use the Classic Build (using the basic example at https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/angular.html), it seems that doesn't apply the styles in the toolbar:

error-ckeditor5

What is different from the example is that from the main module (app.module.ts) I'm creating a web component for each of the components of the project:

const element = createCustomElement(TestComponent, { injector: this._injector });
customElements.define('test-component', element);

Doesn't ckeditor5-angular have compatibility (specially the CSS) when is used in web components?

Thanks!

@Mgsy
Copy link
Member

Mgsy commented Mar 1, 2019

Hello, @futbolsalas15, could you give us more details about your environment? The content of your package.json and code of your component will be appreciated.

@Mgsy Mgsy added the pending:feedback This issue is blocked by necessary feedback. label Mar 1, 2019
@futbolsalas15
Copy link
Author

Hello @Mgsy, thanks for your prompt response!
I attached my package.json:

package.zip

The main module (app.module.ts) has the following code:

const BOOTSTRAP = environment.production ? [] : [AppComponent];

@NgModule({
  bootstrap: BOOTSTRAP,
  declarations: [AppComponent],
  imports: [BrowserModule, RichTextEditorModule],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule implements DoBootstrap {
  constructor(private readonly _injector: Injector) {
    this._registerWidgets();
  }

  public ngDoBootstrap(): void {}

  private _registerWidgets(): void {
    // here is where we register the angular componentes as web components, using createCustomElement method of Angular
    const element = createCustomElement(RichTextEditorComponent, { injector: this._injector });
    customElements.define('rich-text-editor', element);
  }
}

The component RichTextEditorComonent has the following code:

import { Component, Input, OnInit, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic';

@Component({
  templateUrl: './rich-text-editor.component.html',
  styleUrls: ['./rich-text-editor.component.scss'],
  encapsulation: ViewEncapsulation.ShadowDom
})
export class RichTextEditorComponent implements OnInit {
  @Input()
  public content: string;
  public editor = ClassicEditor;

  @Output()
  public contentChanged = new EventEmitter<string>();

  constructor() {}

  public ngOnInit(): void {
    this.content = 'Hello World!';
  }
}

The template:

<ckeditor
  [editor]="editor"
  [data]="content"
  [config]="{ toolbar: ['heading', '|', 'bold', 'italic'] }"
></ckeditor>

And in app.component.html, I use the previous component with the following code:

<rich-text-editor content="test"></rich-text-editor>

I don't know if it is enough. Thanks!.

@futbolsalas15
Copy link
Author

I'm sorry, I missed the module config where I called CKEditorModule:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';

import { RichTextEditorComponent } from './containers/rich-text-editor.component';

  declarations: [RichTextEditorComponent],
  imports: [CommonModule, CKEditorModule],
  entryComponents: [RichTextEditorComponent]
})
export class RichTextEditorModule {}

Thanks!.

@ma2ciek ma2ciek closed this as completed Mar 1, 2019
@ma2ciek ma2ciek added resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). and removed pending:feedback This issue is blocked by necessary feedback. labels Mar 1, 2019
@futbolsalas15
Copy link
Author

futbolsalas15 commented Mar 1, 2019

Hi @ma2ciek

When I included the CKEditorModule, the result is the same:

error-ckeditor

The basic actions works, but the styles of the toolbar aren't applied.

Sorry and thanks!

@ma2ciek ma2ciek removed the resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). label Mar 1, 2019
@ma2ciek ma2ciek self-assigned this Mar 1, 2019
@ma2ciek
Copy link
Contributor

ma2ciek commented Mar 1, 2019

Hi @futbolsalas15!

It looks like I did not understand you previously 😄

I'll check it. Looks like somehow the CKEditor 5 styles are not applied.

@futbolsalas15
Copy link
Author

Hi @ma2ciek ,

I think I found the problem! Is the following line that I added as option to the @Component definition:

encapsulation: ViewEncapsulation.ShadowDom

I changed it to encapsulation: ViewEncapsulation.Emaulated and it works as expected. Reading the error is because ckeditor5 doesn't support Shadow DOM.

Thanks again for your help!

@ma2ciek
Copy link
Contributor

ma2ciek commented Mar 4, 2019

Kudos for you for solving that issue. It's always good to know what can be a potential problem in the integration. 👍

The Shadow DOM is on our TODO list already: ckeditor/ckeditor5#1483.

@Reinmar Reinmar added resolution:resolved This issue was already resolved (e.g. by another ticket). and removed resolution:solved labels Jul 29, 2022
@saravana-sk
Copy link

@ma2ciek @Reinmar
I am seeing this issue is closed, but I am still facing the same issue. May I know whether the ShadowDOM feature is implemented in CK Editor5 ??

@Witoso
Copy link
Member

Witoso commented Feb 15, 2024

It's not, here's a related ticket: ckeditor/ckeditor5#3891, and a comment that it's also blocked on the browsers' side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket).
Projects
None yet
Development

No branches or pull requests

6 participants