From 0000f2a34d274d0785d6d7c6a8021ff38d8000fa Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sat, 18 Jun 2022 00:51:05 +0900 Subject: [PATCH 1/9] Support i18n in context menu --- .../@node-red/editor-client/locales/en-US/editor.json | 6 ++++++ .../@node-red/editor-client/locales/ja/editor.json | 6 ++++++ .../@node-red/editor-client/src/js/ui/contextMenu.js | 8 ++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index 01107d49d..e3028272b 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -1187,5 +1187,11 @@ "missing-config": "__prop__: missing configuration node", "validation-error": "__prop__: validation error: __node__, __id__: __error__" } + }, + "contextMenu": { + "insert": "Insert", + "node": "Node", + "junction": "Junction", + "linkNodes": "Link Nodes" } } diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index 4c918b615..a78fb7d24 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -1188,6 +1188,12 @@ "validation-error": "__prop__: チェックエラー: __node__, __id__: __error__" } }, + "contextMenu": { + "insert": "挿入", + "node": "ノード", + "junction": "分岐点", + "linkNodes": "Linkノード" + }, "action-list": { "toggle-show-tips": "ヒント表示切替", "show-about": "Node-REDの説明を表示", diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js b/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js index 379ed5433..9920789f5 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js @@ -48,10 +48,10 @@ RED.contextMenu = (function() { const menuItems = [ { onselect: 'core:show-action-list', onpostselect: function() {} }, { - label: 'Insert', + label: RED._("contextMenu.insert"), options: [ { - label: 'Node', + label: RED._("contextMenu.node"), onselect: function() { RED.view.showQuickAddDialog({ position: [ options.x - offset.left, options.y - offset.top ], @@ -62,12 +62,12 @@ RED.contextMenu = (function() { } }, { - label: 'Junction', + label: RED._("contextMenu.junction"), onselect: 'core:split-wires-with-junctions', disabled: hasSelection || !hasLinks }, { - label: 'Link Nodes', + label: RED._("contextMenu.linkNodes"), onselect: 'core:split-wire-with-link-nodes', disabled: hasSelection || !hasLinks } From 418b3ee7d68f280e30340032b28df97106a8d87e Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sat, 18 Jun 2022 00:56:34 +0900 Subject: [PATCH 2/9] Fix Japanese translations to be same as others --- .../@node-red/editor-client/locales/ja/editor.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index a78fb7d24..70cb0aa22 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -1308,7 +1308,7 @@ "search": "検索", "search-previous": "前を検索", "search-next": "次を検索", - "show-action-list": "アクション一覧を表示", + "show-action-list": "動作一覧を表示", "confirm-edit-tray": "編集を完了", "cancel-edit-tray": "編集をキャンセル", "show-remote-diff": "リモートとの変更差分を表示", @@ -1330,6 +1330,6 @@ "zoom-out": "ズームアウト", "zoom-reset": "ズームリセット", "toggle-navigator": "ナビゲータ表示切替", - "show-system-info": "システムインフォメーション" + "show-system-info": "システム情報" } } From 3ad95bec3ca553ddd35e48e95aaf171e504d7a97 Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sat, 18 Jun 2022 00:57:30 +0900 Subject: [PATCH 3/9] Add Japanese translation for file nodes --- packages/node_modules/@node-red/nodes/locales/ja/messages.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/node_modules/@node-red/nodes/locales/ja/messages.json b/packages/node_modules/@node-red/nodes/locales/ja/messages.json index c508a3e76..6e16daa6f 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/ja/messages.json @@ -928,6 +928,7 @@ "write": "write file", "read": "read file", "filename": "ファイル名", + "path": "パス", "action": "動作", "addnewline": "メッセージの入力のたびに改行を追加", "createdir": "ディレクトリが存在しない場合は作成", From 75c9353cbddbbeb7203ddc5ebb24dc3fb8b0b0ea Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sun, 19 Jun 2022 01:23:28 +0900 Subject: [PATCH 4/9] Fix keys to insert junction --- .../node_modules/@node-red/editor-client/src/tours/welcome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/tours/welcome.js b/packages/node_modules/@node-red/editor-client/src/tours/welcome.js index 4b6f5f66d..1289e6bee 100644 --- a/packages/node_modules/@node-red/editor-client/src/tours/welcome.js +++ b/packages/node_modules/@node-red/editor-client/src/tours/welcome.js @@ -34,7 +34,7 @@ export default { "en-US": `

To make it easier to route wires around your flows, it is now possible to add junction nodes that give you more control.

-

Junctions can be added to wires by holding the Alt key +

Junctions can be added to wires by holding both the Alt key and the Shift key then click and drag the mouse across the wires.

`, // "ja": `

フローのワイヤーの経路をより制御しやすくするために、分岐点ノードを追加できるようになりました。

//

シフトキーを押しながら、マウスの右ボタンをクリックし、ワイヤーを横切るようにドラッグすることで、分岐点を追加できます。

` From 13885493acbc09d0578894717fff65daaf6e3a61 Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sun, 19 Jun 2022 01:26:48 +0900 Subject: [PATCH 5/9] Update Japanese translations in welcome tour --- .../@node-red/editor-client/src/tours/welcome.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/tours/welcome.js b/packages/node_modules/@node-red/editor-client/src/tours/welcome.js index 1289e6bee..98d83c7e5 100644 --- a/packages/node_modules/@node-red/editor-client/src/tours/welcome.js +++ b/packages/node_modules/@node-red/editor-client/src/tours/welcome.js @@ -9,19 +9,22 @@ export default { }, description: { "en-US": "

This is the final beta release of Node-RED 3.0.

Let's take a moment to discover the new features in this release.

", - // "ja": "

これはNode-RED 3.0の最初のベータリリースです。これには、最終リリースで計画しているほぼ全ての機能が含まれています。

本リリースの新機能を見つけてみましょう。

" + "ja": "

これはNode-RED 3.0の最後のベータリリースです。

本リリースの新機能を見つけてみましょう。

" } }, { title: { - "en-US": "Context Menu" + "en-US": "Context Menu", + "ja": "コンテキストメニュー" }, image: 'images/context-menu.png', description: { "en-US": `

The editor now has its own context menu when you right-click in the workspace.

This makes many of the built-in actions much easier - to access.

` + to access.

`, + "ja": `

ワークスペースで右クリックすると、エディタに独自のコンテキストメニューが表示されるようになりました。

+

これによって多くの組み込み動作を、より簡単に利用できます。

` } }, { @@ -36,8 +39,8 @@ export default { you more control.

Junctions can be added to wires by holding both the Alt key and the Shift key then click and drag the mouse across the wires.

`, - // "ja": `

フローのワイヤーの経路をより制御しやすくするために、分岐点ノードを追加できるようになりました。

- //

シフトキーを押しながら、マウスの右ボタンをクリックし、ワイヤーを横切るようにドラッグすることで、分岐点を追加できます。

` + "ja": `

フローのワイヤーの経路をより制御しやすくするために、分岐点ノードを追加できるようになりました。

+

Altキーとシフトキーを押しながらマウスをクリックし、ワイヤーを横切るようにドラッグすることで、分岐点を追加できます。

` }, }, { From 643541eebdc4394937c0038e5582ff21586a9589 Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sun, 19 Jun 2022 01:37:55 +0900 Subject: [PATCH 6/9] Remove unnecessary spaces --- .../@node-red/nodes/locales/ja/function/10-function.html | 2 +- .../@node-red/nodes/locales/ja/network/10-mqtt.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html index a18e5e8a8..960b755f6 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html @@ -28,7 +28,7 @@

返却/sendの対象は次のとおりです:

  • 単一メッセージオブジェクト - 最初の出力に接続されたノードに渡されます
  • -
  • メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます
  • +
  • メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます

注: 初期化処理の実行はノードの初期化中に行われます。そのため、初期化処理タブにsendを記述した場合に後続ノードでメッセージを受け取れないことがあります。

配列要素が配列の場合には、複数のメッセージを対応する出力に送出します。

diff --git a/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html b/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html index 1b43ea097..435829e1e 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html +++ b/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html @@ -89,7 +89,7 @@
userProperties オブジェクト
MQTTv5: メッセージのユーザプロパティ
messageExpiryInterval 数値
-
MQTTv5: 秒単位のメッセージの有効期限
+
MQTTv5: 秒単位のメッセージの有効期限
topicAlias 数値
MQTTv5: 使用するMQTTトピックエイリアス
From 5e592427e940bd095440bb2ea0bf65636fe30194 Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sun, 19 Jun 2022 01:56:59 +0900 Subject: [PATCH 7/9] Add Japanese translation in action list for junction --- .../@node-red/editor-client/locales/ja/editor.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index 70cb0aa22..ac09a1e87 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -1330,6 +1330,7 @@ "zoom-out": "ズームアウト", "zoom-reset": "ズームリセット", "toggle-navigator": "ナビゲータ表示切替", - "show-system-info": "システム情報" + "show-system-info": "システム情報", + "split-wires-with-junctions": "分岐点によりワイヤーを分割" } } From ad0a08ea0e7dde0684e97545a0fd52c33c7a6316 Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Mon, 20 Jun 2022 00:44:20 +0900 Subject: [PATCH 8/9] Add Japanese translations in action list for project feature --- .../@node-red/editor-client/locales/ja/editor.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index ac09a1e87..2849070bf 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -1331,6 +1331,10 @@ "zoom-reset": "ズームリセット", "toggle-navigator": "ナビゲータ表示切替", "show-system-info": "システム情報", - "split-wires-with-junctions": "分岐点によりワイヤーを分割" + "split-wires-with-junctions": "分岐点によりワイヤーを分割", + "new-project": "新しいプロジェクト", + "open-project": "プロジェクトを開く", + "show-project-settings": "プロジェクト設定を表示", + "show-version-control-tab": "バージョンコントロールタブを表示" } } From 202102ebf7374e6697d9c807457f9bc0c31099cd Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 20 Jun 2022 20:51:31 +0100 Subject: [PATCH 9/9] Fix clicking on node in workspace to hide context menu --- .../editor-client/src/js/ui/contextMenu.js | 3 ++- .../@node-red/editor-client/src/js/ui/view.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js b/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js index 9920789f5..0b388aff3 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js @@ -170,6 +170,7 @@ RED.contextMenu = (function() { } return { - show: show + show: show, + hide: disposeMenu } })() diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 522b86cbc..b55244d0f 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -988,6 +988,7 @@ RED.view = (function() { if (RED.view.DEBUG) { console.warn("canvasMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event }); } + RED.contextMenu.hide(); if (mouse_mode === RED.state.SELECTING_NODE) { d3.event.stopPropagation(); return; @@ -1779,6 +1780,9 @@ RED.view = (function() { } var i; var historyEvent; + if (d3.event.button === 2) { + return + } if (mouse_mode === RED.state.PANNING) { resetMouseVars(); return @@ -2903,6 +2907,7 @@ RED.view = (function() { function portMouseDown(d,portType,portIndex, evt) { if (RED.view.DEBUG) { console.warn("portMouseDown", mouse_mode,d,portType,portIndex); } + RED.contextMenu.hide(); evt = evt || d3.event; if (evt === 1) { return; @@ -3411,6 +3416,7 @@ RED.view = (function() { function nodeMouseDown(d) { if (RED.view.DEBUG) { console.warn("nodeMouseDown", mouse_mode,d); } focusView(); + RED.contextMenu.hide(); if (d3.event.button === 1) { return; } @@ -3793,6 +3799,7 @@ RED.view = (function() { if (RED.view.DEBUG) { console.warn("linkMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event }); } + RED.contextMenu.hide(); if (mouse_mode === RED.state.SELECTING_NODE) { d3.event.stopPropagation(); return; @@ -3852,6 +3859,9 @@ RED.view = (function() { } function groupMouseUp(g) { + if (RED.view.DEBUG) { + console.warn("groupMouseUp", { mouse_mode, event: d3.event }); + } if (dblClickPrimed && mousedown_group == g && clickElapsed > 0 && clickElapsed < dblClickInterval) { mouse_mode = RED.state.DEFAULT; RED.editor.editGroup(g); @@ -3867,6 +3877,10 @@ RED.view = (function() { // return // } + if (RED.view.DEBUG) { + console.warn("groupMouseDown", { mouse_mode, point: mouse, event: d3.event }); + } + RED.contextMenu.hide(); focusView(); if (d3.event.button === 1) { return;