mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
feat: Parse newlines in JSON message as row separators. (#6944)
* feat: Parse message newlines as endOfRow dummies. * Fix the multilineinput field test. * Addressing PR feedback. * Addressing PR feedback. * Newline parsing now uses a new custom input. * npm run format * Added input_end_row to block factory. * Addres feedback, fix endrow after external value.
This commit is contained in:
@@ -177,7 +177,8 @@ FactoryUtils.formatJson_ = function(blockType, rootBlock) {
|
||||
|
||||
var input = {type: contentsBlock.type};
|
||||
// Dummy inputs don't have names. Other inputs do.
|
||||
if (contentsBlock.type !== 'input_dummy') {
|
||||
if (contentsBlock.type !== 'input_dummy' &&
|
||||
contentsBlock.type !== 'input_end_row') {
|
||||
input.name = contentsBlock.getFieldValue('INPUTNAME');
|
||||
}
|
||||
var check = JSON.parse(
|
||||
@@ -202,7 +203,7 @@ FactoryUtils.formatJson_ = function(blockType, rootBlock) {
|
||||
if (fields && FactoryUtils.getFieldsJson_(fields).join('').trim() !== '') {
|
||||
var align = lastInput.getFieldValue('ALIGN');
|
||||
if (align !== 'LEFT') {
|
||||
JS.lastDummyAlign0 = align;
|
||||
JS.implicitAlign0 = align;
|
||||
}
|
||||
args.pop();
|
||||
message.pop();
|
||||
@@ -272,13 +273,15 @@ FactoryUtils.formatJavaScript_ = function(blockType, rootBlock, workspace) {
|
||||
// Generate inputs.
|
||||
var TYPES = {'input_value': 'appendValueInput',
|
||||
'input_statement': 'appendStatementInput',
|
||||
'input_dummy': 'appendDummyInput'};
|
||||
'input_dummy': 'appendDummyInput',
|
||||
'input_end_row': 'appendEndRowInput'};
|
||||
var contentsBlock = rootBlock.getInputTargetBlock('INPUTS');
|
||||
while (contentsBlock) {
|
||||
if (!contentsBlock.disabled && !contentsBlock.getInheritedDisabled()) {
|
||||
var name = '';
|
||||
// Dummy inputs don't have names. Other inputs do.
|
||||
if (contentsBlock.type !== 'input_dummy') {
|
||||
if (contentsBlock.type !== 'input_dummy' &&
|
||||
contentsBlock.type !== 'input_end_row') {
|
||||
name =
|
||||
JSON.stringify(contentsBlock.getFieldValue('INPUTNAME'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user