mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3817 from node-red/fix-regex-name-handle
Allow generateNodeNames to handle names containing regex control chars
This commit is contained in:
commit
86ac955b79
@ -1015,7 +1015,7 @@ RED.view.tools = (function() {
|
|||||||
const nodeDef = n._def || RED.nodes.getType(n.type)
|
const nodeDef = n._def || RED.nodes.getType(n.type)
|
||||||
if (nodeDef && nodeDef.defaults && nodeDef.defaults.name) {
|
if (nodeDef && nodeDef.defaults && nodeDef.defaults.name) {
|
||||||
const paletteLabel = RED.utils.getPaletteLabel(n.type, nodeDef)
|
const paletteLabel = RED.utils.getPaletteLabel(n.type, nodeDef)
|
||||||
const defaultNodeNameRE = new RegExp('^'+paletteLabel+' (\\d+)$')
|
const defaultNodeNameRE = new RegExp('^'+paletteLabel.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+' (\\d+)$')
|
||||||
if (!typeIndex.hasOwnProperty(n.type)) {
|
if (!typeIndex.hasOwnProperty(n.type)) {
|
||||||
const existingNodes = RED.nodes.filterNodes({type: n.type})
|
const existingNodes = RED.nodes.filterNodes({type: n.type})
|
||||||
let maxNameNumber = 0;
|
let maxNameNumber = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user