Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Link always gets parsed on new line #108

Closed
davidraijmakers opened this issue Dec 10, 2018 · 14 comments
Closed

Link always gets parsed on new line #108

davidraijmakers opened this issue Dec 10, 2018 · 14 comments
Assignees
Labels

Comments

@davidraijmakers
Copy link

I am using the following versions:
"deanblackborough/php-quill-renderer": "^3.15",
"quill": "^1.3.6",

And i am trying to parse the following in the editor:
screenshot 2018-12-10 at 11 58 44

This has a link on the same line, on the second line a change of color in the text. The output of the quill javascript contents are the following:
screenshot 2018-12-10 at 12 00 08

This shows that the 'contactformulier' link is added, but also the color change on the next line. I save this in the database but when i render it, it renders like this:
screenshot 2018-12-10 at 12 02 09

The link is always on a new line. I am using the following code to render the deltas:

`$parser = new HtmlParser();
$renderer = new HtmlRenderer();

    $parser->load($deltas)->parse();
    return $renderer->load($parser->deltas())->render();`

Is there something i am doing wrong? Or is this something that can be changed?

@deanblackborough
Copy link
Owner

@davidraijmakers That looks like a bug in the parser. I'll get this fixed as soon as possible, hopefully, this evening but if not definitely tomorrow evening.

Do you have the deltas you used to generate the HTML, that way I can add it to my test suite?

@davidraijmakers
Copy link
Author

davidraijmakers commented Dec 10, 2018

deltas.txt
These are the delta's that i use.

@deanblackborough
Copy link
Owner

David

Sorry, I've spent a little while looking at this and I can't seem to replicate the issue.

When I use the supplied deltas with v3.15 I get the below, I'm not getting the link on a new line, it is within the first paragraph

<--Generated by 3.15-->
<p>Wilt u één van bovenstaande punten wijzigen, dan <a href="https://studiekeuze123.test/contact" >contactformulier</a>.  asd</p>

<p>Wijzigingen die <span style="color: #24372e;">uiterlijk 20 november 2018 </span>bij ons zijn binnengekomen, worden nog verwerkt in release 18.10 op 12 december 2018. Wijzigingen in CROHO (zoals nieuwe opleidingen) dienen ook uiterlijk 20 november door u te zijn ingevoerd om meegenomen te worden in de release van december 2018.</p>
<--Generated by 3.15-->

Can you dump the HTML generated by my parser directly after the call to $renderer->load($parser->deltas())->render(); and before you save to the database to see if it matches the above.

It looks like you have something else parsing the content before generating the HTML. In your screenshot the link is <a href="/contact">contactformulier</a> yet if the supplied delta is used you should get <a href="https://studiekeuze123.test/contact">contactformulier</a>, the parser doesn't modify links, it wouldn't ever make the link relative.

I have a demo site at https://www.transmute-coffee.com/php-quill-renderer.php#demo - If you can replicate the issue there and send me the deltas or send through a script that shows the error I'd be more than happy to take a look but at the moment I can't really do anything.

deanblackborough added a commit that referenced this issue Dec 12, 2018
* Failing test for #108
@davidraijmakers
Copy link
Author

I get the same one, it looks I removed some content before it that might have caused the problem. Here are the new deltas. There are links on 2 lines that are being shown in the editor on the same line. I'll add some pictures for you to understand it as well as it is Dutch.

screenshot 2018-12-13 at 15 10 14
screenshot 2018-12-13 at 15 10 04

deltas.txt

@davidraijmakers
Copy link
Author

P.S. I've tested it in the test link that you send me and this also is being shown wrong in the preview.

@davidraijmakers
Copy link
Author

Do you maybe have time to look at this issue again?

@deanblackborough
Copy link
Owner

Hi David, thank you for the new deltas.

Which image is correct? I'm guessing the first one is what you entered into the Quill editor and the second is what was generated by my library?

I haven't the time to look at this today but will Tuesday evening, apologies for the delay getting back to you, been busy with other work.

@davidraijmakers
Copy link
Author

The https://user-images.githubusercontent.com/4717921/49943840-397b0a00-fee9-11e8-819d-1dd005833150.png is the correct one (or how it should be shown).

But on https://user-images.githubusercontent.com/4717921/49943839-397b0a00-fee9-11e8-919c-7734a186f6a4.png you can see that:
"Wilt u een van de bovenstaande"

is being shown on a new line where it shouldn't be.

Basically all the links at the bottom of the deltas are being shown on a new line where they shouldn't.

@deanblackborough
Copy link
Owner

David

I think I've managed to work out the problem. If there is a link in or close to a heading the parser gets confused, I have now got a couple of failing tests and am working on a fix, please keep an eye on this ticket for updates.

@davidraijmakers
Copy link
Author

Allright, good luck!

@davidraijmakers
Copy link
Author

Can you give me an update or estimation when the update is going to be pushed?
I get that the christmas period isn't the time of the year to be pushing this code, but then i know when i can push this update.

@deanblackborough
Copy link
Owner

David

I'm working on it, there are updates in the https://github.com/deanblackborough/php-quill-renderer/tree/v3.15.1 development branch.

At the moment there is one failing test which is stopping the release, links within a header don't render correctly, links at the end of a header render correctly.

I'm working on paid projects at the moment, this is a side project I work on when I have free time, I'll hopefully get to it soon but can't give you a specific date, it could be tomorrow, it could be next week.

You are welcome to try the branch listed above, it might work for you.

@davidraijmakers
Copy link
Author

For security reasons we can't implement dev versions. I'll wait till the update has been pushed. Good luck!

@deanblackborough deanblackborough added this to the v3.16.0 - Split the Deltas before any parsing milestone Jan 16, 2019
deanblackborough added a commit that referenced this issue Jan 24, 2019
* Initial work on alternate code for splitting deltas on new lines

#109
#108
deanblackborough added a commit that referenced this issue Feb 24, 2019
* All attribute tests back to passing, allow empty inserts, they are valid quill deltas. #108 #109
@deanblackborough deanblackborough modified the milestones: v3.16.0 - Split the Deltas before any parsing, v3.16.1 Feb 28, 2019
deanblackborough added a commit that referenced this issue Mar 3, 2019
* Added first failing test for #108
deanblackborough added a commit that referenced this issue Mar 3, 2019
* Resolved #108
* Added davidraijmakers to credits for reporting bug
@deanblackborough
Copy link
Owner

Closed. Resolved in v3.17.0, will be released shortly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants