Skip to content

Preserve alignment and caption when replacing images#11407

Merged
tommoor merged 2 commits into
mainfrom
copilot/fix-image-replacement-issue
Feb 10, 2026
Merged

Preserve alignment and caption when replacing images#11407
tommoor merged 2 commits into
mainfrom
copilot/fix-image-replacement-issue

Conversation

Copilot AI commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

When replacing an image via the replaceImage command, only width was preserved. Caption (alt) and alignment (layoutClass) were lost.

Changes

shared/editor/nodes/SimpleImage.tsx

  • Extended replaceImage to preserve height, alt, and layoutClass attributes alongside existing width preservation

shared/editor/commands/insertFiles.ts

  • Added alt and layoutClass to Options.attrs type definition

Implementation

// Before: only width preserved
attrs: {
  width: node.attrs.width,
}

// After: all formatting attributes preserved
attrs: {
  width: node.attrs.width,
  height: node.attrs.height,
  alt: node.attrs.alt,              // caption
  layoutClass: node.attrs.layoutClass, // alignment: left-50, right-50, full-width, null
}

The attributes flow through insertFiles and spread into the new image node creation, maintaining user-configured formatting across replacement operations.

Original prompt

This section details on the original issue you should resolve

<issue_title>Replace image clears alignment and caption</issue_title>
<issue_description>### Is there an existing issue for this?

  • I have searched the existing issues

This is not related to configuring Outline

  • The issue is not related to self-hosting config

Current Behavior

If an image is replaced, image alignment and the image caption is cleared. Custom width value remains constant on replacement.

Expected Behavior

Retain previous alignment and caption.

Steps To Reproduce

Insert an image, left or right align the image or add a caption.
Replace the image.

Environment

- Outline: 1.4.0
- Browser: Firefox 147.0.3

