mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
merge upstream/dev
This commit is contained in:
@@ -34,11 +34,11 @@
|
||||
"view" : "Ansicht",
|
||||
"grid" : "Gitter",
|
||||
"showGrid" : "Raster anzeigen",
|
||||
"snapGrid" : "Einrasten am Raster",
|
||||
"snapGrid" : "Am Raster ausrichten",
|
||||
"gridSize" : "Rastergröße",
|
||||
"textDir" : "Textrichtung",
|
||||
"defaultDir" : "Standard",
|
||||
"ltr" : "Links-nach-rechts",
|
||||
"ltr" : "Von links nach rechts",
|
||||
"rtl" : "Von rechts nach links",
|
||||
"auto" : "Kontextuell"
|
||||
},
|
||||
@@ -53,15 +53,15 @@
|
||||
"import" : "Import",
|
||||
"export" : "Exportieren",
|
||||
"search" : "Flows durchsuchen",
|
||||
"searchInput" : "durchsuchen Sie Ihre Flows",
|
||||
"searchInput" : "Flows durchsuchen",
|
||||
"subflows" : "Subflow",
|
||||
"createSubflow" : "Subflow erstellen",
|
||||
"selectionToSubflow" : "Auswahl für Subflow",
|
||||
"selectionToSubflow" : "Auswahl zu Subflow",
|
||||
"flows" : "Flows",
|
||||
"add" : "Hinzufügen",
|
||||
"rename" : "Umbenennen",
|
||||
"delete" : "Löschen",
|
||||
"keyboardShortcuts" : "Tastaturkurzbefehle",
|
||||
"keyboardShortcuts" : "Tastenkürzel",
|
||||
"login" : "Anmelden",
|
||||
"logout" : "Abmelden",
|
||||
"editPalette" : "Palette verwalten",
|
||||
@@ -217,7 +217,7 @@
|
||||
"remote" : "Ferne Änderungen",
|
||||
"reviewChanges" : "Änderungen prüfen",
|
||||
"noBinaryFileShowed" : "Der Inhalt der Binärdatei kann nicht angezeigt",
|
||||
"viewCommitDiff" : "Änderungen festschreiben",
|
||||
"viewCommitDiff" : "Änderungen committen",
|
||||
"compareChanges" : "Änderungen vergleichen",
|
||||
"saveConflict" : "Konfliktlösung speichern",
|
||||
"conflictHeader" : "<span> __resolved__ </span> von <span> __unresolved__ </span> -Konflikten behoben",
|
||||
@@ -226,8 +226,8 @@
|
||||
"newVersionError" : "Neue Version enthält keine gültige JSON-Datei:"
|
||||
},
|
||||
"subflow" : {
|
||||
"editSubflow" : "Flowschablone bearbeiten: __name__",
|
||||
"edit" : "Flowsschablone bearbeiten",
|
||||
"editSubflow" : "Subflow bearbeiten: __name__",
|
||||
"edit" : "Subflow bearbeiten",
|
||||
"subflowInstances" : "Es ist __count__ Instanz dieser Subflow-Vorlage vorhanden.",
|
||||
"subflowInstances_plural" : "Es gibt __count__ Instanzen dieser Subflow-Vorlage.",
|
||||
"editSubflowProperties" : "Eigenschaften bearbeiten",
|
||||
@@ -266,7 +266,7 @@
|
||||
}
|
||||
},
|
||||
"keyboard" : {
|
||||
"title" : "Tastaturkurzbefehle",
|
||||
"title" : "Tastenkürzel",
|
||||
"keyboard" : "Tastatur",
|
||||
"filterActions" : "Filteraktionen",
|
||||
"shortcut" : "Direktaufruf",
|
||||
@@ -283,7 +283,7 @@
|
||||
"exportNode" : "Node exportieren",
|
||||
"nudgeNode" : "Ausgewählte Nodes verschieben (1px)",
|
||||
"moveNode" : "Ausgewählte Nodes verschieben (20px)",
|
||||
"toggleSidebar" : "Seitenleiste ein-/ausschalten",
|
||||
"toggleSidebar" : "Seitenleiste ein-/ausblenden",
|
||||
"copyNode" : "Ausgewählte Nodes kopieren",
|
||||
"cutNode" : "Ausgewählte Nodes ausschneiden",
|
||||
"pasteNode" : "Node einfügen",
|
||||
@@ -308,7 +308,7 @@
|
||||
},
|
||||
"palette" : {
|
||||
"noInfo" : "Keine Informationen verfügbar",
|
||||
"filter" : "Filter Nodes",
|
||||
"filter" : "Nodes filtern",
|
||||
"search" : "Suchmodule",
|
||||
"addCategory" : "Neu hinzufügen ...",
|
||||
"label" : {
|
||||
@@ -366,11 +366,11 @@
|
||||
"remove" : "entfernen",
|
||||
"update" : "Update auf __version__",
|
||||
"updated" : "aktualisiert",
|
||||
"install" : "installieren",
|
||||
"installed" : "installiert",
|
||||
"install" : "Installieren",
|
||||
"installed" : "Installiert",
|
||||
"loading" : "Kataloge werden geladen ...",
|
||||
"tab-nodes" : "Nodes",
|
||||
"tab-install" : "installieren",
|
||||
"tab-install" : "Installieren",
|
||||
"sort" : "Sortierung:",
|
||||
"sortAZ" : "a-z",
|
||||
"sortRecent" : "kürzlich",
|
||||
@@ -452,7 +452,7 @@
|
||||
"name" : "Kontextdaten",
|
||||
"label" : "Kontext",
|
||||
"none" : "keine ausgewählt",
|
||||
"refresh" : "Aktualisierung zum Laden",
|
||||
"refresh" : "Zum Aktualisieren neu laden",
|
||||
"empty" : "leer",
|
||||
"node" : "Node",
|
||||
"flow" : "Flow",
|
||||
@@ -477,7 +477,7 @@
|
||||
"none" : "Keine",
|
||||
"install" : "installieren",
|
||||
"removeFromProject" : "Aus Projekt entfernen",
|
||||
"addToProject" : "zu Projekt hinzufügen",
|
||||
"addToProject" : "Zu Projekt hinzufügen",
|
||||
"files" : "Dateien",
|
||||
"flow" : "Flow",
|
||||
"credentials" : "Berechtigungsnachweis",
|
||||
@@ -510,7 +510,7 @@
|
||||
},
|
||||
"userSettings" : {
|
||||
"committerDetail" : "Committer-Details",
|
||||
"committerTip" : "Leer Wert für Systemstandardwert belassen",
|
||||
"committerTip" : "Leer lassen für Systemstandard",
|
||||
"userName" : "Benutzername",
|
||||
"email" : "E-Mail",
|
||||
"sshKeys" : "SSH-Schlüssel",
|
||||
@@ -544,7 +544,7 @@
|
||||
"revertChanges" : "Änderungen zurücksetzen",
|
||||
"localChanges" : "Lokale Änderungen",
|
||||
"none" : "Keine",
|
||||
"conflictResolve" : "Alle Konflikte wurden aufgelöst. Festschreiben der Änderungen, um den Mischvorgang abzuschließen.",
|
||||
"conflictResolve" : "Alle Konflikte wurden aufgelöst. Committe die Änderungen, um den Merge Request abzuschließen.",
|
||||
"localFiles" : "Lokale Dateien",
|
||||
"all" : "alle",
|
||||
"unmergedChanges" : "Nicht zusammengeführte Änderungen",
|
||||
|
@@ -14,7 +14,11 @@
|
||||
"back": "Back",
|
||||
"next": "Next",
|
||||
"clone": "Clone project",
|
||||
"cont": "Continue"
|
||||
"cont": "Continue",
|
||||
"line": "Outline",
|
||||
"fill": "Fill",
|
||||
"color": "Color",
|
||||
"position": "Position"
|
||||
},
|
||||
"type": {
|
||||
"string": "string",
|
||||
@@ -91,7 +95,12 @@
|
||||
"projects-new": "New",
|
||||
"projects-open": "Open",
|
||||
"projects-settings": "Project Settings",
|
||||
"showNodeLabelDefault": "Show label of newly added nodes"
|
||||
"showNodeLabelDefault": "Show label of newly added nodes",
|
||||
"groups": "Groups",
|
||||
"groupSelection": "Group selection",
|
||||
"ungroupSelection": "Ungroup selection",
|
||||
"groupMergeSelection": "Merge selection",
|
||||
"groupRemoveSelection": "Remove from group"
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
@@ -171,6 +180,8 @@
|
||||
"node_plural": "__count__ nodes",
|
||||
"configNode": "__count__ configuration node",
|
||||
"configNode_plural": "__count__ configuration nodes",
|
||||
"group": "__count__ group",
|
||||
"group_plural": "__count__ groups",
|
||||
"flow": "__count__ flow",
|
||||
"flow_plural": "__count__ flows",
|
||||
"subflow": "__count__ subflow",
|
||||
@@ -186,6 +197,9 @@
|
||||
"nodesImported": "Imported:",
|
||||
"nodeCopied": "__count__ node copied",
|
||||
"nodeCopied_plural": "__count__ nodes copied",
|
||||
"groupCopied": "__count__ group copied",
|
||||
"groupCopied_plural": "__count__ groups copied",
|
||||
"groupStyleCopied": "Group style copied",
|
||||
"invalidFlow": "Invalid flow: __message__",
|
||||
"export": {
|
||||
"selected":"selected nodes",
|
||||
@@ -308,6 +322,13 @@
|
||||
"multipleInputsToSelection": "<strong>Cannot create subflow</strong>: multiple inputs to selection"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"editGroup": "Edit group: __name__",
|
||||
"errors": {
|
||||
"cannotCreateDiffGroups": "Cannot create group using nodes from different groups",
|
||||
"cannotAddSubflowPorts": "Cannot add subflow ports to a group"
|
||||
}
|
||||
},
|
||||
"editor": {
|
||||
"configEdit": "Edit",
|
||||
"configAdd": "Add",
|
||||
@@ -539,6 +560,7 @@
|
||||
"label": "info",
|
||||
"node": "Node",
|
||||
"type": "Type",
|
||||
"group": "Group",
|
||||
"module": "Module",
|
||||
"id": "ID",
|
||||
"status": "Status",
|
||||
@@ -978,7 +1000,8 @@
|
||||
"passphrase": "Passphrase",
|
||||
"retry": "Retry",
|
||||
"update-failed": "Failed to update auth",
|
||||
"unhandled": "Unhandled error response"
|
||||
"unhandled": "Unhandled error response",
|
||||
"host-key-verify-failed": "<p>Host key verification failed.</p><p>The repository host key could not be verified. Please update your <code>known_hosts</code> file and try again."
|
||||
},
|
||||
"create-branch-list": {
|
||||
"invalid": "Invalid branch",
|
||||
|
@@ -24,7 +24,7 @@
|
||||
"buffer": "buffer",
|
||||
"object": "对象",
|
||||
"jsonString": "JSON字符串",
|
||||
"undefined": "为定义",
|
||||
"undefined": "未定义",
|
||||
"null": "空"
|
||||
}
|
||||
},
|
||||
@@ -1008,6 +1008,7 @@
|
||||
"en-US": "英文",
|
||||
"ja": "日语",
|
||||
"ko": "韩文",
|
||||
"zh-CN": "简体中文"
|
||||
"zh-CN": "简体中文",
|
||||
"zh-TW": "繁体中文"
|
||||
}
|
||||
}
|
||||
|
@@ -262,5 +262,9 @@
|
||||
"$distinct": {
|
||||
"args": "array",
|
||||
"desc": "返回一个数组,其中重复的值已从`数组`中删除"
|
||||
},
|
||||
"$type": {
|
||||
"args": "value",
|
||||
"desc": "以字符串形式返回`值`的类型。 如果该`值`未定义,则将返回`未定义`"
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,17 @@
|
||||
"next": "下一步",
|
||||
"clone": "複製專案",
|
||||
"cont": "Continue"
|
||||
},
|
||||
"type": {
|
||||
"string": "字符串",
|
||||
"number": "數值",
|
||||
"boolean": "布林",
|
||||
"array": "數組",
|
||||
"buffer": "buffer",
|
||||
"object": "對象",
|
||||
"jsonString": "JSON字符串",
|
||||
"undefined": "未定義",
|
||||
"null": "空"
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
@@ -29,8 +40,7 @@
|
||||
"enabled": "有效",
|
||||
"disabled": "無效",
|
||||
"info": "詳細描述",
|
||||
"selectNodes": "點擊節點用於選擇",
|
||||
"tip": "詳細描述支援Markdown羽量級標記語言,並將出現在資訊標籤中。"
|
||||
"selectNodes": "點擊節點用於選擇"
|
||||
},
|
||||
"menu": {
|
||||
"label": {
|
||||
@@ -45,14 +55,14 @@
|
||||
"ltr": "從左到右",
|
||||
"rtl": "從右到左",
|
||||
"auto": "上下文",
|
||||
"language": "Language",
|
||||
"browserDefault": "Browser default"
|
||||
"language": "語言",
|
||||
"browserDefault": "瀏覽器默認"
|
||||
},
|
||||
"sidebar": {
|
||||
"show": "顯示側邊欄"
|
||||
},
|
||||
"palette": {
|
||||
"show": "Show palette"
|
||||
"show": "顯示控制板"
|
||||
},
|
||||
"settings": "設置",
|
||||
"userSettings": "使用者設置",
|
||||
@@ -81,10 +91,7 @@
|
||||
"projects-new": "新專案",
|
||||
"projects-open": "開啟專案",
|
||||
"projects-settings": "專案設定",
|
||||
"showNodeLabelDefault": "顯示新添加節點的標籤",
|
||||
"clipboard": "剪貼簿",
|
||||
"library": "庫",
|
||||
"examples": "範例"
|
||||
"showNodeLabelDefault": "顯示新添加節點的標籤"
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
@@ -204,8 +211,7 @@
|
||||
},
|
||||
"copyMessagePath": "已複製路徑",
|
||||
"copyMessageValue": "已複製數值",
|
||||
"copyMessageValue_truncated": "已複製捨棄的數值",
|
||||
"selectNodes": "選擇上面的文本並複製到剪貼簿"
|
||||
"copyMessageValue_truncated": "已複製捨棄的數值"
|
||||
},
|
||||
"deploy": {
|
||||
"deploy": "部署",
|
||||
@@ -237,7 +243,7 @@
|
||||
"undeployedChanges": "您有未部署的更改。\n\n離開此頁面將丟失這些更改。",
|
||||
"improperlyConfigured": "工作區包含一些未正確配置的節點:",
|
||||
"unknown": "工作區包含一些未知的節點類型:",
|
||||
"confirm": "你確定要部署嗎?",
|
||||
"confirm": "確定要部署嗎?",
|
||||
"doNotWarn": "不要再對此發出警告",
|
||||
"conflict": "伺服器正在運行較新的一組流程。",
|
||||
"backgroundUpdate": "伺服器上的流程已更新。",
|
||||
@@ -300,8 +306,7 @@
|
||||
"errors": {
|
||||
"noNodesSelected": "<strong>無法創建子流程</strong>: 未選擇節點",
|
||||
"multipleInputsToSelection": "<strong>無法創建子流程</strong>: 多個輸入到了選擇"
|
||||
},
|
||||
"format": "標記格式"
|
||||
}
|
||||
},
|
||||
"editor": {
|
||||
"configEdit": "編輯",
|
||||
@@ -316,17 +321,53 @@
|
||||
"addNewType": "添加新的__type__節點",
|
||||
"nodeProperties": "節點屬性",
|
||||
"label": "Label",
|
||||
"color": "顏色",
|
||||
"portLabels": "埠標籤",
|
||||
"labelInputs": "輸入",
|
||||
"labelOutputs": "輸出",
|
||||
"settingIcon": "Icon",
|
||||
"default": "默認",
|
||||
"noDefaultLabel": "無",
|
||||
"defaultLabel": "使用默認標籤",
|
||||
"searchIcons": "搜尋 icons",
|
||||
"searchIcons": "搜尋圖標",
|
||||
"useDefault": "使用默認",
|
||||
"description": "描述",
|
||||
"show": "顯示",
|
||||
"hide": "隱藏",
|
||||
"locale": "選擇界面語言",
|
||||
"icon": "圖標",
|
||||
"inputType": "輸入類型",
|
||||
"inputs": {
|
||||
"input": "輸入",
|
||||
"select": "選擇",
|
||||
"checkbox": "復選框",
|
||||
"spinner": "微調器",
|
||||
"none": "空",
|
||||
"hidden": "隱藏屬性"
|
||||
},
|
||||
"types": {
|
||||
"str": "字符串",
|
||||
"num": "數字",
|
||||
"bool": "布爾",
|
||||
"json": "JSON",
|
||||
"bin": "buffer",
|
||||
"env": "環境變量"
|
||||
},
|
||||
"menu": {
|
||||
"input": "輸入",
|
||||
"select": "選擇",
|
||||
"checkbox": "復選框",
|
||||
"spinner": "微調器",
|
||||
"hidden": "僅標簽"
|
||||
},
|
||||
"select": {
|
||||
"label": "標簽",
|
||||
"value": "值"
|
||||
},
|
||||
"spinner": {
|
||||
"min": "最小值",
|
||||
"max": "最大值"
|
||||
},
|
||||
"errors": {
|
||||
"scopeChange": "更改範圍將使其他流程中的節點無法使用",
|
||||
"invalidProperties": "無效的屬性:"
|
||||
@@ -356,8 +397,9 @@
|
||||
"cutNode": "剪切所選節點",
|
||||
"pasteNode": "粘貼節點",
|
||||
"undoChange": "撤銷上次執行的更改",
|
||||
"searchBox": "打開搜索框",
|
||||
"managePalette": "管理面板"
|
||||
"searchBox": "打開搜尋框",
|
||||
"managePalette": "管理面板",
|
||||
"actionList": "動作列表"
|
||||
},
|
||||
"library": {
|
||||
"library": "庫",
|
||||
@@ -371,28 +413,27 @@
|
||||
"savedNodes": "保存的節點",
|
||||
"savedType": "已保存__type__",
|
||||
"saveFailed": "保存失敗: __message__",
|
||||
"newFolder": "新文件夾",
|
||||
"types": {
|
||||
"local": "本地",
|
||||
"examples": "例子"
|
||||
},
|
||||
"exportToLibrary": "將節點匯出到庫",
|
||||
"filename": "檔案名",
|
||||
"folder": "資料夾",
|
||||
"filenamePlaceholder": "文件",
|
||||
"fullFilenamePlaceholder": "a/b/文件",
|
||||
"folderPlaceholder": "a/b",
|
||||
"breadcrumb": "庫"
|
||||
"exportToLibrary": "將節點匯出到庫"
|
||||
},
|
||||
"palette": {
|
||||
"noInfo": "無可用資訊",
|
||||
"filter": "過濾節點",
|
||||
"search": "搜索模組",
|
||||
"search": "搜尋模組",
|
||||
"addCategory": "添加新的...",
|
||||
"label": {
|
||||
"subflows": "子流程",
|
||||
"network": "網絡",
|
||||
"common": "共通",
|
||||
"input": "輸入",
|
||||
"output": "輸出",
|
||||
"function": "功能",
|
||||
"sequence": "序列",
|
||||
"parser": "解析",
|
||||
"social": "社交",
|
||||
"storage": "存儲",
|
||||
"analysis": "分析",
|
||||
@@ -459,7 +500,7 @@
|
||||
"sortRecent": "日期順序",
|
||||
"more": "增加__count__個",
|
||||
"errors": {
|
||||
"catalogLoadFailed": "無法載入節點目錄。<br>查看瀏覽器控制台瞭解更多資訊",
|
||||
"catalogLoadFailed": "無法載入節點目錄。<br>查看瀏覽器控制臺瞭解更多資訊",
|
||||
"installFailed": "無法安裝: __module__<br>__message__<br>查看日誌瞭解更多資訊",
|
||||
"removeFailed": "無法刪除: __module__<br>__message__<br>查看日誌瞭解更多資訊",
|
||||
"updateFailed": "無法更新: __module__<br>__message__<br>查看日誌瞭解更多資訊",
|
||||
@@ -529,8 +570,10 @@
|
||||
"none": "無",
|
||||
"subflows": "子流程",
|
||||
"flows": "流程",
|
||||
"filterUnused": "未使用",
|
||||
"filterAll": "所有",
|
||||
"showAllConfigNodes": "顯示所有配置節點",
|
||||
"filterUnused": "未使用",
|
||||
"showAllUnusedConfigNodes": "顯示所有未使用的配置節點",
|
||||
"filtered": "__count__ 個隱藏"
|
||||
},
|
||||
"context": {
|
||||
@@ -543,7 +586,9 @@
|
||||
"flow": "流程",
|
||||
"global": "全局的",
|
||||
"deleteConfirm": "你確定要刪除這個項目嗎?",
|
||||
"autoRefresh": "自動刷新"
|
||||
"autoRefresh": "自動刷新",
|
||||
"refrsh": "刷新",
|
||||
"delete": "刪除"
|
||||
},
|
||||
"palette": {
|
||||
"name": "節點管理",
|
||||
@@ -558,6 +603,7 @@
|
||||
"noSummaryAvailable": "無可用摘要",
|
||||
"editDescription": "編輯專案描述",
|
||||
"editDependencies": "編輯項目依賴",
|
||||
"noDescriptionAvailable": "沒有可用的描述",
|
||||
"editReadme": "Edit README.md",
|
||||
"showProjectSettings": "顯示項目設置",
|
||||
"projectSettings": {
|
||||
@@ -657,15 +703,15 @@
|
||||
"moreCommits": "更多提交",
|
||||
"changeLocalBranch": "變更當地分支",
|
||||
"createBranchPlaceholder": "查找或創建分支",
|
||||
"upstream": "上游的",
|
||||
"localOverwrite": "您有可通过切换分支覆盖的本地更改。您必须先提交或撤销那些更改。",
|
||||
"upstream": "上遊的",
|
||||
"localOverwrite": "您有可通過切換分支覆蓋的本地更改。您必須先提交或撤銷那些更改。",
|
||||
"manageRemoteBranch": "管理遠程分支",
|
||||
"unableToAccess": "無法訪問遠程存儲庫",
|
||||
"retry": "重試",
|
||||
"setUpstreamBranch": "設置為上游分支",
|
||||
"setUpstreamBranch": "設置為上遊分支",
|
||||
"createRemoteBranchPlaceholder": "查找或創建遠程分支",
|
||||
"trackedUpstreamBranch": "創建的分支將被設置為跟踪的上游分支。",
|
||||
"selectUpstreamBranch": "分支將被創建。 在下面選擇以將其設置為被跟踪的上游分支。",
|
||||
"trackedUpstreamBranch": "創建的分支將被設置為跟蹤的上遊分支。",
|
||||
"selectUpstreamBranch": "分支將被創建。 在下面選擇以將其設置為被跟蹤的上遊分支。",
|
||||
"pushFailed": "Push失敗,因為遠程具有更多的最新提交。請先進行pull與merge,然後再嘗試push。",
|
||||
"push": "push",
|
||||
"pull": "pull",
|
||||
@@ -683,7 +729,7 @@
|
||||
"minsAgo": "__count__分鐘前",
|
||||
"minsAgo_plural": "__count__分鐘前",
|
||||
"secondsAgo": "秒前",
|
||||
"notTracking": "您的本地分支當前未跟踪遠程分支。",
|
||||
"notTracking": "您的本地分支當前未跟蹤遠程分支。",
|
||||
"statusUnmergedChanged": "您的存儲庫中有未合併的更改。您需要解決衝突並提交結果。",
|
||||
"repositoryUpToDate": "您的存儲庫是最新的。",
|
||||
"commitsAhead": "您的倉庫領先遠程倉庫__count__次提交。您現在可以push這些提交。",
|
||||
@@ -748,10 +794,23 @@
|
||||
},
|
||||
"jsonEditor": {
|
||||
"title": "JSON編輯器",
|
||||
"format": "格式化JSON"
|
||||
"format": "格式化JSON",
|
||||
"rawMode": "編輯 JSON",
|
||||
"uiMode": "Visual編輯器",
|
||||
"insertAbove": "在上方插入",
|
||||
"insertBelow": "在下方插入",
|
||||
"addItem": "添加項目",
|
||||
"copyPath": "復制路徑到項目",
|
||||
"expandItems": "展開項目",
|
||||
"collapseItems": "收合項目",
|
||||
"duplicate": "重復",
|
||||
"error": {
|
||||
"invalidJSON": "無效的JSON: "
|
||||
}
|
||||
},
|
||||
"markdownEditor": {
|
||||
"title": "Markdown 編輯器",
|
||||
"expand": "展開",
|
||||
"format": "F使用markdown格式化",
|
||||
"heading1": "Heading 1",
|
||||
"heading2": "Heading 2",
|
||||
@@ -786,7 +845,7 @@
|
||||
},
|
||||
"git-config": {
|
||||
"setup": "設置您的版本控制客戶端",
|
||||
"desc0": "Node-RED使用開源工具Git進行版本控制。 它跟踪對項目文件的更改,並允許您將其推送到遠程存儲庫。",
|
||||
"desc0": "Node-RED使用開源工具Git進行版本控制。 它跟蹤對項目文件的更改,並允許您將其推送到遠程存儲庫。",
|
||||
"desc1": "提交一組更改時,Git會使用用戶名和電子郵件地址記錄誰進行了更改。 用戶名可以是您想要的任何名稱-不必是您的真實姓名。",
|
||||
"desc2": "您的Git客戶端已經配置了以下詳細信息。",
|
||||
"desc3": "您可以稍後在設置對話框的“ Git config”標籤下更改這些設置。",
|
||||
@@ -905,7 +964,7 @@
|
||||
"confirm": "您確定要刪除此項目嗎?"
|
||||
},
|
||||
"create-project-list": {
|
||||
"search": "搜索您的項目",
|
||||
"search": "搜尋您的項目",
|
||||
"current": "當前的"
|
||||
},
|
||||
"require-clean": {
|
||||
@@ -938,8 +997,19 @@
|
||||
},
|
||||
"editor-tab": {
|
||||
"properties": "屬性",
|
||||
"envProperties": "環境變量",
|
||||
"description": "描述",
|
||||
"appearance": "外觀",
|
||||
"preview": "UI預覽",
|
||||
"defaultValue": "默認值",
|
||||
"env": "環境變量"
|
||||
},
|
||||
"languages": {
|
||||
"de": "德語",
|
||||
"en-US": "英語",
|
||||
"ja": "日語",
|
||||
"ko": "韓語",
|
||||
"zh-CN": "簡體中文",
|
||||
"zh-TW": "繁體中文"
|
||||
}
|
||||
}
|
||||
|
@@ -214,5 +214,57 @@
|
||||
"$toMillis": {
|
||||
"args": "timestamp",
|
||||
"desc": "將ISO 8601格式的字串`timestamp`轉換為從UNIX時間 (1970年1月1日 UTC/GMT的午夜)開始到現在的毫秒數。如果該字串的格式不正確,則拋出錯誤。"
|
||||
},
|
||||
"$env": {
|
||||
"args": "arg",
|
||||
"desc": "返回環境變量的值。\n\n這是Node-RED定義的函數。"
|
||||
},
|
||||
"$eval": {
|
||||
"args": "expr [, context]",
|
||||
"desc": "使用當前上下文來作為評估依據,分析並評估字符串`expr`,其中包含文字JSON或JSONata表達式。"
|
||||
},
|
||||
"$formatInteger": {
|
||||
"args": "number, picture",
|
||||
"desc": "將“數字”轉換為字符串,並將其格式化為“圖片”字符串指定的整數表示形式。圖片字符串參數定義了數字的格式,並具有與XPath F&O 3.1 規範中的fn:format-integer相同的語法。"
|
||||
},
|
||||
"$parseInteger": {
|
||||
"args": "string, picture",
|
||||
"desc": "使用“圖片”字符串指定的格式將“字符串”參數的內容解析為整數(作為JSON數字)。圖片字符串參數與$formatInteger格式相同。."
|
||||
},
|
||||
"$error": {
|
||||
"args": "[str]",
|
||||
"desc": "引發錯誤並顯示一條消息。 可選的`str`將替代$error()函數評估的默認消息。"
|
||||
},
|
||||
"$assert": {
|
||||
"args": "arg, str",
|
||||
"desc": "如果`arg`為真,則該函數返回。 如果arg為假,則拋出帶有str的異常作為異常消息。"
|
||||
},
|
||||
"$single": {
|
||||
"args": "array, function",
|
||||
"desc": "返回滿足參數function謂語的array參數中的唯一值 (比如:傳遞值時,函數返回布林值“true”)。如果匹配值的數量不唯一時,則拋出異常。\n\n應在以下簽名中提供函數:`function(value [,index [,array []]])`其中value是數組的每個輸入,index是該值的位置,整個數組作為第三個參數傳遞。"
|
||||
},
|
||||
"$encodeUrl": {
|
||||
"args": "str",
|
||||
"desc": "通過用表示字符的UTF-8編碼的一個,兩個,三個或四個轉義序列替換某些字符的每個實例,對統一資源定位符(URL)組件進行編碼。\n\n示例:`$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
|
||||
},
|
||||
"$encodeUrlComponent": {
|
||||
"args": "str",
|
||||
"desc": "通過用表示字符的UTF-8編碼的一個,兩個,三個或四個轉義序列替換某些字符的每個實例,對統一資源定位符(URL)進行編碼。\n\n示例: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
|
||||
},
|
||||
"$decodeUrl": {
|
||||
"args": "str",
|
||||
"desc": "解碼以前由encodeUrlComponent創建的統一資源定位器(URL)組件。 \n\n示例: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
|
||||
},
|
||||
"$decodeUrlComponent": {
|
||||
"args": "str",
|
||||
"desc": "解碼先前由encodeUrl創建的統一資源定位符(URL)。 \n\n示例: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
|
||||
},
|
||||
"$distinct": {
|
||||
"args": "array",
|
||||
"desc": "返回一個數組,其中重復的值已從`數組`中刪除"
|
||||
},
|
||||
"$type": {
|
||||
"args": "value",
|
||||
"desc": "以字符串形式返回`值`的類型。 如果該`值`未定義,則將返回`未定義`"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-client",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@@ -21,6 +21,7 @@ RED.history = (function() {
|
||||
var i;
|
||||
var len;
|
||||
var node;
|
||||
var group;
|
||||
var subflow;
|
||||
var modifiedTabs = {};
|
||||
var inverseEv;
|
||||
@@ -74,6 +75,15 @@ RED.history = (function() {
|
||||
RED.nodes.removeLink(ev.links[i]);
|
||||
}
|
||||
}
|
||||
if (ev.groups) {
|
||||
inverseEv.groups = [];
|
||||
for (i=0;i<ev.groups.length;i++) {
|
||||
group = ev.groups[i];
|
||||
modifiedTabs[group.z] = true;
|
||||
inverseEv.groups.push(group);
|
||||
RED.nodes.removeGroup(group);
|
||||
}
|
||||
}
|
||||
if (ev.workspaces) {
|
||||
inverseEv.workspaces = [];
|
||||
for (i=0;i<ev.workspaces.length;i++) {
|
||||
@@ -193,12 +203,35 @@ RED.history = (function() {
|
||||
n.dirty = true;
|
||||
});
|
||||
}
|
||||
if (ev.groups) {
|
||||
inverseEv.groups = [];
|
||||
var groupsToAdd = new Set(ev.groups.map(function(g) { return g.id }));
|
||||
for (i=0;i<ev.groups.length;i++) {
|
||||
RED.nodes.addGroup(ev.groups[i])
|
||||
modifiedTabs[ev.groups[i].z] = true;
|
||||
inverseEv.groups.push(ev.groups[i]);
|
||||
if (ev.groups[i].g && !groupsToAdd.has(ev.groups[i].g)) {
|
||||
group = RED.nodes.group(ev.groups[i].g);
|
||||
if (group.nodes.indexOf(ev.groups[i]) === -1) {
|
||||
group.nodes.push(ev.groups[i]);
|
||||
}
|
||||
RED.group.markDirty(ev.groups[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ev.nodes) {
|
||||
inverseEv.nodes = [];
|
||||
for (i=0;i<ev.nodes.length;i++) {
|
||||
RED.nodes.add(ev.nodes[i]);
|
||||
modifiedTabs[ev.nodes[i].z] = true;
|
||||
inverseEv.nodes.push(ev.nodes[i].id);
|
||||
if (ev.nodes[i].g) {
|
||||
group = RED.nodes.group(ev.nodes[i].g);
|
||||
if (group.nodes.indexOf(ev.nodes[i]) === -1) {
|
||||
group.nodes.push(ev.nodes[i]);
|
||||
}
|
||||
RED.group.markDirty(group)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ev.links) {
|
||||
@@ -260,6 +293,13 @@ RED.history = (function() {
|
||||
RED.nodes.addLink(ev.removedLinks[i]);
|
||||
}
|
||||
}
|
||||
if (ev.addToGroup) {
|
||||
RED.group.removeFromGroup(ev.addToGroup,ev.nodes.map(function(n) { return n.n }),true);
|
||||
inverseEv.removeFromGroup = ev.addToGroup;
|
||||
} else if (ev.removeFromGroup) {
|
||||
RED.group.addToGroup(ev.removeFromGroup,ev.nodes.map(function(n) { return n.n }));
|
||||
inverseEv.addToGroup = ev.removeFromGroup;
|
||||
}
|
||||
} else if (ev.t == "edit") {
|
||||
inverseEv = {
|
||||
t: "edit",
|
||||
@@ -370,7 +410,9 @@ RED.history = (function() {
|
||||
if (ev.nodes) {
|
||||
inverseEv.movedNodes = [];
|
||||
var z = ev.activeWorkspace;
|
||||
RED.nodes.filterNodes({z:ev.subflow.subflow.id}).forEach(function(n) {
|
||||
var fullNodeList = RED.nodes.filterNodes({z:ev.subflow.subflow.id});
|
||||
fullNodeList = fullNodeList.concat(RED.nodes.groups(ev.subflow.subflow.id))
|
||||
fullNodeList.forEach(function(n) {
|
||||
n.x += ev.subflow.offsetX;
|
||||
n.y += ev.subflow.offsetY;
|
||||
n.dirty = true;
|
||||
@@ -411,6 +453,9 @@ RED.history = (function() {
|
||||
if (ev.subflow) {
|
||||
RED.nodes.addSubflow(ev.subflow.subflow);
|
||||
inverseEv.subflow = ev.subflow;
|
||||
if (ev.subflow.subflow.g) {
|
||||
RED.group.addToGroup(RED.nodes.group(ev.subflow.subflow.g),ev.subflow.subflow);
|
||||
}
|
||||
}
|
||||
if (ev.subflows) {
|
||||
inverseEv.nodes = [];
|
||||
@@ -422,6 +467,9 @@ RED.history = (function() {
|
||||
if (ev.movedNodes) {
|
||||
ev.movedNodes.forEach(function(nid) {
|
||||
nn = RED.nodes.node(nid);
|
||||
if (!nn) {
|
||||
nn = RED.nodes.group(nid);
|
||||
}
|
||||
nn.x -= ev.subflow.offsetX;
|
||||
nn.y -= ev.subflow.offsetY;
|
||||
nn.dirty = true;
|
||||
@@ -435,7 +483,7 @@ RED.history = (function() {
|
||||
RED.nodes.addLink(ev.links[i]);
|
||||
}
|
||||
}
|
||||
if (ev.createdLinks) {
|
||||
if (ev.createdLinks) {
|
||||
inverseEv.removedLinks = [];
|
||||
for (i=0;i<ev.createdLinks.length;i++) {
|
||||
inverseEv.removedLinks.push(ev.createdLinks[i]);
|
||||
@@ -450,6 +498,55 @@ RED.history = (function() {
|
||||
if (ev.order) {
|
||||
RED.workspaces.order(ev.order);
|
||||
}
|
||||
} else if (ev.t == "createGroup") {
|
||||
inverseEv = {
|
||||
t: "ungroup",
|
||||
dirty: RED.nodes.dirty(),
|
||||
groups: []
|
||||
}
|
||||
if (ev.groups) {
|
||||
for (i=0;i<ev.groups.length;i++) {
|
||||
inverseEv.groups.push(ev.groups[i]);
|
||||
RED.group.ungroup(ev.groups[i]);
|
||||
}
|
||||
}
|
||||
} else if (ev.t == "ungroup") {
|
||||
inverseEv = {
|
||||
t: "createGroup",
|
||||
dirty: RED.nodes.dirty(),
|
||||
groups: []
|
||||
}
|
||||
if (ev.groups) {
|
||||
for (i=0;i<ev.groups.length;i++) {
|
||||
inverseEv.groups.push(ev.groups[i]);
|
||||
var nodes = ev.groups[i].nodes.slice();
|
||||
ev.groups[i].nodes = [];
|
||||
RED.nodes.addGroup(ev.groups[i]);
|
||||
RED.group.addToGroup(ev.groups[i],nodes);
|
||||
}
|
||||
}
|
||||
} else if (ev.t == "addToGroup") {
|
||||
inverseEv = {
|
||||
t: "removeFromGroup",
|
||||
dirty: RED.nodes.dirty(),
|
||||
group: ev.group,
|
||||
nodes: ev.nodes,
|
||||
reparent: ev.reparent
|
||||
}
|
||||
if (ev.nodes) {
|
||||
RED.group.removeFromGroup(ev.group,ev.nodes,(ev.hasOwnProperty('reparent')&&ev.hasOwnProperty('reparent')!==undefined)?ev.reparent:true);
|
||||
}
|
||||
} else if (ev.t == "removeFromGroup") {
|
||||
inverseEv = {
|
||||
t: "addToGroup",
|
||||
dirty: RED.nodes.dirty(),
|
||||
group: ev.group,
|
||||
nodes: ev.nodes,
|
||||
reparent: ev.reparent
|
||||
}
|
||||
if (ev.nodes) {
|
||||
RED.group.addToGroup(ev.group,ev.nodes);
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(modifiedTabs).forEach(function(id) {
|
||||
@@ -460,8 +557,8 @@ RED.history = (function() {
|
||||
});
|
||||
|
||||
RED.nodes.dirty(ev.dirty);
|
||||
RED.view.updateActive();
|
||||
RED.view.select(null);
|
||||
RED.view.redraw(true);
|
||||
RED.palette.refresh();
|
||||
RED.workspaces.refresh();
|
||||
RED.sidebar.config.refresh();
|
||||
@@ -482,6 +579,9 @@ RED.history = (function() {
|
||||
list: function() {
|
||||
return undoHistory;
|
||||
},
|
||||
listRedo: function() {
|
||||
return redoHistory;
|
||||
},
|
||||
depth: function() {
|
||||
return undoHistory.length;
|
||||
},
|
||||
|
@@ -61,6 +61,10 @@
|
||||
"shift-down": "core:step-selection-down",
|
||||
"shift-left": "core:step-selection-left",
|
||||
"ctrl-shift-j": "core:show-previous-tab",
|
||||
"ctrl-shift-k": "core:show-next-tab"
|
||||
"ctrl-shift-k": "core:show-next-tab",
|
||||
"ctrl-shift-g": "core:group-selection",
|
||||
"ctrl-shift-u": "core:ungroup-selection",
|
||||
"ctrl-shift-c": "core:copy-group-style",
|
||||
"ctrl-shift-v": "core:paste-group-style"
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,9 @@ RED.nodes = (function() {
|
||||
var subflows = {};
|
||||
var loadedFlowVersion = null;
|
||||
|
||||
var groups = {};
|
||||
var groupsByZ = {};
|
||||
|
||||
var initialLoad;
|
||||
|
||||
var dirty = false;
|
||||
@@ -302,6 +305,10 @@ RED.nodes = (function() {
|
||||
}
|
||||
|
||||
function moveNodeToTab(node, z) {
|
||||
if (node.type === "group") {
|
||||
moveGroupToTab(node,z);
|
||||
return;
|
||||
}
|
||||
if (nodeTabMap[node.z]) {
|
||||
delete nodeTabMap[node.z][node.id];
|
||||
}
|
||||
@@ -311,6 +318,13 @@ RED.nodes = (function() {
|
||||
nodeTabMap[z][node.id] = node;
|
||||
node.z = z;
|
||||
}
|
||||
function moveGroupToTab(group, z) {
|
||||
var index = groupsByZ[group.z].indexOf(group);
|
||||
groupsByZ[group.z].splice(index,1);
|
||||
groupsByZ[z] = groupsByZ[z] || [];
|
||||
groupsByZ[z].push(group);
|
||||
group.z = z;
|
||||
}
|
||||
|
||||
function removeLink(l) {
|
||||
var index = links.indexOf(l);
|
||||
@@ -340,6 +354,7 @@ RED.nodes = (function() {
|
||||
|
||||
var removedNodes = [];
|
||||
var removedLinks = [];
|
||||
var removedGroups = [];
|
||||
var n;
|
||||
var node;
|
||||
for (n=0;n<nodes.length;n++) {
|
||||
@@ -356,11 +371,17 @@ RED.nodes = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
removedGroups = groupsByZ[id] || [];
|
||||
removedGroups.forEach(function(g) {
|
||||
delete groups[g.id]
|
||||
})
|
||||
delete groupsByZ[id];
|
||||
|
||||
for (n=0;n<removedNodes.length;n++) {
|
||||
var result = removeNode(removedNodes[n].id);
|
||||
removedLinks = removedLinks.concat(result.links);
|
||||
}
|
||||
return {nodes:removedNodes,links:removedLinks};
|
||||
return {nodes:removedNodes,links:removedLinks, groups: removedGroups};
|
||||
}
|
||||
|
||||
function addSubflow(sf, createNewIds) {
|
||||
@@ -497,6 +518,9 @@ RED.nodes = (function() {
|
||||
if (n.d === true) {
|
||||
node.d = true;
|
||||
}
|
||||
if (n.g) {
|
||||
node.g = n.g;
|
||||
}
|
||||
if (node.type == "unknown") {
|
||||
for (var p in n._orig) {
|
||||
if (n._orig.hasOwnProperty(p)) {
|
||||
@@ -544,6 +568,13 @@ RED.nodes = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (n.type === "group") {
|
||||
node.x = n.x;
|
||||
node.y = n.y;
|
||||
node.w = n.w;
|
||||
node.h = n.h;
|
||||
node.nodes = node.nodes.map(function(n) { return n.id });
|
||||
}
|
||||
if (n._def.category != "config") {
|
||||
node.x = n.x;
|
||||
node.y = n.y;
|
||||
@@ -669,8 +700,18 @@ RED.nodes = (function() {
|
||||
/**
|
||||
* Converts the current node selection to an exportable JSON Object
|
||||
**/
|
||||
function createExportableNodeSet(set, exportedSubflows, exportedConfigNodes) {
|
||||
function createExportableNodeSet(set, exportedIds, exportedSubflows, exportedConfigNodes) {
|
||||
var nns = [];
|
||||
|
||||
exportedIds = exportedIds || {};
|
||||
set = set.filter(function(n) {
|
||||
if (exportedIds[n.id]) {
|
||||
return false;
|
||||
}
|
||||
exportedIds[n.id] = true;
|
||||
return true;
|
||||
})
|
||||
|
||||
exportedConfigNodes = exportedConfigNodes || {};
|
||||
exportedSubflows = exportedSubflows || {};
|
||||
for (var n=0;n<set.length;n++) {
|
||||
@@ -686,11 +727,11 @@ RED.nodes = (function() {
|
||||
subflowSet.push(n);
|
||||
}
|
||||
});
|
||||
var exportableSubflow = createExportableNodeSet(subflowSet, exportedSubflows, exportedConfigNodes);
|
||||
var exportableSubflow = createExportableNodeSet(subflowSet, exportedIds, exportedSubflows, exportedConfigNodes);
|
||||
nns = exportableSubflow.concat(nns);
|
||||
}
|
||||
}
|
||||
if (node.type != "subflow") {
|
||||
if (node.type !== "subflow") {
|
||||
var convertedNode = RED.nodes.convertNode(node);
|
||||
for (var d in node._def.defaults) {
|
||||
if (node._def.defaults[d].type && node[d] in configNodes) {
|
||||
@@ -707,6 +748,9 @@ RED.nodes = (function() {
|
||||
}
|
||||
}
|
||||
nns.push(convertedNode);
|
||||
if (node.type === "group") {
|
||||
nns = nns.concat(createExportableNodeSet(node.nodes, exportedIds, exportedSubflows, exportedConfigNodes));
|
||||
}
|
||||
} else {
|
||||
var convertedSubflow = convertSubflow(node);
|
||||
nns.push(convertedSubflow);
|
||||
@@ -732,6 +776,11 @@ RED.nodes = (function() {
|
||||
nns.push(convertSubflow(subflows[i], exportCredentials));
|
||||
}
|
||||
}
|
||||
for (i in groups) {
|
||||
if (groups.hasOwnProperty(i)) {
|
||||
nns.push(convertNode(groups[i]));
|
||||
}
|
||||
}
|
||||
for (i in configNodes) {
|
||||
if (configNodes.hasOwnProperty(i)) {
|
||||
nns.push(convertNode(configNodes[i], exportCredentials));
|
||||
@@ -858,6 +907,7 @@ RED.nodes = (function() {
|
||||
if (n.type != "workspace" &&
|
||||
n.type != "tab" &&
|
||||
n.type != "subflow" &&
|
||||
n.type != "group" &&
|
||||
!registry.getNodeType(n.type) &&
|
||||
n.type.substring(0,8) != "subflow:" &&
|
||||
unknownTypes.indexOf(n.type)==-1) {
|
||||
@@ -907,6 +957,7 @@ RED.nodes = (function() {
|
||||
var node_map = {};
|
||||
var new_nodes = [];
|
||||
var new_links = [];
|
||||
var new_groups = [];
|
||||
var nid;
|
||||
var def;
|
||||
var configNode;
|
||||
@@ -1074,20 +1125,25 @@ RED.nodes = (function() {
|
||||
y:parseFloat(n.y || 0),
|
||||
z:n.z,
|
||||
type:0,
|
||||
wires:n.wires||[],
|
||||
inputLabels: n.inputLabels,
|
||||
outputLabels: n.outputLabels,
|
||||
icon: n.icon,
|
||||
info: n.info,
|
||||
changed:false,
|
||||
_config:{}
|
||||
};
|
||||
}
|
||||
if (n.type !== "group") {
|
||||
node.wires = n.wires||[];
|
||||
node.inputLabels = n.inputLabels;
|
||||
node.outputLabels = n.outputLabels;
|
||||
node.icon = n.icon;
|
||||
}
|
||||
if (n.hasOwnProperty('l')) {
|
||||
node.l = n.l;
|
||||
}
|
||||
if (n.hasOwnProperty('d')) {
|
||||
node.d = n.d;
|
||||
}
|
||||
if (n.hasOwnProperty('g')) {
|
||||
node.g = n.g;
|
||||
}
|
||||
if (createNewIds) {
|
||||
if (subflow_blacklist[n.z]) {
|
||||
continue;
|
||||
@@ -1124,7 +1180,17 @@ RED.nodes = (function() {
|
||||
}
|
||||
node.type = n.type;
|
||||
node._def = def;
|
||||
if (n.type.substring(0,7) === "subflow") {
|
||||
if (node.type === "group") {
|
||||
node._def = RED.group.def;
|
||||
for (d in node._def.defaults) {
|
||||
if (node._def.defaults.hasOwnProperty(d) && d !== 'inputs' && d !== 'outputs') {
|
||||
node[d] = n[d];
|
||||
node._config[d] = JSON.stringify(n[d]);
|
||||
}
|
||||
}
|
||||
node._config.x = node.x;
|
||||
node._config.y = node.y;
|
||||
} else if (n.type.substring(0,7) === "subflow") {
|
||||
var parentId = n.type.split(":")[1];
|
||||
var subflow = subflow_blacklist[parentId]||subflow_map[parentId]||getSubflow(parentId);
|
||||
if (createNewIds) {
|
||||
@@ -1214,13 +1280,19 @@ RED.nodes = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
addNode(node);
|
||||
RED.editor.validateNode(node);
|
||||
if (node.type !== "group") {
|
||||
addNode(node);
|
||||
RED.editor.validateNode(node);
|
||||
} else {
|
||||
addGroup(node);
|
||||
}
|
||||
node_map[n.id] = node;
|
||||
// If an 'unknown' config node, it will not have been caught by the
|
||||
// proper config node handling, so needs adding to new_nodes here
|
||||
if (node.type === "unknown" || node._def.category !== "config") {
|
||||
new_nodes.push(node);
|
||||
} else if (node.type === "group") {
|
||||
new_groups.push(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1255,6 +1327,11 @@ RED.nodes = (function() {
|
||||
}
|
||||
delete n.wires;
|
||||
}
|
||||
if (n.g && node_map[n.g]) {
|
||||
n.g = node_map[n.g].id;
|
||||
} else {
|
||||
delete n.g
|
||||
}
|
||||
for (var d3 in n._def.defaults) {
|
||||
if (n._def.defaults.hasOwnProperty(d3)) {
|
||||
if (n._def.defaults[d3].type && node_map[n[d3]]) {
|
||||
@@ -1323,9 +1400,20 @@ RED.nodes = (function() {
|
||||
delete n.status.wires;
|
||||
}
|
||||
}
|
||||
for (i=0;i<new_groups.length;i++) {
|
||||
n = new_groups[i];
|
||||
if (n.g && node_map[n.g]) {
|
||||
n.g = node_map[n.g].id;
|
||||
} else {
|
||||
delete n.g;
|
||||
}
|
||||
n.nodes = n.nodes.map(function(id) {
|
||||
return node_map[id];
|
||||
})
|
||||
}
|
||||
|
||||
RED.workspaces.refresh();
|
||||
return [new_nodes,new_links,new_workspaces,new_subflows,missingWorkspace];
|
||||
return [new_nodes,new_links,new_groups,new_workspaces,new_subflows,missingWorkspace];
|
||||
}
|
||||
|
||||
// TODO: supports filter.z|type
|
||||
@@ -1416,6 +1504,9 @@ RED.nodes = (function() {
|
||||
nodeTabMap = {};
|
||||
configNodes = {};
|
||||
workspacesOrder = [];
|
||||
groups = {};
|
||||
groupsByZ = {};
|
||||
|
||||
var subflowIds = Object.keys(subflows);
|
||||
subflowIds.forEach(function(id) {
|
||||
RED.subflow.removeSubflow(id)
|
||||
@@ -1444,6 +1535,27 @@ RED.nodes = (function() {
|
||||
// var loadedFlowVersion = null;
|
||||
}
|
||||
|
||||
function addGroup(group) {
|
||||
groupsByZ[group.z] = groupsByZ[group.z] || [];
|
||||
groupsByZ[group.z].push(group);
|
||||
groups[group.id] = group;
|
||||
}
|
||||
function removeGroup(group) {
|
||||
var i = groupsByZ[group.z].indexOf(group);
|
||||
groupsByZ[group.z].splice(i,1);
|
||||
|
||||
if (group.g) {
|
||||
if (groups[group.g]) {
|
||||
var index = groups[group.g].nodes.indexOf(group);
|
||||
groups[group.g].nodes.splice(index,1);
|
||||
}
|
||||
}
|
||||
RED.group.markDirty(group);
|
||||
|
||||
delete groups[group.id];
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
RED.events.on("registry:node-type-added",function(type) {
|
||||
@@ -1539,6 +1651,11 @@ RED.nodes = (function() {
|
||||
subflow: getSubflow,
|
||||
subflowContains: subflowContains,
|
||||
|
||||
addGroup: addGroup,
|
||||
removeGroup: removeGroup,
|
||||
group: function(id) { return groups[id] },
|
||||
groups: function(z) { return groupsByZ[z]||[] },
|
||||
|
||||
eachNode: function(cb) {
|
||||
for (var n=0;n<nodes.length;n++) {
|
||||
if (cb(nodes[n]) === false) {
|
||||
|
@@ -431,7 +431,7 @@ var RED = (function() {
|
||||
'<img width="50px" src="red/images/node-red-icon.svg" />'+
|
||||
'</div>';
|
||||
|
||||
RED.sidebar.info.set(aboutHeader+marked(data));
|
||||
RED.sidebar.info.set(aboutHeader+RED.utils.renderMarkdown(data));
|
||||
RED.sidebar.info.show();
|
||||
});
|
||||
}
|
||||
@@ -472,6 +472,14 @@ var RED = (function() {
|
||||
{id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:"core:create-subflow"},
|
||||
{id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:"core:convert-to-subflow"},
|
||||
]});
|
||||
menuOptions.push({id:"menu-item-group",label:RED._("menu.label.groups"), options: [
|
||||
{id:"menu-item-group-group",label:RED._("menu.label.groupSelection"),disabled:true,onselect:"core:group-selection"},
|
||||
{id:"menu-item-group-ungroup",label:RED._("menu.label.ungroupSelection"),disabled:true,onselect:"core:ungroup-selection"},
|
||||
null,
|
||||
{id:"menu-item-group-merge",label:RED._("menu.label.groupMergeSelection"),disabled:true,onselect:"core:merge-selection-to-group"},
|
||||
{id:"menu-item-group-remove",label:RED._("menu.label.groupRemoveSelection"),disabled:true,onselect:"core:remove-selection-from-group"}
|
||||
]});
|
||||
|
||||
menuOptions.push(null);
|
||||
if (RED.settings.theme('palette.editable') !== false) {
|
||||
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:"core:manage-palette"});
|
||||
@@ -524,6 +532,7 @@ var RED = (function() {
|
||||
}
|
||||
|
||||
RED.subflow.init();
|
||||
RED.group.init();
|
||||
RED.clipboard.init();
|
||||
RED.search.init();
|
||||
RED.actionList.init();
|
||||
|
@@ -583,6 +583,7 @@ RED.clipboard = (function() {
|
||||
nodes = [];
|
||||
selection.forEach(function(n) {
|
||||
nodes.push(n);
|
||||
nodes = nodes.concat(RED.nodes.groups(n.id));
|
||||
nodes = nodes.concat(RED.nodes.filterNodes({z:n.id}));
|
||||
});
|
||||
} else {
|
||||
@@ -592,7 +593,8 @@ RED.clipboard = (function() {
|
||||
nodes = RED.nodes.createExportableNodeSet(nodes.filter(function(n) { return n.type !== 'subflow'}));
|
||||
} else if (type === 'red-ui-clipboard-dialog-export-rng-flow') {
|
||||
var activeWorkspace = RED.workspaces.active();
|
||||
nodes = RED.nodes.filterNodes({z:activeWorkspace});
|
||||
nodes = RED.nodes.groups(activeWorkspace);
|
||||
nodes = nodes.concat(RED.nodes.filterNodes({z:activeWorkspace}));
|
||||
var parentNode = RED.nodes.workspace(activeWorkspace)||RED.nodes.subflow(activeWorkspace);
|
||||
nodes.unshift(parentNode);
|
||||
nodes = RED.nodes.createExportableNodeSet(nodes);
|
||||
|
223
packages/node_modules/@node-red/editor-client/src/js/ui/common/colorPicker.js
vendored
Normal file
223
packages/node_modules/@node-red/editor-client/src/js/ui/common/colorPicker.js
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
RED.colorPicker = (function() {
|
||||
|
||||
function getDarkerColor(c) {
|
||||
var r,g,b;
|
||||
if (/^#[a-f0-9]{6}$/i.test(c)) {
|
||||
r = parseInt(c.substring(1, 3), 16);
|
||||
g = parseInt(c.substring(3, 5), 16);
|
||||
b = parseInt(c.substring(5, 7), 16);
|
||||
} else if (/^#[a-f0-9]{3}$/i.test(c)) {
|
||||
r = parseInt(c.substring(1, 2)+c.substring(1, 2), 16);
|
||||
g = parseInt(c.substring(2, 3)+c.substring(2, 3), 16);
|
||||
b = parseInt(c.substring(3, 4)+c.substring(3, 4), 16);
|
||||
} else {
|
||||
return c;
|
||||
}
|
||||
var l = 0.3 * r/255 + 0.59 * g/255 + 0.11 * b/255 ;
|
||||
r = Math.max(0,r-50);
|
||||
g = Math.max(0,g-50);
|
||||
b = Math.max(0,b-50);
|
||||
return '#'+((r<<16) + (g<<8) + b).toString(16).padStart(6,'0')
|
||||
}
|
||||
|
||||
function create(options) {
|
||||
var color = options.value;
|
||||
var id = options.id;
|
||||
var colorPalette = options.palette || [];
|
||||
var width = options.cellWidth || 30;
|
||||
var height = options.cellHeight || 30;
|
||||
var margin = options.cellMargin || 2;
|
||||
var perRow = options.cellPerRow || 6;
|
||||
|
||||
var container = $("<div>",{style:"display:inline-block"});
|
||||
var colorHiddenInput = $("<input/>", { id: id, type: "hidden", value: color }).appendTo(container);
|
||||
var opacityHiddenInput = $("<input/>", { id: id+"-opacity", type: "hidden", value: options.hasOwnProperty('opacity')?options.opacity:"1" }).appendTo(container);
|
||||
|
||||
var colorButton = $('<button type="button" class="red-ui-button red-ui-editor-node-appearance-button">').appendTo(container);
|
||||
$('<i class="fa fa-caret-down"></i>').appendTo(colorButton);
|
||||
|
||||
var colorDispContainer = $('<div>',{class:"red-ui-search-result-node"}).appendTo(colorButton);
|
||||
$('<div>',{class:"red-ui-color-picker-cell-none"}).appendTo(colorDispContainer);
|
||||
var colorDisp = $('<div>',{class:"red-ui-color-picker-swatch"}).appendTo(colorDispContainer);
|
||||
|
||||
|
||||
var refreshDisplay = function(color) {
|
||||
if (color === "none") {
|
||||
colorDisp.addClass('red-ui-color-picker-cell-none').css({
|
||||
"background-color": "",
|
||||
opacity: 1
|
||||
});
|
||||
colorDispContainer.css({
|
||||
"border-color":""
|
||||
})
|
||||
} else {
|
||||
var opacity = parseFloat(opacityHiddenInput.val())
|
||||
colorDisp.removeClass('red-ui-color-picker-cell-none').css({
|
||||
"background-color": color,
|
||||
"opacity": opacity
|
||||
});
|
||||
var border = getDarkerColor(color);
|
||||
if (border[0] === '#') {
|
||||
border += Math.round(255*Math.floor(opacity*100)/100).toString(16);
|
||||
} else {
|
||||
border = "";
|
||||
}
|
||||
|
||||
colorDispContainer.css({
|
||||
"border-color": border
|
||||
})
|
||||
}
|
||||
if (options.hasOwnProperty('opacity')) {
|
||||
$(".red-ui-color-picker-opacity-slider-overlay").css({
|
||||
"background-image": "linear-gradient(90deg, transparent 0%, "+color+" 100%)"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
colorButton.on("click", function (e) {
|
||||
var numColors = colorPalette.length;
|
||||
|
||||
var picker = $("<div/>", {
|
||||
class: "red-ui-color-picker"
|
||||
}).css({
|
||||
width: ((width+margin+margin)*perRow)+"px",
|
||||
height: Math.ceil(numColors/perRow)*(height+margin+margin)+"+px"
|
||||
});
|
||||
var count = 0;
|
||||
var row = null;
|
||||
row = $("<div/>").appendTo(picker);
|
||||
|
||||
var colorInput = $('<input>',{
|
||||
type:"text",
|
||||
value:colorHiddenInput.val()
|
||||
}).appendTo(row);
|
||||
|
||||
colorInput.on("change", function (e) {
|
||||
var color = colorInput.val();
|
||||
colorHiddenInput.val(color).trigger('change');
|
||||
refreshDisplay(color);
|
||||
});
|
||||
// if (options.hasOwnProperty('opacity')) {
|
||||
// var sliderContainer = $("<div>",{class:"red-ui-color-picker-opacity-slider"
|
||||
// }
|
||||
|
||||
if (options.none) {
|
||||
row = $("<div/>").appendTo(picker);
|
||||
var button = $("<button/>", {
|
||||
class:"red-ui-color-picker-cell red-ui-color-picker-cell-none"
|
||||
}).css({
|
||||
width: width+"px",
|
||||
height: height+"px",
|
||||
margin: margin+"px"
|
||||
}).appendTo(row);
|
||||
button.on("click", function (e) {
|
||||
e.preventDefault();
|
||||
colorInput.val("none");
|
||||
colorInput.trigger("change");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
colorPalette.forEach(function (col) {
|
||||
if ((count % perRow) == 0) {
|
||||
row = $("<div/>").appendTo(picker);
|
||||
}
|
||||
var button = $("<button/>", {
|
||||
class:"red-ui-color-picker-cell"
|
||||
}).css({
|
||||
width: width+"px",
|
||||
height: height+"px",
|
||||
margin: margin+"px",
|
||||
backgroundColor: col,
|
||||
"border-color": getDarkerColor(col)
|
||||
}).appendTo(row);
|
||||
button.on("click", function (e) {
|
||||
e.preventDefault();
|
||||
// colorPanel.hide();
|
||||
colorInput.val(col);
|
||||
colorInput.trigger("change");
|
||||
});
|
||||
count++;
|
||||
});
|
||||
if (options.none || options.hasOwnProperty('opacity')) {
|
||||
row = $("<div/>").appendTo(picker);
|
||||
// if (options.none) {
|
||||
// var button = $("<button/>", {
|
||||
// class:"red-ui-color-picker-cell red-ui-color-picker-cell-none"
|
||||
// }).css({
|
||||
// width: width+"px",
|
||||
// height: height+"px",
|
||||
// margin: margin+"px"
|
||||
// }).appendTo(row);
|
||||
// button.on("click", function (e) {
|
||||
// e.preventDefault();
|
||||
// colorPanel.hide();
|
||||
// selector.val("none");
|
||||
// selector.trigger("change");
|
||||
// });
|
||||
// }
|
||||
if (options.hasOwnProperty('opacity')) {
|
||||
var sliderContainer = $("<div>",{class:"red-ui-color-picker-opacity-slider"}).appendTo(row);
|
||||
sliderContainer.on("mousedown", function(evt) {
|
||||
if (evt.target === sliderHandle[0]) {
|
||||
return;
|
||||
}
|
||||
var v = evt.offsetX/sliderContainer.width();
|
||||
sliderHandle.css({
|
||||
left: ( v*(sliderContainer.width() - sliderHandle.outerWidth()))+"px"
|
||||
});
|
||||
v = Math.floor(100*v)
|
||||
opacityHiddenInput.val(v/100)
|
||||
opacityLabel.text(v+"%");
|
||||
refreshDisplay(colorHiddenInput.val());
|
||||
})
|
||||
$("<div>",{class:"red-ui-color-picker-opacity-slider-overlay"}).appendTo(sliderContainer);
|
||||
var sliderHandle = $("<div>",{class:"red-ui-color-picker-opacity-slider-handle red-ui-button red-ui-button-small"}).appendTo(sliderContainer).draggable({
|
||||
containment: "parent",
|
||||
axis: "x",
|
||||
drag: function( event, ui ) {
|
||||
var v = Math.max(0,ui.position.left/($(this).parent().width()-$(this).outerWidth()));
|
||||
// Odd bug that if it is loaded with a non-0 value, the first time
|
||||
// it is dragged it ranges -1 to 99. But every other time, its 0 to 100.
|
||||
// The Math.max above makes the -1 disappear. The follow hack ensures
|
||||
// it always maxes out at a 100, at the cost of not allowing 99% exactly.
|
||||
v = Math.floor(100*v)
|
||||
if ( v === 99 ) {
|
||||
v = 100;
|
||||
}
|
||||
// console.log("uip",ui.position.left);
|
||||
opacityHiddenInput.val(v/100)
|
||||
opacityLabel.text(v+"%");
|
||||
refreshDisplay(colorHiddenInput.val());
|
||||
}
|
||||
});
|
||||
var opacityLabel = $('<small></small>').appendTo(row);
|
||||
setTimeout(function() {
|
||||
sliderHandle.css({
|
||||
left: (parseFloat(opacityHiddenInput.val())*(sliderContainer.width() - sliderHandle.outerWidth()))+"px"
|
||||
})
|
||||
opacityLabel.text(Math.floor(opacityHiddenInput.val()*100)+"%");
|
||||
},50);
|
||||
}
|
||||
}
|
||||
|
||||
var colorPanel = RED.popover.panel(picker);
|
||||
setTimeout(function() {
|
||||
refreshDisplay(colorHiddenInput.val())
|
||||
},50);
|
||||
colorPanel.show({
|
||||
target: colorButton
|
||||
})
|
||||
});
|
||||
setTimeout(function() {
|
||||
refreshDisplay(colorHiddenInput.val())
|
||||
},50);
|
||||
return container;
|
||||
}
|
||||
|
||||
return {
|
||||
create: create
|
||||
}
|
||||
})();
|
@@ -38,7 +38,10 @@
|
||||
this.element.addClass("red-ui-searchBox-input");
|
||||
this.uiContainer = this.element.wrap("<div>").parent();
|
||||
this.uiContainer.addClass("red-ui-searchBox-container");
|
||||
|
||||
if (this.element.parents("form").length === 0) {
|
||||
var form = this.element.wrap("<form>").parent();
|
||||
form.addClass("red-ui-searchBox-form");
|
||||
}
|
||||
$('<i class="fa fa-search"></i>').prependTo(this.uiContainer);
|
||||
this.clearButton = $('<a href="#"><i class="fa fa-times"></i></a>').appendTo(this.uiContainer);
|
||||
this.clearButton.on("click",function(e) {
|
||||
|
@@ -514,7 +514,9 @@ RED.editor = (function() {
|
||||
for (var i=editStack.length-1;i<editStack.length;i++) {
|
||||
var node = editStack[i];
|
||||
label = node.type;
|
||||
if (node.type === '_expression') {
|
||||
if (node.type === 'group') {
|
||||
label = RED._("group.editGroup",{name:RED.utils.sanitize(node.name||node.id)});
|
||||
} else if (node.type === '_expression') {
|
||||
label = RED._("expressionEditor.title");
|
||||
} else if (node.type === '_js') {
|
||||
label = RED._("jsEditor.title");
|
||||
@@ -588,8 +590,8 @@ RED.editor = (function() {
|
||||
// cases, and also prevent browser auto-fill of password
|
||||
// - the elements cannot be hidden otherwise Chrome will ignore them.
|
||||
// - the elements need to have id's that imply password/username
|
||||
$('<div style="position: absolute; top: -2000px;"><input id="red-ui-trap-password" type="password"/></div>').prependTo(dialogForm);
|
||||
$('<div style="position: absolute; top: -2000px;"><input id="red-ui-trap-username" type="text"/></div>').prependTo(dialogForm);
|
||||
$('<span style="position: absolute; top: -2000px;"><input id="red-ui-trap-password" type="password"/></span>').prependTo(dialogForm);
|
||||
$('<span style="position: absolute; top: -2000px;"><input id="red-ui-trap-username" type="text"/></span>').prependTo(dialogForm);
|
||||
dialogForm.on("submit", function(e) { e.preventDefault();});
|
||||
dialogForm.find('input').attr("autocomplete","off");
|
||||
return dialogForm;
|
||||
@@ -823,99 +825,6 @@ RED.editor = (function() {
|
||||
searchInput.trigger("focus");
|
||||
}
|
||||
|
||||
function createColorPicker(colorRow, color) {
|
||||
|
||||
var colorButton = $('<button type="button" class="red-ui-button red-ui-editor-node-appearance-button">').appendTo(colorRow);
|
||||
$('<i class="fa fa-caret-down"></i>').appendTo(colorButton);
|
||||
|
||||
var colorDisp = $('<div>',{class:"red-ui-search-result-node"}).appendTo(colorButton);
|
||||
|
||||
var selector = $("<input/>", {
|
||||
id: "red-ui-editor-node-color",
|
||||
type: "text",
|
||||
value: color
|
||||
}).css({
|
||||
marginLeft: "10px",
|
||||
width: "150px",
|
||||
}).appendTo(colorRow);
|
||||
|
||||
selector.on("change", function (e) {
|
||||
var color = selector.val();
|
||||
$(".red-ui-editor-node-appearance-button .red-ui-search-result-node").css({
|
||||
"background-color": color
|
||||
});
|
||||
});
|
||||
selector.trigger("change");
|
||||
colorButton.on("click", function (e) {
|
||||
var recommendedColors = [
|
||||
"#DDAA99",
|
||||
"#3FADB5", "#87A980", "#A6BBCF",
|
||||
"#AAAA66", "#C0C0C0", "#C0DEED",
|
||||
"#C7E9C0", "#D7D7A0", "#D8BFD8",
|
||||
"#DAC4B4", "#DEB887", "#DEBD5C",
|
||||
"#E2D96E", "#E6E0F8", "#E7E7AE",
|
||||
"#E9967A", "#F3B567", "#FDD0A2",
|
||||
"#FDF0C2", "#FFAAAA", "#FFCC66",
|
||||
"#FFF0F0", "#FFFFFF"
|
||||
].map(function(c) {
|
||||
var r = parseInt(c.substring(1, 3), 16) / 255;
|
||||
var g = parseInt(c.substring(3, 5), 16) / 255;
|
||||
var b = parseInt(c.substring(5, 7), 16) / 255;
|
||||
return {
|
||||
hex: c,
|
||||
r: r,
|
||||
g: g,
|
||||
b: b,
|
||||
l: 0.3 * r + 0.59 * g + 0.11 * b
|
||||
}
|
||||
});
|
||||
// Sort by luminosity.
|
||||
recommendedColors.sort(function (a, b) {
|
||||
return a.l - b.l;
|
||||
});
|
||||
|
||||
var numColors = recommendedColors.length;
|
||||
var width = 30;
|
||||
var height = 30;
|
||||
var margin = 2;
|
||||
var perRow = 6;
|
||||
var picker = $("<div/>", {
|
||||
class: "red-ui-color-picker"
|
||||
}).css({
|
||||
width: ((width+margin+margin)*perRow)+"px",
|
||||
height: Math.ceil(numColors/perRow)*(height+margin+margin)+"+px"
|
||||
});
|
||||
var count = 0;
|
||||
var row = null;
|
||||
recommendedColors.forEach(function (col) {
|
||||
if ((count % perRow) == 0) {
|
||||
row = $("<div/>").appendTo(picker);
|
||||
}
|
||||
var button = $("<button/>", {
|
||||
}).css({
|
||||
width: width+"px",
|
||||
height: height+"px",
|
||||
margin: margin+"px",
|
||||
backgroundColor: col.hex,
|
||||
"border-style": "solid",
|
||||
"border-width": "1px",
|
||||
"border-color": col.luma<0.92?col.hex:'#ccc'
|
||||
}).appendTo(row);
|
||||
button.on("click", function (e) {
|
||||
e.preventDefault();
|
||||
colorPanel.hide();
|
||||
selector.val(col.hex);
|
||||
selector.trigger("change");
|
||||
});
|
||||
count++;
|
||||
});
|
||||
var colorPanel = RED.popover.panel(picker);
|
||||
colorPanel.show({
|
||||
target: colorButton
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function buildAppearanceForm(container,node) {
|
||||
var dialogForm = $('<form class="dialog-form form-horizontal" autocomplete="off"></form>').appendTo(container);
|
||||
|
||||
@@ -1001,7 +910,30 @@ RED.editor = (function() {
|
||||
class: "form-row"
|
||||
}).appendTo(dialogForm);
|
||||
$("<label/>").text(RED._("editor.color")).appendTo(colorRow);
|
||||
createColorPicker(colorRow, color);
|
||||
|
||||
var recommendedColors = [
|
||||
"#DDAA99",
|
||||
"#3FADB5", "#87A980", "#A6BBCF",
|
||||
"#AAAA66", "#C0C0C0", "#C0DEED",
|
||||
"#C7E9C0", "#D7D7A0", "#D8BFD8",
|
||||
"#DAC4B4", "#DEB887", "#DEBD5C",
|
||||
"#E2D96E", "#E6E0F8", "#E7E7AE",
|
||||
"#E9967A", "#F3B567", "#FDD0A2",
|
||||
"#FDF0C2", "#FFAAAA", "#FFCC66",
|
||||
"#FFF0F0", "#FFFFFF"
|
||||
]
|
||||
|
||||
RED.colorPicker.create({
|
||||
id: "red-ui-editor-node-color",
|
||||
value: color,
|
||||
palette: recommendedColors,
|
||||
sortPalette: function (a, b) {return a.l - b.l;}
|
||||
}).appendTo(colorRow);
|
||||
|
||||
$("#red-ui-editor-node-color").on('change', function(ev) {
|
||||
// Horribly out of scope...
|
||||
nodeDiv.css('backgroundColor',$(this).val());
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2454,6 +2386,249 @@ RED.editor = (function() {
|
||||
RED.tray.show(trayOptions);
|
||||
}
|
||||
|
||||
function showEditGroupDialog(group) {
|
||||
var editing_node = group;
|
||||
editStack.push(group);
|
||||
RED.view.state(RED.state.EDITING);
|
||||
var nodeInfoEditor;
|
||||
var finishedBuilding = false;
|
||||
var trayOptions = {
|
||||
title: getEditStackTitle(),
|
||||
buttons: [
|
||||
{
|
||||
id: "node-dialog-cancel",
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
RED.tray.close();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "node-dialog-ok",
|
||||
class: "primary",
|
||||
text: RED._("common.label.done"),
|
||||
click: function() {
|
||||
var changes = {};
|
||||
var changed = false;
|
||||
var wasDirty = RED.nodes.dirty();
|
||||
var d;
|
||||
var outputMap;
|
||||
|
||||
if (editing_node._def.oneditsave) {
|
||||
var oldValues = {};
|
||||
for (d in editing_node._def.defaults) {
|
||||
if (editing_node._def.defaults.hasOwnProperty(d)) {
|
||||
if (typeof editing_node[d] === "string" || typeof editing_node[d] === "number") {
|
||||
oldValues[d] = editing_node[d];
|
||||
} else {
|
||||
oldValues[d] = $.extend(true,{},{v:editing_node[d]}).v;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
var rc = editing_node._def.oneditsave.call(editing_node);
|
||||
if (rc === true) {
|
||||
changed = true;
|
||||
}
|
||||
} catch(err) {
|
||||
console.log("oneditsave",editing_node.id,editing_node.type,err.toString());
|
||||
}
|
||||
|
||||
for (d in editing_node._def.defaults) {
|
||||
if (editing_node._def.defaults.hasOwnProperty(d)) {
|
||||
if (oldValues[d] === null || typeof oldValues[d] === "string" || typeof oldValues[d] === "number") {
|
||||
if (oldValues[d] !== editing_node[d]) {
|
||||
changes[d] = oldValues[d];
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
if (JSON.stringify(oldValues[d]) !== JSON.stringify(editing_node[d])) {
|
||||
changes[d] = oldValues[d];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var newValue;
|
||||
if (editing_node._def.defaults) {
|
||||
for (d in editing_node._def.defaults) {
|
||||
if (editing_node._def.defaults.hasOwnProperty(d)) {
|
||||
var input = $("#node-input-"+d);
|
||||
if (input.attr('type') === "checkbox") {
|
||||
newValue = input.prop('checked');
|
||||
} else if (input.prop("nodeName") === "select" && input.attr("multiple") === "multiple") {
|
||||
// An empty select-multiple box returns null.
|
||||
// Need to treat that as an empty array.
|
||||
newValue = input.val();
|
||||
if (newValue == null) {
|
||||
newValue = [];
|
||||
}
|
||||
} else if ("format" in editing_node._def.defaults[d] && editing_node._def.defaults[d].format !== "" && input[0].nodeName === "DIV") {
|
||||
newValue = input.text();
|
||||
} else {
|
||||
newValue = input.val();
|
||||
}
|
||||
if (newValue != null) {
|
||||
if (editing_node._def.defaults[d].type) {
|
||||
if (newValue == "_ADD_") {
|
||||
newValue = "";
|
||||
}
|
||||
}
|
||||
if (editing_node[d] != newValue) {
|
||||
if (editing_node._def.defaults[d].type) {
|
||||
// Change to a related config node
|
||||
var configNode = RED.nodes.node(editing_node[d]);
|
||||
if (configNode) {
|
||||
var users = configNode.users;
|
||||
users.splice(users.indexOf(editing_node),1);
|
||||
}
|
||||
configNode = RED.nodes.node(newValue);
|
||||
if (configNode) {
|
||||
configNode.users.push(editing_node);
|
||||
}
|
||||
}
|
||||
changes[d] = editing_node[d];
|
||||
editing_node[d] = newValue;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var oldInfo = editing_node.info;
|
||||
if (nodeInfoEditor) {
|
||||
var newInfo = nodeInfoEditor.getValue();
|
||||
if (!!oldInfo) {
|
||||
// Has existing info property
|
||||
if (newInfo.trim() === "") {
|
||||
// New value is blank - remove the property
|
||||
changed = true;
|
||||
changes.info = oldInfo;
|
||||
delete editing_node.info;
|
||||
} else if (newInfo !== oldInfo) {
|
||||
// New value is different
|
||||
changed = true;
|
||||
changes.info = oldInfo;
|
||||
editing_node.info = newInfo;
|
||||
}
|
||||
} else {
|
||||
// No existing info
|
||||
if (newInfo.trim() !== "") {
|
||||
// New value is not blank
|
||||
changed = true;
|
||||
changes.info = undefined;
|
||||
editing_node.info = newInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
var wasChanged = editing_node.changed;
|
||||
editing_node.changed = true;
|
||||
RED.nodes.dirty(true);
|
||||
var historyEvent = {
|
||||
t:'edit',
|
||||
node:editing_node,
|
||||
changes:changes,
|
||||
dirty:wasDirty,
|
||||
changed:wasChanged
|
||||
};
|
||||
RED.history.push(historyEvent);
|
||||
}
|
||||
editing_node.dirty = true;
|
||||
RED.tray.close();
|
||||
RED.view.redraw(true);
|
||||
}
|
||||
}
|
||||
],
|
||||
resize: function(size) {
|
||||
editTrayWidthCache['group'] = size.width;
|
||||
$(".red-ui-tray-content").height(size.height - 50);
|
||||
// var form = $(".red-ui-tray-content form").height(dimensions.height - 50 - 40);
|
||||
// if (editing_node && editing_node._def.oneditresize) {
|
||||
// try {
|
||||
// editing_node._def.oneditresize.call(editing_node,{width:form.width(),height:form.height()});
|
||||
// } catch(err) {
|
||||
// console.log("oneditresize",editing_node.id,editing_node.type,err.toString());
|
||||
// }
|
||||
// }
|
||||
},
|
||||
open: function(tray, done) {
|
||||
var trayFooter = tray.find(".red-ui-tray-footer");
|
||||
var trayFooterLeft = $("<div/>", {
|
||||
class: "red-ui-tray-footer-left"
|
||||
}).appendTo(trayFooter)
|
||||
var trayBody = tray.find('.red-ui-tray-body');
|
||||
trayBody.parent().css('overflow','hidden');
|
||||
|
||||
var editorTabEl = $('<ul></ul>').appendTo(trayBody);
|
||||
var editorContent = $('<div></div>').appendTo(trayBody);
|
||||
|
||||
var editorTabs = RED.tabs.create({
|
||||
element:editorTabEl,
|
||||
onchange:function(tab) {
|
||||
editorContent.children().hide();
|
||||
if (tab.onchange) {
|
||||
tab.onchange.call(tab);
|
||||
}
|
||||
tab.content.show();
|
||||
if (finishedBuilding) {
|
||||
RED.tray.resize();
|
||||
}
|
||||
},
|
||||
collapsible: true,
|
||||
menu: false
|
||||
});
|
||||
|
||||
var nodePropertiesTab = {
|
||||
id: "editor-tab-properties",
|
||||
label: RED._("editor-tab.properties"),
|
||||
name: RED._("editor-tab.properties"),
|
||||
content: $('<div>', {class:"red-ui-tray-content"}).appendTo(editorContent).hide(),
|
||||
iconClass: "fa fa-cog"
|
||||
};
|
||||
buildEditForm(nodePropertiesTab.content,"dialog-form","group","node-red",group);
|
||||
|
||||
editorTabs.addTab(nodePropertiesTab);
|
||||
|
||||
var descriptionTab = {
|
||||
id: "editor-tab-description",
|
||||
label: RED._("editor-tab.description"),
|
||||
name: RED._("editor-tab.description"),
|
||||
content: $('<div>', {class:"red-ui-tray-content"}).appendTo(editorContent).hide(),
|
||||
iconClass: "fa fa-file-text-o",
|
||||
onchange: function() {
|
||||
nodeInfoEditor.focus();
|
||||
}
|
||||
};
|
||||
editorTabs.addTab(descriptionTab);
|
||||
nodeInfoEditor = buildDescriptionForm(descriptionTab.content,editing_node);
|
||||
prepareEditDialog(group,group._def,"node-input", function() {
|
||||
trayBody.i18n();
|
||||
finishedBuilding = true;
|
||||
done();
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
|
||||
RED.view.state(RED.state.DEFAULT);
|
||||
}
|
||||
nodeInfoEditor.destroy();
|
||||
nodeInfoEditor = null;
|
||||
editStack.pop();
|
||||
editing_node = null;
|
||||
},
|
||||
show: function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (editTrayWidthCache.hasOwnProperty('group')) {
|
||||
trayOptions.width = editTrayWidthCache['group'];
|
||||
}
|
||||
RED.tray.show(trayOptions);
|
||||
}
|
||||
|
||||
function showTypeEditor(type, options) {
|
||||
if (customEditTypes.hasOwnProperty(type)) {
|
||||
if (editStack.length > 0) {
|
||||
@@ -2577,6 +2752,7 @@ RED.editor = (function() {
|
||||
edit: showEditDialog,
|
||||
editConfig: showEditConfigNodeDialog,
|
||||
editSubflow: showEditSubflowDialog,
|
||||
editGroup: showEditGroupDialog,
|
||||
editJavaScript: function(options) { showTypeEditor("_js",options) },
|
||||
editExpression: function(options) { showTypeEditor("_expression", options) },
|
||||
editJSON: function(options) { showTypeEditor("_json", options) },
|
||||
|
@@ -102,7 +102,7 @@
|
||||
var f = $(this).val();
|
||||
var args = RED._('jsonata:'+f+".args",{defaultValue:''});
|
||||
var title = "<h5>"+f+"("+args+")</h5>";
|
||||
var body = marked(RED._('jsonata:'+f+'.desc',{defaultValue:''}));
|
||||
var body = RED.utils.renderMarkdown(RED._('jsonata:'+f+'.desc',{defaultValue:''}));
|
||||
$("#red-ui-editor-type-expression-help").html(title+"<p>"+body+"</p>");
|
||||
|
||||
})
|
||||
|
@@ -107,7 +107,7 @@
|
||||
clearTimeout(changeTimer);
|
||||
changeTimer = setTimeout(function() {
|
||||
var currentScrollTop = $(".red-ui-editor-type-markdown-panel-preview").scrollTop();
|
||||
$(".red-ui-editor-type-markdown-panel-preview").html(marked(expressionEditor.getValue()));
|
||||
$(".red-ui-editor-type-markdown-panel-preview").html(RED.utils.renderMarkdown(expressionEditor.getValue()));
|
||||
$(".red-ui-editor-type-markdown-panel-preview").scrollTop(currentScrollTop);
|
||||
},200);
|
||||
})
|
||||
@@ -116,7 +116,7 @@
|
||||
}
|
||||
|
||||
if (value) {
|
||||
$(".red-ui-editor-type-markdown-panel-preview").html(marked(expressionEditor.getValue()));
|
||||
$(".red-ui-editor-type-markdown-panel-preview").html(RED.utils.renderMarkdown(expressionEditor.getValue()));
|
||||
}
|
||||
panels = RED.panels.create({
|
||||
id:"red-ui-editor-type-markdown-panels",
|
||||
|
633
packages/node_modules/@node-red/editor-client/src/js/ui/group.js
vendored
Normal file
633
packages/node_modules/@node-red/editor-client/src/js/ui/group.js
vendored
Normal file
@@ -0,0 +1,633 @@
|
||||
/**
|
||||
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
RED.group = (function() {
|
||||
|
||||
var _groupEditTemplate = '<script type="text/x-red" data-template-name="group">'+
|
||||
'<div class="form-row">'+
|
||||
'<label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>'+
|
||||
'<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">'+
|
||||
'</div>'+
|
||||
|
||||
// '<div class="node-input-group-style-tools"><span class="button-group"><button class="red-ui-button red-ui-button-small">Use default style</button><button class="red-ui-button red-ui-button-small">Set as default style</button></span></div>'+
|
||||
|
||||
'<div class="form-row" id="node-input-row-style-stroke">'+
|
||||
'<label>Style</label>'+
|
||||
'<label style="width: 70px;margin-right:10px" for="node-input-style-stroke" data-i18n="editor:common.label.line"></label>'+
|
||||
'</div>'+
|
||||
'<div class="form-row" style="padding-left: 100px;" id="node-input-row-style-fill">'+
|
||||
'<label style="width: 70px;margin-right: 10px " for="node-input-style-fill" data-i18n="editor:common.label.fill"></label>'+
|
||||
'</div>'+
|
||||
'<div class="form-row">'+
|
||||
'<label for="node-input-style-label">Label</label>'+
|
||||
'<input type="checkbox" id="node-input-style-label"/>'+
|
||||
'</div>'+
|
||||
'<div class="form-row" id="node-input-row-style-label-options">'+
|
||||
'<div style="margin-left: 100px; display: inline-block">'+
|
||||
'<div class="form-row">'+
|
||||
'<span style="display: inline-block; min-width: 140px" id="node-input-row-style-label-color">'+
|
||||
'<label style="width: 70px;margin-right: 10px" for="node-input-style-fill" data-i18n="editor:common.label.color"></label>'+
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'<div class="form-row">'+
|
||||
'<span style="display: inline-block; min-width: 140px;" id="node-input-row-style-label-position">'+
|
||||
'<label style="width: 70px;margin-right: 10px " for="node-input-style-label-position" data-i18n="editor:common.label.position"></label>'+
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
|
||||
'</script>';
|
||||
|
||||
var colorPalette = [
|
||||
"#ff0000",
|
||||
"#ffC000",
|
||||
"#ffff00",
|
||||
"#92d04f",
|
||||
"#0070c0",
|
||||
"#001f60",
|
||||
"#6f2fa0",
|
||||
"#000000",
|
||||
"#777777"
|
||||
]
|
||||
var colorSteps = 3;
|
||||
var colorCount = colorPalette.length;
|
||||
for (var i=0,len=colorPalette.length*colorSteps;i<len;i++) {
|
||||
var ci = i%colorCount;
|
||||
var j = Math.floor(i/colorCount)+1;
|
||||
var c = colorPalette[ci];
|
||||
var r = parseInt(c.substring(1, 3), 16);
|
||||
var g = parseInt(c.substring(3, 5), 16);
|
||||
var b = parseInt(c.substring(5, 7), 16);
|
||||
var dr = (255-r)/(colorSteps+((ci===colorCount-1) ?0:1));
|
||||
var dg = (255-g)/(colorSteps+((ci===colorCount-1) ?0:1));
|
||||
var db = (255-b)/(colorSteps+((ci===colorCount-1) ?0:1));
|
||||
r = Math.min(255,Math.floor(r+j*dr));
|
||||
g = Math.min(255,Math.floor(g+j*dg));
|
||||
b = Math.min(255,Math.floor(b+j*db));
|
||||
colorPalette.push('#'+((r<<16) + (g<<8) + b).toString(16).padStart(6,'0'));
|
||||
}
|
||||
|
||||
var defaultGroupStyle = {};
|
||||
|
||||
var groupDef = {
|
||||
defaults:{
|
||||
name:{value:""},
|
||||
style:{value:{}},
|
||||
nodes:{value:[]}
|
||||
},
|
||||
category: "config",
|
||||
oneditprepare: function() {
|
||||
var style = this.style || {};
|
||||
RED.colorPicker.create({
|
||||
id:"node-input-style-stroke",
|
||||
value: style.stroke || "#a4a4a4",
|
||||
palette: colorPalette,
|
||||
cellPerRow: colorCount,
|
||||
cellWidth: 16,
|
||||
cellHeight: 16,
|
||||
cellMargin: 3,
|
||||
none: true,
|
||||
opacity: style['stroke-opacity'] || 1.0
|
||||
}).appendTo("#node-input-row-style-stroke");
|
||||
RED.colorPicker.create({
|
||||
id:"node-input-style-fill",
|
||||
value: style.fill || "none",
|
||||
palette: colorPalette,
|
||||
cellPerRow: colorCount,
|
||||
cellWidth: 16,
|
||||
cellHeight: 16,
|
||||
cellMargin: 3,
|
||||
none: true,
|
||||
opacity: style['fill-opacity'] || 1.0
|
||||
}).appendTo("#node-input-row-style-fill");
|
||||
|
||||
createLayoutPicker({
|
||||
id:"node-input-style-label-position",
|
||||
value:style["label-position"] || "nw"
|
||||
}).appendTo("#node-input-row-style-label-position");
|
||||
|
||||
RED.colorPicker.create({
|
||||
id:"node-input-style-color",
|
||||
value: style.color || "#a4a4a4",
|
||||
palette: colorPalette,
|
||||
cellPerRow: colorCount,
|
||||
cellWidth: 16,
|
||||
cellHeight: 16,
|
||||
cellMargin: 3
|
||||
}).appendTo("#node-input-row-style-label-color");
|
||||
|
||||
$("#node-input-style-label").toggleButton({
|
||||
enabledLabel: RED._("editor.show"),
|
||||
disabledLabel: RED._("editor.hide")
|
||||
})
|
||||
|
||||
|
||||
$("#node-input-style-label").on("change", function(evt) {
|
||||
$("#node-input-row-style-label-options").toggle($(this).prop("checked"));
|
||||
})
|
||||
$("#node-input-style-label").prop("checked", this.style.label)
|
||||
$("#node-input-style-label").trigger("change");
|
||||
|
||||
},
|
||||
oneditresize: function(size) {
|
||||
},
|
||||
oneditsave: function() {
|
||||
this.style.stroke = $("#node-input-style-stroke").val();
|
||||
this.style.fill = $("#node-input-style-fill").val();
|
||||
this.style["stroke-opacity"] = $("#node-input-style-stroke-opacity").val();
|
||||
this.style["fill-opacity"] = $("#node-input-style-fill-opacity").val();
|
||||
this.style.label = $("#node-input-style-label").prop("checked");
|
||||
if (this.style.label) {
|
||||
this.style["label-position"] = $("#node-input-style-label-position").val();
|
||||
this.style.color = $("#node-input-style-color").val();
|
||||
} else {
|
||||
delete this.style["label-position"];
|
||||
delete this.style.color;
|
||||
}
|
||||
|
||||
if (this.style["stroke-opacity"] === "1") {
|
||||
delete this.style["stroke-opacity"]
|
||||
}
|
||||
if (this.style["fill-opacity"] === "1") {
|
||||
delete this.style["fill-opacity"]
|
||||
}
|
||||
this.resize = true;
|
||||
},
|
||||
set:{
|
||||
module: "node-red"
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
RED.events.on("view:selection-changed",function(selection) {
|
||||
RED.menu.setDisabled("menu-item-group-group",!!!selection.nodes);
|
||||
RED.menu.setDisabled("menu-item-group-ungroup",!!!selection.nodes || selection.nodes.filter(function(n) { return n.type==='group'}).length === 0);
|
||||
RED.menu.setDisabled("menu-item-group-merge",!!!selection.nodes);
|
||||
RED.menu.setDisabled("menu-item-group-remove",!!!selection.nodes || selection.nodes.filter(function(n) { return !!n.g }).length === 0);
|
||||
});
|
||||
|
||||
RED.actions.add("core:group-selection", function() { groupSelection() })
|
||||
RED.actions.add("core:ungroup-selection", function() { ungroupSelection() })
|
||||
RED.actions.add("core:merge-selection-to-group", function() { mergeSelection() })
|
||||
RED.actions.add("core:remove-selection-from-group", function() { removeSelection() })
|
||||
RED.actions.add("core:copy-group-style", function() { copyGroupStyle() });
|
||||
RED.actions.add("core:paste-group-style", function() { pasteGroupStyle() });
|
||||
|
||||
$(_groupEditTemplate).appendTo("#red-ui-editor-node-configs");
|
||||
|
||||
var groupStyleDiv = $("<div>",{
|
||||
class:"red-ui-flow-group-body",
|
||||
style: "position: absolute; top: -1000px;"
|
||||
}).appendTo(document.body);
|
||||
var groupStyle = getComputedStyle(groupStyleDiv[0]);
|
||||
defaultGroupStyle = {
|
||||
stroke: convertColorToHex(groupStyle.stroke),
|
||||
"stroke-opacity": groupStyle.strokeOpacity,
|
||||
fill: convertColorToHex(groupStyle.fill),
|
||||
"fill-opacity": groupStyle.fillOpacity
|
||||
}
|
||||
groupStyleDiv.remove();
|
||||
}
|
||||
|
||||
function convertColorToHex(c) {
|
||||
var m = /^rgb\((\d+), (\d+), (\d+)\)$/.exec(c);
|
||||
if (m) {
|
||||
return "#"+(((parseInt(m[1])<<16) + (parseInt(m[2])<<8) + parseInt(m[3])).toString(16).padStart(6,'0'))
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
var groupStyleClipboard;
|
||||
|
||||
function copyGroupStyle() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes && selection.nodes.length === 1 && selection.nodes[0].type === 'group') {
|
||||
groupStyleClipboard = JSON.parse(JSON.stringify(selection.nodes[0].style));
|
||||
RED.notify(RED._("clipboard.groupStyleCopied"),{id:"clipboard"})
|
||||
}
|
||||
}
|
||||
function pasteGroupStyle() {
|
||||
if (groupStyleClipboard) {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
var historyEvent = {
|
||||
t:'multi',
|
||||
events:[],
|
||||
dirty: RED.nodes.dirty()
|
||||
}
|
||||
selection.nodes.forEach(function(n) {
|
||||
if (n.type === 'group') {
|
||||
historyEvent.events.push({
|
||||
t: "edit",
|
||||
node: n,
|
||||
changes: {
|
||||
style: JSON.parse(JSON.stringify(n.style))
|
||||
},
|
||||
dirty: RED.nodes.dirty()
|
||||
});
|
||||
n.style = JSON.parse(JSON.stringify(groupStyleClipboard));
|
||||
n.dirty = true;
|
||||
|
||||
}
|
||||
})
|
||||
if (historyEvent.events.length > 0) {
|
||||
RED.history.push(historyEvent);
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function groupSelection() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
var group = createGroup(selection.nodes);
|
||||
if (group) {
|
||||
var historyEvent = {
|
||||
t:"createGroup",
|
||||
groups: [ group ],
|
||||
dirty: RED.nodes.dirty()
|
||||
}
|
||||
RED.history.push(historyEvent);
|
||||
RED.view.select({nodes:[group]});
|
||||
RED.nodes.dirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
function ungroupSelection() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
var newSelection = [];
|
||||
groups = selection.nodes.filter(function(n) { return n.type === "group" });
|
||||
|
||||
var historyEvent = {
|
||||
t:"ungroup",
|
||||
groups: [ ],
|
||||
dirty: RED.nodes.dirty()
|
||||
}
|
||||
RED.history.push(historyEvent);
|
||||
|
||||
|
||||
groups.forEach(function(g) {
|
||||
newSelection = newSelection.concat(ungroup(g))
|
||||
historyEvent.groups.push(g);
|
||||
})
|
||||
RED.history.push(historyEvent);
|
||||
RED.view.select({nodes:newSelection})
|
||||
RED.nodes.dirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
function ungroup(g) {
|
||||
var nodes = [];
|
||||
var parentGroup = RED.nodes.group(g.g);
|
||||
g.nodes.forEach(function(n) {
|
||||
nodes.push(n);
|
||||
if (parentGroup) {
|
||||
// Move nodes to parent group
|
||||
n.g = parentGroup.id;
|
||||
parentGroup.nodes.push(n);
|
||||
parentGroup.dirty = true;
|
||||
n.dirty = true;
|
||||
} else {
|
||||
delete n.g;
|
||||
}
|
||||
})
|
||||
RED.nodes.removeGroup(g);
|
||||
return nodes;
|
||||
}
|
||||
|
||||
function mergeSelection() {
|
||||
// TODO: this currently creates an entirely new group. Need to merge properties
|
||||
// of any existing group
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
var nodes = [];
|
||||
|
||||
var historyEvent = {
|
||||
t: "multi",
|
||||
events: []
|
||||
}
|
||||
var ungroupHistoryEvent = {
|
||||
t: "ungroup",
|
||||
groups: []
|
||||
}
|
||||
|
||||
|
||||
var n;
|
||||
var parentGroup;
|
||||
// First pass, check they are all in the same parent
|
||||
// TODO: DRY mergeSelection,removeSelection,...
|
||||
for (var i=0; i<selection.nodes.length; i++) {
|
||||
n = selection.nodes[i];
|
||||
if (i === 0) {
|
||||
parentGroup = n.g;
|
||||
} else if (n.g !== parentGroup) {
|
||||
RED.notify(RED._("group.errors.cannotCreateDiffGroups"),"error");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Second pass, ungroup any groups in the selection and add their contents
|
||||
// to the selection
|
||||
for (var i=0; i<selection.nodes.length; i++) {
|
||||
n = selection.nodes[i];
|
||||
if (n.type === "group") {
|
||||
ungroupHistoryEvent.groups.push(n);
|
||||
nodes = nodes.concat(ungroup(n));
|
||||
} else {
|
||||
nodes.push(n);
|
||||
}
|
||||
n.dirty = true;
|
||||
}
|
||||
if (ungroupHistoryEvent.groups.length > 0) {
|
||||
historyEvent.events.push(ungroupHistoryEvent);
|
||||
}
|
||||
// Finally, create the new group
|
||||
var group = createGroup(nodes);
|
||||
if (group) {
|
||||
RED.view.select({nodes:[group]})
|
||||
}
|
||||
historyEvent.events.push({
|
||||
t:"createGroup",
|
||||
groups: [ group ],
|
||||
dirty: RED.nodes.dirty()
|
||||
});
|
||||
RED.history.push(historyEvent);
|
||||
RED.nodes.dirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
function removeSelection() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
var nodes = [];
|
||||
var n;
|
||||
var parentGroup = RED.nodes.group(selection.nodes[0].g);
|
||||
if (parentGroup) {
|
||||
try {
|
||||
removeFromGroup(parentGroup,selection.nodes,true);
|
||||
var historyEvent = {
|
||||
t: "removeFromGroup",
|
||||
dirty: RED.nodes.dirty(),
|
||||
group: parentGroup,
|
||||
nodes: selection.nodes
|
||||
}
|
||||
RED.history.push(historyEvent);
|
||||
RED.nodes.dirty(true);
|
||||
} catch(err) {
|
||||
RED.notify(err,"error");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RED.view.select({nodes:selection.nodes})
|
||||
}
|
||||
}
|
||||
function createGroup(nodes) {
|
||||
if (nodes.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (nodes.filter(function(n) { return n.type === "subflow" }).length > 0) {
|
||||
RED.notify(RED._("group.errors.cannotAddSubflowPorts"),"error");
|
||||
return;
|
||||
}
|
||||
// nodes is an array
|
||||
// each node must be on the same tab (z)
|
||||
var group = {
|
||||
id: RED.nodes.id(),
|
||||
type: 'group',
|
||||
nodes: [],
|
||||
style: JSON.parse(JSON.stringify(defaultGroupStyle)),
|
||||
x: Number.POSITIVE_INFINITY,
|
||||
y: Number.POSITIVE_INFINITY,
|
||||
w: 0,
|
||||
h: 0,
|
||||
_def: RED.group.def
|
||||
}
|
||||
try {
|
||||
addToGroup(group,nodes);
|
||||
} catch(err) {
|
||||
RED.notify(err,"error");
|
||||
return;
|
||||
}
|
||||
group.z = nodes[0].z;
|
||||
|
||||
RED.nodes.addGroup(group);
|
||||
return group;
|
||||
}
|
||||
function addToGroup(group,nodes) {
|
||||
if (!Array.isArray(nodes)) {
|
||||
nodes = [nodes];
|
||||
}
|
||||
var i,n,z;
|
||||
var g;
|
||||
// First pass - validate we can safely add these nodes to the group
|
||||
for (i=0;i<nodes.length;i++) {
|
||||
n = nodes[i]
|
||||
if (!n.z) {
|
||||
throw new Error("Cannot add node without a z property to a group")
|
||||
}
|
||||
if (!z) {
|
||||
z = n.z;
|
||||
} else if (z !== n.z) {
|
||||
throw new Error("Cannot add nooes with different z properties")
|
||||
}
|
||||
if (n.g) {
|
||||
// This is already in a group.
|
||||
// - check they are all in the same group
|
||||
if (!g) {
|
||||
if (i!==0) {
|
||||
// TODO: this might be ok when merging groups
|
||||
throw new Error(RED._("group.errors.cannotCreateDiffGroups"))
|
||||
}
|
||||
g = n.g
|
||||
}
|
||||
}
|
||||
if (g !== n.g) {
|
||||
throw new Error(RED._("group.errors.cannotCreateDiffGroups"))
|
||||
}
|
||||
}
|
||||
// The nodes are already in a group. The assumption is they should be
|
||||
// wrapped in the newly provided group, and that group added to in their
|
||||
// place to the existing containing group.
|
||||
if (g) {
|
||||
g = RED.nodes.group(g);
|
||||
g.nodes.push(group);
|
||||
g.dirty = true;
|
||||
group.g = g.id;
|
||||
}
|
||||
// Second pass - add them to the group
|
||||
for (i=0;i<nodes.length;i++) {
|
||||
n = nodes[i];
|
||||
if (n.type !== "subflow") {
|
||||
if (g && n.g === g.id) {
|
||||
var ni = g.nodes.indexOf(n);
|
||||
if (ni > -1) {
|
||||
g.nodes.splice(ni,1)
|
||||
}
|
||||
}
|
||||
n.g = group.id;
|
||||
n.dirty = true;
|
||||
group.nodes.push(n);
|
||||
group.x = Math.min(group.x,n.x-n.w/2-25-((n._def.button && n._def.align!=="right")?20:0));
|
||||
group.y = Math.min(group.y,n.y-n.h/2-25);
|
||||
group.w = Math.max(group.w,n.x+n.w/2+25+((n._def.button && n._def.align=="right")?20:0) - group.x);
|
||||
group.h = Math.max(group.h,n.y+n.h/2+25-group.y);
|
||||
}
|
||||
}
|
||||
|
||||
markDirty(group);
|
||||
}
|
||||
function removeFromGroup(group, nodes, reparent) {
|
||||
if (!Array.isArray(nodes)) {
|
||||
nodes = [nodes];
|
||||
}
|
||||
var n;
|
||||
// First pass, check they are all in the same parent
|
||||
// TODO: DRY mergeSelection,removeSelection,...
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
if (nodes[i].g !== group.id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var parentGroup = RED.nodes.group(group.g);
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
n = nodes[i];
|
||||
n.dirty = true;
|
||||
var index = group.nodes.indexOf(n);
|
||||
group.nodes.splice(index,1);
|
||||
if (reparent && group.g) {
|
||||
n.g = group.g
|
||||
parentGroup.nodes.push(n);
|
||||
} else {
|
||||
delete n.g;
|
||||
}
|
||||
}
|
||||
markDirty(group);
|
||||
}
|
||||
|
||||
function getNodes(group,recursive) {
|
||||
var nodes = [];
|
||||
group.nodes.forEach(function(n) {
|
||||
nodes.push(n);
|
||||
if (recursive && n.type === 'group') {
|
||||
nodes = nodes.concat(getNodes(n,recursive))
|
||||
}
|
||||
})
|
||||
return nodes;
|
||||
}
|
||||
|
||||
function groupContains(group,item) {
|
||||
if (item.g === group.id) {
|
||||
return true;
|
||||
}
|
||||
for (var i=0;i<group.nodes.length;i++) {
|
||||
if (group.nodes[i].type === "group") {
|
||||
if (groupContains(group.nodes[i],item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function getRootGroup(group) {
|
||||
if (!group.g) {
|
||||
return group;
|
||||
}
|
||||
return getRootGroup(RED.nodes.group(group.g))
|
||||
}
|
||||
|
||||
function createLayoutPicker(options) {
|
||||
|
||||
var container = $("<div>",{style:"display:inline-block"});
|
||||
var layoutHiddenInput = $("<input/>", { id: options.id, type: "hidden", value: options.value }).appendTo(container);
|
||||
|
||||
var layoutButton = $('<button type="button" class="red-ui-button red-ui-editor-node-appearance-button">').appendTo(container);
|
||||
$('<i class="fa fa-caret-down"></i>').appendTo(layoutButton);
|
||||
|
||||
var layoutDispContainer = $('<div>',{class:"red-ui-search-result-node"}).appendTo(layoutButton);
|
||||
var layoutDisp = $('<div>',{class:"red-ui-group-layout-picker-cell-text red-ui-group-layout-text-pos-"}).appendTo(layoutDispContainer);
|
||||
|
||||
var refreshDisplay = function() {
|
||||
var val = layoutHiddenInput.val();
|
||||
layoutDisp.removeClass().addClass("red-ui-group-layout-picker-cell-text red-ui-group-layout-text-pos-"+val)
|
||||
}
|
||||
layoutButton.on("click", function(e) {
|
||||
var picker = $("<div/>", {
|
||||
class: "red-ui-group-layout-picker"
|
||||
}).css({
|
||||
width: "126px"
|
||||
});
|
||||
|
||||
var row = null;
|
||||
|
||||
row = $("<div/>").appendTo(picker);
|
||||
|
||||
for (var y=0;y<2;y++) { //red-ui-group-layout-text-pos
|
||||
var yComponent= "ns"[y];
|
||||
row = $("<div/>").appendTo(picker);
|
||||
for (var x=0;x<3;x++) {
|
||||
var xComponent = ["w","","e"][x];
|
||||
var val = yComponent+xComponent;
|
||||
var button = $("<button/>", { class:"red-ui-search-result-node","data-pos":val }).appendTo(row);
|
||||
button.on("click", function (e) {
|
||||
e.preventDefault();
|
||||
layoutHiddenInput.val($(this).data("pos"));
|
||||
layoutPanel.hide()
|
||||
refreshDisplay();
|
||||
});
|
||||
$('<div>',{class:"red-ui-group-layout-picker-cell-text red-ui-group-layout-text-pos-"+val}).appendTo(button);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
refreshDisplay();
|
||||
var layoutPanel = RED.popover.panel(picker);
|
||||
layoutPanel.show({
|
||||
target: layoutButton
|
||||
})
|
||||
})
|
||||
|
||||
refreshDisplay();
|
||||
|
||||
return container;
|
||||
|
||||
}
|
||||
|
||||
function markDirty(group) {
|
||||
group.dirty = true;
|
||||
while(group) {
|
||||
group.dirty = true;
|
||||
group = RED.nodes.group(group.g);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
def: groupDef,
|
||||
init: init,
|
||||
createGroup: createGroup,
|
||||
ungroup: ungroup,
|
||||
addToGroup: addToGroup,
|
||||
removeFromGroup: removeFromGroup,
|
||||
getNodes: getNodes,
|
||||
contains: groupContains,
|
||||
markDirty: markDirty
|
||||
}
|
||||
})();
|
@@ -524,12 +524,12 @@ RED.keyboard = (function() {
|
||||
var pane = $('<div id="red-ui-settings-tab-keyboard"></div>');
|
||||
|
||||
$('<div class="keyboard-shortcut-entry keyboard-shortcut-list-header">'+
|
||||
'<div class="keyboard-shortcut-entry-key keyboard-shortcut-entry-text"><input id="red-ui-settings-tab-keyboard-filter" type="text" data-i18n="[placeholder]keyboard.filterActions"></div>'+
|
||||
'<div class="keyboard-shortcut-entry-key keyboard-shortcut-entry-text"><input autocomplete="off" name="keyboard-filter" id="red-ui-settings-tab-keyboard-filter" type="text" data-i18n="[placeholder]keyboard.filterActions"></div>'+
|
||||
'<div class="keyboard-shortcut-entry-key" data-i18n="keyboard.shortcut"></div>'+
|
||||
'<div class="keyboard-shortcut-entry-scope" data-i18n="keyboard.scope"></div>'+
|
||||
'</div>').appendTo(pane);
|
||||
|
||||
pane.find("input").searchBox({
|
||||
pane.find("#red-ui-settings-tab-keyboard-filter").searchBox({
|
||||
delay: 100,
|
||||
change: function() {
|
||||
var filterValue = $(this).val().trim();
|
||||
|
@@ -384,6 +384,7 @@ RED.palette.editor = (function() {
|
||||
handleCatalogResponse(null,catalog,index,v);
|
||||
refreshNodeModuleList();
|
||||
}).fail(function(jqxhr, textStatus, error) {
|
||||
console.warn("Error loading catalog",catalog,":",error);
|
||||
handleCatalogResponse(jqxhr,catalog,index);
|
||||
}).always(function() {
|
||||
handled++;
|
||||
|
@@ -269,7 +269,7 @@ RED.palette = (function() {
|
||||
RED.view.focus();
|
||||
var helpText;
|
||||
if (nt.indexOf("subflow:") === 0) {
|
||||
helpText = marked(RED.nodes.subflow(nt.substring(8)).info||"")||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||
helpText = RED.utils.renderMarkdown(RED.nodes.subflow(nt.substring(8)).info||"")||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||
} else {
|
||||
helpText = $("script[data-help-name='"+d.attr("data-palette-type")+"']").html()||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||
}
|
||||
@@ -284,6 +284,9 @@ RED.palette = (function() {
|
||||
var mouseX;
|
||||
var mouseY;
|
||||
var spliceTimer;
|
||||
var groupTimer;
|
||||
var activeGroup;
|
||||
var hoverGroup;
|
||||
var paletteWidth;
|
||||
var paletteTop;
|
||||
$(d).draggable({
|
||||
@@ -295,16 +298,51 @@ RED.palette = (function() {
|
||||
start: function() {
|
||||
paletteWidth = $("#red-ui-palette").width();
|
||||
paletteTop = $("#red-ui-palette").parent().position().top + $("#red-ui-palette-container").position().top;
|
||||
hoverGroup = null;
|
||||
activeGroup = RED.view.getActiveGroup();
|
||||
if (activeGroup) {
|
||||
document.getElementById(activeGroup.id).classList.add("red-ui-flow-group-active-hovered");
|
||||
}
|
||||
RED.view.focus();
|
||||
},
|
||||
stop: function() { d3.select('.red-ui-flow-link-splice').classed('red-ui-flow-link-splice',false); if (spliceTimer) { clearTimeout(spliceTimer); spliceTimer = null;}},
|
||||
stop: function() {
|
||||
d3.select('.red-ui-flow-link-splice').classed('red-ui-flow-link-splice',false);
|
||||
if (hoverGroup) {
|
||||
document.getElementById(hoverGroup.id).classList.remove("red-ui-flow-group-hovered");
|
||||
}
|
||||
if (activeGroup) {
|
||||
document.getElementById(activeGroup.id).classList.remove("red-ui-flow-group-active-hovered");
|
||||
}
|
||||
if (spliceTimer) { clearTimeout(spliceTimer); spliceTimer = null; }
|
||||
if (groupTimer) { clearTimeout(groupTimer); groupTimer = null; }
|
||||
},
|
||||
drag: function(e,ui) {
|
||||
var paletteNode = getPaletteNode(nt);
|
||||
ui.originalPosition.left = paletteNode.offset().left;
|
||||
mouseX = ui.position.left - paletteWidth + (ui.helper.width()/2) + chart.scrollLeft();
|
||||
mouseY = ui.position.top - paletteTop + (ui.helper.height()/2) + chart.scrollTop();
|
||||
if (!groupTimer) {
|
||||
groupTimer = setTimeout(function() {
|
||||
var group = RED.view.getGroupAtPoint(mouseX,mouseY);
|
||||
if (group !== hoverGroup) {
|
||||
if (hoverGroup) {
|
||||
document.getElementById(hoverGroup.id).classList.remove("red-ui-flow-group-hovered");
|
||||
}
|
||||
if (group) {
|
||||
document.getElementById(group.id).classList.add("red-ui-flow-group-hovered");
|
||||
}
|
||||
hoverGroup = group;
|
||||
if (hoverGroup) {
|
||||
$(ui.helper).data('group',hoverGroup);
|
||||
} else {
|
||||
$(ui.helper).removeData('group');
|
||||
}
|
||||
}
|
||||
groupTimer = null;
|
||||
|
||||
},200)
|
||||
}
|
||||
if (def.inputs > 0 && def.outputs > 0) {
|
||||
mouseX = ui.position.left - paletteWidth + (ui.helper.width()/2) + chart.scrollLeft();
|
||||
mouseY = ui.position.top - paletteTop + (ui.helper.height()/2) + chart.scrollTop();
|
||||
if (!spliceTimer) {
|
||||
spliceTimer = setTimeout(function() {
|
||||
var nodes = [];
|
||||
@@ -370,7 +408,7 @@ RED.palette = (function() {
|
||||
RED.workspaces.show(nt.substring(8));
|
||||
e.preventDefault();
|
||||
});
|
||||
nodeInfo = marked(def.info||"");
|
||||
nodeInfo = RED.utils.renderMarkdown(def.info||"");
|
||||
}
|
||||
setLabel(nt,d,label,nodeInfo);
|
||||
|
||||
@@ -440,7 +478,7 @@ RED.palette = (function() {
|
||||
} else if (portOutput.length !== 0 && sf.out.length === 0) {
|
||||
portOutput.remove();
|
||||
}
|
||||
setLabel(sf.type+":"+sf.id,paletteNode,sf.name,marked(sf.info||""));
|
||||
setLabel(sf.type+":"+sf.id,paletteNode,sf.name,RED.utils.renderMarkdown(sf.info||""));
|
||||
setIcon(paletteNode,sf);
|
||||
|
||||
var currentCategory = paletteNode.data('category');
|
||||
|
@@ -158,7 +158,7 @@ RED.projects.settings = (function() {
|
||||
container.empty();
|
||||
var desc;
|
||||
if (activeProject.description) {
|
||||
desc = marked(activeProject.description);
|
||||
desc = RED.utils.renderMarkdown(activeProject.description);
|
||||
} else {
|
||||
desc = '<span class="red-ui-help-info-none">' + RED._("sidebar.project.noDescriptionAvailable") + '</span>';
|
||||
}
|
||||
|
@@ -30,13 +30,13 @@ RED.projects.userSettings = (function() {
|
||||
$('<div class="red-ui-settings-section-description"></div>').appendTo(gitconfigContainer).text(RED._("editor:sidebar.project.userSettings.committerTip"));
|
||||
|
||||
var row = $('<div class="red-ui-settings-row"></div>').appendTo(gitconfigContainer);
|
||||
$('<label for=""></label>').text(RED._("editor:sidebar.project.userSettings.userName")).appendTo(row);
|
||||
gitUsernameInput = $('<input type="text">').appendTo(row);
|
||||
$('<label for="user-settings-gitconfig-username"></label>').text(RED._("editor:sidebar.project.userSettings.userName")).appendTo(row);
|
||||
gitUsernameInput = $('<input type="text" id="user-settings-gitconfig-username">').appendTo(row);
|
||||
gitUsernameInput.val(currentGitSettings.user.name||"");
|
||||
|
||||
row = $('<div class="red-ui-settings-row"></div>').appendTo(gitconfigContainer);
|
||||
$('<label for=""></label>').text(RED._("editor:sidebar.project.userSettings.email")).appendTo(row);
|
||||
gitEmailInput = $('<input type="text">').appendTo(row);
|
||||
$('<label for="user-settings-gitconfig-email"></label>').text(RED._("editor:sidebar.project.userSettings.email")).appendTo(row);
|
||||
gitEmailInput = $('<input type="text" id="user-settings-gitconfig-email">').appendTo(row);
|
||||
gitEmailInput.val(currentGitSettings.user.email||"");
|
||||
}
|
||||
|
||||
|
@@ -1939,100 +1939,121 @@ RED.projects = (function() {
|
||||
}
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
var responses;
|
||||
|
||||
if (options.responses && options.responses[xhr.status]) {
|
||||
responses = options.responses[xhr.status];
|
||||
if (typeof responses === 'function') {
|
||||
resultCallback = responses;
|
||||
resultCallbackArgs = {error:responses.statusText};
|
||||
return;
|
||||
} else if (options.handleAuthFail !== false && xhr.responseJSON.code === 'git_auth_failed') {
|
||||
var url = activeProject.git.remotes[xhr.responseJSON.remote||options.remote||'origin'].fetch;
|
||||
} else if (options.handleAuthFail !== false && (xhr.responseJSON.code === 'git_auth_failed' || xhr.responseJSON.code === 'git_host_key_verification_failed')) {
|
||||
if (xhr.responseJSON.code === 'git_auth_failed') {
|
||||
var url = activeProject.git.remotes[xhr.responseJSON.remote||options.remote||'origin'].fetch;
|
||||
|
||||
var message = $('<div>'+
|
||||
var message = $('<div>'+
|
||||
'<div class="form-row">'+RED._("projects.send-req.auth-req")+':</div>'+
|
||||
'<div class="form-row"><div style="margin-left: 20px;">'+url+'</div></div>'+
|
||||
'</div>');
|
||||
|
||||
var isSSH = false;
|
||||
if (/^https?:\/\//.test(url)) {
|
||||
$('<div class="form-row"><label for="projects-user-auth-username">'+RED._("projects.send-req.username")+'</label><input id="projects-user-auth-username" type="text"></input></div>'+
|
||||
'<div class="form-row"><label for=projects-user-auth-password">'+RED._("projects.send-req.password")+'</label><input id="projects-user-auth-password" type="password"></input></div>').appendTo(message);
|
||||
} else if (/^(?:ssh|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?/.test(url)) {
|
||||
isSSH = true;
|
||||
var row = $('<div class="form-row"></div>').appendTo(message);
|
||||
$('<label for="projects-user-auth-key">SSH Key</label>').appendTo(row);
|
||||
var projectRepoSSHKeySelect = $('<select id="projects-user-auth-key">').width('70%').appendTo(row);
|
||||
$.getJSON("settings/user/keys", function(data) {
|
||||
var count = 0;
|
||||
data.keys.forEach(function(key) {
|
||||
projectRepoSSHKeySelect.append($("<option></option>").val(key.name).text(key.name));
|
||||
count++;
|
||||
var isSSH = false;
|
||||
if (/^https?:\/\//.test(url)) {
|
||||
$('<div class="form-row"><label for="projects-user-auth-username">'+RED._("projects.send-req.username")+'</label><input id="projects-user-auth-username" type="text"></input></div>'+
|
||||
'<div class="form-row"><label for=projects-user-auth-password">'+RED._("projects.send-req.password")+'</label><input id="projects-user-auth-password" type="password"></input></div>').appendTo(message);
|
||||
} else if (/^(?:ssh|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?/.test(url)) {
|
||||
isSSH = true;
|
||||
var row = $('<div class="form-row"></div>').appendTo(message);
|
||||
$('<label for="projects-user-auth-key">SSH Key</label>').appendTo(row);
|
||||
var projectRepoSSHKeySelect = $('<select id="projects-user-auth-key">').width('70%').appendTo(row);
|
||||
$.getJSON("settings/user/keys", function(data) {
|
||||
var count = 0;
|
||||
data.keys.forEach(function(key) {
|
||||
projectRepoSSHKeySelect.append($("<option></option>").val(key.name).text(key.name));
|
||||
count++;
|
||||
});
|
||||
if (count === 0) {
|
||||
//TODO: handle no keys yet setup
|
||||
}
|
||||
});
|
||||
if (count === 0) {
|
||||
//TODO: handle no keys yet setup
|
||||
}
|
||||
});
|
||||
row = $('<div class="form-row"></div>').appendTo(message);
|
||||
$('<label for="projects-user-auth-passphrase">'+RED._("projects.send-req.passphrase")+'</label>').appendTo(row);
|
||||
$('<input id="projects-user-auth-passphrase" type="password"></input>').appendTo(row);
|
||||
}
|
||||
row = $('<div class="form-row"></div>').appendTo(message);
|
||||
$('<label for="projects-user-auth-passphrase">'+RED._("projects.send-req.passphrase")+'</label>').appendTo(row);
|
||||
$('<input id="projects-user-auth-passphrase" type="password"></input>').appendTo(row);
|
||||
}
|
||||
|
||||
var notification = RED.notify(message,{
|
||||
type:"error",
|
||||
fixed: true,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{
|
||||
//id: "node-dialog-delete",
|
||||
//class: 'leftButton',
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
notification.close();
|
||||
}
|
||||
},{
|
||||
text: '<span><i class="fa fa-refresh"></i> ' +RED._("projects.send-req.retry") +'</span>',
|
||||
click: function() {
|
||||
body = body || {};
|
||||
var authBody = {};
|
||||
if (isSSH) {
|
||||
authBody.keyFile = $('#projects-user-auth-key').val();
|
||||
authBody.passphrase = $('#projects-user-auth-passphrase').val();
|
||||
} else {
|
||||
authBody.username = $('#projects-user-auth-username').val();
|
||||
authBody.password = $('#projects-user-auth-password').val();
|
||||
var notification = RED.notify(message,{
|
||||
type:"error",
|
||||
fixed: true,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{
|
||||
//id: "node-dialog-delete",
|
||||
//class: 'leftButton',
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
notification.close();
|
||||
}
|
||||
var done = function(err) {
|
||||
if (err) {
|
||||
console.log(RED._("projects.send-req.update-failed"));
|
||||
console.log(err);
|
||||
},{
|
||||
text: '<span><i class="fa fa-refresh"></i> ' +RED._("projects.send-req.retry") +'</span>',
|
||||
click: function() {
|
||||
body = body || {};
|
||||
var authBody = {};
|
||||
if (isSSH) {
|
||||
authBody.keyFile = $('#projects-user-auth-key').val();
|
||||
authBody.passphrase = $('#projects-user-auth-passphrase').val();
|
||||
} else {
|
||||
sendRequest(options,body);
|
||||
notification.close();
|
||||
authBody.username = $('#projects-user-auth-username').val();
|
||||
authBody.password = $('#projects-user-auth-password').val();
|
||||
}
|
||||
var done = function(err) {
|
||||
if (err) {
|
||||
console.log(RED._("projects.send-req.update-failed"));
|
||||
console.log(err);
|
||||
} else {
|
||||
sendRequest(options,body);
|
||||
notification.close();
|
||||
}
|
||||
|
||||
}
|
||||
sendRequest({
|
||||
url: "projects/"+activeProject.name+"/remotes/"+(xhr.responseJSON.remote||options.remote||'origin'),
|
||||
type: "PUT",
|
||||
responses: {
|
||||
0: function(error) {
|
||||
done(error,null);
|
||||
},
|
||||
200: function(data) {
|
||||
done(null,data);
|
||||
},
|
||||
400: {
|
||||
'unexpected_error': function(error) {
|
||||
done(error,null);
|
||||
}
|
||||
},
|
||||
}
|
||||
},{auth:authBody});
|
||||
sendRequest({
|
||||
url: "projects/"+activeProject.name+"/remotes/"+(xhr.responseJSON.remote||options.remote||'origin'),
|
||||
type: "PUT",
|
||||
responses: {
|
||||
0: function(error) {
|
||||
done(error,null);
|
||||
},
|
||||
200: function(data) {
|
||||
done(null,data);
|
||||
},
|
||||
400: {
|
||||
'unexpected_error': function(error) {
|
||||
done(error,null);
|
||||
}
|
||||
},
|
||||
}
|
||||
},{auth:authBody});
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
return;
|
||||
]
|
||||
});
|
||||
return;
|
||||
} else if (xhr.responseJSON.code === 'git_host_key_verification_failed') {
|
||||
var message = $('<div>'+
|
||||
'<div class="form-row">'+RED._("projects.send-req.host-key-verify-failed")+'</div>'+
|
||||
'</div>');
|
||||
var notification = RED.notify(message,{
|
||||
type:"error",
|
||||
fixed: true,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{
|
||||
text: RED._("common.label.close"),
|
||||
click: function() {
|
||||
notification.close();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else if (responses[xhr.responseJSON.code]) {
|
||||
resultCallback = responses[xhr.responseJSON.code];
|
||||
resultCallbackArgs = xhr.responseJSON;
|
||||
|
@@ -25,5 +25,7 @@ RED.state = {
|
||||
IMPORT_DRAGGING: 8,
|
||||
QUICK_JOINING: 9,
|
||||
PANNING: 10,
|
||||
SELECTING_NODE: 11
|
||||
SELECTING_NODE: 11,
|
||||
GROUP_DRAGGING: 12,
|
||||
GROUP_RESIZE: 13
|
||||
}
|
||||
|
@@ -567,6 +567,34 @@ RED.subflow = (function() {
|
||||
return;
|
||||
}
|
||||
var i,n;
|
||||
var nodeList = new Set();
|
||||
var tmplist = selection.nodes.slice();
|
||||
var includedGroups = new Set();
|
||||
while(tmplist.length > 0) {
|
||||
n = tmplist.shift();
|
||||
if (n.type === "group") {
|
||||
includedGroups.add(n.id);
|
||||
tmplist = tmplist.concat(n.nodes);
|
||||
}
|
||||
nodeList.add(n);
|
||||
}
|
||||
|
||||
nodeList = Array.from(nodeList);
|
||||
|
||||
var containingGroup = nodeList[0].g;
|
||||
var nodesMovedFromGroup = [];
|
||||
|
||||
for (i=0; i<nodeList.length;i++) {
|
||||
if (nodeList[i].g && !includedGroups.has(nodeList[i].g)) {
|
||||
if (containingGroup !== nodeList[i].g) {
|
||||
RED.notify("Cannot create subflow across multiple groups","error");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (containingGroup) {
|
||||
containingGroup = RED.nodes.group(containingGroup);
|
||||
}
|
||||
var nodes = {};
|
||||
var new_links = [];
|
||||
var removedLinks = [];
|
||||
@@ -575,13 +603,13 @@ RED.subflow = (function() {
|
||||
var candidateOutputs = [];
|
||||
var candidateInputNodes = {};
|
||||
|
||||
var boundingBox = [selection.nodes[0].x,
|
||||
selection.nodes[0].y,
|
||||
selection.nodes[0].x,
|
||||
selection.nodes[0].y];
|
||||
var boundingBox = [nodeList[0].x,
|
||||
nodeList[0].y,
|
||||
nodeList[0].x,
|
||||
nodeList[0].y];
|
||||
|
||||
for (i=0;i<selection.nodes.length;i++) {
|
||||
n = selection.nodes[i];
|
||||
for (i=0;i<nodeList.length;i++) {
|
||||
n = nodeList[i];
|
||||
nodes[n.id] = {n:n,outputs:{}};
|
||||
boundingBox = [
|
||||
Math.min(boundingBox[0],n.x),
|
||||
@@ -690,6 +718,20 @@ RED.subflow = (function() {
|
||||
RED.editor.validateNode(subflowInstance);
|
||||
RED.nodes.add(subflowInstance);
|
||||
|
||||
if (containingGroup) {
|
||||
RED.group.addToGroup(containingGroup, subflowInstance);
|
||||
nodeList.forEach(function(nl) {
|
||||
if (nl.g === containingGroup.id) {
|
||||
delete nl.g;
|
||||
var index = containingGroup.nodes.indexOf(nl);
|
||||
containingGroup.nodes.splice(index,1);
|
||||
nodesMovedFromGroup.push(nl);
|
||||
}
|
||||
})
|
||||
containingGroup.dirty = true;
|
||||
}
|
||||
|
||||
|
||||
candidateInputs.forEach(function(l) {
|
||||
var link = {source:l.source, sourcePort:l.sourcePort, target: subflowInstance};
|
||||
new_links.push(link);
|
||||
@@ -723,8 +765,8 @@ RED.subflow = (function() {
|
||||
RED.nodes.removeLink(removedLinks[i]);
|
||||
}
|
||||
|
||||
for (i=0;i<selection.nodes.length;i++) {
|
||||
n = selection.nodes[i];
|
||||
for (i=0;i<nodeList.length;i++) {
|
||||
n = nodeList[i];
|
||||
if (/^link /.test(n.type)) {
|
||||
n.links = n.links.filter(function(id) {
|
||||
var isLocalLink = nodes.hasOwnProperty(id);
|
||||
@@ -745,7 +787,8 @@ RED.subflow = (function() {
|
||||
RED.nodes.moveNodeToTab(n, subflow.id);
|
||||
}
|
||||
|
||||
RED.history.push({
|
||||
|
||||
var historyEvent = {
|
||||
t:'createSubflow',
|
||||
nodes:[subflowInstance.id],
|
||||
links:new_links,
|
||||
@@ -759,11 +802,29 @@ RED.subflow = (function() {
|
||||
removedLinks: removedLinks,
|
||||
|
||||
dirty:RED.nodes.dirty()
|
||||
});
|
||||
RED.view.select(null);
|
||||
}
|
||||
if (containingGroup) {
|
||||
historyEvent = {
|
||||
t:'multi',
|
||||
events: [ historyEvent ]
|
||||
}
|
||||
historyEvent.events.push({
|
||||
t:'addToGroup',
|
||||
group: containingGroup,
|
||||
nodes: [subflowInstance]
|
||||
})
|
||||
historyEvent.events.push({
|
||||
t:'removeFromGroup',
|
||||
group: containingGroup,
|
||||
nodes: nodesMovedFromGroup,
|
||||
reparent: false
|
||||
})
|
||||
}
|
||||
RED.history.push(historyEvent);
|
||||
RED.editor.validateNode(subflow);
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
RED.view.updateActive();
|
||||
RED.view.select(null);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -231,7 +231,8 @@ RED.sidebar.context = (function() {
|
||||
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
|
||||
typeHint: data.format,
|
||||
sourceId: id+"."+k,
|
||||
tools: tools
|
||||
tools: tools,
|
||||
path: ""
|
||||
}).appendTo(propRow.children()[1]);
|
||||
}
|
||||
})
|
||||
@@ -275,7 +276,8 @@ RED.sidebar.context = (function() {
|
||||
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
|
||||
typeHint: data.format,
|
||||
sourceId: id+"."+k,
|
||||
tools: tools
|
||||
tools: tools,
|
||||
path: ""
|
||||
}).appendTo(propRow.children()[1]);
|
||||
}
|
||||
});
|
||||
@@ -295,7 +297,8 @@ RED.sidebar.context = (function() {
|
||||
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
|
||||
typeHint: v.format,
|
||||
sourceId: id+"."+k,
|
||||
tools: tools
|
||||
tools: tools,
|
||||
path: ""
|
||||
}).appendTo(propRow.children()[1]);
|
||||
if (contextStores.length > 1) {
|
||||
$("<span>",{class:"red-ui-sidebar-context-property-storename"}).text(v.store).appendTo($(propRow.children()[0]))
|
||||
|
@@ -15,17 +15,6 @@
|
||||
**/
|
||||
RED.sidebar.info = (function() {
|
||||
|
||||
marked.setOptions({
|
||||
renderer: new marked.Renderer(),
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: false,
|
||||
pedantic: false,
|
||||
sanitize: true,
|
||||
smartLists: true,
|
||||
smartypants: false
|
||||
});
|
||||
|
||||
var content;
|
||||
var sections;
|
||||
var propertiesSection;
|
||||
@@ -163,7 +152,8 @@ RED.sidebar.info = (function() {
|
||||
var types = {
|
||||
nodes:0,
|
||||
flows:0,
|
||||
subflows:0
|
||||
subflows:0,
|
||||
groups: 0
|
||||
}
|
||||
node.forEach(function(n) {
|
||||
if (n.type === 'tab') {
|
||||
@@ -171,6 +161,8 @@ RED.sidebar.info = (function() {
|
||||
types.nodes += RED.nodes.filterNodes({z:n.id}).length;
|
||||
} else if (n.type === 'subflow') {
|
||||
types.subflows++;
|
||||
} else if (n.type === 'group') {
|
||||
types.groups++;
|
||||
} else {
|
||||
types.nodes++;
|
||||
}
|
||||
@@ -190,6 +182,9 @@ RED.sidebar.info = (function() {
|
||||
if (types.nodes > 0) {
|
||||
$('<div>').text(RED._("clipboard.node",{count:types.nodes})).appendTo(counts);
|
||||
}
|
||||
if (types.groups > 0) {
|
||||
$('<div>').text(RED._("clipboard.group",{count:types.groups})).appendTo(counts);
|
||||
}
|
||||
} else {
|
||||
// A single 'thing' selected.
|
||||
|
||||
@@ -220,6 +215,36 @@ RED.sidebar.info = (function() {
|
||||
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("sidebar.info.status")+'</td><td></td></tr>').appendTo(tableBody);
|
||||
$(propRow.children()[1]).text((!!!node.disabled)?RED._("sidebar.info.enabled"):RED._("sidebar.info.disabled"))
|
||||
}
|
||||
} else if (node.type === "group") {
|
||||
// An actual node is selected in the editor - build up its properties table
|
||||
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("sidebar.info.group")+"</td><td></td></tr>").appendTo(tableBody);
|
||||
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
|
||||
if (node.name) {
|
||||
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("common.label.name")+'</td><td></td></tr>').appendTo(tableBody);
|
||||
$('<span class="red-ui-text-bidi-aware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'"></span>').text(node.name).appendTo(propRow.children()[1]);
|
||||
}
|
||||
propRow = $('<tr class="red-ui-help-info-row"><td> </td><td></td></tr>').appendTo(tableBody);
|
||||
var typeCounts = {
|
||||
nodes:0,
|
||||
groups: 0
|
||||
}
|
||||
var allNodes = RED.group.getNodes(node,true);
|
||||
allNodes.forEach(function(n) {
|
||||
if (n.type === "group") {
|
||||
typeCounts.groups++;
|
||||
} else {
|
||||
typeCounts.nodes++
|
||||
}
|
||||
});
|
||||
var counts = $('<div>').appendTo($(propRow.children()[1]));
|
||||
if (typeCounts.nodes > 0) {
|
||||
$('<div>').text(RED._("clipboard.node",{count:typeCounts.nodes})).appendTo(counts);
|
||||
}
|
||||
if (typeCounts.groups > 0) {
|
||||
$('<div>').text(RED._("clipboard.group",{count:typeCounts.groups})).appendTo(counts);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// An actual node is selected in the editor - build up its properties table
|
||||
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("sidebar.info.node")+"</td><td></td></tr>").appendTo(tableBody);
|
||||
@@ -236,7 +261,7 @@ RED.sidebar.info = (function() {
|
||||
}
|
||||
}
|
||||
var count = 0;
|
||||
if (!m && node.type != "subflow") {
|
||||
if (!m && node.type != "subflow" && node.type != "group") {
|
||||
var defaults;
|
||||
if (node.type === 'unknown') {
|
||||
defaults = {};
|
||||
@@ -314,7 +339,7 @@ RED.sidebar.info = (function() {
|
||||
if (subflowNode && node.type !== "subflow") {
|
||||
// Selected a subflow instance node.
|
||||
// - The subflow template info goes into help
|
||||
helpText = (marked(subflowNode.info||"")||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>'));
|
||||
helpText = (RED.utils.renderMarkdown(subflowNode.info||"")||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>'));
|
||||
} else {
|
||||
helpText = $("script[data-help-name='"+node.type+"']").html()||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
|
||||
}
|
||||
@@ -326,10 +351,10 @@ RED.sidebar.info = (function() {
|
||||
if (node._def && node._def.info) {
|
||||
var info = node._def.info;
|
||||
var textInfo = (typeof info === "function" ? info.call(node) : info);
|
||||
infoText = infoText + marked(textInfo);
|
||||
infoText = infoText + RED.utils.renderMarkdown(textInfo);
|
||||
}
|
||||
if (node.info) {
|
||||
infoText = infoText + marked(node.info || "")
|
||||
infoText = infoText + RED.utils.renderMarkdown(node.info || "")
|
||||
}
|
||||
setInfoText(infoText, infoSection.content);
|
||||
|
||||
|
@@ -16,6 +16,28 @@
|
||||
|
||||
RED.utils = (function() {
|
||||
|
||||
window._marked = window.marked;
|
||||
window.marked = function(txt) {
|
||||
console.warn("Use of 'marked()' is deprecated. Use RED.utils.renderMarkdown() instead");
|
||||
return renderMarkdown(txt);
|
||||
}
|
||||
|
||||
_marked.setOptions({
|
||||
renderer: new _marked.Renderer(),
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: false,
|
||||
pedantic: false,
|
||||
smartLists: true,
|
||||
smartypants: false
|
||||
});
|
||||
|
||||
function renderMarkdown(txt) {
|
||||
var rendered = _marked(txt);
|
||||
var cleaned = DOMPurify.sanitize(rendered, {SAFE_FOR_JQUERY: true})
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
function formatString(str) {
|
||||
return str.replace(/\r?\n/g,"↵").replace(/\t/g,"→");
|
||||
}
|
||||
@@ -1053,6 +1075,7 @@ RED.utils = (function() {
|
||||
decodeObject: decodeObject,
|
||||
parseContextKey: parseContextKey,
|
||||
createIconElement: createIconElement,
|
||||
sanitize: sanitize
|
||||
sanitize: sanitize,
|
||||
renderMarkdown: renderMarkdown
|
||||
}
|
||||
})();
|
||||
|
@@ -67,9 +67,16 @@ RED.view.tools = (function() {
|
||||
|
||||
function moveSelection(dx,dy) {
|
||||
if (moving_set === null) {
|
||||
moving_set = [];
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
moving_set = selection.nodes.map(function(n) { return {n:n}});
|
||||
while (selection.nodes.length > 0) {
|
||||
var n = selection.nodes.shift();
|
||||
moving_set.push({n:n});
|
||||
if (n.type === "group") {
|
||||
selection.nodes = selection.nodes.concat(n.nodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (moving_set && moving_set.length > 0) {
|
||||
@@ -93,6 +100,9 @@ RED.view.tools = (function() {
|
||||
node.n.x += dx;
|
||||
node.n.y += dy;
|
||||
node.n.dirty = true;
|
||||
if (node.n.type === "group") {
|
||||
RED.group.markDirty(node.n);
|
||||
}
|
||||
minX = Math.min(node.n.x-node.n.w/2-5,minX);
|
||||
minY = Math.min(node.n.y-node.n.h/2-5,minY);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -284,3 +284,8 @@ $debug-message-border: #eee;
|
||||
$debug-message-border-hover: #999;
|
||||
$debug-message-border-warning: #ffdf9d;
|
||||
$debug-message-border-error: #f99;
|
||||
|
||||
$group-default-fill: none;
|
||||
$group-default-fill-opacity: 1;
|
||||
$group-default-stroke: #999;
|
||||
$group-default-stroke-opacity: 1;
|
||||
|
@@ -411,6 +411,133 @@ button.red-ui-button.red-ui-editor-node-appearance-button {
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-group-layout-picker {
|
||||
padding: 5px;
|
||||
background: $primary-background;
|
||||
}
|
||||
.red-ui-group-layout-picker-cell-text {
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
height: 2px;
|
||||
border-top: 2px solid $secondary-text-color;
|
||||
border-bottom: 2px solid $secondary-text-color;
|
||||
margin: 2px;
|
||||
|
||||
&.red-ui-group-layout-text-pos-nw { top: 0; left: 0; }
|
||||
&.red-ui-group-layout-text-pos-n { top: 0; left: calc(50% - 9px); }
|
||||
&.red-ui-group-layout-text-pos-ne { top: 0; right: 0; }
|
||||
&.red-ui-group-layout-text-pos-sw { bottom: 0; left: 0; }
|
||||
&.red-ui-group-layout-text-pos-s { bottom: 0; left: calc(50% - 9px); }
|
||||
&.red-ui-group-layout-text-pos-se { bottom: 0; right: 0; }
|
||||
&.red-ui-group-layout-text-pos- {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 5px;
|
||||
margin: 0;
|
||||
background-color: #FFF;
|
||||
background-size: 100% 100%;
|
||||
background-position: 0 0, 50% 50%;
|
||||
background-image: linear-gradient(45deg, transparent 45%, $secondary-border-color 45%, $secondary-border-color 55%, transparent 55%, transparent),linear-gradient(-45deg, transparent 45%, $secondary-border-color 45%, $secondary-border-color 55%, transparent 55%, transparent);
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-group-layout-picker button.red-ui-search-result-node {
|
||||
float: none;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin: 5px;
|
||||
width: 32px;
|
||||
height: 27px;
|
||||
}
|
||||
|
||||
button.red-ui-group-layout-picker-none {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.red-ui-color-picker {
|
||||
input[type="text"] {
|
||||
border-radius:0;
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
border: none;
|
||||
border-bottom: 1px solid $form-input-border-color;
|
||||
}
|
||||
small {
|
||||
color: $secondary-text-color;
|
||||
margin-left: 5px;
|
||||
margin-right: 4px;
|
||||
display: inline-block;
|
||||
min-width: 35px;
|
||||
text-align: right;
|
||||
}
|
||||
background: $primary-background;
|
||||
}
|
||||
.red-ui-editor-node-appearance-button {
|
||||
.red-ui-search-result-node {
|
||||
overflow: hidden
|
||||
}
|
||||
}
|
||||
.red-ui-color-picker-cell {
|
||||
padding: 0;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: $secondary-border-color;
|
||||
}
|
||||
.red-ui-color-picker-swatch {
|
||||
position: absolute;
|
||||
top:-1px;right:-1px;left:-1px;bottom:-1px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.red-ui-color-picker-cell-none {
|
||||
height: 100%;
|
||||
background-color: #FFF;
|
||||
background-size: 100% 100%;
|
||||
background-position: 0 0, 50% 50%;
|
||||
background-image: linear-gradient(45deg, transparent 45%, $secondary-border-color 45%, $secondary-border-color 55%, transparent 55%, transparent),linear-gradient(-45deg, transparent 45%, $secondary-border-color 45%, $secondary-border-color 55%, transparent 55%, transparent)
|
||||
}
|
||||
.red-ui-search-result-node .red-ui-color-picker-cell-none {
|
||||
border-radius: 4px;
|
||||
background-size: 50% 50%;
|
||||
background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
|
||||
}
|
||||
|
||||
.red-ui-color-picker-opacity-slider {
|
||||
position:relative;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
width: calc(100% - 50px);
|
||||
height: 14px;
|
||||
margin: 6px 3px 8px;
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
background-image:
|
||||
linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 25%),
|
||||
linear-gradient(-45deg, #eee 25%, transparent 25%, transparent 75%, #eee 25%);
|
||||
background-size: 6px 6px;
|
||||
}
|
||||
.red-ui-color-picker-opacity-slider-overlay {
|
||||
position: absolute;
|
||||
top:0;right:0;left:0;bottom:0;
|
||||
background-image:linear-gradient(90deg, transparent 0%, #f00 100%);
|
||||
background-size: 100% 100%;
|
||||
border: 1px solid $primary-border-color;
|
||||
}
|
||||
|
||||
div.red-ui-button-small.red-ui-color-picker-opacity-slider-handle {
|
||||
z-Index: 10;
|
||||
top: -4px;
|
||||
cursor: pointer;
|
||||
min-width: 0;
|
||||
width: 10px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
border: 1px solid $primary-border-color;
|
||||
border-radius: 1px;
|
||||
background: $secondary-background;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.red-ui-icon-picker {
|
||||
select {
|
||||
box-sizing: border-box;
|
||||
|
@@ -71,6 +71,48 @@
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-flow-group {
|
||||
&.red-ui-flow-group-hovered {
|
||||
.red-ui-flow-group-outline-select {
|
||||
stroke-opacity: 0.8 !important;
|
||||
stroke-dasharray: 10 4 !important;
|
||||
}
|
||||
}
|
||||
&.red-ui-flow-group-active-hovered:not(.red-ui-flow-group-hovered) {
|
||||
.red-ui-flow-group-outline-select {
|
||||
stroke: $link-link-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-flow-group-outline {
|
||||
fill: none;
|
||||
stroke: $node-selected-color;
|
||||
stroke-opacity: 0;
|
||||
stroke-width: 12;
|
||||
pointer-events: stroke;
|
||||
}
|
||||
.red-ui-flow-group-outline-select {
|
||||
fill: none;
|
||||
stroke: $node-selected-color;
|
||||
pointer-events: stroke;
|
||||
stroke-opacity: 0;
|
||||
stroke-width: 3;
|
||||
}
|
||||
.red-ui-flow-group-body {
|
||||
pointer-events: none;
|
||||
fill: $group-default-fill;
|
||||
fill-opacity: $group-default-fill-opacity;
|
||||
stroke-width: 2;
|
||||
stroke: $group-default-stroke;
|
||||
stroke-opacity: $group-default-stroke-opacity;
|
||||
}
|
||||
.red-ui-flow-group-label {
|
||||
@include disable-selection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.red-ui-flow-node-unknown {
|
||||
stroke-dasharray:10,4;
|
||||
stroke: $node-border-unknown;
|
||||
@@ -248,6 +290,7 @@ g.red-ui-flow-node-selected {
|
||||
|
||||
.red-ui-flow-link-outline {
|
||||
stroke: $view-background;
|
||||
stroke-opacity: 0.4;
|
||||
stroke-width: 5;
|
||||
cursor: crosshair;
|
||||
fill: none;
|
||||
|
@@ -32,6 +32,9 @@
|
||||
right: 5px;
|
||||
top: 9px;
|
||||
}
|
||||
form.red-ui-searchBox-form {
|
||||
margin: 0;
|
||||
}
|
||||
input.red-ui-searchBox-input {
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
|
@@ -11,6 +11,7 @@
|
||||
var length = str.length;
|
||||
var start = 0;
|
||||
var inString = false;
|
||||
var inRegex = false;
|
||||
var inBox = false;
|
||||
var quoteChar;
|
||||
var list = [];
|
||||
@@ -24,8 +25,13 @@
|
||||
}
|
||||
for (var i=0;i<length;i++) {
|
||||
var c = str[i];
|
||||
if (!inString) {
|
||||
if (c === "'" || c === '"') {
|
||||
if (!inString && !inRegex) {
|
||||
if (c === "/") {
|
||||
inRegex = true;
|
||||
frame = {type:"regex",pos:i};
|
||||
list.push(frame);
|
||||
stack.push(frame);
|
||||
} else if (c === "'" || c === '"') {
|
||||
inString = true;
|
||||
quoteChar = c;
|
||||
frame = {type:"string",pos:i};
|
||||
@@ -37,6 +43,9 @@
|
||||
} else if (c === ",") {
|
||||
frame = {type:",",pos:i};
|
||||
list.push(frame);
|
||||
} else if (c === "&") {
|
||||
frame = {type:"&",pos:i};
|
||||
list.push(frame);
|
||||
} else if (/[\(\[\{]/.test(c)) {
|
||||
frame = {type:"open-block",char:c,pos:i};
|
||||
list.push(frame);
|
||||
@@ -44,7 +53,8 @@
|
||||
} else if (/[\}\)\]]/.test(c)) {
|
||||
var oldFrame = stack.pop();
|
||||
if (matchingBrackets[oldFrame.char] !== c) {
|
||||
//console.log("Stack frame mismatch",c,"at",i,"expected",matchingBrackets[oldFrame.char],"from",oldFrame.pos);
|
||||
// console.log("Stack frame mismatch",c,"at",i,"expected",matchingBrackets[oldFrame.char],"from",oldFrame.pos);
|
||||
// console.log(list);
|
||||
return str;
|
||||
}
|
||||
//console.log("Closing",c,"at",i,"compare",oldFrame.type,oldFrame.pos);
|
||||
@@ -53,19 +63,32 @@
|
||||
list.push(frame);
|
||||
}
|
||||
} else {
|
||||
if (c === quoteChar) {
|
||||
// Next char must be a ]
|
||||
inString = false;
|
||||
stack.pop();
|
||||
if (c === "\\") {
|
||||
// an escaped char - stay in current mode and skip the next char
|
||||
i++;
|
||||
}
|
||||
if (inString) {
|
||||
if (c === quoteChar) {
|
||||
// Next char must be a ]
|
||||
inString = false;
|
||||
var f = stack.pop();
|
||||
f.end = i;
|
||||
}
|
||||
} else if (inRegex) {
|
||||
if (c === "/") {
|
||||
inRegex = false;
|
||||
var f = stack.pop();
|
||||
f.end = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// console.log(stack);
|
||||
// console.log("list",list);
|
||||
|
||||
var result = str;
|
||||
var indent = 0;
|
||||
var offset = 0;
|
||||
var pre,post,indented;
|
||||
var pre,post,indented,hasNewline;
|
||||
var longStack = [];
|
||||
list.forEach(function(f) {
|
||||
if (f.type === ";" || f.type === ",") {
|
||||
@@ -73,29 +96,51 @@
|
||||
pre = result.substring(0,offset+f.pos+1);
|
||||
post = result.substring(offset+f.pos+1);
|
||||
indented = indentLine(post,indent);
|
||||
result = pre+"\n"+indented;
|
||||
offset += indented.length-post.length+1;
|
||||
hasNewline = /\n$/.test(pre);
|
||||
// console.log("A§"+pre+"§\n§"+indented+"§",hasNewline);
|
||||
result = pre+(hasNewline?"":"\n")+indented;
|
||||
offset += indented.length-post.length+(hasNewline?0:1);
|
||||
}
|
||||
} else if (f.type === "&") {
|
||||
pre = result.substring(0,offset+f.pos+1);
|
||||
var lastLineBreak = pre.lastIndexOf("\n");
|
||||
var lineLength = pre.length - lastLineBreak;
|
||||
if (lineLength > 70) {
|
||||
post = result.substring(offset+f.pos+1);
|
||||
if (!/^\n/.test(post)) {
|
||||
indented = indentLine(post,indent);
|
||||
hasNewline = /\n$/.test(pre);
|
||||
result = pre+(hasNewline?"":"\n")+indented;
|
||||
offset += indented.length-post.length+(hasNewline?0:1);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (f.type === "open-block") {
|
||||
if (f.width > 30) {
|
||||
if (f.width > 40) {
|
||||
longStack.push(true);
|
||||
indent += 4;
|
||||
pre = result.substring(0,offset+f.pos+1);
|
||||
post = result.substring(offset+f.pos+1);
|
||||
hasNewline = /\n$/.test(pre);
|
||||
indented = indentLine(post,indent);
|
||||
result = pre+"\n"+indented;
|
||||
offset += indented.length-post.length+1;
|
||||
result = pre+(hasNewline?"":"\n")+indented;
|
||||
offset += indented.length-post.length+(hasNewline?0:1);
|
||||
} else {
|
||||
longStack.push(false);
|
||||
}
|
||||
} else if (f.type === "close-block") {
|
||||
if (f.width > 30) {
|
||||
if (f.width > 40) {
|
||||
indent -= 4;
|
||||
pre = result.substring(0,offset+f.pos);
|
||||
post = result.substring(offset+f.pos);
|
||||
indented = indentLine(post,indent);
|
||||
result = pre+"\n"+indented;
|
||||
offset += indented.length-post.length+1;
|
||||
hasNewline = /\n *$/.test(pre);
|
||||
if (hasNewline) {
|
||||
result = pre + post;
|
||||
} else {
|
||||
result = pre+"\n"+indented;
|
||||
offset += indented.length-post.length+1;
|
||||
}
|
||||
}
|
||||
longStack.pop();
|
||||
}
|
||||
|
@@ -28,6 +28,11 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
}, "identifier");
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "\\/",
|
||||
next: "regex"
|
||||
},
|
||||
{
|
||||
token : "string",
|
||||
regex : "'(?=.)",
|
||||
@@ -46,34 +51,35 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
token : "constant.numeric", // float
|
||||
regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||
},
|
||||
{ token: "keyword",
|
||||
regex: /λ/
|
||||
},
|
||||
{
|
||||
token: "keyword",
|
||||
regex: jsonataFunctions
|
||||
},
|
||||
{
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"
|
||||
},
|
||||
{
|
||||
token : "punctuation.operator",
|
||||
regex : /[.](?![.])/
|
||||
},
|
||||
{
|
||||
token : "keyword.operator",
|
||||
regex : /\|\||<=|>=|\.\.|\*\*|!=|:=|[=<>`!$%&*+\-~\/^]/,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
token : "punctuation.operator",
|
||||
regex : /[?:,;.]/,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]/,
|
||||
{
|
||||
token: "keyword",
|
||||
regex: /λ/
|
||||
},
|
||||
{
|
||||
token: "keyword",
|
||||
regex: jsonataFunctions
|
||||
},
|
||||
{
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"
|
||||
},
|
||||
{
|
||||
token : "punctuation.operator",
|
||||
regex : /[.](?![.])/
|
||||
},
|
||||
{
|
||||
token : "keyword.operator",
|
||||
regex : /\|\||<=|>=|\.\.|\*\*|!=|:=|[=<>`!$%&*+\-~\/^]/,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
token : "punctuation.operator",
|
||||
regex : /[?:,;.]/,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]/,
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
@@ -86,7 +92,8 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
defaultToken: "string"
|
||||
}
|
||||
],
|
||||
@@ -95,9 +102,24 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
defaultToken: "string"
|
||||
}
|
||||
],
|
||||
"regex" : [
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "\\\\/"
|
||||
},
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "/[sxngimy]*",
|
||||
next: "start"
|
||||
},
|
||||
{
|
||||
defaultToken: "string.regexp"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user