mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
let library createUi accept elements other than node-input-name
This commit is contained in:
parent
9066cedc29
commit
5e87828b29
@ -15,8 +15,8 @@
|
||||
**/
|
||||
RED.library = (function() {
|
||||
|
||||
|
||||
var exportToLibraryDialog;
|
||||
var element = "node-input-name";
|
||||
|
||||
function loadFlowLibrary() {
|
||||
$.getJSON("library/flows",function(data) {
|
||||
@ -86,6 +86,7 @@ RED.library = (function() {
|
||||
var libraryData = {};
|
||||
var selectedLibraryItem = null;
|
||||
var libraryEditor = null;
|
||||
element = options.element || "node-input-name";
|
||||
|
||||
// Orion editor has set/getText
|
||||
// ACE editor has set/getValue
|
||||
@ -157,7 +158,7 @@ RED.library = (function() {
|
||||
return ul;
|
||||
}
|
||||
|
||||
$('#node-input-name').css("width","66%").after(
|
||||
$('#'+element).css("width","calc(100% - 52px)").after(
|
||||
'<div class="btn-group" style="margin-left:5px;">'+
|
||||
'<a id="node-input-'+options.type+'-lookup" class="editor-button" data-toggle="dropdown"><i class="fa fa-book"></i> <i class="fa fa-caret-down"></i></a>'+
|
||||
'<ul class="dropdown-menu pull-right" role="menu">'+
|
||||
@ -187,7 +188,7 @@ RED.library = (function() {
|
||||
|
||||
$('#node-input-'+options.type+'-menu-save-library').click(function(e) {
|
||||
//var found = false;
|
||||
var name = $("#node-input-name").val().replace(/(^\s*)|(\s*$)/g,"");
|
||||
var name = $("#"+element).val().replace(/(^\s*)|(\s*$)/g,"");
|
||||
|
||||
//var buildPathList = function(data,root) {
|
||||
// var paths = [];
|
||||
@ -286,7 +287,7 @@ RED.library = (function() {
|
||||
});
|
||||
|
||||
function saveToLibrary(overwrite) {
|
||||
var name = $("#node-input-name").val().replace(/(^\s*)|(\s*$)/g,"");
|
||||
var name = $("#"+element).val().replace(/(^\s*)|(\s*$)/g,"");
|
||||
if (name === "") {
|
||||
name = RED._("library.unnamedType",{type:options.type});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user