Fix #3209.
Fixing some technical errors when avoiding importing the `converse` global with bootstrap modal API.
This commit is contained in:
parent
94963662e7
commit
e18fdd56b1
|
@ -4,7 +4,7 @@ import log from "@converse/headless/log";
|
|||
import sizzle from 'sizzle';
|
||||
import tplAlertComponent from "./templates/modal-alert.js";
|
||||
import { View } from '@converse/skeletor/src/view.js';
|
||||
import { addClass, removeElement } from '../../utils/html.js';
|
||||
import { hasClass, addClass, removeElement, removeClass } from '../../utils/html.js';
|
||||
import { render } from 'lit';
|
||||
|
||||
import './styles/_modal.scss';
|
||||
|
@ -43,7 +43,7 @@ const BaseModal = View.extend({
|
|||
},
|
||||
|
||||
onHide () {
|
||||
u.removeClass('selected', this.trigger_el);
|
||||
removeClass('selected', this.trigger_el);
|
||||
!this.persistent && api.modal.remove(this);
|
||||
},
|
||||
|
||||
|
|
|
@ -236,14 +236,20 @@ u.getLastChildElement = function (el, selector = '*') {
|
|||
return last_el;
|
||||
};
|
||||
|
||||
u.hasClass = function (className, el) {
|
||||
return el instanceof Element && el.classList.contains(className);
|
||||
};
|
||||
|
||||
u.toggleClass = function (className, el) {
|
||||
u.hasClass(className, el) ? removeClass(className, el) : addClass(className, el);
|
||||
};
|
||||
|
||||
/**
|
||||
* Has an element a class?
|
||||
* @method u#hasClass
|
||||
* @param { string } className
|
||||
* @param { Element } el
|
||||
*/
|
||||
export function hasClass (className, el) {
|
||||
return el instanceof Element && el.classList.contains(className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a class to an element.
|
||||
* @method u#addClass
|
||||
|
@ -615,6 +621,7 @@ u.xForm2TemplateResult = function (field, stanza, options={}) {
|
|||
};
|
||||
|
||||
Object.assign(u, {
|
||||
hasClass,
|
||||
addClass,
|
||||
ancestor,
|
||||
getOOBURLMarkup,
|
||||
|
|
Loading…
Reference in New Issue