|
|
@ -24,7 +24,11 @@ class Toaster { |
|
|
|
} |
|
|
|
} |
|
|
|
render (tooltipText, action, opts) { |
|
|
|
render (tooltipText, action, opts) { |
|
|
|
opts = defaultOptions(opts) |
|
|
|
opts = defaultOptions(opts) |
|
|
|
|
|
|
|
let canShorten = true |
|
|
|
|
|
|
|
if (tooltipText instanceof Element) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
canShorten = false |
|
|
|
|
|
|
|
} else { |
|
|
|
if (typeof tooltipText === 'object') { |
|
|
|
if (typeof tooltipText === 'object') { |
|
|
|
if (tooltipText.message) { |
|
|
|
if (tooltipText.message) { |
|
|
|
tooltipText = tooltipText.message |
|
|
|
tooltipText = tooltipText.message |
|
|
@ -35,9 +39,10 @@ class Toaster { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
const shortTooltipText = tooltipText.length > 201 ? tooltipText.substring(0, 200) + '...' : tooltipText |
|
|
|
const shortTooltipText = (canShorten && tooltipText.length > 201) ? tooltipText.substring(0, 200) + '...' : tooltipText |
|
|
|
|
|
|
|
|
|
|
|
let button = tooltipText.length > 201 ? yo` |
|
|
|
let button = tooltipText.length > 201 ? yo` |
|
|
|
<button class="btn btn-secondary btn-sm" onclick=${() => { modal.alert(tooltipText) }}>show full message</button> |
|
|
|
<button class="btn btn-secondary btn-sm" onclick=${() => { modal.alert(tooltipText) }}>show full message</button> |
|
|
|