Merge pull request #2813 from brkcvn/master
Javascript console error fixed
This commit is contained in:
commit
e968a62c80
59
public/akaunting-js/generalAction.js
vendored
59
public/akaunting-js/generalAction.js
vendored
@ -190,37 +190,40 @@ function runDropdown(dropdownToggleEl) {
|
|||||||
],
|
],
|
||||||
}); // toggle when click on the button
|
}); // toggle when click on the button
|
||||||
|
|
||||||
dropdownMenuEl.classList.toggle("hidden");
|
if (dropdownMenuEl !== null) {
|
||||||
dropdownMenuEl.classList.toggle("block");
|
dropdownMenuEl.classList.toggle("hidden");
|
||||||
|
dropdownMenuEl.classList.toggle("block");
|
||||||
|
|
||||||
function handleDropdownOutsideClick(event) {
|
function handleDropdownOutsideClick(event) {
|
||||||
var targetElement = event.target; // clicked element
|
var targetElement = event.target; // clicked element
|
||||||
|
|
||||||
if (
|
if (
|
||||||
targetElement !== dropdownMenuEl &&
|
targetElement !== dropdownMenuEl &&
|
||||||
targetElement !== dropdownToggleEl &&
|
targetElement !== dropdownToggleEl &&
|
||||||
!dropdownToggleEl.contains(targetElement)
|
!dropdownToggleEl.contains(targetElement)
|
||||||
) {
|
) {
|
||||||
dropdownMenuEl.classList.add("hidden");
|
dropdownMenuEl.classList.add("hidden");
|
||||||
dropdownMenuEl.classList.remove("block");
|
dropdownMenuEl.classList.remove("block");
|
||||||
document.body.removeEventListener(
|
document.body.removeEventListener(
|
||||||
"click",
|
"click",
|
||||||
handleDropdownOutsideClick,
|
handleDropdownOutsideClick,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
} // hide popper when clicking outside the element
|
||||||
|
|
||||||
|
document.body.addEventListener("click", handleDropdownOutsideClick, true);
|
||||||
|
|
||||||
|
if (dropdownMenuEl.getAttribute("data-click-outside-none") != null) {
|
||||||
|
if (event.target.getAttribute("data-click-outside") != null || event.target.parentElement.getAttribute("data-click-outside") != null) {
|
||||||
|
dropdownMenuEl.classList.add("hidden");
|
||||||
|
dropdownMenuEl.classList.remove("block");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
debugger;
|
||||||
|
dropdownMenuEl.classList.add("block");
|
||||||
|
dropdownMenuEl.classList.remove("hidden");
|
||||||
}
|
}
|
||||||
} // hide popper when clicking outside the element
|
|
||||||
|
|
||||||
document.body.addEventListener("click", handleDropdownOutsideClick, true);
|
|
||||||
|
|
||||||
if (dropdownMenuEl.getAttribute("data-click-outside-none") != null) {
|
|
||||||
if (event.target.getAttribute("data-click-outside") != null || event.target.parentElement.getAttribute("data-click-outside") != null) {
|
|
||||||
dropdownMenuEl.classList.add("hidden");
|
|
||||||
dropdownMenuEl.classList.remove("block");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dropdownMenuEl.classList.add("block");
|
|
||||||
dropdownMenuEl.classList.remove("hidden");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Toggle dropdown elements using [data-dropdown-toggle]
|
// Toggle dropdown elements using [data-dropdown-toggle]
|
||||||
|
@ -114,7 +114,7 @@ const app = new Vue({
|
|||||||
onRefFocus(ref) {
|
onRefFocus(ref) {
|
||||||
let index = this.form.items.length - 1;
|
let index = this.form.items.length - 1;
|
||||||
|
|
||||||
if (this.$refs['items-' + index + '-' + ref] != undefined) {
|
if (typeof (this.$refs['items-' + index + '-' + ref]) !== 'undefined') {
|
||||||
let first_ref = this.$refs['items-' + index + '-' + ref];
|
let first_ref = this.$refs['items-' + index + '-' + ref];
|
||||||
first_ref != undefined ? first_ref[0].focus() : this.$refs[Object.keys(this.$refs)[0]][0].focus();
|
first_ref != undefined ? first_ref[0].focus() : this.$refs[Object.keys(this.$refs)[0]][0].focus();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user