升级到 2.0
Quill 已显著现代化。利用最新的浏览器支持的 API,Quill 现在提供了更高效、更可靠的编辑体验。
¥Quill has been significantly modernized. Leveraging the latest browser-supported APIs, Quill now delivers a more efficient and reliable editing experience.
Quill
Quill 代码库已使用 TypeScript 重写,并提供了官方的 TypeScript 定义文件。
¥The Quill repository has been rewritten in TypeScript, providing an official TypeScript definition file.
-
如果你已安装
@types/quill,请将其卸载,因为它不再需要。¥If you have
@types/quillinstalled, uninstall it, as it is no longer needed -
SVG 图标现在已内联到源代码中,无需在打包器中为 .svg 文件设置加载器。
¥SVG icons are now inlined in the source code, eliminating the need to set up loaders for .svg files in your bundler.
选项
¥Options
-
strict已移除¥
strictremoved以前,一些实际操作中很小的更改(重命名),但需要进行语义版本重大改进,会在此配置下隐藏。最终,这带来的困惑大于帮助,因为我们将不再使用它。
¥Previously some changes that were small in practice (renames) but would warrant a semver major bump would be hidden under this configuration. This ended up being more confusing than helpful as we will no longer make use of this.
-
registry- 添加此函数是为了允许多个具有不同格式的编辑器在同一页面上共存。学习更多。¥
registry- added to allow multiple editors with different formats to coexist on the same page. Learn more. -
scrollingContainer已移除¥
scrollingContainerremovedQuill 现在会自动检测可滚动的祖级元素,无需提供此选项。这种新行为更加健壮,并且可以与嵌套的可滚动元素无缝协作。
¥Quill will now automatically detect the scrollable ancestor, eliminating the need to provide this option. This new behavior is more robust and works seamlessly with nested scrollable elements.
剪贴板
¥Clipboard
-
convert- API 已更改为同时包含 HTML 和文本,并且先前的功能被拆分为多个方法调用(convert、onCapturePaste),以便提供更多接口。¥
convert- API changed to include both HTML and text and previous functionality is broken into multiple method calls (convert,onCapturePaste) to allow more surface to hook into. -
onCapturePaste- 已添加¥
onCapturePaste- Added
配置
¥Configuration
-
matchVisual已移除 - 以前,你可以选择使用粘贴空格的视觉或语义解释;现在只使用语义解释。视觉匹配的开销很大,需要 DOM 渲染器,但在新的剪贴板重写中,DOM 渲染器已不再可用。¥
matchVisualremoved - Previously there was a choice between using visual or semantic interpretation of pasted whitespace; now just the semantic interpretation is used. Visual matching was expensive, requiring the DOM renderer which is no longer available in the new clipboard rewrite. -
pasteHTML已移除 -dangerouslyPasteHTML的弃用别名。¥
pasteHTMLremoved - Deprecated alias todangerouslyPasteHTML.
键盘
¥Keyboard
-
绑定
key不再区分大小写。为了支持像key: '@'这样的绑定,修饰符会被考虑在内,因此 shift 修饰符会影响大小写敏感度。¥Binding
keyis no longer case insensitive. To support bindings likekey: '@', modifiers are taken into account so the shift modifier will affect case sensitivity. -
绑定
key现在支持键数组,可轻松绑定到多个快捷键。¥Binding
keynow supports an array of keys to easily bind to multiple shortcuts. -
原生键盘事件对象现在也会传递到处理程序中。
¥Native keyboard event object is now also passed into handlers.
羊皮纸
¥Parchment
-
所有列表都使用
<ol>而不是<ul>和<ol>,以便更好地在两者之间嵌套。复制的内容将生成正确的语义标记,以便粘贴到其他应用中。¥All lists use
<ol>instead of both<ul>and<ol>allowing better nesting between the two. Copied content will generate the correct semantic markup for paste into other applications. -
代码块标记现在使用
<div>来更好地支持语法高亮。¥Code block markup now uses
<div>to better support syntax highlighting. -
添加静态
register方法,允许依赖注册链。¥Static
registermethod added to allow dependent chains of registration. -
静态
formats方法现在传入scroll。¥Static
formatsmethod now passes inscroll. -
Blot 构造函数现在需要传入
scroll。¥Blot constructor now requires
scrollto be passed in. -
属性器作为顶层类导出。
¥Attributors are exported as top-level classes.
现在使用
Parchment.ClassAttributor,而不是通过Parchment.Attributor.Class访问类属性。同样,Parchment.Attributor.Style现在是Parchment.StyleAttributor,Parchment.Attributor.Attribute现在是Parchment.Attributor。¥Instead of accessing class attributor via
Parchment.Attributor.Class, you now use it atParchment.ClassAttributor. Similarly,Parchment.Attributor.Styleis nowParchment.StyleAttributor, andParchment.Attributor.Attributeis nowParchment.Attributor. -
导出使用全名。
¥Exports are using full names.
现在使用
Parchment.ScrollBlot,而不是Parchment.Scroll。类似的变化适用于Parchment.Embed、Parchment.Text、Parchment.Block、Parchment.Inline等。¥Instead of
Parchment.Scroll, you now useParchment.ScrollBlot. The similar change applies toParchment.Embed,Parchment.Text,Parchment.Block,Parchment.Inline, and more.
增量
¥Delta
-
现已移除对已弃用的 delta 格式(其中嵌入具有整数值,列表属性具有不同的键)的支持。
¥Support for the deprecated delta format, where embeds had integer values and list attributes had different keys, is now removed
浏览器
¥Browser
-
Internet Explorer 支持已取消。
¥Internet Explorer support is dropped.