Skip to content

Commit

Permalink
Merge pull request #6429 from melloware/PR5960-editor
Browse files Browse the repository at this point in the history
Fix #5960: Quill 2.0.0 support
  • Loading branch information
nitrogenous authored Apr 29, 2024
2 parents 0830867 + 0ae5805 commit 689cdf6
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 153 deletions.
5 changes: 1 addition & 4 deletions components/doc/editor/accessibilitydoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { DocSectionText } from '@/components/doc/common/docsectiontext';
export function AccessibilityDoc() {
return (
<DocSectionText id="accessibility" label="Accessibility">
<p>
Quill performs generally well in terms of accessibility. The elements in the toolbar can be tabbed and have the necessary ARIA roles/attributes for screen readers. One known limitation is the lack of arrow key support for{' '}
<a href="https://github.com/quilljs/quill/issues/1031">dropdowns</a> in the toolbar that may be overcome with a custom toolbar.
</p>
<p>Quill performs generally well in terms of accessibility. The elements in the toolbar can be tabbed and have the necessary ARIA roles/attributes for screen readers.</p>
</DocSectionText>
);
}
2 changes: 1 addition & 1 deletion components/doc/editor/basicdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function BasicDemo() {
<div className="card">
<Editor value={text} onTextChange={(e) => setText(e.htmlValue)} style={{ height: '320px' }} />
</div>
<DocSectionCode code={code} dependencies={{ quill: '1.3.7' }} />
<DocSectionCode code={code} dependencies={{ quill: '2.0.0' }} />
</>
);
}
2 changes: 1 addition & 1 deletion components/doc/editor/readonlydoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function ReadOnlyDemo() {
<div className="card">
<Editor value="Always bet on Prime!" readOnly style={{ height: '320px' }} />
</div>
<DocSectionCode code={code} dependencies={{ quill: '1.3.7' }} />
<DocSectionCode code={code} dependencies={{ quill: '2.0.0' }} />
</>
);
}
2 changes: 1 addition & 1 deletion components/doc/editor/templatedoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function TemplateDemo() {
<div className="card">
<Editor value={text} onTextChange={(e) => setText(e.htmlValue)} headerTemplate={header} style={{ height: '320px' }} />
</div>
<DocSectionCode code={code} dependencies={{ quill: '1.3.7' }} />
<DocSectionCode code={code} dependencies={{ quill: '2.0.0' }} />
</>
);
}
2 changes: 1 addition & 1 deletion components/doc/editor/theming/tailwinddoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function UnstyledDemo() {
</p>
<DocSectionCode code={code} hideToggleCode import hideStackBlitz />
<p>A playground sample with the pre-built Tailwind theme.</p>
<DocSectionCode code={code2} embedded dependencies={{ quill: '1.3.7' }} />
<DocSectionCode code={code2} embedded dependencies={{ quill: '2.0.0' }} />
</DocSectionText>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions components/lib/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const Editor = React.memo(
quill.current = quillInstance;

if (props.value) {
quill.current.setContents(quill.current.clipboard.convert(props.value));
quill.current.clipboard.dangerouslyPasteHTML(props.value);
}

setQuillCreated(true);
Expand Down Expand Up @@ -151,7 +151,7 @@ export const Editor = React.memo(

useUpdateEffect(() => {
if (quill.current && !quill.current.hasFocus()) {
props.value ? quill.current.setContents(quill.current.clipboard.convert(props.value)) : quill.current.setText('');
props.value ? quill.current.clipboard.dangerouslyPasteHTML(props.value) : quill.current.setText('');
}
}, [props.value]);

Expand Down
78 changes: 0 additions & 78 deletions components/lib/editor/Editor.spec.js

This file was deleted.

Loading

0 comments on commit 689cdf6

Please sign in to comment.