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

Inconsistent quill-view behaviour #45

Open
MatteoOstermeier opened this issue Jan 3, 2023 · 8 comments
Open

Inconsistent quill-view behaviour #45

MatteoOstermeier opened this issue Jan 3, 2023 · 8 comments

Comments

@MatteoOstermeier
Copy link

First of all, thanks a lot for this great package! I'm experiencing a little issue with the quill view.
I'm running ngx-quill 19.0.1 with angular 14.2.12 and ionic 6.4.1 (capacitor).

The root of the problem is that while the quill editor works like a charm the quill view is eating up some html tags - and even doing differently on first load vs. second time the view is opened.

Here is a test content:
Quill-Editor:
image

Quill-View on first load after ionic serve:
image
This is only displayed correctly the first time a quill-view is displayed in the app. If I open another dataset first, it does not display the content correctly (see next point).

Quill-View on any subsequent load:
image

At some stage, quill-view is removing the h1 tags. Similar things also happen with line breaks.

Any idea on how I can fix this?

Tanks a lot!

@KillerCodeMonkey
Copy link
Owner

KillerCodeMonkey commented Jan 3, 2023 via email

@KillerCodeMonkey
Copy link
Owner

KillerCodeMonkey commented Jan 3, 2023 via email

@MatteoOstermeier
Copy link
Author

MatteoOstermeier commented Jan 4, 2023

Good morning! Thanks a lot for your reply! The errors were actually missing image sources, as I had originally been testing my thumbnail creation functions with weird image types. I can confirm that the same happens without any errors in the console.

The behaviour, though, seems to change if I remove custom css classes from quill-view. For demo, i have added a div showing the real html code to the view.

Test 1: quill-view with custom CSS:
Is consistently showing the "wrong" format without the h1 tags.
image

Test 2: quill-view without custom CSS
First time opening the ion-modal:
image

Second time opening the ion-modal
image

My Custom CSS is used to modify the size of h1 and h2 tags, margins as well as setting the ngx-quill colours to match the app colour scheme.
custom.css.txt

Tiny remark: I've updated ngx-quill to 20.0.1, and angular to 15 but that did not help...

@KillerCodeMonkey
Copy link
Owner

i guess this is something like a timing problem or maybe even with ionic, because maybe it is rendered during the modal transition.

could you please try to initialize quill-view in ionViewDidEnder?

@MatteoOstermeier
Copy link
Author

MatteoOstermeier commented Jan 4, 2023

How can I initialize Quill-View? Sorry, but I'm lacking that.


The modal seems to be the problem. I'm currently importing Quill in two locations. One is the app.module.ts, one a shared-components-module.

app.module.ts:
image

shared-components.module.ts:
image

Quill view is working like expected when shown on a "normal" page which is importing the SharedComponents Module.

In the modal it's not working. Here's how its opened:

page "my-stories.page" is opening a Modal with a ViewStoryComponent. my-stories.module is importing the SharedComponentsModule. The Same is done with the CreateStoryComponent including the Quill Editor.

The quill view is displayed indirectly: View-story-component.html. Still, the same is done in the working example on the main page.
image

Story-content-component.html:
image

I've uploaded the current code to https://beta.1day1story.com/ if that helps...

@KillerCodeMonkey
Copy link
Owner

just use *ngIf inside of the modal html and set a property to true after ionViewDidEnter was executed.

@Component({ ... })
class Component {
  isEntered = false

  ionViewDidEnter() {
    this.isEntered = true
  }
}
<quill-view *ngIf="isEntered"></quill-view>

@KillerCodeMonkey
Copy link
Owner

btw: there is also a quill-view-html component, that simply renders the html with some additions for sanitizing and so on.

@MatteoOstermeier
Copy link
Author

MatteoOstermeier commented Jan 4, 2023

Good evening!
Initializing on DidEnter did not solve the issue. But the quill-view-html works as I'd expect it to do ;)

So thanks a lot!

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

No branches or pull requests

2 participants