Skip to content

Commit

Permalink
Table popup hide on clicingk on page and everything except table butt…
Browse files Browse the repository at this point in the history
…on and its children fixes publiclab#750
  • Loading branch information
RaviAnand111 committed Jan 26, 2022
1 parent 6fc2548 commit 58e33ca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
23 changes: 12 additions & 11 deletions dist/PublicLab.Editor.js
Expand Up @@ -22758,7 +22758,8 @@ module.exports = function CustomInsert(_module, wysiwyg) {
}
});
const builder = require("./PublicLab.CustomInsert.Template.js");
$('.wk-commands').append('<a class="woofmark-command-insert btn btn-outline-secondary" data-toggle="Insert" title="Custom Insert"><i class="fa fa-tags"></i></a>');
$('.wk-commands').append('<a class="woofmark-command-insert btn btn-outline-secondary" data-toggle="insert" title="Custom Insert"><i class="fa fa-tags"></i></a>');

var Option1 = "Notes";
var Option2 = "List";
$('.woofmark-command-insert').attr('data-content', builder);
Expand Down Expand Up @@ -23394,17 +23395,17 @@ module.exports = function initTables(_module, wysiwyg) {
$('.woofmark-command-table').popover('toggle');
});
});
});
// close table popover when user click outside the page
$(':not(".woofmark-command-table")').click((e) => {
// check to see that the clicked element isn't fa-table icon, else when you click on the fa-table icon, the popover will close
if (popoverIsOpen && $('.woofmark-command-table').children()[0] != e.target) {
const popoverContainer = document.querySelector('.popover');
const isChildElement = popoverContainer.contains(e.target);
if (popoverIsOpen && !e.target.classList.contains("woofmark-command-table") && !isChildElement) {
$('.woofmark-command-table').click();

$(':not(".woofmark-command-table")').click((e) => {
// check to see that the clicked element isn't fa-table icon, else when you click on the fa-table icon, the popover will close
if (popoverIsOpen && $('.woofmark-command-table').children()[0] != e.target) {
const popoverContainer = document.querySelector('.popover');
const isChildElement = popoverContainer.contains(e.target);
if (popoverIsOpen && !e.target.classList.contains("woofmark-command-table") && !isChildElement) {
$('.woofmark-command-table').click();
}
}
}
});
});
};

Expand Down
20 changes: 10 additions & 10 deletions src/modules/PublicLab.RichTextModule.Table.js
Expand Up @@ -97,16 +97,16 @@ module.exports = function initTables(_module, wysiwyg) {
$('.woofmark-command-table').popover('toggle');
});
});
});
// close table popover when user click outside the page
$(':not(".woofmark-command-table")').click((e) => {
// check to see that the clicked element isn't fa-table icon, else when you click on the fa-table icon, the popover will close
if (popoverIsOpen && $('.woofmark-command-table').children()[0] != e.target) {
const popoverContainer = document.querySelector('.popover');
const isChildElement = popoverContainer.contains(e.target);
if (popoverIsOpen && !e.target.classList.contains("woofmark-command-table") && !isChildElement) {
$('.woofmark-command-table').click();

$(':not(".woofmark-command-table")').click((e) => {
// check to see that the clicked element isn't fa-table icon, else when you click on the fa-table icon, the popover will close
if (popoverIsOpen && $('.woofmark-command-table').children()[0] != e.target) {
const popoverContainer = document.querySelector('.popover');
const isChildElement = popoverContainer.contains(e.target);
if (popoverIsOpen && !e.target.classList.contains("woofmark-command-table") && !isChildElement) {
$('.woofmark-command-table').click();
}
}
}
});
});
};

0 comments on commit 58e33ca

Please sign in to comment.