Closed YacoubBelaoura closed 5 years ago
If we remove the <b>
how do we highlight the matched string from an option?
my solution is to use this Zero-width joiner
add ‍
after <b>
tag
highlight(label) {
return label.replace(
new RegExp(`(${this.query})`, 'gi'), '‍<b>$1</b>',
);
here is the output.
you mean before the <b>
tag?
So just to be clear, doing this fixes the reported problem?
the problem is that this function will inject empty <b>
tags in select options.
highlight(label) {
return label.replace(
new RegExp(`(${this.query})`, 'gi'), '<b>$1</b>',
);
},
like here:
<span><b></b>ق<b></b>ر<b></b>ا<b></b>ء<b></b>ة<b></b></span>
so the fix is only to inject <b>
tag when there is a query.
so here is the working fix:
highlight(label) {
if (this.query.length > 0) {
return label.replace(
new RegExp(`(${this.query})`, 'gi'), '<b>$1</b>',
);
} else {
return label;
}
},
i will make a PR if you approve.
@YacoubBelaoura, I forgot about this, do a PR.
Thanks.
PS use a ternary instead of if else.
This is a bug ?.
Prerequisites
Description
the
vue-select
dropdown dont suportcursive writing
fonts and languages like 'arabic' example screenshotsSteps to Reproduce
Edit Permission
and change language to arabic "use cursive writing" and click on type select dropdown menu, you will notice it separate characters.Expected behavior
for
cursive fonts
it should keep it like it isActual behavior
reason ?
the
<b>
tag aroundRegExp
text