react-quill icon indicating copy to clipboard operation
react-quill copied to clipboard

Update Quill Dependency to ^2.0.0

Open VaguelySerious opened this issue 1 month ago • 7 comments

This fork is now available on NPM until the original maintainers of this repository merge this PR: [email protected]. I will keep publishing this package with any fixes and updates I discover. If you need to reach out to me in private, do so via email through the website link on my github profile, otherwise comment on this PR, my notifications are on.

If you're using my forked NPM package and are getting errors like "Unexpected Token: export" or similar, and are using webpack with babel, make sure you have babel transpile this package by ignoring it in the exclude clause for babel-loader. Because Quill moved to being a native ESM module, this PR does the same, which requires ES5-compatible projects to use babel for it.

==============================================================================

This PR updates the quill dependency in react-quill from an outdated version (1.3.7) to the latest release: 2.0.x.

The Quill release mainly includes security fixes and performance enhancement, but most relevant of all, it replaces a deprecated DOM API that will be dropped from Browsers on July 23, 2024 (source). This means that the following issues will be addressed:

  • https://github.com/zenoamaro/react-quill/issues/943
  • https://github.com/zenoamaro/react-quill/issues/601

The code in this PR is based on the (already approved) https://github.com/zenoamaro/react-quill/pull/967, which seemed to be advancing a bit slowly, hence my PR here, with the addition of:

  • The PR feedback on https://github.com/zenoamaro/react-quill/pull/967 by @adgoncal, @piesuke, and @luin.
  • Updates typescript dev dependency from 3.x to 5.x to be in line with Quill 2.0's typescript version. This ensures tsc runs correctly with the new type import syntax.
  • Fixes typescript compilation warnings and errors by upgrading some type dependencies

Note that Quill >2.0.0 uses ES modules natively, which breaks some of the tooling in this repository. This PR doesn't directly address that. Specifically, the test setup isn't compatible with the ES modules.

Next steps

Once this PR is merged, I suggest releasing it as 2.1.0-beta.1, to allow users to upgrade via NPM without suggesting it's completely stable yet. Given the timeline for the DOM API deprecation, we'll have at least a full month to bring this to users in beta state before it becomes advisable to release a full version.

Before a production release, we should revisit the test setup to ensure compatibility with the ES modules. This could take the form of updating the webpack setup to transpile the Quill dependency, or finding a version of Mocha that supports these natively.

VaguelySerious avatar May 06 '24 12:05 VaguelySerious

Build command is now running fine, see build step output:

yarn build                                                                                                                     10s  18.20.2 15:33:18
yarn run v1.22.19
$ npm run build:lib && npm run build:dist && npm run build:css

> [email protected] build:lib
> tsc


> [email protected] build:dist
> webpack

Hash: 95cce68c8ae2eb1f8e21
Version: webpack 4.41.2
Time: 1038ms
Built at: 05/06/2024 3:33:25 PM
            Asset      Size  Chunks             Chunk Names
../lib/index.d.ts  5.05 KiB          [emitted]
   react-quill.js  31.4 KiB       0  [emitted]  main
Entrypoint main = react-quill.js
[11] external {"commonjs":"react","commonjs2":"react","amd":"react","root":"React"} 42 bytes {0} [built]
[12] external {"commonjs":"react-dom","commonjs2":"react-dom","amd":"react-dom","root":"ReactDOM"} 42 bytes {0} [built]
[22] (webpack)/buildin/module.js 497 bytes {0} [built]
[26] ./src/index.tsx 17.6 KiB {0} [built]
[41] (webpack)/buildin/global.js 472 bytes {0} [built]
    + 90 hidden modules

> [email protected] build:css
> cpx 'node_modules/quill/dist/quill.*.css' dist

✨  Done in 4.28s.

VaguelySerious avatar May 06 '24 13:05 VaguelySerious

Any estimate when the beta npm package will be available?

hasangursoy avatar May 08 '24 08:05 hasangursoy

@hasangursoy I'm not a maintainer of this repository, and I think even they would be hard pressed to give you an estimate. If we don't have a beta release by June, however, I'll release this branch as a fork on npm and will link it here. If you need it sooner than that, I suggest making a fork and package yourself.

VaguelySerious avatar May 08 '24 11:05 VaguelySerious

For everyone arriving at this PR, @hasangursoy published this fork as a new npm package (see this issue), and I have my own published fork (with updated typescript type exports) under [email protected]. This might be a helpful intermediary solution for anyone testing their rollout for the react-quill upgrade. Note that this package is not endorsed or managed by the maintainers of this repository, and does not include a full test suite, so use at your own risk.

VaguelySerious avatar May 13 '24 09:05 VaguelySerious