Skip to content

Commit 8fea833

Browse files
committed
Git Clone: Add automatic pasting
If you have 'valid' git url in your clipboard when opening the clone view, it now automatically pastes it to the textfield
1 parent 5cfdd7a commit 8fea833

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CodeEdit/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
</dict>
4646
</array>
4747
<key>GitHash</key>
48-
<string>Placeholder</string>
48+
<string>c27acdfadd10e91ab5ff3ccdf4deb73b1e0d5fd2</string>
4949
</dict>
5050
</plist>

CodeEditModules/Modules/GitClone/src/GitCloneView.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public struct GitCloneView: View {
100100
.padding(.top, 20)
101101
.padding(.horizontal, 20)
102102
.padding(.bottom, 16)
103+
.onAppear {
104+
self.checkClipboard(textFieldText: &repoUrlStr)
105+
}
103106
}
104107
}
105108
}
@@ -151,4 +154,11 @@ extension GitCloneView {
151154
}
152155
return false
153156
}
157+
func checkClipboard(textFieldText: inout String) {
158+
if let url = NSPasteboard.general.pasteboardItems?.first?.string(forType: .string) {
159+
if isValid(url: url) {
160+
textFieldText = url
161+
}
162+
}
163+
}
154164
}

0 commit comments

Comments
 (0)