quill 1.3.1 , change to InlineEmbed breaks existing Embed code / Major problems

Created on 7 Aug 2017  路  5Comments  路  Source: quilljs/quill

Note: the standard issue report is not suitable for this problem, but if it's not obvious from the description I can setup a before and after code pen.

I upgraded to quill 1.3.1 this morning and I'm finding a number of issues.... I had been using the InlineEmbed blot but that had changed to Embed, I only knew how to address this from reading the issues board... surely this should've been mentioned in the release notes? this update got automatically deployed because I had a caret ^ on my package.json dependency for small version numbers and it has several breaking changes to embeds..

I was able to change my inlineembed to the default embed relatively easily but I'm also having trouble with my regular embeds... initially the advantage of embed was that I could add arbitrary content without having to worry about reconciling this with quill.... in particular I was using the embed blot to create a figure tag with a figcaption child... worked fine before, now the figcaption will not come through unless I register a blot with the figcaption tag and use it inline this creates very bad markup...

<figure contenteditable="false">
<img src="AIRPLANE.jpg" class="ql-embed-selected">
<figcaption>&#65279;<span contenteditable="false">caption text</span>&#65279;</figcaption>
</figure>

Embeds now cant include tags that haven't been registered... and am I to assume every inline embed will have these guards and the nested span?? because I dont think this is going to work out, its very different than the old Embed.... I can imagine this is going to break a lot of people's code... this also makes things like drag and drop embeds impossible.... I have attempted to adapt it to block embed but now arbitrary content in the block needs to reconcile with quill, surely embeds shouldn't be changing the embedded code?

All 5 comments

This code no longer works the same, figcaption doesn't get added to the html, it did in the previous Embed

class ImageWithCaption extends Embed {
  static create(value) {
    let node = super.create(value);

    const img = document.createElement("img");
    img.setAttribute("src", value);

    const caption = document.createElement("figcaption");
    caption.innerText = 'test';

    node.appendChild(img);
    node.appendChild(caption);
    return node;
  }

  static value(node) {
    return node.childNodes[0].getAttribute('src');
  }

}

to be clear this used to work without requiring figcaption to be a blot, and without span guards on every element, surely quill should not be affecting the internals of an embed?

Quill follows semantic versioning which is very clear in how version numbers change and the changelog exists as commentary to this. Semver covers documented API surfaces, not internal code which Quill is free to reorganize, refactor or reimplement. Please show how usage of a documented API broke from 1.3.0 to 1.3.1 and I can reopen.

@jhchen this report is very clear, I am aware you're free to do whatever you like, that is not the point. but I will spend more time later with clear examples of how this API broke from 1.3.0 to 1.3.1, I'm also going to document the issues on other sites.

I did not claim to do whatever I like. I do claim that I followed SemVer and it did not obligue me to note changes to internally undocumented code.

A clear example: In 1.3.0, Embed was always a single node. In 1.3.1, Embed always includes an inner node.

Was this page helpful?
0 / 5 - 0 ratings