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

Updated Selector escapeName to accommodate special characters used in tailwind class names #5719

Merged
merged 10 commits into from
May 23, 2024
4 changes: 4 additions & 0 deletions src/commands/view/ShowOffset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export default {
const zoom = this.em.getZoomDecimal();
const el = opt.el as HTMLElement | undefined;

if (!(el instanceof HTMLElement)) {
return;
}
artf marked this conversation as resolved.
Show resolved Hide resolved

if (!config.showOffsets || !el || isTextNode(el) || (!config.showOffsetsSelected && state == 'Fixed')) {
editor.stopCommand(`${this.id}`, opts);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/selector_manager/model/Selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class Selector extends Model<SelectorProps & { [key: string]: unk
* @private
*/
static escapeName(name: string) {
return `${name}`.trim().replace(/([^a-z0-9\w-\\:@\\/]+)/gi, '-');
return `${name}`.trim().replace(/([^a-z0-9\w\-\\:@\\/()\.%\+\[\]]+)/gi, '-');
bernesto marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Loading