1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Better toggling between raw/string views of buffers

This commit is contained in:
Nick O'Leary 2016-11-02 16:17:56 +00:00
parent 74b6d9dff9
commit 3489fe0cf4
2 changed files with 11 additions and 6 deletions

View File

@ -288,13 +288,14 @@ RED.debug = (function() {
if (originalLength > 0) {
$('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header);
var arrayRows = $('<div class="debug-message-array-rows"></div>').appendTo(element);
element.addClass('debug-message-buffer-raw');
makeExpandable(header,function() {
if (!key) {
headerHead = $('<span class="debug-message-type-meta debug-message-object-type-header"></span>').html(typeHint||(type+'['+originalLength+']')).appendTo(header);
}
if (type === 'buffer') {
var stringRow = $('<div class="debug-message-object-entry collapsed"></div>').hide().appendTo(element);
var sr = $('<div class="debug-message-array-rows"></div>').appendTo(stringRow);
var stringRow = $('<div class="debug-message-string-rows"></div>').appendTo(element);
var sr = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(stringRow);
var stringEncoding = "";
try {
stringEncoding = String.fromCharCode.apply(null, new Uint16Array(data))
@ -306,12 +307,10 @@ RED.debug = (function() {
$('<a href="#"></a>').addClass('selected').html('raw').appendTo(bufferOpts).click(function(e) {
if ($(this).text() === 'raw') {
$(this).text('string');
arrayRows.hide();
stringRow.show();
element.addClass('debug-message-buffer-string').removeClass('debug-message-buffer-raw');
} else {
$(this).text('raw');
arrayRows.show();
stringRow.hide();
element.removeClass('debug-message-buffer-string').addClass('debug-message-buffer-raw');
}
e.preventDefault();
e.stopPropagation();

View File

@ -163,3 +163,9 @@
border: 1px solid #999;
background: #f3f3f3;
}
.debug-message-buffer-raw > .debug-message-string-rows {
display: none;
}
.debug-message-buffer-string > .debug-message-array-rows {
display: none;
}