edit button in files now detects linebreak based on remote os #7647
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Feb 24, 2026 at 15:12 UTC
575b871978cc7e19e7bf59d6033c6ebafabf9dd6
2 files changed
+17
views/default.handlebars
+8
@@ -11782,6 +11782,14 @@
11782
if (gdownloadFile.tag == 'viewer') {
11783
// View the file in the dialog box
11784
setDialogMode(4, EscapeHtml(gdownloadFile.file), 3, p13editSaveBack, null, gdownloadFile.file);
11785
+ if (isWindowsNode(currentNode)){
11786
+ d4EditLineBreakVal = 0; // Windows (CR LF)
11787
+ } else if (isMacNode(currentNode)) {
11788
+ d4EditLineBreakVal = 2; // Mac (CR)
11789
+ } else {
11790
+ d4EditLineBreakVal = 1; // Linux (LF)
11791
+ }
11792
+ d4ToggleLineBreak(true);
11793
QV('d4EncodingButton', true);
11794
QV('d4LineBreakButton', true);
11795
QS('dialog').width = 'auto';
views/default3.handlebars
+9
@@ -12827,6 +12827,14 @@
12827
setModalContent('xxAddAgent', EscapeHtml(gdownloadFile.file), 4, 'extra-large');
12828
var file = gdownloadFile.file;
12829
showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13editSaveBack(3, file));
12830
+ if (isWindowsNode(currentNode)){
12831
+ d4EditLineBreakVal = 0; // Windows (CR LF)
12832
+ } else if (isMacNode(currentNode)) {
12833
+ d4EditLineBreakVal = 2; // Mac (CR)
12834
+ } else {
12835
+ d4EditLineBreakVal = 1; // Linux (LF)
12836
+ }
12837
+ d4ToggleLineBreak(true);
12838
QV('d4EncodingButton', true);
12839
QV('d4LineBreakButton', true);
12840
if (d4EditEncodingVal == 1) {
@@ -21230,6 +21238,7 @@
21238
function round(value, precision) { var multiplier = Math.pow(10, precision || 0); return Math.round(value * multiplier) / multiplier; }
21239
function safeNewWindow(url, target) { var newWindow = window.open(url, target, 'noopener,noreferrer'); if (newWindow) { newWindow.opener = null; } }
21240
function isWindowsNode(node) { if ((node.mtype != 2) || (node.agent == null) || (node.agent.id == null)) return false; return ([1, 2, 3, 4, 21, 22, 34, 42, 43].indexOf(node.agent.id) >= 0); }
21241
+ function isMacNode(node) { if ((node.mtype != 2) || (node.agent == null) || (node.agent.id == null)) return false; return ([11,16,29].indexOf(node.agent.id) >= 0); }
21242
21243
function downloadFile(link, name, closeDialog) {
21244
var element = document.createElement('iframe');