Anything else?

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix image replacement to retain alignment and caption Preserve alignment and caption when replacing images Feb 10, 2026
Copilot AI requested a review from tommoor February 10, 2026 22:42
@tommoor tommoor marked this pull request as ready for review February 10, 2026 22:44
@tommoor tommoor merged commit 7252701 into main Feb 10, 2026
15 checks passed
@tommoor tommoor deleted the copilot/fix-image-replacement-issue branch February 10, 2026 23:16
alexlebens pushed a commit to alexlebens/infrastructure that referenced this pull request Feb 15, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [outline/outline](https://github.com/outline/outline) | minor | `1.4.0` → `1.5.0` |

---

### Release Notes

<details>
<summary>outline/outline (outline/outline)</summary>

### [`v1.5.0`](https://github.com/outline/outline/releases/tag/v1.5.0)

[Compare Source](outline/outline@v1.4.0...v1.5.0)

#### What's Changed

##### Improvements

- Added sorting options to the search screen in [#&#8203;11242](outline/outline#11242)
- Added `diff` language highlighting for code blocks in [#&#8203;11301](outline/outline#11301)
- Allow `cmd+enter` to toggle all checkboxes in a selection in [#&#8203;11322](outline/outline#11322)
- Added support for currency sorting in tables in [#&#8203;11332](outline/outline#11332)
- Added a custom color picker for text highlights in [#&#8203;11337](outline/outline#11337)
- Clicking on a group in the share dialog now shows it's members in [#&#8203;11338](outline/outline#11338)
- Table headers are now sticky in [#&#8203;11353](outline/outline#11353)
- Importing toggle blocks from Notion is now supported in [#&#8203;11371](outline/outline#11371)
- All tables in settings now have right-click context menu support in [#&#8203;11378](outline/outline#11378)
- Added a hide/show completed items control for checkbox lists in [#&#8203;11379](outline/outline#11379)
- Markdown frontmatter is now converted to YAML code blocks on import in [#&#8203;11420](outline/outline#11420)
- Added a "Rename" option to sidebar context menus in [#&#8203;11425](outline/outline#11425)
- Added Alt-click to recursively expand or collapse sidebar documents and collections in [#&#8203;11432](outline/outline#11432)
- Added a preference for desktop notification badge with off, count, and indicator options in [#&#8203;11436](outline/outline#11436)
- Added alphabetic ordered list support to markdown import and paste in [#&#8203;11446](outline/outline#11446)
- Allow creating a new document before or after another in the sidebar in [#&#8203;11453](outline/outline#11453)

##### Fixes

- Preserved alignment and caption when replacing images in [#&#8203;11407](outline/outline#11407)
- Improved popularity scoring job performance in [#&#8203;11293](outline/outline#11293)
- Fixed downloading mermaid images from the lightbox in [#&#8203;11300](outline/outline#11300)
- Further popularity scoring performance improvements in [#&#8203;11305](outline/outline#11305)
- Fixed text truncation with emoji icons in sidebar in [#&#8203;11307](outline/outline#11307)
- Separated user input errors from internal errors for Sentry reporting in [#&#8203;11308](outline/outline#11308)
- Fixed editor focus loss on text link interaction in [#&#8203;11310](outline/outline#11310)
- Removed unnecessary Markdown conversion when importing HTML in [#&#8203;11315](outline/outline#11315)
- Fixed "New draft" from command menu leading to "Not found" in [#&#8203;11316](outline/outline#11316)
- Improved slow query in `CleanupDeletedDocumentsTask` in [#&#8203;11317](outline/outline#11317)
- Removed Babel from production dependencies in [#&#8203;11318](outline/outline#11318)
- Minor React performance optimizations in [#&#8203;11319](outline/outline#11319)
- Fixed share panel state for drafts in a shared parent in [#&#8203;11320](outline/outline#11320)
- Fixed embed option showing for links that cannot be embedded in [#&#8203;11323](outline/outline#11323)
- Fixed non-admins being unable to see public ACL attachments in [#&#8203;11326](outline/outline#11326)
- Fixed suggestion menu inserting at incorrect position when choosing with mouse in [#&#8203;11327](outline/outline#11327)
- Fixed passkey registration with non-standard HTTPS ports in [#&#8203;11329](outline/outline#11329)
- Fixed collapsed toggles not expanding when they contain the highlighted search result in [#&#8203;11330](outline/outline#11330)
- Fixed column and row selection not restoring after sort or align in [#&#8203;11333](outline/outline#11333)
- Renamed `DATABASE_READ_ONLY_URL` environment variable in [#&#8203;11334](outline/outline#11334)
- Fixed Safari print offset issue in [#&#8203;11339](outline/outline#11339)
- Permanently deleted documents are now removed from the local store in [#&#8203;11344](outline/outline#11344)
- Fixed overly broad catch-all on root share in [#&#8203;11346](outline/outline#11346)
- Removed hanging toggle sidebar button with no functionality in [#&#8203;11350](outline/outline#11350)
- Fixed tables with merged cells behaving incorrectly when sorting in [#&#8203;11351](outline/outline#11351)
- Fixed prefetching document structure for starred documents in [#&#8203;11355](outline/outline#11355)
- Refactored `activeDocumentId` handling in [#&#8203;11144](outline/outline#11144)
- Fixed missing outline on focused editable elements in [#&#8203;11362](outline/outline#11362)
- Fixed document creation routing to use the correct parameter name in [#&#8203;11369](outline/outline#11369)
- Fixed test snapshot in [#&#8203;11391](outline/outline#11391)
- Auto-compressed images by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in [#&#8203;11394](outline/outline#11394)
- Fixed test snapshot in [#&#8203;11395](outline/outline#11395)
- Fixed Sentry error resulting from browser extensions using MobX in [#&#8203;11399](outline/outline#11399)
- Fixed selection toolbar issues around link selection in [#&#8203;11408](outline/outline#11408)
- Removed unnecessary loading of authentication rows in `userProvisioner` in [#&#8203;11413](outline/outline#11413)
- Allowlisted more methods for CSRF skip in [#&#8203;11414](outline/outline#11414)
- Added `application_name` to database logging in [#&#8203;11415](outline/outline#11415)
- Fixed exporting a document with a table causing a crash in [#&#8203;11422](outline/outline#11422)
- Fixed an issue in active context creation due to a fallback in [#&#8203;11426](outline/outline#11426)
- Stopped using public ACL for avatars in [#&#8203;11427](outline/outline#11427)
- Fixed potential task queue saturation in the Notion importer in [#&#8203;11428](outline/outline#11428)
- Fixed edits containing only a mention below edit distance not triggering a notification in [#&#8203;11434](outline/outline#11434)
- Fixed missing check for disabled group mentions in [#&#8203;11435](outline/outline#11435)
- Fixed mispositioned toolbar on first document open in [#&#8203;11437](outline/outline#11437)
- Fixed creating a new document from the sidebar not redirecting correctly to edit mode in [#&#8203;11442](outline/outline#11442)
- Fixed collections with the same name overwriting each other in export in [#&#8203;11443](outline/outline#11443)
- Fixed notification badge not appearing until the notification popover was opened in [#&#8203;11444](outline/outline#11444)
- Translation locale files now load over `CDN_URL` for better performance in [#&#8203;11445](outline/outline#11445)
- Fixed synthetic "latest" revision failing to load in [#&#8203;11451](outline/outline#11451)
- Added missing tooltips in [#&#8203;11452](outline/outline#11452)
- Cleaned up the collection create dialog in [#&#8203;11454](outline/outline#11454)
- Fixed small race conditions in the diagrams.net integration in [#&#8203;11458](outline/outline#11458)

**Full Changelog**: <outline/outline@v1.4.0...v1.5.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zLjYiLCJ1cGRhdGVkSW5WZXIiOiI0My4zLjYiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImltYWdlIl19-->

Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/4012
Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net>
Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
alexlebens pushed a commit to alexlebens/infrastructure that referenced this pull request Feb 15, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [outlinewiki/outline](https://github.com/outline/outline) | minor | `1.4.0` → `1.5.0` |

---

### Release Notes

<details>
<summary>outline/outline (outlinewiki/outline)</summary>

### [`v1.5.0`](https://github.com/outline/outline/releases/tag/v1.5.0)

[Compare Source](outline/outline@v1.4.0...v1.5.0)

##### What's Changed

##### Improvements

- Added sorting options to the search screen in [#&#8203;11242](outline/outline#11242)
- Added `diff` language highlighting for code blocks in [#&#8203;11301](outline/outline#11301)
- Allow `cmd+enter` to toggle all checkboxes in a selection in [#&#8203;11322](outline/outline#11322)
- Added support for currency sorting in tables in [#&#8203;11332](outline/outline#11332)
- Added a custom color picker for text highlights in [#&#8203;11337](outline/outline#11337)
- Clicking on a group in the share dialog now shows it's members in [#&#8203;11338](outline/outline#11338)
- Table headers are now sticky in [#&#8203;11353](outline/outline#11353)
- Importing toggle blocks from Notion is now supported in [#&#8203;11371](outline/outline#11371)
- All tables in settings now have right-click context menu support in [#&#8203;11378](outline/outline#11378)
- Added a hide/show completed items control for checkbox lists in [#&#8203;11379](outline/outline#11379)
- Markdown frontmatter is now converted to YAML code blocks on import in [#&#8203;11420](outline/outline#11420)
- Added a "Rename" option to sidebar context menus in [#&#8203;11425](outline/outline#11425)
- Added Alt-click to recursively expand or collapse sidebar documents and collections in [#&#8203;11432](outline/outline#11432)
- Added a preference for desktop notification badge with off, count, and indicator options in [#&#8203;11436](outline/outline#11436)
- Added alphabetic ordered list support to markdown import and paste in [#&#8203;11446](outline/outline#11446)
- Allow creating a new document before or after another in the sidebar in [#&#8203;11453](outline/outline#11453)

##### Fixes

- Preserved alignment and caption when replacing images in [#&#8203;11407](outline/outline#11407)
- Improved popularity scoring job performance in [#&#8203;11293](outline/outline#11293)
- Fixed downloading mermaid images from the lightbox in [#&#8203;11300](outline/outline#11300)
- Further popularity scoring performance improvements in [#&#8203;11305](outline/outline#11305)
- Fixed text truncation with emoji icons in sidebar in [#&#8203;11307](outline/outline#11307)
- Separated user input errors from internal errors for Sentry reporting in [#&#8203;11308](outline/outline#11308)
- Fixed editor focus loss on text link interaction in [#&#8203;11310](outline/outline#11310)
- Removed unnecessary Markdown conversion when importing HTML in [#&#8203;11315](outline/outline#11315)
- Fixed "New draft" from command menu leading to "Not found" in [#&#8203;11316](outline/outline#11316)
- Improved slow query in `CleanupDeletedDocumentsTask` in [#&#8203;11317](outline/outline#11317)
- Removed Babel from production dependencies in [#&#8203;11318](outline/outline#11318)
- Minor React performance optimizations in [#&#8203;11319](outline/outline#11319)
- Fixed share panel state for drafts in a shared parent in [#&#8203;11320](outline/outline#11320)
- Fixed embed option showing for links that cannot be embedded in [#&#8203;11323](outline/outline#11323)
- Fixed non-admins being unable to see public ACL attachments in [#&#8203;11326](outline/outline#11326)
- Fixed suggestion menu inserting at incorrect position when choosing with mouse in [#&#8203;11327](outline/outline#11327)
- Fixed passkey registration with non-standard HTTPS ports in [#&#8203;11329](outline/outline#11329)
- Fixed collapsed toggles not expanding when they contain the highlighted search result in [#&#8203;11330](outline/outline#11330)
- Fixed column and row selection not restoring after sort or align in [#&#8203;11333](outline/outline#11333)
- Renamed `DATABASE_READ_ONLY_URL` environment variable in [#&#8203;11334](outline/outline#11334)
- Fixed Safari print offset issue in [#&#8203;11339](outline/outline#11339)
- Permanently deleted documents are now removed from the local store in [#&#8203;11344](outline/outline#11344)
- Fixed overly broad catch-all on root share in [#&#8203;11346](outline/outline#11346)
- Removed hanging toggle sidebar button with no functionality in [#&#8203;11350](outline/outline#11350)
- Fixed tables with merged cells behaving incorrectly when sorting in [#&#8203;11351](outline/outline#11351)
- Fixed prefetching document structure for starred documents in [#&#8203;11355](outline/outline#11355)
- Refactored `activeDocumentId` handling in [#&#8203;11144](outline/outline#11144)
- Fixed missing outline on focused editable elements in [#&#8203;11362](outline/outline#11362)
- Fixed document creation routing to use the correct parameter name in [#&#8203;11369](outline/outline#11369)
- Fixed test snapshot in [#&#8203;11391](outline/outline#11391)
- Auto-compressed images by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in [#&#8203;11394](outline/outline#11394)
- Fixed test snapshot in [#&#8203;11395](outline/outline#11395)
- Fixed Sentry error resulting from browser extensions using MobX in [#&#8203;11399](outline/outline#11399)
- Fixed selection toolbar issues around link selection in [#&#8203;11408](outline/outline#11408)
- Removed unnecessary loading of authentication rows in `userProvisioner` in [#&#8203;11413](outline/outline#11413)
- Allowlisted more methods for CSRF skip in [#&#8203;11414](outline/outline#11414)
- Added `application_name` to database logging in [#&#8203;11415](outline/outline#11415)
- Fixed exporting a document with a table causing a crash in [#&#8203;11422](outline/outline#11422)
- Fixed an issue in active context creation due to a fallback in [#&#8203;11426](outline/outline#11426)
- Stopped using public ACL for avatars in [#&#8203;11427](outline/outline#11427)
- Fixed potential task queue saturation in the Notion importer in [#&#8203;11428](outline/outline#11428)
- Fixed edits containing only a mention below edit distance not triggering a notification in [#&#8203;11434](outline/outline#11434)
- Fixed missing check for disabled group mentions in [#&#8203;11435](outline/outline#11435)
- Fixed mispositioned toolbar on first document open in [#&#8203;11437](outline/outline#11437)
- Fixed creating a new document from the sidebar not redirecting correctly to edit mode in [#&#8203;11442](outline/outline#11442)
- Fixed collections with the same name overwriting each other in export in [#&#8203;11443](outline/outline#11443)
- Fixed notification badge not appearing until the notification popover was opened in [#&#8203;11444](outline/outline#11444)
- Translation locale files now load over `CDN_URL` for better performance in [#&#8203;11445](outline/outline#11445)
- Fixed synthetic "latest" revision failing to load in [#&#8203;11451](outline/outline#11451)
- Added missing tooltips in [#&#8203;11452](outline/outline#11452)
- Cleaned up the collection create dialog in [#&#8203;11454](outline/outline#11454)
- Fixed small race conditions in the diagrams.net integration in [#&#8203;11458](outline/outline#11458)

**Full Changelog**: <outline/outline@v1.4.0...v1.5.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zLjYiLCJ1cGRhdGVkSW5WZXIiOiI0My4zLjYiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImltYWdlIl19-->

Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/4013
Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net>
Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace image clears alignment and caption

2 participants