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

fix: Don't use HTML in panel titles, treat as text (#2365) #2366

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/golden-layout/src/controls/DragProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class DragProxy extends EventEmitter {
'title',
stripTags(this._contentItem.config.title ?? '')
);
this.element.find('.lm_title').html(this._contentItem.config.title ?? '');
this.element.find('.lm_title').text(this._contentItem.config.title ?? '');
this.childElementContainer = this.element.find('.lm_content');
this.childElementContainer.append(contentItem.element);

Expand Down
2 changes: 1 addition & 1 deletion packages/golden-layout/src/controls/Tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class Tab {
setTitle(title = '') {
// Disabling for illumon project, we want to manage our own tooltips
// this.element.attr( 'title', lm.utils.stripTags( title ) );
this.titleElement.html(title);
this.titleElement.text(title);
}

/**
Expand Down
5 changes: 2 additions & 3 deletions packages/golden-layout/test/title-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ describe('content items are abled to to emit events that bubble up the tree', fu
it('supports html in title', function () {
itemWithTitle.container.setTitle('title <b>with</b> html');
expect(stack.header.tabs[0].element.find('.lm_title').html()).toBe(
'title <b>with</b> html'
'title &lt;b&gt;with&lt;/b&gt; html'
);
expect(stack.header.tabs[0].element.find('.lm_title').text()).toBe(
'title with html'
'title <b>with</b> html'
);
// expect( stack.header.tabs[ 0 ].element.attr( 'title' ) ).toBe( 'title with html' );
});

it('destroys the layout', function () {
Expand Down
Loading