Skip to content

Commit

Permalink
delete html tags from value (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yassir-BenBOUBKER authored Mar 28, 2024
1 parent ff6f43a commit 2cb078a
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 257 deletions.
243 changes: 122 additions & 121 deletions src/main/webapp/js/app.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/webapp/js/diagramly/Pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ DiagramPage.prototype.setName = function(value)
}
else
{
this.node.setAttribute('name', value);
this.node.setAttribute('name', value.replace(/<br>/g, ' ').replace(/&nbsp;/g, ' '));
}
};

Expand Down
14 changes: 12 additions & 2 deletions src/main/webapp/js/grapheditor/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,15 @@ Actions.prototype.init = function()

let cellAttributes = [];

function deleteHtml(label) {
return label.replace(/<br>/g, ' ').replace(/&nbsp;/g, ' ');
}

function createAttributes(arrayProps) {
return arrayProps.map((key) => {
if (cell.getAttribute(key) !== undefined) {
return {[key]: cell.getAttribute(key)};
const value = cell.getAttribute(key);
return {[key]: key === 'label' ? deleteHtml(value) : value};
}
}).filter(prop => prop !== undefined);
};
Expand Down Expand Up @@ -823,10 +828,15 @@ Actions.prototype.init = function()

const containerProps = ['type', 'modelId', 'viewId', 'imageName', 'centreonImageId', 'label'];

function deleteHtml(label) {
return label.replace(/<br>/g, ' ').replace(/&nbsp;/g, ' ');
}

function createAttributes(arrayProps) {
return arrayProps.map((key) => {
if (cell.getAttribute(key) !== undefined) {
return {[key]: cell.getAttribute(key)};
const value = cell.getAttribute(key);
return {[key]: key === 'label' ? deleteHtml(value) : value};
}
}).filter(prop => prop !== undefined);
};
Expand Down
Loading

0 comments on commit 2cb078a

Please sign in to comment.