RawData.js (909B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { 8 Component, 9 } = require("resource://devtools/client/shared/vendor/react.mjs"); 10 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs"); 11 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 12 13 /** 14 * Shows raw data of a message. 15 */ 16 class RawData extends Component { 17 static get propTypes() { 18 return { 19 payload: PropTypes.string.isRequired, 20 }; 21 } 22 23 render() { 24 const { payload } = this.props; 25 return dom.textarea({ 26 className: "message-rawData-payload", 27 rows: payload.split(/\n/g).length + 1, 28 value: payload, 29 readOnly: true, 30 }); 31 } 32 } 33 34 module.exports = RawData;