/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
this.state = { // The device form type can be 3 states: "add", "edit", or "". // "add" - The form shown is adding a new device. // "edit" - The form shown is editing an existing custom device. // "" - The form is closed.
deviceFormType: "", // The device being edited from the edit form.
editingDevice: null,
}; for (const type of this.props.devices.types) { for (const device of this.props.devices[type]) { this.state[device.name] = device.displayed;
}
}
// We want to remove the original device name from state after editing, so create a // new state setting the old key to null and the new one to true. this.setState({
[this.state.editingDevice.name]: null,
[newDevice.name]: true,
});
}
renderAddForm() { // If a device is currently selected, fold its attributes into a single object for use // as the starting values of the form. If no device is selected, use the values for // the current window. const { deviceAdderViewportTemplate: viewportTemplate } = this.props; const deviceTemplate = this.props.deviceAdderViewportTemplate; if (viewportTemplate.device) { const device = this.props.devices[viewportTemplate.deviceType].find(d => { return d.name == viewportTemplate.device;
});
Object.assign(deviceTemplate, {
pixelRatio: device.pixelRatio,
userAgent: device.userAgent,
touch: device.touch,
name: getFormatStr("responsive.customDeviceNameFromBase", device.name),
});
} else {
Object.assign(deviceTemplate, {
pixelRatio: window.devicePixelRatio,
userAgent: navigator.userAgent,
touch: false,
name: getStr("responsive.customDeviceName"),
});
}
renderDevices() { const sortedDevices = {}; for (const type of this.props.devices.types) {
sortedDevices[type] = this.props.devices[type].sort((a, b) =>
a.name.localeCompare(b.name)
);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.2Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.