Skip to content

Commit

Permalink
fix(modal): properly render *-html props if provided (closes #3491) (
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorehouse committed Jun 11, 2019
1 parent 42570e0 commit c1ada9f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/modal/helpers/bv-modal.js
Expand Up @@ -112,7 +112,7 @@ const plugin = Vue => {
hideHeaderClose: true,
hideHeader: !(props.title || props.titleHtml),
// Add in (filtered) user supplied props
...omit(props, ['msgBoxContent']),
...omit(props, keys(propsToSlots)),
// Props that can't be overridden
lazy: false,
busy: false,
Expand Down
20 changes: 13 additions & 7 deletions src/components/modal/modal.js
Expand Up @@ -715,11 +715,13 @@ export const BModal = /*#__PURE__*/ Vue.extend({
[this.normalizeSlot('modal-header-close', {})]
)
}
const domProps =
!this.hasNormalizedSlot('modal-title') && this.titleHtml
? { innerHTML: this.titleHtml }
: {}
modalHeader = [
h(this.titleTag, { class: ['modal-title'] }, [
this.normalizeSlot('modal-title', this.slotScope) ||
this.titleHtml ||
stripTags(this.title)
h(this.titleTag, { class: ['modal-title'], domProps }, [
this.normalizeSlot('modal-title', this.slotScope) || stripTags(this.title)
]),
closeButton
]
Expand Down Expand Up @@ -755,6 +757,7 @@ export const BModal = /*#__PURE__*/ Vue.extend({
if (!modalFooter) {
let cancelButton = h(false)
if (!this.okOnly) {
const cancelHtml = this.cancelTitleHtml ? { innerHTML: this.cancelTitleHtml } : null
cancelButton = h(
BButton,
{
Expand All @@ -767,11 +770,11 @@ export const BModal = /*#__PURE__*/ Vue.extend({
},
[
this.normalizeSlot('modal-cancel', {}) ||
this.cancelTitleHtml ||
stripTags(this.cancelTitle)
(cancelHtml ? h('span', { domProps: cancelHtml }) : stripTags(this.cancelTitle))
]
)
}
const okHtml = this.okTitleHtml ? { innerHTML: this.okTitleHtml } : null
const okButton = h(
BButton,
{
Expand All @@ -782,7 +785,10 @@ export const BModal = /*#__PURE__*/ Vue.extend({
},
on: { click: this.onOk }
},
[this.normalizeSlot('modal-ok', {}) || this.okTitleHtml || stripTags(this.okTitle)]
[
this.normalizeSlot('modal-ok', {}) ||
(okHtml ? h('span', { domProps: okHtml }) : stripTags(this.okTitle))
]
)
modalFooter = [cancelButton, okButton]
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/toast/helpers/bv-toast.js
Expand Up @@ -106,7 +106,7 @@ const plugin = Vue => {
propsData: {
...filterOptions(getComponentConfig('BToast') || {}),
// Add in (filtered) user supplied props
...omit(props, ['toastContent']),
...omit(props, keys(propsToSlots)),
// Props that can't be overridden
static: false,
visible: true
Expand Down

0 comments on commit c1ada9f

Please sign in to comment.