From 5009ead53fe1594133a3898046586559d276c2e6 Mon Sep 17 00:00:00 2001 From: rk-helper <62377740+rk-helper@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:33:20 +0400 Subject: [PATCH 1/6] Centered texting --- freewrite.xcodeproj/project.pbxproj | 8 +++--- freewrite/ContentView.swift | 38 +++++++++++++++++++---------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/freewrite.xcodeproj/project.pbxproj b/freewrite.xcodeproj/project.pbxproj index f89a773..e2600be 100644 --- a/freewrite.xcodeproj/project.pbxproj +++ b/freewrite.xcodeproj/project.pbxproj @@ -402,7 +402,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = 2UDAY4J48G; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -419,7 +419,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 18.1; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 13.5; + MACOSX_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = app.humansongs.freewrite; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -444,7 +444,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = 2UDAY4J48G; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -461,7 +461,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 18.1; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 13.5; + MACOSX_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = app.humansongs.freewrite; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/freewrite/ContentView.swift b/freewrite/ContentView.swift index cc4113a..b9b927f 100644 --- a/freewrite/ContentView.swift +++ b/freewrite/ContentView.swift @@ -381,6 +381,8 @@ struct ContentView: View { return colorScheme == .light ? Color.primary : Color.white } + @State private var viewHeight: CGFloat = 0 + var body: some View { let buttonBackground = colorScheme == .light ? Color.white : Color.black let navHeight: CGFloat = 68 @@ -393,17 +395,18 @@ struct ContentView: View { Color(colorScheme == .light ? .white : .black) .ignoresSafeArea() - TextEditor(text: Binding( - get: { text }, - set: { newValue in - // Ensure the text always starts with two newlines - if !newValue.hasPrefix("\n\n") { - text = "\n\n" + newValue.trimmingCharacters(in: .newlines) - } else { - text = newValue + + TextEditor(text: Binding( + get: { text }, + set: { newValue in + // Ensure the text always starts with two newlines + if !newValue.hasPrefix("\n\n") { + text = "\n\n" + newValue.trimmingCharacters(in: .newlines) + } else { + text = newValue + } } - } - )) + )) .background(Color(colorScheme == .light ? .white : .black)) .font(.custom(selectedFont, size: fontSize)) .foregroundColor(colorScheme == .light ? Color(red: 0.20, green: 0.20, blue: 0.20) : Color(red: 0.9, green: 0.9, blue: 0.9)) @@ -411,6 +414,8 @@ struct ContentView: View { .scrollIndicators(.never) .lineSpacing(lineHeight) .frame(maxWidth: 650) + + .id("\(selectedFont)-\(fontSize)-\(colorScheme)") .padding(.bottom, bottomNavOpacity > 0 ? navHeight : 0) .ignoresSafeArea() @@ -425,13 +430,20 @@ struct ContentView: View { Text(placeholderText) .font(.custom(selectedFont, size: fontSize)) .foregroundColor(colorScheme == .light ? .gray.opacity(0.5) : .gray.opacity(0.6)) - // .padding(.top, 8) - // .padding(.leading, 8) + // .padding(.top, 8) + // .padding(.leading, 8) .allowsHitTesting(false) .offset(x: 5, y: placeholderOffset) } }, alignment: .topLeading ) + .onGeometryChange(for: CGFloat.self) { proxy in + proxy.size.height + } action: { height in + viewHeight = height + } + .contentMargins(.bottom, viewHeight / 2) + VStack { Spacer() @@ -1305,4 +1317,4 @@ extension NSView { #Preview { ContentView() -} \ No newline at end of file +} From 57ba4af5be325347048eb884364cb63ba3606025 Mon Sep 17 00:00:00 2001 From: thorfinn Date: Fri, 25 Apr 2025 05:47:09 -0700 Subject: [PATCH 2/6] changes --- freewrite.xcodeproj/project.pbxproj | 8 ++++---- freewrite/ContentView.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/freewrite.xcodeproj/project.pbxproj b/freewrite.xcodeproj/project.pbxproj index e2600be..f89a773 100644 --- a/freewrite.xcodeproj/project.pbxproj +++ b/freewrite.xcodeproj/project.pbxproj @@ -402,7 +402,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 2UDAY4J48G; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -419,7 +419,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 18.1; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 14.0; + MACOSX_DEPLOYMENT_TARGET = 13.5; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = app.humansongs.freewrite; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -444,7 +444,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 2UDAY4J48G; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -461,7 +461,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 18.1; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 14.0; + MACOSX_DEPLOYMENT_TARGET = 13.5; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = app.humansongs.freewrite; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/freewrite/ContentView.swift b/freewrite/ContentView.swift index b9b927f..2616d91 100644 --- a/freewrite/ContentView.swift +++ b/freewrite/ContentView.swift @@ -442,7 +442,7 @@ struct ContentView: View { } action: { height in viewHeight = height } - .contentMargins(.bottom, viewHeight / 2) + .contentMargins(.bottom, viewHeight / 4) VStack { From 601365c8529bd448ce72af3f4fb30077a52cce3a Mon Sep 17 00:00:00 2001 From: rk-helper <62377740+rk-helper@users.noreply.github.com> Date: Fri, 25 Apr 2025 17:57:16 +0400 Subject: [PATCH 3/6] initial project file --- freewrite.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freewrite.xcodeproj/project.pbxproj b/freewrite.xcodeproj/project.pbxproj index e2600be..b4bede5 100644 --- a/freewrite.xcodeproj/project.pbxproj +++ b/freewrite.xcodeproj/project.pbxproj @@ -402,7 +402,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 2UDAY4J48G; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -444,7 +444,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 2UDAY4J48G; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; From d6fc8fee028a91e550b072e9fe645c244b80098d Mon Sep 17 00:00:00 2001 From: Vishruth Date: Fri, 25 Jul 2025 17:03:18 +0800 Subject: [PATCH 4/6] feat: add strict mode --- freewrite/ContentView.swift | 41 ++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/freewrite/ContentView.swift b/freewrite/ContentView.swift index 1ed74db..384854e 100644 --- a/freewrite/ContentView.swift +++ b/freewrite/ContentView.swift @@ -85,6 +85,8 @@ struct ContentView: View { @State private var colorScheme: ColorScheme = .light // Add state for color scheme @State private var isHoveringThemeToggle = false // Add state for theme toggle hover @State private var didCopyPrompt: Bool = false // Add state for copy prompt feedback + @State private var strictMode = false // Add state for strict mode + @State private var isHoveringStrictMode = false // Add state for strict mode hover let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() let entryHeight: CGFloat = 40 @@ -157,6 +159,19 @@ struct ContentView: View { _colorScheme = State(initialValue: savedScheme == "dark" ? .dark : .light) } + // Setup key event monitor for strict mode + private func setupStrictModeKeyMonitor() { + NSEvent.addLocalMonitorForEvents(matching: .keyDown) { event in + // Check if strict mode is enabled and the key is backspace (keyCode 51) + if strictMode && event.keyCode == 51 { + // Block the backspace key by returning nil + return nil + } + // Allow all other key events to pass through + return event + } + } + // Modify getDocumentsDirectory to use cached value private func getDocumentsDirectory() -> URL { return documentsDirectory @@ -385,7 +400,6 @@ struct ContentView: View { @State private var viewHeight: CGFloat = 0 var body: some View { - let buttonBackground = colorScheme == .light ? Color.white : Color.black let navHeight: CGFloat = 68 let textColor = colorScheme == .light ? Color.gray : Color.gray.opacity(0.8) let textHoverColor = colorScheme == .light ? Color.black : Color.white @@ -815,6 +829,30 @@ struct ContentView: View { } } + Text("•") + .foregroundColor(.gray) + + // Strict mode toggle button + Button(action: { + strictMode.toggle() + }) { + Image(systemName: strictMode ? "lock.fill" : "lock.open") + .foregroundColor(strictMode ? + (isHoveringStrictMode ? textHoverColor : .red) : + (isHoveringStrictMode ? textHoverColor : textColor)) + } + .buttonStyle(.plain) + .onHover { hovering in + isHoveringStrictMode = hovering + isHoveringBottomNav = hovering + if hovering { + NSCursor.pointingHand.push() + } else { + NSCursor.pop() + } + } + .help(strictMode ? "Strict mode enabled - backspace disabled" : "Enable strict mode") + Text("•") .foregroundColor(.gray) @@ -1039,6 +1077,7 @@ struct ContentView: View { .onAppear { showingSidebar = false // Hide sidebar by default loadExistingEntries() + setupStrictModeKeyMonitor() } .onChange(of: text) { _ in // Save current entry when text changes From d4773a8593dfe7ac8d50cc3a142d2db403eecb07 Mon Sep 17 00:00:00 2001 From: Vishruth-N Date: Fri, 25 Jul 2025 17:40:05 +0800 Subject: [PATCH 5/6] update defult.md with strict-mode --- freewrite/default.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freewrite/default.md b/freewrite/default.md index 767e6ce..f713c7c 100644 --- a/freewrite/default.md +++ b/freewrite/default.md @@ -35,7 +35,7 @@ That’s it. Some basic rules: -- Again, no backspaces +- Again, no backspaces (click on the padlock to toggle strict mode and really enforce this) - No fixing spelling - Little 5–10s breaks are fine, but try to not stop typing - No need to stay on the topic you started with — let your mind wander From 3fb100b779a1eb3c879b718f5f14e449e70a6b2e Mon Sep 17 00:00:00 2001 From: Vishruth-N Date: Sat, 26 Jul 2025 20:12:55 +0800 Subject: [PATCH 6/6] update gitignore --- .gitignore | 3 +++ freewrite.xcodeproj/project.pbxproj | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b89a18f..d6b010b 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,6 @@ playground.xcworkspace # Icon? Icon? + +# Project +project.pbxproj diff --git a/freewrite.xcodeproj/project.pbxproj b/freewrite.xcodeproj/project.pbxproj index b4bede5..e64e6d4 100644 --- a/freewrite.xcodeproj/project.pbxproj +++ b/freewrite.xcodeproj/project.pbxproj @@ -398,11 +398,11 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = freewrite/freewrite.entitlements; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = 2UDAY4J48G; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -440,11 +440,11 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = freewrite/freewrite.entitlements; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"freewrite/Preview Content\""; - DEVELOPMENT_TEAM = 2UDAY4J48G; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES;