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(common): don't try to strip tags on object input to calc cell width #1453

Merged
merged 1 commit into from
Apr 4, 2024
Merged
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
4 changes: 2 additions & 2 deletions packages/common/src/services/resizer.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BindingEventService } from '@slickgrid-universal/binding';
import type { BasePubSubService, EventSubscription } from '@slickgrid-universal/event-pub-sub';
import { getInnerSize, getOffset, stripTags } from '@slickgrid-universal/utils';
import { getInnerSize, getOffset, isPrimitiveOrHTML, stripTags } from '@slickgrid-universal/utils';

import { FieldType, } from '../enums/index';
import type {
Expand Down Expand Up @@ -505,7 +505,7 @@ export class ResizerService {
if (!columnDef.originalWidth) {
const charWidthPx = columnDef?.resizeCharWidthInPx ?? resizeCellCharWidthInPx;
const formattedData = parseFormatterWhenExist(columnDef?.formatter, rowIdx, colIdx, columnDef, item, this._grid);
const formattedDataSanitized = stripTags(formattedData);
const formattedDataSanitized = isPrimitiveOrHTML(formattedData) ? stripTags(formattedData) : '';
const formattedTextWidthInPx = Math.ceil(formattedDataSanitized.length * charWidthPx);
const resizeMaxWidthThreshold = columnDef.resizeMaxWidthThreshold;
if (columnDef && (initialMininalColumnWidth === undefined || formattedTextWidthInPx > initialMininalColumnWidth)) {
Expand Down
Loading