GithubHelp home page GithubHelp logo

Comments (9)

richtera avatar richtera commented on July 17, 2024

Yup, code should be

const arraysEqual = (arr1, arr2) => {
  if (arr1.length !== arr2.length) {
    return false;
  }
  // defining for loops with airbnb config is a pain maybe should disable some rules
  // eslint-disable-next-line
  for (let i = 0; i < arr1.length; i++) {
    if (arr1[i] !== arr2[i]) {
      return false;
    }
  }
  return true;
};

from redraft.

lokiuz avatar lokiuz commented on July 17, 2024

Merged the PR, but as I said there would still be nice to add a test case for this.

from redraft.

adjesusds avatar adjesusds commented on July 17, 2024

Say we have Draft.js implemented as our primary rich-text editor.

screen shot 2018-03-25 at 16 02 15

The above image can be represented as the following JSON:

{
  inlineStyleRanges: [
    { length: 6, offset: 0, style: 'bgcolor-rgb(251,160,38)' },
    { length: 6, offset: 6, style: 'bgcolor-rgb(97,189,109)' },
  ],
  text: 'Lorem ipsum.',
}

The issue here is that these two styles are subsequent to each other, and they both have the same amount of styles.

On an effort to reduce the amount of markup generated, when deciding whether or not to reuse the same ContentNode, the arraysEqual function will fail, due to the bug described above.

screen shot 2018-03-25 at 16 04 08

Leading to the first set of rules overlapping any subsequent one with an equal amount of styles.

from redraft.

richtera avatar richtera commented on July 17, 2024

Is this PR in npm? I didn't see a new compile.

from redraft.

adjesusds avatar adjesusds commented on July 17, 2024

The fix is now on master, but it hasn't made it to a release yet.

from redraft.

richtera avatar richtera commented on July 17, 2024

But this is an obvious typo where the code has for(init; inc; cond) { } instead of for(init; cond; inc) { }. Should we compile the code into the fork and install from there or would you be able to post this into npm soon?

from redraft.

lokiuz avatar lokiuz commented on July 17, 2024

I will push a new version to npm in a few hours.

from redraft.

lokiuz avatar lokiuz commented on July 17, 2024

Published 0.10.1 with the patch.

from redraft.

richtera avatar richtera commented on July 17, 2024

Awesome, thank you.

from redraft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.