[ Launch: Tributary inlet ] a8ca0fd977797f83f202 by nicohaemhouts
[ Launch: Tributary inlet ] 0d6739453db1a4da22a4 by nicohaemhouts
[ Launch: Updating Area Chart ] 4c667295ffc0d1aff071 by nicohaemhouts[ Launch: Tributary inlet ] 0d6739453db1a4da22a4 by nicohaemhouts
git tag archive/<your-branch> <your-branch> | |
git push --tags | |
git push -d origin <your-branch> | |
git branch -D <your-branch> |
/* Using GeometryReader to find out the width of the parent is problematic when the parent does not have a height and depends on its children to give it height, e.g. VStack, ScrollView, etc GeometryReader takes up all the space it can get but if the parent has no height then GeometryReader will simply not have a height and your view will not render properly. ParentWidthReader uses a widely used workaround using PreferenceKey and a GeometryReader as a background thus bypassing the height problem. | |
*/ | |
import SwiftUI | |
struct ParentWidthReader<Content>: View where Content: View { | |
typealias ContentBuilder = (CGFloat) -> Content | |
@State var width: CGFloat = .infinity | |
let content: ContentBuilder | |
This limits the number of lines of any textarea that has the attribute 'data-limit-rows' set to 'true'. The limit is the 'rows'-attribute of the textarea.
To know how many lines have been entered you have to look at the number of newline characters (\n) in the text. You could do this by splitting text on the newline character, and looking at the length of the resulting array: i.e. myText.split(/\n/g).length; This would work fine in every browser, except for one special case in Internet Explorer 8, whereby the user hits the enter key several times in a row, thus producing empty lines. In this case Internet Explorer 8 excludes all empty values from the resulting array, ie those places where the delimiters appear next to each other. The result is that the usr can enter more lines of text than permitted. This is probably also true for Internet Explorer versions lower than 8, but I didn't check.
To know which key was pressed it's b