# 支持响应式图片，Halo 2.19.0 发布

原文：<https://www.halo.run/archives/halo-2.19-released>

Halo 是一款强大易用的开源建站工具，它让你无需太多的技术知识就可以快速搭建一个博客、网站或者内容管理系统。具备可插拔架构、主题套用、富文本编辑器等多重特性，支持用户根据自己的喜好选择不同类型的插件及主题模板来定制化自己的站点功能及外观。让内容创作和发布更加便捷生动。

截至目前（2024 年 Q2 季度），Halo 已经在 Docker Hub 获得了超过 220 万次下载，GitHub Star 数突破 32 k，并拥有一百多名社区贡献者。

2024 年 09 月 02 日，强大易用的开源建站工具 Halo 正式发布 2.19.0 版本。

Halo 2.19.0 版本主要支持了附件图片尺寸生成和响应式图片。

## ⚠️ 重要提示

-   此版本有安全性修复，建议所有用户升级到此版本。
    
-   为了获得更好的体验，此版本的编辑器移除了代码块高亮渲染功能，改为由代码块高亮插件统一提供，建议升级到此版本之后，同时升级 [highlight.js 代码高亮](https://www.halo.run/store/apps/app-sqpgf) 插件至最新版本。
    
-   此版本新增了附件生成多尺寸图片的功能，升级到此版本之后会自动为已上传的图片生成不同尺寸的图片，这个阶段可能会导致服务运行缓慢，这属于正常现象。
    

## **亮点更新**

### 附件图片尺寸生成和响应式图片

在 Halo 2.19 中，我们为附件的图片添加了多尺寸生成的功能，用于优化网站中的图片资源访问速度。此外，我们还默认为文章中的图片添加了[响应式图片](https://developer.mozilla.org/zh-CN/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)的支持，可以在尽可能不影响显示效果的情况下根据设备尺寸自动加载合适尺寸大小的图片，最大程度降低数据请求量和加快图片加载速度。

一些图片使用场景的对比示例：

![2.19-attachments-before.png](https://www.halo.run/upload/2.19-attachments-before.png)

**2.18 附件库 🐢**

![2.19-attachments-after.png](https://www.halo.run/upload/2.19-attachments-after.png)

**2.19** **附件库 🚀**

* * *

![2.19-posts-before.png](https://www.halo.run/upload/2.19-posts-before.png)

**2.18 文章图片 🐢**

![2.19-posts-after.png](https://www.halo.run/upload/2.19-posts-after.png)

**2.19** **文章图片 🚀**

* * *

![2.19-mobile-posts-before.png](https://www.halo.run/upload/2.19-mobile-posts-before.png)

**2.18 移动端文章图片 🐢**

![2.19-mobile-posts-after.png](https://www.halo.run/upload/2.19-mobile-posts-after.png)

**2.19** **移动端文章图片 🚀**

### 附件选择器改进

在 Halo 2.19 版本中，我们优化了附件选择组件，支持了搜索、排序、布局方式切换等功能。

![](https://www.halo.run/upload/2.19-attachments-selector.png)

### 备份恢复功能改进

在 Halo 2.19 版本中，我们改进了备份恢复功能，现在支持扫描服务器的备份目录并选择实际的备份文件进行恢复，这样就可以提前将备份文件上传到待恢复的服务器，这对备份文件较大或者服务器带宽较小的场景下会非常有用，不用再因为上传问题而恢复失败，然后反复进行上传的操作。

![](https://www.halo.run/upload/2.19-restore-from-file.png)

### 编辑器代码块功能改进

在之前的版本中，编辑器的代码块功能存在以下问题：

1.  语言支持不完整，很可能出现编辑器的高亮语言在发布文章之后无法正常渲染。
    
2.  无法和常见的代码高亮插件完美适配。
    
3.  代码高亮语言包体积较大，影响页面首屏加载速度。
    

基于这些问题，Halo 2.19 对这个场景做了针对性的优化，即默认移除编辑器的代码高亮功能，只提供基本的代码块编写功能，并提供了代码块的扩展方式，可以让专门的代码块高亮插件接管。

目前 Halo 社区维护的 [highlight.js 代码高亮](https://www.halo.run/store/apps/app-sqpgf) 插件已经适配，可以实现完整的高亮语言支持，且无需再手动配置所需的额外语言，并且实现了在 Console 页面中异步加载语言包资源，防止插件捆绑包资源过大。

![](https://www.halo.run/upload/2.19-editor-code-block.png)

## **完整更新日志**

### 新特性

-   附件图片支持生成多尺寸图片，文章支持响应式图片。 by [@guqing](https://github.com/guqing) in [#6454](https://github.com/halo-dev/halo/pull/6454)
    
-   为附件选择组件添加更多筛选项支持。 by [@ruibaby](https://github.com/ruibaby) in [#6505](https://github.com/halo-dev/halo/pull/6505)
    
-   支持修改附件的显示名称。 by [@ruibaby](https://github.com/ruibaby) in [#6504](https://github.com/halo-dev/halo/pull/6504)
    
-   支持从备份目录选择文件进行恢复。 by [@JohnNiang](https://github.com/JohnNiang) in [#6486](https://github.com/halo-dev/halo/pull/6486)
    
-   Code 输入框支持全屏编辑。 by [@ruibaby](https://github.com/ruibaby) in [#6453](https://github.com/halo-dev/halo/pull/6453)
    

### 功能优化

-   优化当主题模板找不到的异常提示。 by [@JohnNiang](https://github.com/JohnNiang) in [#6511](https://github.com/halo-dev/halo/pull/6511)
    
-   在初始化页面添加使用 H2 数据库的警告。 by [@ruibaby](https://github.com/ruibaby) in [#6502](https://github.com/halo-dev/halo/pull/6502)
    
-   支持在插件变动之后（版本更新或者首次启用），提示使用者重载页面。 by [@guqing](https://github.com/guqing) in [#6470](https://github.com/halo-dev/halo/pull/6470)
    
-   使用 patch 接口重构文章的恢复、可见性修改等逻辑。 by [@ruibaby](https://github.com/ruibaby) in [#6464](https://github.com/halo-dev/halo/pull/6464)
    
-   使用 patch 接口重构页面的删除、可见性修改等逻辑。 by [@ruibaby](https://github.com/ruibaby) in [#6463](https://github.com/halo-dev/halo/pull/6463)
    
-   使用 patch 接口重构菜单项拖动排序功能。 by [@ruibaby](https://github.com/ruibaby) in [#6462](https://github.com/halo-dev/halo/pull/6462)
    
-   使用 patch 接口重构分类拖动排序功能。 by [@ruibaby](https://github.com/ruibaby) in [#6461](https://github.com/halo-dev/halo/pull/6461)
    
-   在主题预览界面中将保存按钮固定在底部。 by [@LIlGG](https://github.com/LIlGG) in [#6449](https://github.com/halo-dev/halo/pull/6449)
    
-   支持在附件库中预览 avif 类型的图片。 by [@LIlGG](https://github.com/LIlGG) in [#6446](https://github.com/halo-dev/halo/pull/6446)
    
-   完善搜索引擎过滤功能。 by [@JohnNiang](https://github.com/JohnNiang) in [#6442](https://github.com/halo-dev/halo/pull/6442)
    
-   重构用户筛选组件，支持远程搜索。 by [@ruibaby](https://github.com/ruibaby) in [#6529](https://github.com/halo-dev/halo/pull/6529)
    
-   使用重构的 Formkit Select 组件来实现业务选择器。 by [@LIlGG](https://github.com/LIlGG) in [#6525](https://github.com/halo-dev/halo/pull/6525)
    
-   简化文章设置表单的部分表单项。 by [@ruibaby](https://github.com/ruibaby) in [#6539](https://github.com/halo-dev/halo/pull/6539)
    

### 问题修复

-   使用白名单校验 a 标签的 href 用于解决潜在的安全问题。 by [@LIlGG](https://github.com/LIlGG) in [#6499](https://github.com/halo-dev/halo/pull/6499)
    
-   修复文章的上一篇下一篇链接包含了隐藏分类下的文章。 by [@guqing](https://github.com/guqing) in [#6491](https://github.com/halo-dev/halo/pull/6491)
    
-   修复切换账号登录时设备信息更新不正确的问题。 by [@guqing](https://github.com/guqing) in [#6483](https://github.com/halo-dev/halo/pull/6483)
    
-   修复有时无法给用户赋权限的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6471](https://github.com/halo-dev/halo/pull/6471)
    
-   解决预览主题时保存设置，页面会跳转至首页的问题。 by [@LIlGG](https://github.com/LIlGG) in [#6447](https://github.com/halo-dev/halo/pull/6447)
    
-   解决默认编辑器中在空白行中按退格键无法回退到列表项中的问题。 by [@LIlGG](https://github.com/LIlGG) in [#6445](https://github.com/halo-dev/halo/pull/6445)
    
-   修复获取用户列表时可能返回空结果的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6532](https://github.com/halo-dev/halo/pull/6532)
    
-   修复滚动更新时无法启动新的 Halo 实例的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#6543](https://github.com/halo-dev/halo/pull/6543)
    
-   修复由于索引比较时可能出现整数溢出导致文章偶尔无法访问的问题。 by [@guqing](https://github.com/guqing) in [#6555](https://github.com/halo-dev/halo/pull/6555)
    

### 开发者相关

-   重构默认编辑器代码块使其能够被插件扩展。 by [@LIlGG](https://github.com/LIlGG) in [#6428](https://github.com/halo-dev/halo/pull/6428)
    
-   Console 评论和回复管理列表项的操作按钮支持被插件扩展。 by [@chengzhongxue](https://github.com/chengzhongxue) in [#6438](https://github.com/halo-dev/halo/pull/6438)
    
-   增加通过链接转存第三方资源至附件库的接口。 by [@LIlGG](https://github.com/LIlGG) in [#6364](https://github.com/halo-dev/halo/pull/6364)
    
-   重构 FormKit 选择器组件以支持更多功能。 by [@LIlGG](https://github.com/LIlGG) in [#6473](https://github.com/halo-dev/halo/pull/6473)
    
-   为 postFinder 添加一个统一参数的 list 方法并支持传递排序参数。 by [@guqing](https://github.com/guqing) in [#6531](https://github.com/halo-dev/halo/pull/6531)
    

### 依赖更新

-   升级 Spring Boot 至 3.3.3。 by [@JohnNiang](https://github.com/JohnNiang) in [#6512](https://github.com/halo-dev/halo/pull/6512)
    
-   升级 Tiptap 相关依赖至 [2.6.5](https://github.com/ueberdosis/tiptap/releases/tag/v2.6.5)。 by [@LIlGG](https://github.com/LIlGG) in [#6503](https://github.com/halo-dev/halo/pull/6503)
    

* * *

### 升级文档

[https://docs.halo.run/category/安装指南](https://docs.halo.run/category/%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97)
