Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编辑粘贴图片BUG #5035

Closed
githubgeekrabbit opened this issue Dec 11, 2023 · 6 comments · Fixed by #5114
Closed

编辑粘贴图片BUG #5035

githubgeekrabbit opened this issue Dec 11, 2023 · 6 comments · Fixed by #5114
Assignees
Labels
area/console Issues or PRs related to the Halo Console help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@githubgeekrabbit
Copy link

系统信息

在设置界面创建的文章就可以粘贴图片,而在用户界面创建的文章粘贴图片就报错
iShot_2023-12-11_23 32 42
iShot_2023-12-11_23 37 01

使用的哪种方式运行?

Docker

在线站点地址

https://demo.halo.run/

发生了什么?

在设置界面创建的文章就可以粘贴图片,而在用户界面创建的文章粘贴图片就报错
iShot_2023-12-11_23 32 42
iShot_2023-12-11_23 37 01

相关日志输出

在设置界面创建的文章就可以粘贴图片,而在用户界面创建的文章粘贴图片就报错
<img width="1514" alt="iShot_2023-12-11_23 32 42" src="https://github.com/halo-dev/halo/assets/45820964/5d0aa5c2-03b8-4f5e-9951-427d85e40426">
<img width="1602" alt="iShot_2023-12-11_23 37 01" src="https://github.com/halo-dev/halo/assets/45820964/026a283e-47c9-4365-90be-482e6299252c">

附加信息

No response

@JohnNiang
Copy link
Member

Hi @githubgeekrabbit ,感谢反馈问题!

我确认在未创建文章的状态下,在个人中心的文章模块中直接上传图片会出现以上错误。可能的原因是上传图片前自动创建文章的数据中没有包含文章标题。 @halo-dev/sig-halo-console

/kind bug
/area console

@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. area/console Issues or PRs related to the Halo Console labels Dec 11, 2023
@githubgeekrabbit
Copy link
Author

还有就是,用户模式下,文章不会自动保存,切出去再回来写的东西就全没了

@JohnNiang
Copy link
Member

还有就是,用户模式下,文章不会自动保存,切出去再回来写的东西就全没了

Hi @githubgeekrabbit ,再次感谢反馈!不过这个问题和当前 Issue 没有直接关联,建议提交新的 Issue 跟踪。

@JohnNiang
Copy link
Member

/milestone 2.11.x

@f2c-ci-robot f2c-ci-robot bot added this to the 2.11.x milestone Dec 11, 2023
@ruibaby
Copy link
Member

ruibaby commented Dec 12, 2023

if (!isUpdateMode.value) {
formState.value.metadata.annotations = {
...formState.value.metadata.annotations,
[contentAnnotations.CONTENT_JSON]: JSON.stringify(content.value),
};
await apiClient.uc.post.createMyPost({
post: formState.value,
});
}

需要在这里自动设置 title 和 slug,参考:

if (!formState.value.post.spec.title) {
formState.value.post.spec.title = t("core.post_editor.untitled");
}
if (!formState.value.post.spec.slug) {
formState.value.post.spec.slug = new Date().getTime().toString();
}

/good-first-issue

@f2c-ci-robot f2c-ci-robot bot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Dec 12, 2023
@ruibaby ruibaby self-assigned this Dec 27, 2023
@JohnNiang
Copy link
Member

/remove-good-first-issue
/milestone 2.11.3

@f2c-ci-robot f2c-ci-robot bot removed the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Dec 27, 2023
@f2c-ci-robot f2c-ci-robot bot modified the milestones: 2.11.x, 2.11.3 Dec 27, 2023
f2c-ci-robot bot pushed a commit that referenced this issue Dec 27, 2023
#### What type of PR is this?

/area console
/kind bug
/milestone 2.12.x

#### What this PR does / why we need it:

修复在个人中心的文章编辑器中创建新文章时无法上传图片的问题

#### Which issue(s) this PR fixes:

Fixes #5035

#### Special notes for your reviewer:

测试在 UC 新建文章,在未保存时是否能上传图片。

#### Does this PR introduce a user-facing change?

```release-note
修复个人中心创建新文章时无法上传图片的问题
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/console Issues or PRs related to the Halo Console help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
3 participants