bartbutenaers / node-red-contrib-ui-svg

A Node-RED widget node to show interactive SVG (vector graphics) in the dashboard
Apache License 2.0
94 stars 27 forks source link

Ace mode svg results in error 404 #2

Open bartbutenaers opened 5 years ago

bartbutenaers commented 5 years ago

The SVG editor is an ACE editor, which is created similar like the Template-node does it:

this.editor = RED.editor.createEditor({
   id: 'node-input-svg-editor',
   mode: 'ace/mode/html',
   value: $("#node-input-svgString").val()
});

However the Template-node supports HTML mode, while my node should only support SVG mode.

I suppose it should be supported by looking at the language list, but when I use it I get an error 404. This indicates that the resource file doesn't exist in Node-RED...

image

bartbutenaers commented 5 years ago

So we should use 'svg' instead of 'html' here:

this.editor = RED.editor.createEditor({
    id: 'node-input-svg-source',
    mode: 'ace/mode/html',
    value: $("#node-input-svgString").val()
});

And I think we have to remove this code snippet (which currently gives the error):

RED.library.create({
    url:"uitemplates", // where to get the data from
    type:"ui_template", // the type of object the library is for
    editor:this.editor, // the field name the main text body goes to
    mode:"ace/mode/svg",
    fields:['name']
});
bartbutenaers commented 4 years ago

As you can see in this discussion, SVG should be supported starting from Node-RED 1.0