Skip to content

Commit c1ada9f

Browse files
authored
fix(modal): properly render *-html props if provided (closes #3491) (#3492)
1 parent 42570e0 commit c1ada9f

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/components/modal/helpers/bv-modal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const plugin = Vue => {
112112
hideHeaderClose: true,
113113
hideHeader: !(props.title || props.titleHtml),
114114
// Add in (filtered) user supplied props
115-
...omit(props, ['msgBoxContent']),
115+
...omit(props, keys(propsToSlots)),
116116
// Props that can't be overridden
117117
lazy: false,
118118
busy: false,

src/components/modal/modal.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -715,11 +715,13 @@ export const BModal = /*#__PURE__*/ Vue.extend({
715715
[this.normalizeSlot('modal-header-close', {})]
716716
)
717717
}
718+
const domProps =
719+
!this.hasNormalizedSlot('modal-title') && this.titleHtml
720+
? { innerHTML: this.titleHtml }
721+
: {}
718722
modalHeader = [
719-
h(this.titleTag, { class: ['modal-title'] }, [
720-
this.normalizeSlot('modal-title', this.slotScope) ||
721-
this.titleHtml ||
722-
stripTags(this.title)
723+
h(this.titleTag, { class: ['modal-title'], domProps }, [
724+
this.normalizeSlot('modal-title', this.slotScope) || stripTags(this.title)
723725
]),
724726
closeButton
725727
]
@@ -755,6 +757,7 @@ export const BModal = /*#__PURE__*/ Vue.extend({
755757
if (!modalFooter) {
756758
let cancelButton = h(false)
757759
if (!this.okOnly) {
760+
const cancelHtml = this.cancelTitleHtml ? { innerHTML: this.cancelTitleHtml } : null
758761
cancelButton = h(
759762
BButton,
760763
{
@@ -767,11 +770,11 @@ export const BModal = /*#__PURE__*/ Vue.extend({
767770
},
768771
[
769772
this.normalizeSlot('modal-cancel', {}) ||
770-
this.cancelTitleHtml ||
771-
stripTags(this.cancelTitle)
773+
(cancelHtml ? h('span', { domProps: cancelHtml }) : stripTags(this.cancelTitle))
772774
]
773775
)
774776
}
777+
const okHtml = this.okTitleHtml ? { innerHTML: this.okTitleHtml } : null
775778
const okButton = h(
776779
BButton,
777780
{
@@ -782,7 +785,10 @@ export const BModal = /*#__PURE__*/ Vue.extend({
782785
},
783786
on: { click: this.onOk }
784787
},
785-
[this.normalizeSlot('modal-ok', {}) || this.okTitleHtml || stripTags(this.okTitle)]
788+
[
789+
this.normalizeSlot('modal-ok', {}) ||
790+
(okHtml ? h('span', { domProps: okHtml }) : stripTags(this.okTitle))
791+
]
786792
)
787793
modalFooter = [cancelButton, okButton]
788794
}

src/components/toast/helpers/bv-toast.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const plugin = Vue => {
106106
propsData: {
107107
...filterOptions(getComponentConfig('BToast') || {}),
108108
// Add in (filtered) user supplied props
109-
...omit(props, ['toastContent']),
109+
...omit(props, keys(propsToSlots)),
110110
// Props that can't be overridden
111111
static: false,
112112
visible: true

0 commit comments

Comments
 (0)