pull/2370/head
yigitfindikli 2022-03-30 14:40:04 +03:00
parent 890b670293
commit 6424fe33ae
2 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
import {UniqueComponentId,DomHandler,ConnectedOverlayScrollHandler,ZIndexUtils,ObjectUtils} from 'primevue/utils'; import {UniqueComponentId,DomHandler,ConnectedOverlayScrollHandler,ZIndexUtils} from 'primevue/utils';
function bindEvents(el) { function bindEvents(el) {
const modifiers = el.$_ptooltipModifiers; const modifiers = el.$_ptooltipModifiers;
@ -106,8 +106,14 @@ function create(el) {
let tooltipText = document.createElement('div'); let tooltipText = document.createElement('div');
tooltipText.className = 'p-tooltip-text'; tooltipText.className = 'p-tooltip-text';
let tooltipLabel = ObjectUtils.htmlEncode(el.$_ptooltipValue);
tooltipText.innerHTML = tooltipLabel; if (el.$_ptooltipEscape) {
tooltipText.innerHTML = el.$_ptooltipValue;
}
else {
tooltipText.innerHTML = '';
tooltipText.appendChild(document.createTextNode(el.$_ptooltipValue));
}
container.appendChild(tooltipText); container.appendChild(tooltipText);
document.body.appendChild(container); document.body.appendChild(container);
@ -285,11 +291,13 @@ const Tooltip = {
else if (typeof options.value === 'string') { else if (typeof options.value === 'string') {
target.$_ptooltipValue = options.value; target.$_ptooltipValue = options.value;
target.$_ptooltipDisabled = false; target.$_ptooltipDisabled = false;
target.$_ptooltipEscape = false;
target.$_ptooltipClass = null; target.$_ptooltipClass = null;
} }
else { else {
target.$_ptooltipValue = options.value.value; target.$_ptooltipValue = options.value.value;
target.$_ptooltipDisabled = options.value.disabled || false; target.$_ptooltipDisabled = options.value.disabled || false;
target.$_ptooltipEscape = options.value.escape || false;
target.$_ptooltipClass = options.value.class; target.$_ptooltipClass = options.value.class;
} }
@ -316,11 +324,13 @@ const Tooltip = {
if (typeof options.value === 'string') { if (typeof options.value === 'string') {
target.$_ptooltipValue = options.value; target.$_ptooltipValue = options.value;
target.$_ptooltipDisabled = false; target.$_ptooltipDisabled = false;
target.$_ptooltipEscape = false;
target.$_ptooltipClass = null; target.$_ptooltipClass = null;
} }
else { else {
target.$_ptooltipValue = options.value.value; target.$_ptooltipValue = options.value.value;
target.$_ptooltipDisabled = options.value.disabled || false; target.$_ptooltipDisabled = options.value.disabled || false;
target.$_ptooltipEscape = options.value.escape || false;
target.$_ptooltipClass = options.value.class; target.$_ptooltipClass = options.value.class;
} }
} }

View File

@ -204,16 +204,6 @@ export default {
return null; return null;
}, },
htmlEncode(str){
if (str) {
return str.replace(/[^\w. ]/gi, function(c){
return '&#'+c.charCodeAt(0)+';';
});
}
return null;
},
isEmpty(value) { isEmpty(value) {
return ( return (
value === null || value === undefined || value === '' || value === null || value === undefined || value === '' ||