Skip to content

Commit

Permalink
Merge branch 'develop' into zh-table-ot
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Mar 3, 2022
2 parents 4313e90 + 0f20a58 commit fbb887b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ class Quill {
Quill.sources.USER,
);
});
const contents = this.clipboard.convert({
html: `${html}<p><br></p>`,
text: '\n',
});
this.setContents(contents);
if (html) {
const contents = this.clipboard.convert({
html: `${html}<p><br></p>`,
text: '\n',
});
this.setContents(contents);
}
this.history.clear();
if (this.options.placeholder) {
this.root.setAttribute('data-placeholder', this.options.placeholder);
Expand Down
6 changes: 6 additions & 0 deletions core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ class Selection {
}

getRange() {
const root = this.scroll.domNode;
if ('isConnected' in root && !root.isConnected) {
// document.getSelection() forces layout on Blink, so we trend to
// not calling it.
return [null, null];
}
const normalized = this.getNativeRange();
if (normalized == null) return [null, null];
const range = this.normalizedToRange(normalized);
Expand Down

0 comments on commit fbb887b

Please sign in to comment.