文档升级到 2.0

升级到 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/quill installed, 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 已移除

    ¥strict removed

    以前,一些实际操作中很小的更改(重命名),但需要进行语义版本重大改进,会在此配置下隐藏。最终,这带来的困惑大于帮助,因为我们将不再使用它。

    ¥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 已移除

    ¥scrollingContainer removed

    Quill 现在会自动检测可滚动的祖级元素,无需提供此选项。这种新行为更加健壮,并且可以与嵌套的可滚​​动元素无缝协作。

    ¥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 和文本,并且先前的功能被拆分为多个方法调用(convertonCapturePaste),以便提供更多接口。

    ¥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 渲染器已不再可用。

    ¥matchVisual removed - 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 的弃用别名。

    ¥pasteHTML removed - Deprecated alias to dangerouslyPasteHTML.

键盘

¥Keyboard

  • 绑定 key 不再区分大小写。为了支持像 key: '@' 这样的绑定,修饰符会被考虑在内,因此 shift 修饰符会影响大小写敏感度。

    ¥Binding key is no longer case insensitive. To support bindings like key: '@', modifiers are taken into account so the shift modifier will affect case sensitivity.

  • 绑定 key 现在支持键数组,可轻松绑定到多个快捷键。

    ¥Binding key now 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 register method added to allow dependent chains of registration.

  • 静态 formats 方法现在传入 scroll

    ¥Static formats method now passes in scroll.

  • Blot 构造函数现在需要传入 scroll

    ¥Blot constructor now requires scroll to be passed in.

  • 属性器作为顶层类导出。

    ¥Attributors are exported as top-level classes.

    现在使用 Parchment.ClassAttributor,而不是通过 Parchment.Attributor.Class 访问类属性。同样,Parchment.Attributor.Style 现在是 Parchment.StyleAttributorParchment.Attributor.Attribute 现在是 Parchment.Attributor

    ¥Instead of accessing class attributor via Parchment.Attributor.Class, you now use it at Parchment.ClassAttributor. Similarly, Parchment.Attributor.Style is now Parchment.StyleAttributor, and Parchment.Attributor.Attribute is now Parchment.Attributor.

  • 导出使用全名。

    ¥Exports are using full names.

    现在使用 Parchment.ScrollBlot,而不是 Parchment.Scroll。类似的变化适用于 Parchment.EmbedParchment.TextParchment.BlockParchment.Inline 等。

    ¥Instead of Parchment.Scroll, you now use Parchment.ScrollBlot. The similar change applies to Parchment.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.