handle second issue

This commit is contained in:
Ayoub Ait Lachgar 2024-01-05 09:08:12 +01:00
parent b4ebd69279
commit 7889b4d54a
1 changed files with 10 additions and 7 deletions

View File

@ -1,7 +1,7 @@
const LOW_PRIORITY = 800;
export default function PropertiesPanelProvider(propertiesPanel, eventBus) {
let elId;
let el;
// eventBus.on('propertiesPanel.providersChanged', function (event) {
// console.log('------------------- propertiesPanel.providersChanged', event);
@ -21,10 +21,12 @@ export default function PropertiesPanelProvider(propertiesPanel, eventBus) {
this.getGroups = function (element) {
return function (groups) {
// console.log('PropertiesPanelProvider -> getGroups: ', groups, propertiesPanel, element);
// Only render the properties panel once per element
if (element.id !== elId || !elId) {
elId = element.id;
// Only render when : el is undefined (editor onload state) or user selects new element or user changes the type of a selected element
if (!el || element.id !== el.id || (element.type !== el.type && element.id === el.id)) {
el = {
id: element.id,
type: element.type
}
this.render(groups);
}
return groups;
@ -39,6 +41,7 @@ PropertiesPanelProvider.$inject = ['propertiesPanel', 'eventBus'];
PropertiesPanelProvider.prototype.render = function (groups) {
setTimeout(() => {
console.log('Render ;;;')
const propertiesPanelContainer = document.querySelector('.bio-properties-panel-container');
if (!propertiesPanelContainer) return;
@ -63,12 +66,12 @@ PropertiesPanelProvider.prototype.render = function (groups) {
arrow.classList.remove('bio-properties-panel-arrow-right');
// Handles the first click, to prevent the bpmn js library from handling it instead
header.addEventListener('click', function(event) {
header.addEventListener('click', function() {
if (isFirstClick) {
header.click();
isFirstClick = false;
}
}, { once: true });
});
}
}