-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Textarea Field, Multiline Block (from acbart) #2663
Textarea Field, Multiline Block (from acbart) #2663
Conversation
…ibutes, fix JS multiline text generator
…ascript blocks with parentheses
… blockpy-edu-develop-2
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only "I consent." in this pull request. Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
I consent. |
Looks like there's a couple unit tests still failing with this. Do you have it under handled or does this need to be tackled again? |
If you want to take a look, that would be awesome. The failing unit test does seem to be directly related to the XML. |
Just as an update, I've tracked it down to the XML unit test changing slightly. There's now an XML element without a closing tag. @NeilFraser added it a few weeks ago: https://github.com/google/blockly/blame/develop/tests/jsunit/xml_test.js#L38 Assuming this is desirable, I think I'll need to update the regex to handle this case. Which... doesn't look super fun, but I'll try to take a stab at it. |
I believe the new regex should be: var regexp = /(<[^/][^<]*>[^<]*[^/])\n([^<]*<\/)/; In Line 299 in 3f66116
But I am not entirely certain. It does pass the tests and my experimentation with a regex tool. |
We haven't forgotten this--Neil will take a look at the regex when he gets a chance. |
Oh great. This is the exact issue raised in the most-cited Stack Overflow question of all time: But accepting our fate that we can't solve the general case, we can still solve the Blockly-specific one. The following example shows that your proposed regexp isn't correct:
The most straight-forward regexp I can come up with is:
This would be easier if browsers supported lookbehind assertions, but so far only Chrome supports them. Definitely also add another example to the comment:
|
…etter vertical alignment, and made it worked in Edge and IE.
An update on this. I have gone through and updated the field so that:
This is ready for a final review. There's a CLA Issue where it's unable to verify concent. @rachel-fenichel do you have any idea how to resolve? |
CLA is fine--he consented above: #2663 (comment) |
htmlInput.style.borderRadius = borderRadius; | ||
var padding = Blockly.Field.DEFAULT_TEXT_OFFSET * scale; | ||
htmlInput.style.paddingLeft = padding + 'px'; | ||
htmlInput.style.width = 'calc(100% - ' + padding + 'px)'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know you could do this.
Also, the round trip jsunit tests are failing which I'm looking into. |
Fixed jsunit tests by using Neil's regex instead. |
Field structure lgtm. |
This is a version of #2584 from @acbart, with two changes:
Blockly.Xml.utils
, which we renamed while the other PR was open@acbart I made a new PR because I didn't want to push to your develop branch.
The basics
The details
See #2584 for details and discussion.