@@ -53,6 +53,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
5353 indentStyle : CodeEditor . IndentStyle ,
5454 autoPairs : [ String : String ] ,
5555 inset : CGSize ,
56+ allowsUndo : Bool ,
5657 autoscroll : Bool )
5758 {
5859 self . source = source
@@ -64,6 +65,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
6465 self . indentStyle = indentStyle
6566 self . autoPairs = autoPairs
6667 self . inset = inset
68+ self . allowsUndo = allowsUndo
6769 self . autoscroll = autoscroll
6870 }
6971
@@ -75,6 +77,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
7577 private let flags : CodeEditor . Flags
7678 private let indentStyle : CodeEditor . IndentStyle
7779 private let inset : CGSize
80+ private let allowsUndo : Bool
7881 private let autoPairs : [ String : String ]
7982 private let autoscroll : Bool
8083
@@ -235,7 +238,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
235238 let textView = UXCodeTextView ( )
236239 textView. autoresizingMask = [ . width, . height ]
237240 textView. delegate = context. coordinator
238- textView. allowsUndo = true
241+ textView. allowsUndo = allowsUndo
239242 textView. textContainerInset = inset
240243
241244 let scrollView = NSScrollView ( )
@@ -319,6 +322,7 @@ struct UXCodeTextViewRepresentable_Previews: PreviewProvider {
319322 indentStyle : . system,
320323 autoPairs : [ : ] ,
321324 inset : . init( width: 8 , height: 8 ) ,
325+ allowsUndo : true ,
322326 autoscroll : false )
323327 . frame ( width: 200 , height: 100 )
324328
@@ -331,6 +335,7 @@ struct UXCodeTextViewRepresentable_Previews: PreviewProvider {
331335 indentStyle : . system,
332336 autoPairs : [ : ] ,
333337 inset : . init( width: 8 , height: 8 ) ,
338+ allowsUndo : true ,
334339 autoscroll : false )
335340 . frame ( width: 200 , height: 100 )
336341
@@ -349,6 +354,7 @@ struct UXCodeTextViewRepresentable_Previews: PreviewProvider {
349354 indentStyle : . system,
350355 autoPairs : [ : ] ,
351356 inset : . init( width: 8 , height: 8 ) ,
357+ allowsUndo : true ,
352358 autoscroll : false
353359 )
354360 . frame ( width: 540 , height: 200 )
0 commit comments