Skip to content

Commit

Permalink
fix(block editor): Support UrlContentMap on Links (#30674)
Browse files Browse the repository at this point in the history
This pull request includes a change to the `BubbleLinkFormComponent`
class in the
`core-web/libs/block-editor/src/lib/extensions/bubble-link-form/bubble-link-form.component.ts`
file. The change focuses on cleaning up the URLs for contentlets.

Improvements to URL handling:

*
[`core-web/libs/block-editor/src/lib/extensions/bubble-link-form/bubble-link-form.component.ts`](diffhunk://#diff-dd9a756d839455372ca42ef647e07ce405f4e476065c152bdb06c5bc3f6f8259R248-R263):
Added logic to replace the URL in `contentlet` with the actual URL
stored in `urlMap` if `URL_MAP_FOR_CONTENT` is present. This ensures
that the URLs for `urlContentMaps` are correctly formatted.
  • Loading branch information
zJaaal authored Nov 15, 2024
1 parent 656775a commit 8912af1
Show file tree
Hide file tree
Showing 2 changed files with 354 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,22 @@ export class BubbleLinkFormComponent implements OnInit {
const { languageId } = contentlet;
contentlet.language = this.getContentletLanguage(languageId);

// The URLs for urlContentMaps have this format: /content.<contentlet inode>
// So we need to replace it with the actual URL which is stored in urlMap
const cleanedContentlet = {
...contentlet,
url: contentlet.URL_MAP_FOR_CONTENT ? contentlet.urlMap : contentlet.url
};

return {
label: contentlet.title,
icon: 'contentlet/image',
data: {
contentlet: contentlet
contentlet: cleanedContentlet
},
command: () => {
this.onSelection({
payload: contentlet,
payload: cleanedContentlet,
type: {
name: 'dotContent'
}
Expand Down
Loading

0 comments on commit 8912af1

Please sign in to comment.