Better handling of formatting in pasted text

This commit is contained in:
Scott Nonnenberg 2023-05-23 15:00:05 -07:00 committed by GitHub
parent d012779e87
commit a31cf5645e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 105 additions and 43 deletions

View file

@ -1,5 +1,5 @@
diff --git a/node_modules/@formatjs/intl/src/types.d.ts b/node_modules/@formatjs/intl/src/types.d.ts
index 1f73905..9abaacd 100644
index e36094c..2ee473e 100644
--- a/node_modules/@formatjs/intl/src/types.d.ts
+++ b/node_modules/@formatjs/intl/src/types.d.ts
@@ -8,10 +8,8 @@ import { DEFAULT_INTL_CONFIG } from './utils';

View file

@ -1,5 +1,5 @@
diff --git a/node_modules/quill/dist/quill.js b/node_modules/quill/dist/quill.js
index 811b3d0..313f301 100644
index 811b3d0..b31c7fd 100644
--- a/node_modules/quill/dist/quill.js
+++ b/node_modules/quill/dist/quill.js
@@ -8916,10 +8916,10 @@ var Clipboard = function (_Module) {
@ -72,7 +72,20 @@ index 811b3d0..313f301 100644
var style = computeStyle(node);
- return ['block', 'list-item'].indexOf(style.display) > -1;
+ // return ['block', 'list-item'].indexOf(style.display) > -1;
+ return ['block', 'list-item'].indexOf(style.display) > -1 || node.nodeName === 'DIV' || node.nodeName === 'P';
+ return ['block', 'list-item'].indexOf(style.display) > -1 || node.nodeName === 'DIV' || node.nodeName === 'P' || node.nodeName === 'TIME';
}
function traverse(node, elementMatchers, textMatchers) {
@@ -9177,8 +9183,10 @@ function matchIndent(node, delta) {
}
function matchNewline(node, delta) {
- if (!deltaEndsWith(delta, '\n')) {
- if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
+ // if (!deltaEndsWith(delta, '\n')) {
+ if (!deltaEndsWith(delta, '\n\n')) {
+ // if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
+ if (delta.length() > 0 && isLine(node)) {
delta.insert('\n');
}
}