Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// if the visual of the element is already replaced
if (context.visualReplacements[id]) {
return;
}
var element = elementRegistry.get(id);
assign(newElement, { x: element.x, y: element.y });
// create a temporary shape
var tempShape = elementFactory.createShape(newElement);
canvas.addShape(tempShape, element.parent);
// select the original SVG element related to the element and hide it
var gfx = domQuery('[data-element-id="' + cssEscape(element.id) + '"]', context.dragGroup);
if (gfx) {
svgAttr(gfx, { display: 'none' });
}
// clone the gfx of the temporary shape and add it to the drag group
var dragger = previewSupport.addDragger(tempShape, context.dragGroup);
context.visualReplacements[id] = dragger;
canvas.removeShape(tempShape);
});
}
BrowserDataFrame.prototype._getElement = function(label, _document) {
return _document && _document.querySelector('[data-label="' + cssEscape(label) + '"]');
};
function hasRoleInChannel(channel, roles, nick) {
if (!channel || !roles) {
return false;
}
const channelID = channel.attr("data-id");
const network = $("#sidebar .network").has(`.chan[data-id="${channelID}"]`);
const target = nick || network.attr("data-nick");
const user = channel.find(`.names .user[data-name="${escape(target)}"]`).first();
return user.parent().is("." + roles.join(", ."));
}
export function escape(name) {
return cssEscape(escapeAttr(name));
}
forEach(visualReplacements, function(dragger, id) {
var originalGfx = domQuery('[data-element-id="' + cssEscape(id) + '"]', context.dragGroup);
if (originalGfx) {
svgAttr(originalGfx, { display: 'inline' });
}
dragger.remove();
if (visualReplacements[id]) {
delete visualReplacements[id];
}
});
}
var getGfx = function(shape) {
var selector,
gfx;
if (dragGroup) {
selector = '[data-element-id="' + cssEscape(shape.id) + '"]';
gfx = dragGroup;
}
else if (visual) {
selector = '.djs-dragger';
gfx = visual;
}
return gfx && domQuery(selector, gfx);
};
export const escapeDeepLinkPath = (str) => cssEscape( createDeepLinkPath(str).replace(/%20/g, "_") )
export function getNodeById(elementId, container) {
return query(`[data-element-id="${ cssEscape(elementId) }"]`, container);
}