Simple put, I'd like to vertical align the Checkbox from Material UI.
Try changing alignItems style property of FormControlLabel.
This worked for me:
<FormControlLabel
sx={{ alignItems: 'flex-start' }}
control={
<Checkbox
sx={{
marginTop: -1,
}}
/>
}
/>
This took me a while to track down, but this solution for another forum was the one that worked:
<FormControl fullWidth>
<FormControlLabel
style={{display:'table'}}
control={<div style={{display:'table-cell'}}><CustomizedCheckbox/></div>}
label={<div className="disclaimerandnotes">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</div>}
/>
</FormControl>
Since MUI is based on Flexbox, you can simply override its alignItems property:
<FormControlLabel
control={
<div style={{ alignSelf: 'start' }}>
<Checkbox checked={isChecked()} onChange={check.toggle} />
</div>
}
label="Toggle Checkbox"
/>
You can probably make it even leaner by overriding the checkbox component style.
Related
description
I want to link some titles in Markdown. It works good except when I link a German word like "Systemüberwachung" or "ähnliches". I think this is not working because of the "ü" and "ä".
I already tried to link like this: #system-berwachung, #systemberwachung, #systemuberwachung and many others.
But how can I link word with the characters ä ö and ü?
I use VSCode 1.63.2 and Markdown Preview
test code snippet
- [Systemüberwachung](#systemüberwachung)
- [something](#something)
- [ähnliches](#ähnliches)
## Systemüberwachung
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet
## something
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet
## ähnliches
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet
.
It looks like Visual Studio Code takes the title string, lower-cases it, and URL-encodes it. That makes sense, as these are essentially URL fragments.
Heading
Link fragment
Systemüberwachung
system%C3%BCberwachung
ähnliches
%C3%A4hnliches
You can reproduce this in JavaScript, e.g. like so:
encodeURIComponent("Systemüberwachung".toLowerCase())
//=> "system%C3%BCberwachung"
(There's probably more to this logic, e.g. to replace punctuation, but for the purposes of this question I think this is the relevant part.)
Unfortunately, these links don't seem to actually work, even though they are linking to the correct elements. I'm not sure why that is.
Background
Since Visual Studio Code is built on Webview, I discovered this by opening up its dev tools with the "Developer: Open Webview Developer Tools" command via the command palette.
Then I used the "select an element" feature (also available via Ctrl+Shift+C when the dev tools are open and focused):
Clicking on the rendered title brings up the underlying HTML in the devtools panel:
Which then reveals the generated ID:
<h1 data-line="0" class="code-line" id="system%C3%BCberwachung">Systemüberwachung</h1>
We can verify that we are using the correct ID in the devtools console, e.g.
document.getElementById("system%C3%BCberwachung")
# German umlaut characters
## Table of Content
- [Systemüberwachung](#systemuberwachung)
- [something](#something)
- [ähnliches](#ahnliches)
<div id="systemuberwachung">
<h2>Systemüberwachung</h2>
</div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
## something
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
<div id="ahnliches">
<h2>ähnliches<h2>
</div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
.
I have created a Popover that looks as follows:
How to set the Popover window smaller?
if you just wanna show an information to the user use an sap.m.MessageBox.
sap.m.MessageBox.information(
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat"
);
If you need sap.m.Popover go for sth. like this:
contentWidth="{= ${device>/system/phone} ? '100%' : '20%'}"
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Popover title="Popover" placement="Bottom" contentWidth="{= ${device>/system/phone} ? '100%' : '20%'}" class="sapUiContentPadding">
<Text
text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."/>
</Popover>
</core:FragmentDefinition>
What is the recommended replacement for the SAP UI5 Control "TextView", which is deprecated since 1.38?
I found this outdated Control while working through the SAPUI5 Walkthrough tutorial and following a "related information" link that is still using on the old TextView Control.
There is no replacement info given in the API Reference of TextView:
https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.commons.TextView
You can use sap.m.Text instead. Api.
View example:
<mvc:View
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<VBox class="sapUiSmallMargin">
<Text text="Lorem ipsum dolor st amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat" />
</VBox>
</mvc:View>
See what I mean by going here: https://codemirror.net/demo/indentwrap.html
Paste in something large enough to trigger scrollbar, you may need to remove existing text first:
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
The cursor will appear not in the correct location until you type or move it. Has anyone seen this or know of a solution or workaround?
Edit:
If I put listeners for pasting and do a refresh() and scrollIntoView() it seems to work most of the time... but doesnt always seem effective if I'm posting between content for some reason.
Although it has the small side affect of always having a 17px padding on the right side... adding padding-right: 17px !important to .CodeMirror-sizer seems to fix the problem.
The problem seems to have been caused by when the scrollbar appears, it makes the scrollbar visible, and also adds the 17px right padding to the sizer (so the text doesn't run under the scrollbar). The cursor appears to be positioned based on if that padding was never added until the user types or does something that would move the cursor. By always having that right padding, we don't run into this problem.
The small side affect doesn't matter much to me so I'm happy with this workaround, however... if someone else finds a better solution I'd like to see it.
I often run across a situation where I've constructed an Element or Form and wish to crop the view down to a given area (i.e. for scrolling within a smaller rectangle) though I haven't been able to find any methods for this within their respective modules.
Is it possible to do this using Elm's std library? If not, are there any 3rd-party libraries capable of doing this?
Otherwise, perhaps there is a better way of achieving this?
Any help or suggestions appreciated!
No scollbars (using the std library)
I can't find a way to crop but have scrollbars with the current Graphics.Element. What is possible is to crop without having scrollbars, either through a container that's smaller than it's contents or by resizing an element with size. I think the container way is more robust, as resizing an image will actually warp the image.
Here's an example:
import Graphics.Element exposing (..)
import Text
string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est."
main : Element
main =
let element =
leftAligned (Text.fromString string)
|> container 400 300 topLeft
in container 205 200 topLeft element
Scrollbars (via "3rd party" library)
If you want scrollbars, you'll probably need at least a little bit of html from elm-html. Note that the author of the library is also the author of Elm, so it's not quite 3rd party :P . You can keep it minimal by using conversions to html and from html and wrapping it in a div with style attributes that define the smaller size and the right overflow property. As long as that div has a known size, it should be easy to convert back to an Element.