From 45fd19614aed25dbfa3bda1f4cf5bb5b60c671ee Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 16 Sep 2017 16:39:13 -0700 Subject: [PATCH 01/92] link to Quill's `disable` docs for readOnly prop --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0dfb8eb..1662b5b8 100644 --- a/README.md +++ b/README.md @@ -566,7 +566,7 @@ import ReactQuill, { Quill, Mixin, Toolbar } from 'react-quill'; // ES6 : Initial value for the editor as an uncontrolled component. Can be a string containing HTML, a [Quill Delta](https://quilljs.com/docs/delta/), or a plain object representing a Delta. `readOnly` -: If true, the editor won't allow changing its contents. +: If true, the editor won't allow changing its contents. Wraps the Quill [`disable` API](https://quilljs.com/docs/api/#enable). `placeholder` : The default value for the empty editor. From 22608c588220e991ebbc46f3619bd5c0a18ce93e Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 17 Sep 2017 22:14:39 -0700 Subject: [PATCH 02/92] add npm badges --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1662b5b8..88a91b1e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -React-Quill [![Build Status](https://travis-ci.org/zenoamaro/react-quill.svg?branch=master)](https://travis-ci.org/zenoamaro/react-quill) +React-Quill [![Build Status](https://travis-ci.org/zenoamaro/react-quill.svg?branch=master)](https://travis-ci.org/zenoamaro/react-quill) [![npm](https://img.shields.io/npm/v/react-quill.svg)](https://www.npmjs.com/package/react-quill) +[![npm downloads](https://img.shields.io/npm/dt/react-quill.svg?maxAge=2592000)](http://www.npmtrends.com/react-quill) ============================================================================== A [Quill] component for [React]. From 6b258e49995602d5ca529e8854ff3bc69f6075ea Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 17 Sep 2017 22:16:49 -0700 Subject: [PATCH 03/92] update latest package version in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88a91b1e..76b720ac 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,10 @@ Thanks to @clemmy and @alexkrolick for landing this much-awaited change. There a --- -🎧 **Latest published package version: `v1.0.0`** +🎧 **Latest published package version: `v1.1.0`** ```sh -npm install react-quill@v1.0.0 +npm install react-quill@v1.1.0 ``` Special thank you to everyone who contributed during the 1.0.0 release cycle! From 418f7c22b56cdba1186576230427237215b75dd1 Mon Sep 17 00:00:00 2001 From: Pjstaab Date: Mon, 16 Oct 2017 16:21:54 -0500 Subject: [PATCH 04/92] Fix typo in README.md (#279) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 76b720ac..0a41715b 100644 --- a/README.md +++ b/README.md @@ -346,7 +346,7 @@ Quill.register(BoldBlot); */ class MyComponent extends React.Component { constructor(props) { - this.formats = ['italic, 'underline'] // default formats + this.formats = ['italic', 'underline'] // default formats this.state = { text: '' } } From 92beccc417cf0bec16c902c5b307b6a6971344ea Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 23 Oct 2017 23:02:26 -0700 Subject: [PATCH 05/92] Point issue template at "pen from template" link --- .github/ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 3c448a75..c2300f63 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -3,7 +3,7 @@ Thanks for filing an issue! If at all possible, please provide a Codepen to demonstrate the problem you're having with React Quill. Here's a [template] to get you started. [template]: -http://codepen.io/alexkrolick/pen/xgyOXQ/left?editors=0010#0 +https://codepen.io/pen?template=xgyOXQ ### FAQ From a88200c0f4bc88c62048c1d8ae38f66db84806a2 Mon Sep 17 00:00:00 2001 From: Adam Charron Date: Fri, 17 Nov 2017 02:32:51 -0500 Subject: [PATCH 06/92] Add TypeScript type definitions (#277) * Add type definitions * Implement feedback in type defintions * Convert to spaces * Improve unpriveleged editor types --- package.json | 3 ++ test.ts | 0 types.d.ts | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ yarn.lock | 8 ++++ 4 files changed, 115 insertions(+) create mode 100644 test.ts create mode 100644 types.d.ts diff --git a/package.json b/package.json index 86b12d1d..05d38157 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "main": "lib/index.js", "browser": "lib/index.js", + "types": "types.d.ts", "scripts": { "test": "make test", "build": "make build", @@ -43,6 +44,8 @@ "LICENSE" ], "dependencies": { + "@types/quill": "*", + "@types/react": "*", "create-react-class": "^15.6.0", "lodash": "^4.17.4", "prop-types": "^15.5.10", diff --git a/test.ts b/test.ts new file mode 100644 index 00000000..e69de29b diff --git a/types.d.ts b/types.d.ts new file mode 100644 index 00000000..8a20588a --- /dev/null +++ b/types.d.ts @@ -0,0 +1,104 @@ +import * as React from "react"; +import * as Quill from "quill"; + +type ToolbarOptionItem = string | string[] | Object[]; + +interface ToolbarOptionObject { + container: string; + handlers?: { + [key: string]: Function; + }; +} + +export interface Modules { + /** + * @deprecated + * 'Since v1.0.0, React Quill will not create a custom toolbar for you anymore. + * Create a toolbar explictly, or let Quill create one. + * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100 + */ + toolbar?: never; +} + +export interface UnprivilegedEditor { + getLength(): number; + getText(index?: number, length?: number): string; + getHTML(): string; + getBounds(index: number, length?: number): Quill.BoundsStatic; + getSelection(focus?: boolean): Quill.RangeStatic; + getContents(index?: number, length?: number): DeltaStatic;} + +export interface ComponentProps { + id?: string; + className?: string; + theme?: string; + style?: React.CSSProperties; + readOnly?: boolean; + value?: string | Quill.Delta; + defaultValue?: string | Quill.Delta; + placeholder?: string; + tabIndex?: number; + bounds?: string | HTMLElement; + onChange?: (content: string, delta: Quill.Delta, source: Quill.Sources, editor: UnprivilegedEditor) => void; + onChangeSelection?: (range: Quill.RangeStatic, source: Quill.Sources, editor: UnprivilegedEditor) => void; + onFocus?: (range: Quill.RangeStatic, source: Quill.Sources, editor: UnprivilegedEditor) => void; + onBlur?: (previousRange: Quill.RangeStatic, source: Quill.Sources, editor: UnprivilegedEditor) => void; + onKeyPress?: React.EventHandler; + onKeyDown?: React.EventHandler; + onKeyUp?: React.EventHandler; + formats?: string[]; + children?: React.ReactElement; + modules?: Modules; + + /** @deprecated + * The `toolbar` prop has been deprecated. Use `modules.toolbar` instead. + * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100. + * */ + + toolbar?: never; + /** @deprecated + * The `styles` prop has been deprecated. Use custom stylesheets instead. + * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100 + */ + + styles?: never; + /** + * @deprecated + * The `pollInterval` property does not have any effect anymore. + * You can safely remove it from your props. + * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100. + */ + pollInterval?: never; +} + +export default class Component extends React.Component { + focus(): void; + blur(): void; + getEditor(): Quill.Quill; +} + +export interface ToolbarItem { + type: string; + label?: string; + value?: string; + items?: ToolbarItem[]; +} + +export interface ToolbarProps { + id?: string; + className?: string; + style?: Object; + items?: ToolbarItem[]; +} + +export class Toolbar extends React.Component {} + +export interface Mixin { + createEditor(element: HTMLElement, config: Quill.QuillOptionsStatic): Quill.Quill; + hookEditor(editor: Quill.Quill): void; + unhookEditor(editor: Quill.Quill): void; + setEditorReadOnly(editor: Quill.Quill, value: boolean); + setEditorContents(editor: Quill.Quill, value: Quill.Delta | string); + setEditorSelection(editor: Quill.Quill, range: Quill.RangeStatic); + makeUnprivilegedEditor(editor: Quill.Quill): UnprivilegedEditor; +} diff --git a/yarn.lock b/yarn.lock index a3f26506..ff568aa2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6,6 +6,14 @@ version "6.0.78" resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.78.tgz#5d4a3f579c1524e01ee21bf474e6fba09198f470" +"@types/quill@*": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@types/quill/-/quill-1.3.3.tgz#06e08fb017d9493e3708c5c13fbb8bf33ad03d9e" + +"@types/react@*": + version "16.0.10" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.0.10.tgz#a24b630f5f1f170866a148a147d4fc8636ea88e0" + abab@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" From 2deb9ee16bce10dede7d5f522459539deee84d18 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Thu, 16 Nov 2017 23:34:16 -0800 Subject: [PATCH 07/92] v1.2.0 --- CHANGELOG.md | 5 +++++ README.md | 8 ++++++-- package.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5aa4398..709b708c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +v1.2.0 +------ + +- Add Typescript definitions (#277 @Charrondev) + v1.1.0 ------ diff --git a/README.md b/README.md index 0a41715b..653d54a1 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,10 @@ Thanks to @clemmy and @alexkrolick for landing this much-awaited change. There a --- -🎧 **Latest published package version: `v1.1.0`** +🎧 **Latest published package version: `v1.2.0`** ```sh -npm install react-quill@v1.1.0 +npm install react-quill@v1.2.0 ``` Special thank you to everyone who contributed during the 1.0.0 release cycle! @@ -755,6 +755,10 @@ Please check the browser support table for the upstream [Quill](https://github.c ## Changelog +### v1.2.0 + +- Add Typescript definitions (#277 @Charrondev) + ### v1.1.0 - Add support for React 16 and onwards by depending on `prop-types` and `create-react-class` (#181 @mikecousins) - Allow setting contents with a Quill Delta via the `value` prop (#101) diff --git a/package.json b/package.json index 05d38157..1ecc0ec9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-quill", - "version": "1.1.0", + "version": "1.2.0", "description": "The Quill rich-text editor as a React component.", "author": "zenoamaro ", "homepage": "https://github.com/zenoamaro/react-quill", From 4e2d43482f3534669b55bf81b507e8c9a86c3958 Mon Sep 17 00:00:00 2001 From: JD Huntington Date: Tue, 28 Nov 2017 15:28:53 -0800 Subject: [PATCH 08/92] Add types.d.ts to the produced package. (#294) --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 1ecc0ec9..e5da05ab 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "files": [ "dist/", "lib/", + "types.d.ts", "README.md", "CHANGELOG.md", "LICENSE" From af14c3f4aedf03f5a3b1f95142482ec02ff20be0 Mon Sep 17 00:00:00 2001 From: Arlan Jaska Date: Tue, 28 Nov 2017 17:30:11 -0800 Subject: [PATCH 09/92] Clean up types (#296) --- types.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types.d.ts b/types.d.ts index 8a20588a..38544f5d 100644 --- a/types.d.ts +++ b/types.d.ts @@ -26,7 +26,7 @@ export interface UnprivilegedEditor { getHTML(): string; getBounds(index: number, length?: number): Quill.BoundsStatic; getSelection(focus?: boolean): Quill.RangeStatic; - getContents(index?: number, length?: number): DeltaStatic;} + getContents(index?: number, length?: number): Quill.DeltaStatic;} export interface ComponentProps { id?: string; @@ -97,8 +97,8 @@ export interface Mixin { createEditor(element: HTMLElement, config: Quill.QuillOptionsStatic): Quill.Quill; hookEditor(editor: Quill.Quill): void; unhookEditor(editor: Quill.Quill): void; - setEditorReadOnly(editor: Quill.Quill, value: boolean); - setEditorContents(editor: Quill.Quill, value: Quill.Delta | string); - setEditorSelection(editor: Quill.Quill, range: Quill.RangeStatic); + setEditorReadOnly(editor: Quill.Quill, value: boolean): void; + setEditorContents(editor: Quill.Quill, value: Quill.Delta | string): void; + setEditorSelection(editor: Quill.Quill, range: Quill.RangeStatic): void; makeUnprivilegedEditor(editor: Quill.Quill): UnprivilegedEditor; } From 09341ea81966d6d513418272974d95ceee504cdc Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Tue, 28 Nov 2017 15:30:46 -0800 Subject: [PATCH 10/92] v1.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5da05ab..ef9e3af4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-quill", - "version": "1.2.0", + "version": "1.2.1", "description": "The Quill rich-text editor as a React component.", "author": "zenoamaro ", "homepage": "https://github.com/zenoamaro/react-quill", From 8d306324850bbc8ea098bbfb484fc1cd7e7265b5 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Tue, 28 Nov 2017 15:38:44 -0800 Subject: [PATCH 11/92] remove empty test file --- test.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test.ts diff --git a/test.ts b/test.ts deleted file mode 100644 index e69de29b..00000000 From 9580178578718014d8157bbe4b17bd0b8c61a24e Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Tue, 28 Nov 2017 17:31:24 -0800 Subject: [PATCH 12/92] v1.2.2 --- CHANGELOG.md | 4 +++- README.md | 4 ++-- package.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 709b708c..fc587348 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ Changelog ========= -v1.2.0 + +v1.2.2 ------ - Add Typescript definitions (#277 @Charrondev) +- Fixes for TS definitions (#294 @jdhungtington, #296 @ajaska) v1.1.0 ------ diff --git a/README.md b/README.md index 653d54a1..7c93b263 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,10 @@ Thanks to @clemmy and @alexkrolick for landing this much-awaited change. There a --- -🎧 **Latest published package version: `v1.2.0`** +🎧 **Latest published package version: `v1.2.2`** ```sh -npm install react-quill@v1.2.0 +npm install react-quill@v1.2.2 ``` Special thank you to everyone who contributed during the 1.0.0 release cycle! diff --git a/package.json b/package.json index ef9e3af4..151f07f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-quill", - "version": "1.2.1", + "version": "1.2.2", "description": "The Quill rich-text editor as a React component.", "author": "zenoamaro ", "homepage": "https://github.com/zenoamaro/react-quill", From d4c9b3c8a488112f1078ee4fe1f0f4656a69ba9f Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Tue, 28 Nov 2017 17:36:57 -0800 Subject: [PATCH 13/92] update roadmap checklist --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c93b263..5310b1c2 100644 --- a/README.md +++ b/README.md @@ -862,7 +862,7 @@ React Quill would not be where it is today without the contributions of many peo - [x] React 0.14 support - [x] Quill v1.0.0+ support - [x] Tests! -- [ ] Compatibility with React 16 +- [x] Compatibility with React 16 - [ ] Additional APIs for working with Quill ## License From b871de59afe13cda3a99ed4e5b597c0638f0b429 Mon Sep 17 00:00:00 2001 From: Juan Bernal Date: Mon, 4 Dec 2017 18:21:54 -0500 Subject: [PATCH 14/92] Modules toolbar typings (#298) * Added Formats type and toolbar types. * Format changes. * Aligned modules with Quill.StringMap The modules now inherit from Quill. --- types.d.ts | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/types.d.ts b/types.d.ts index 38544f5d..285341c9 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1,32 +1,14 @@ import * as React from "react"; import * as Quill from "quill"; -type ToolbarOptionItem = string | string[] | Object[]; - -interface ToolbarOptionObject { - container: string; - handlers?: { - [key: string]: Function; - }; -} - -export interface Modules { - /** - * @deprecated - * 'Since v1.0.0, React Quill will not create a custom toolbar for you anymore. - * Create a toolbar explictly, or let Quill create one. - * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100 - */ - toolbar?: never; -} - export interface UnprivilegedEditor { getLength(): number; - getText(index?: number, length?: number): string; + getText(index?: number, length?: number): string; getHTML(): string; getBounds(index: number, length?: number): Quill.BoundsStatic; - getSelection(focus?: boolean): Quill.RangeStatic; - getContents(index?: number, length?: number): Quill.DeltaStatic;} + getSelection(focus?: boolean): Quill.RangeStatic; + getContents(index?: number, length?: number): Quill.DeltaStatic; +} export interface ComponentProps { id?: string; @@ -48,7 +30,7 @@ export interface ComponentProps { onKeyUp?: React.EventHandler; formats?: string[]; children?: React.ReactElement; - modules?: Modules; + modules?: Quill.StringMap; /** @deprecated * The `toolbar` prop has been deprecated. Use `modules.toolbar` instead. @@ -61,7 +43,7 @@ export interface ComponentProps { * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100 */ - styles?: never; + styles?: never; /** * @deprecated * The `pollInterval` property does not have any effect anymore. @@ -77,22 +59,6 @@ export default class Component extends React.Component { getEditor(): Quill.Quill; } -export interface ToolbarItem { - type: string; - label?: string; - value?: string; - items?: ToolbarItem[]; -} - -export interface ToolbarProps { - id?: string; - className?: string; - style?: Object; - items?: ToolbarItem[]; -} - -export class Toolbar extends React.Component {} - export interface Mixin { createEditor(element: HTMLElement, config: Quill.QuillOptionsStatic): Quill.Quill; hookEditor(editor: Quill.Quill): void; From 6772165b209646ac39388182c500faa9c15482c3 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Mon, 4 Dec 2017 15:23:42 -0800 Subject: [PATCH 15/92] v1.2.3 --- README.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5310b1c2..9e98c5ce 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Thanks to @clemmy and @alexkrolick for landing this much-awaited change. There a --- -🎧 **Latest published package version: `v1.2.2`** +🎧 **Latest published package version: `v1.2.3`** ```sh npm install react-quill@v1.2.2 diff --git a/package.json b/package.json index 151f07f4..c8b1057c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-quill", - "version": "1.2.2", + "version": "1.2.3", "description": "The Quill rich-text editor as a React component.", "author": "zenoamaro ", "homepage": "https://github.com/zenoamaro/react-quill", From 327cf014b6a61d3667c67f8554964e70f37a4422 Mon Sep 17 00:00:00 2001 From: Matt Kunze Date: Thu, 15 Feb 2018 14:59:31 -0700 Subject: [PATCH 16/92] Only restore selection if editor has focus (#312) in `setEditorContents`. Prevents component from stealing focus if content changes when the editor isn't focused --- src/mixin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mixin.js b/src/mixin.js index 4c418275..ed0d6853 100644 --- a/src/mixin.js +++ b/src/mixin.js @@ -63,14 +63,14 @@ var QuillMixin = { */ setEditorContents: function(editor, value) { var sel = editor.getSelection(); - + if (typeof value === 'string') { editor.clipboard.dangerouslyPasteHTML(value); } else { editor.setContents(value); } - if (sel) this.setEditorSelection(editor, sel); + if (sel && editor.hasFocus()) this.setEditorSelection(editor, sel); }, setEditorSelection: function(editor, range) { From aeb0af6283e850ca4be66e4f606dee0bd793b67e Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 15 Feb 2018 14:03:48 -0800 Subject: [PATCH 17/92] Update README.md --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9e98c5ce..e836f34c 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,9 @@ Thanks to @clemmy and @alexkrolick for landing this much-awaited change. There a --- -🎧 **Latest published package version: `v1.2.3`** - ```sh -npm install react-quill@v1.2.2 +npm install react-quill +yarn add react-quill ``` Special thank you to everyone who contributed during the 1.0.0 release cycle! @@ -755,6 +754,10 @@ Please check the browser support table for the upstream [Quill](https://github.c ## Changelog +### v1.2.4 + +- Only restore focus if editor had focus (#312 @MattKunze) + ### v1.2.0 - Add Typescript definitions (#277 @Charrondev) @@ -856,6 +859,7 @@ React Quill would not be where it is today without the contributions of many peo - @rpellerin - @sandbochs - @wouterh +- @MattKunze ## Roadmap From 69b10b3d62d17664be68857eb301a0d362606141 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 15 Feb 2018 14:05:37 -0800 Subject: [PATCH 18/92] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc587348..74ca9bfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +v1.2.4 +------ + +- Only restore focus if editor had focus (#312 @MattKunze) + v1.2.2 ------ From 3c15731b56d937bc1785bad9a15c8cd954f3e169 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Thu, 15 Feb 2018 14:00:27 -0800 Subject: [PATCH 19/92] v1.2.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8b1057c..b65a94d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-quill", - "version": "1.2.3", + "version": "1.2.4", "description": "The Quill rich-text editor as a React component.", "author": "zenoamaro ", "homepage": "https://github.com/zenoamaro/react-quill", From af34e52d8574737bb768e1517dc4610bee65db33 Mon Sep 17 00:00:00 2001 From: Jet Zhou Date: Sun, 25 Feb 2018 20:43:08 -0800 Subject: [PATCH 20/92] Fix issue with unnecessary editor focus on mount (#321) --- src/mixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixin.js b/src/mixin.js index ed0d6853..56b2e451 100644 --- a/src/mixin.js +++ b/src/mixin.js @@ -65,7 +65,7 @@ var QuillMixin = { var sel = editor.getSelection(); if (typeof value === 'string') { - editor.clipboard.dangerouslyPasteHTML(value); + editor.setContents(editor.clipboard.convert(value)); } else { editor.setContents(value); } From 8fb198860a424fa56d1c1d519d4e17857f1fd6a2 Mon Sep 17 00:00:00 2001 From: Ty Le Date: Mon, 26 Feb 2018 15:46:15 +1100 Subject: [PATCH 21/92] Replaced React.DOM with react-dom-factories (#319) --- src/toolbar.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/toolbar.js b/src/toolbar.js index 98551f1e..07c3e68c 100644 --- a/src/toolbar.js +++ b/src/toolbar.js @@ -102,7 +102,7 @@ var QuillToolbar = createClass({ }, renderGroup: function(item, key) { - return React.DOM.span({ + return DOM.span({ key: item.label || key, className:'ql-formats' }, item.items.map(this.renderItem) @@ -110,7 +110,7 @@ var QuillToolbar = createClass({ }, renderChoiceItem: function(item, key) { - return React.DOM.option({ + return DOM.option({ key: item.label || item.value || key, value: item.value }, item.label @@ -126,11 +126,11 @@ var QuillToolbar = createClass({ className: 'ql-'+item.type, value: selectedItem.value, }; - return React.DOM.select(attrs, choiceItems); + return DOM.select(attrs, choiceItems); }, renderButton: function(item, key) { - return React.DOM.button({ + return DOM.button({ type: 'button', key: item.label || item.value || key, value: item.value, @@ -141,7 +141,7 @@ var QuillToolbar = createClass({ }, renderAction: function(item, key) { - return React.DOM.button({ + return DOM.button({ key: item.label || item.value || key, className: 'ql-'+item.type, title: item.label }, From 8efbe4842a7cb541f6e93855e4b574f297632530 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 25 Feb 2018 20:49:41 -0800 Subject: [PATCH 22/92] Link to changelog directly --- README.md | 78 +------------------------------------------------------ 1 file changed, 1 insertion(+), 77 deletions(-) diff --git a/README.md b/README.md index e836f34c..efecfddd 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ See a [live demo] or [Codepen](http://codepen.io/alexkrolick/pen/xgyOXQ/left?edi 1. [Browser support](#browser-support) 1. [Building and testing](#building-and-testing) 1. [Bundling with Webpack](#bundling-with-webpack) -1. [Changelog](#changelog) +1. [Changelog](./Changelog.md) 1. [Contributors](#contributors) 1. [License](#license) @@ -754,84 +754,8 @@ Please check the browser support table for the upstream [Quill](https://github.c ## Changelog -### v1.2.4 - -- Only restore focus if editor had focus (#312 @MattKunze) - -### v1.2.0 - -- Add Typescript definitions (#277 @Charrondev) - -### v1.1.0 -- Add support for React 16 and onwards by depending on `prop-types` and `create-react-class` (#181 @mikecousins) -- Allow setting contents with a Quill Delta via the `value` prop (#101) -- Add onFocus/onBlur props (#110) -- Add tabindex support (#232) - -#### v1.0.0 -This release adds support for Quill v1.0.0+. ⚠️ There are many breaking changes, both in Quill and in ReactQuill. See [Upgrading to React-Quill v1.0.0](#upgrading-to-react-quill-v100). - -- Updated to support Quill v1.0.0+ (@clemmy, @alexkrolick) -- Bundling Quill with ReactQuill (@clemmy) -- Bundling CSS files in the NPM package -- Removed `dist` from source control (@alexkrolick) -- Deprecated `toolbar` property and component -- Deprecated the `styles` property -- Deprecated custom formats via the `formats` property -- Deprecated the `pollInterval` property -- Rerendering on `style` property change (@lavrton) -- Improved docs for `bounds`, which now rerenders on change -- Performing deep props comparison to avoid rerenders -- Fixed the unprivileged editor not returning values -- Restoring selection event after text change -- Fixed the order of parameters in change events (@webcarrot) -- Using 'core' instead of 'base' CSS (@alexkrolick) -- Added support for the `placeholder` property (@alexkrolick) -- Enable/disable editor using top-level Quill API (@alexkrolick) -- Prevent whitespace issues when initializing the editor (@bobrafie) -- Using buttons instead of spans for toolbar actions (@clemmy) -- Removed getHtml from unprivileged editor (@clemmy) -- Fixed calculations for range fields (@clemmy) -- Removed deprecated destroy functionality (@clemmy) -- Added return statement to proxy editor methods (@druti) -- Inline styles support for Quill Toolbar (@e-jigsaw) -- Fixed custom font size definitions (@clemmy) -- Support for bullet and ordered lists in toolbar (@clemmy) -- Updated the toolbar alignment section (@clemmy) -- Updated rendering of toolbar actions (@clemmy) -- Improved toolbar renderChoices implementation (@zhang-z) -- Fixed use of `defaultValue` in Toolbar selects -- Fixed bounds validation in setEditorSelection (@wouterh) -- Exposed Quill in exports (@tdg5) -- Added unhook function to clean up event listeners on unmount (@alexkrolick, @jrmmnr) -- Fixed documentation typos (@l3kn) -- Started testing with Enzyme (@alexkrolick) -- Fixed issue where changing props caused re-render artifacts (#147) -- Fixed bounds validation in setEditorSelection (@wouterh) -- Updated README.md to reference core.css instead of base.css (@sandbochs) -- Updated React peerDependency (@rpellerin) -- Removed inline Parchment formats for font-size and font-family (#217) - -#### v0.4.1 -- Added contents of `dist` to NPM package. - -#### v0.4.0 -This release adds support for React 0.14. ⚠️ Shims to support older versions of React have been removed. - -- React 0.14 support (@jacktrades, #49) -- Removed shims for React 0.12 and 0.13 -- Bumped Quill.js to v0.20.1 -- _Normal_ and _smaller_ sizes are not swapped anymore. (#63) -- Various toolbar choice items are now correctly ordered. -- Added image tooltips to the default set of modules (@kairxa, #54) -- Fixed extra white-space in classnames (@asiniy, #67) -- Published the Quill namespace on ReactQuill (@Sajam, #60) -- Quill stylesheets are now linked to `dist/` for convenience. (#70) -- Exposed editor accessor methods in change events. (#33) - [Full changelog](CHANGELOG.md) - ## Contributors React Quill would not be where it is today without the contributions of many people, which we are incredibly grateful for: From 281e6d27d1ae5e26355022a6e1dbe37c47d7d7bb Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 25 Feb 2018 20:50:39 -0800 Subject: [PATCH 23/92] Fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index efecfddd..6243ff52 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ See a [live demo] or [Codepen](http://codepen.io/alexkrolick/pen/xgyOXQ/left?edi 1. [Browser support](#browser-support) 1. [Building and testing](#building-and-testing) 1. [Bundling with Webpack](#bundling-with-webpack) -1. [Changelog](./Changelog.md) +1. [Changelog](./CHANGELOG.md) 1. [Contributors](#contributors) 1. [License](#license) From 37123dcd330d8f675b5787d2ecd0d6d32e2cb6cc Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 25 Feb 2018 20:53:06 -0800 Subject: [PATCH 24/92] Update CHANGELOG.md --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74ca9bfb..c83807f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ Changelog ========= +v1.2.6 +------ + +Replaced React.DOM with react-dom-factories (#319 thienanle) + +v1.2.5 +------ + +- Fix issue with unnecessary editor focus on mount (#321 jetzhou) +- Switch to Quill's clipboard.convert from the paste API that now grabs focus automatically + v1.2.4 ------ From 4509e0caacbaf126b74a0004afff833bb320baa9 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 25 Feb 2018 22:40:34 -0800 Subject: [PATCH 25/92] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6243ff52..ff12618c 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ function insertStar () { */ const CustomToolbar = () => (
- e.persist()}> From edfb1e55510512e58127304e2958808599728b69 Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 4 Apr 2018 00:47:09 +0800 Subject: [PATCH 26/92] Change types to top level export (#349) --- types.d.ts | 136 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 80 insertions(+), 56 deletions(-) diff --git a/types.d.ts b/types.d.ts index 285341c9..3d4915b2 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1,70 +1,94 @@ import * as React from "react"; import * as Quill from "quill"; -export interface UnprivilegedEditor { - getLength(): number; - getText(index?: number, length?: number): string; - getHTML(): string; - getBounds(index: number, length?: number): Quill.BoundsStatic; - getSelection(focus?: boolean): Quill.RangeStatic; - getContents(index?: number, length?: number): Quill.DeltaStatic; -} +declare namespace ReactQuill { + export interface UnprivilegedEditor { + getLength(): number; + getText(index?: number, length?: number): string; + getHTML(): string; + getBounds(index: number, length?: number): Quill.BoundsStatic; + getSelection(focus?: boolean): Quill.RangeStatic; + getContents(index?: number, length?: number): Quill.DeltaStatic; + } + + export interface ComponentProps { + id?: string; + className?: string; + theme?: string; + style?: React.CSSProperties; + readOnly?: boolean; + value?: string | Quill.Delta; + defaultValue?: string | Quill.Delta; + placeholder?: string; + tabIndex?: number; + bounds?: string | HTMLElement; + onChange?: ( + content: string, + delta: Quill.Delta, + source: Quill.Sources, + editor: UnprivilegedEditor + ) => void; + onChangeSelection?: ( + range: Quill.RangeStatic, + source: Quill.Sources, + editor: UnprivilegedEditor + ) => void; + onFocus?: ( + range: Quill.RangeStatic, + source: Quill.Sources, + editor: UnprivilegedEditor + ) => void; + onBlur?: ( + previousRange: Quill.RangeStatic, + source: Quill.Sources, + editor: UnprivilegedEditor + ) => void; + onKeyPress?: React.EventHandler; + onKeyDown?: React.EventHandler; + onKeyUp?: React.EventHandler; + formats?: string[]; + children?: React.ReactElement; + modules?: Quill.StringMap; -export interface ComponentProps { - id?: string; - className?: string; - theme?: string; - style?: React.CSSProperties; - readOnly?: boolean; - value?: string | Quill.Delta; - defaultValue?: string | Quill.Delta; - placeholder?: string; - tabIndex?: number; - bounds?: string | HTMLElement; - onChange?: (content: string, delta: Quill.Delta, source: Quill.Sources, editor: UnprivilegedEditor) => void; - onChangeSelection?: (range: Quill.RangeStatic, source: Quill.Sources, editor: UnprivilegedEditor) => void; - onFocus?: (range: Quill.RangeStatic, source: Quill.Sources, editor: UnprivilegedEditor) => void; - onBlur?: (previousRange: Quill.RangeStatic, source: Quill.Sources, editor: UnprivilegedEditor) => void; - onKeyPress?: React.EventHandler; - onKeyDown?: React.EventHandler; - onKeyUp?: React.EventHandler; - formats?: string[]; - children?: React.ReactElement; - modules?: Quill.StringMap; + /** @deprecated + * The `toolbar` prop has been deprecated. Use `modules.toolbar` instead. + * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100. + * */ - /** @deprecated - * The `toolbar` prop has been deprecated. Use `modules.toolbar` instead. - * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100. - * */ + toolbar?: never; + /** @deprecated + * The `styles` prop has been deprecated. Use custom stylesheets instead. + * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100 + */ - toolbar?: never; - /** @deprecated - * The `styles` prop has been deprecated. Use custom stylesheets instead. - * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100 - */ + styles?: never; + /** + * @deprecated + * The `pollInterval` property does not have any effect anymore. + * You can safely remove it from your props. + * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100. + */ + pollInterval?: never; + } - styles?: never; - /** - * @deprecated - * The `pollInterval` property does not have any effect anymore. - * You can safely remove it from your props. - * See: https://github.com/zenoamaro/react-quill#upgrading-to-react-quill-v100. - */ - pollInterval?: never; + export interface Mixin { + createEditor( + element: HTMLElement, + config: Quill.QuillOptionsStatic + ): Quill.Quill; + hookEditor(editor: Quill.Quill): void; + unhookEditor(editor: Quill.Quill): void; + setEditorReadOnly(editor: Quill.Quill, value: boolean): void; + setEditorContents(editor: Quill.Quill, value: Quill.Delta | string): void; + setEditorSelection(editor: Quill.Quill, range: Quill.RangeStatic): void; + makeUnprivilegedEditor(editor: Quill.Quill): UnprivilegedEditor; + } } -export default class Component extends React.Component { +declare class ReactQuill extends React.Component { focus(): void; blur(): void; getEditor(): Quill.Quill; } -export interface Mixin { - createEditor(element: HTMLElement, config: Quill.QuillOptionsStatic): Quill.Quill; - hookEditor(editor: Quill.Quill): void; - unhookEditor(editor: Quill.Quill): void; - setEditorReadOnly(editor: Quill.Quill, value: boolean): void; - setEditorContents(editor: Quill.Quill, value: Quill.Delta | string): void; - setEditorSelection(editor: Quill.Quill, range: Quill.RangeStatic): void; - makeUnprivilegedEditor(editor: Quill.Quill): UnprivilegedEditor; -} +export = ReactQuill; From 23514c283ec161af7c9b992b9f5922c9ae68cda6 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Tue, 3 Apr 2018 09:49:39 -0700 Subject: [PATCH 27/92] v1.2.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b65a94d3..7ea6da97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-quill", - "version": "1.2.4", + "version": "1.2.7", "description": "The Quill rich-text editor as a React component.", "author": "zenoamaro ", "homepage": "https://github.com/zenoamaro/react-quill", From 6ebfe49912dad6a1c6cff570dd1b2c8abd00ea54 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Tue, 3 Apr 2018 10:08:47 -0700 Subject: [PATCH 28/92] Add note about updating placeholder --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff12618c..29363b3b 100644 --- a/README.md +++ b/README.md @@ -569,7 +569,7 @@ import ReactQuill, { Quill, Mixin, Toolbar } from 'react-quill'; // ES6 : If true, the editor won't allow changing its contents. Wraps the Quill [`disable` API](https://quilljs.com/docs/api/#enable). `placeholder` -: The default value for the empty editor. +: The default value for the empty editor. Note: The Quill API does not support changing this value dynamically. Use refs and data-attributes instead (see [#340](https://github.com/zenoamaro/react-quill/issues/340#issuecomment-376176878)). `modules` : An object specifying which modules are enabled, and their configuration. The editor toolbar is a commonly customized module. See the [modules section](http://quilljs.com/docs/modules/) over the Quill documentation for more information on what modules are available. From fdf8525c9123a26d786ce6c2aceb5a567e202d77 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Thu, 5 Apr 2018 19:56:35 -0700 Subject: [PATCH 29/92] Add TS import example code --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29363b3b..3ad3bbaa 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,9 @@ His contributions have been incredible so far, and his passion and dedication wi ### Import the component ```jsx -const ReactQuill = require('react-quill'); // CommonJS import ReactQuill from 'react-quill'; // ES6 +import * as ReactQuill from 'react-quill'; // Typescript +const ReactQuill = require('react-quill'); // CommonJS ``` ### Import the stylesheet From 95ca0035ebf86ae055f1fa7fdf9ba4e02a4e4a67 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Thu, 5 Apr 2018 20:10:49 -0700 Subject: [PATCH 30/92] Add note about custom editing areas w/React 16 See #309 This _may_ be related to a change in React 16: https://github.com/facebook/react/blob/master/CHANGELOG.md#breaking-changes --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3ad3bbaa..91301b75 100644 --- a/README.md +++ b/README.md @@ -372,6 +372,8 @@ class MyComponent extends React.Component { If you instantiate ReactQuill without children, it will create a `
` for you, to be used as the editing area for Quill. If you prefer, you can specify your own element for ReactQuill to use. Note that `