Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make showing of all doc notes possible #27

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions client/PropertyInfoPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var _ = require('lodash');

var elementOverlays = [];
var overlaysVisible = true;
var docNotesVisible = false;

function PropertyInfoPlugin(eventBus, overlays, elementRegistry, editorActions) {

Expand Down Expand Up @@ -34,6 +35,12 @@ function PropertyInfoPlugin(eventBus, overlays, elementRegistry, editorActions)
}
});

editorActions.register({
togglePropertyDocNotes: function () {
toggleDocNotes();
}
});

function changeShape(event) {
var element = event.element;
if (!(element.businessObject.$instanceOf('bpmn:FlowNode') || element.businessObject.$instanceOf('bpmn:Participant'))) {
Expand Down Expand Up @@ -75,6 +82,14 @@ function PropertyInfoPlugin(eventBus, overlays, elementRegistry, editorActions)
}
}

function toggleDocNotes() {
if (overlaysVisible) {
docNotesVisible = !docNotesVisible;
overlaysVisible = false;
toggleOverlays();
}
}

function addStyle(element) {

if (elementOverlays[element.id] !== undefined && elementOverlays[element.id].length !== 0) {
Expand All @@ -93,14 +108,17 @@ function PropertyInfoPlugin(eventBus, overlays, elementRegistry, editorActions)
var text = element.businessObject.documentation[0].text;
text = text.replace(/(?:\r\n|\r|\n)/g, '<br />');


var noteClass = "doc-val-hover";
if (docNotesVisible) {
noteClass += " doc-val-visible-note";
}
elementOverlays[element.id].push(
overlays.add(element, 'badge', {
position: {
top: 4,
right: 4
},
html: '<div class="doc-val-true" data-badge="D"></div><div class="doc-val-hover" data-badge="D">'+text+'</div>'
html: '<div class="doc-val-true" data-badge="D"></div><div class="'+noteClass+'" data-badge="D">'+text+'</div>'
}));
}

Expand Down
Loading