Preserve formatting on entering newline

Restoring behavior removed here: https://github.com/slab/quill/pull/3428
This commit is contained in:
Scott Nonnenberg 2025-01-23 13:16:38 -10:00
parent f6eeddde2d
commit 2a0bd6dda2

View File

@ -350,6 +350,13 @@ class Keyboard extends Module<KeyboardOptions> {
this.quill.updateContents(delta, Quill.sources.USER);
this.quill.setSelection(range.index + 1, Quill.sources.SILENT);
this.quill.focus();
Object.keys(context.format).forEach((name) => {
if (lineFormats[name] != null) return;
if (Array.isArray(context.format[name])) return;
if (name === 'code' || name === 'link') return;
this.quill.format(name, context.format[name], Quill.sources.USER);
});
}
}