halo icon indicating copy to clipboard operation
halo copied to clipboard

fix: resolve the positioning error issue when storing external images

Open LIlGG opened this issue 3 months ago • 5 comments

What type of PR is this?

/kind bug /area editor /milestone 2.22.x

What this PR does / why we need it:

在复制并粘贴上传外链图片时,在点击转存后,目前会出现图片无法被正常转换为相对链接,并且在非第一行粘贴时,会导致错误的图片插入在第一行。

此 PR 对转存的逻辑进行了修复,在转存时获取了当前编辑器中对应节点的相对位置,确保替换链接时的位置正确性。

How to test it?

  1. 复制一个外链图片。
  2. 在编辑器中任意一个位置粘贴。
  3. 点击确认转存。
  4. 查看其地址是否变为了相对地址。

Which issue(s) this PR fixes:

Fixes #7912

Does this PR introduce a user-facing change?

解决编辑器粘贴转存外链图片时无法替换链接及错误插入的问题。

LIlGG avatar Dec 05 '25 04:12 LIlGG

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign lilgg for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

f2c-ci-robot[bot] avatar Dec 05 '25 04:12 f2c-ci-robot[bot]

Open in StackBlitz

@halo-dev/api-client

npm i https://pkg.pr.new/@halo-dev/api-client@7987
@halo-dev/components

npm i https://pkg.pr.new/@halo-dev/components@7987
@halo-dev/richtext-editor

npm i https://pkg.pr.new/@halo-dev/richtext-editor@7987
@halo-dev/ui-shared

npm i https://pkg.pr.new/@halo-dev/ui-shared@7987
@halo-dev/ui-plugin-bundler-kit

npm i https://pkg.pr.new/@halo-dev/ui-plugin-bundler-kit@7987

commit: 1c9e4bf

pkg-pr-new[bot] avatar Dec 05 '25 04:12 pkg-pr-new[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 60.94%. Comparing base (42c374d) to head (1c9e4bf). :warning: Report is 305 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7987      +/-   ##
============================================
+ Coverage     59.55%   60.94%   +1.38%     
- Complexity     3812     3928     +116     
============================================
  Files           677      689      +12     
  Lines         23248    23539     +291     
  Branches       1500     1523      +23     
============================================
+ Hits          13846    14345     +499     
+ Misses         8764     8470     -294     
- Partials        638      724      +86     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Dec 05 '25 04:12 codecov[bot]

/hold 此方式并不能解决已有问题

LIlGG avatar Dec 10 '25 06:12 LIlGG