Setting `formats` on quill with quill-blot-formatter breaks alignment.
Hello, I have encountered an issue.
When I try to set the `formats` parameter on a Quill instance (so that only some select formats are available) the alignment stops working.
I tried adding `'imageAlign', 'iframeAlign'` to the formats which sometimes works, but most of the times it shows an error in the console.
```
logger.ts:8 quill Cannot register "imageAlign" specified in "formats" config. Are you sure it was registered?
logger.ts:8 quill Cannot register "iframeAlign" specified in "formats" config. Are you sure it was registered?
```
A minimalistic app that shows the issue is as follows:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESM Blot Formatter Demo</title>
<link href="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.snow.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/@enzedonline/quill-blot-formatter2@3.0/dist/css/quill-blot-formatter2.css" rel="stylesheet">
<style>
body {
font-family: Helvetica, Arial, sans-serif;
}
#quill-editor {
overflow: clip;
height: 400px;
}
</style>
</head>
<body>
<div id="quill-editor"></div>
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@enzedonline/quill-blot-formatter2@3.0/dist/index.js"></script>
<script>
Quill.register('modules/blotFormatter2', window.QuillBlotFormatter2.default);
window.quill = new Quill("#quill-editor", {
modules: {
toolbar: [
// Removed most of the default toolbar options --->>>
["bold"],
["image"]
],
blotFormatter2: {
debug: true
}
},
// Set custom formats ->>>
// formats: ["bold", "image"],
// I have Also tried adding these two formats, but still no luck
formats: ["bold", "image", "iframeAlign", "imageAlign"],
placeholder: "Compose an epic...",
theme: "snow"
});
</script>
</body>
</html>
```
Any help would be appreciated!!!
My workaround now is just not using the `formats` field at all...
关闭于 2026-05-15 5 条评论