Skip to content

Commit 17df1c7

Browse files
committed
Fixes print margins
1 parent c75c059 commit 17df1c7

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

FSNotes.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4350,7 +4350,7 @@
43504350
CODE_SIGN_IDENTITY = "Apple Development";
43514351
CODE_SIGN_STYLE = Automatic;
43524352
COMBINE_HIDPI_IMAGES = YES;
4353-
CURRENT_PROJECT_VERSION = 446;
4353+
CURRENT_PROJECT_VERSION = 450;
43544354
DEVELOPMENT_TEAM = 866P6MTE92;
43554355
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
43564356
ENABLE_HARDENED_RUNTIME = YES;
@@ -4363,7 +4363,7 @@
43634363
INFOPLIST_FILE = "FSNotes Info (Notarized).plist";
43644364
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
43654365
MACOSX_DEPLOYMENT_TARGET = 10.12;
4366-
MARKETING_VERSION = 4.9.1;
4366+
MARKETING_VERSION = 4.9.2;
43674367
PRODUCT_BUNDLE_IDENTIFIER = co.fluder.FSNotes;
43684368
PRODUCT_NAME = FSNotes;
43694369
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -4385,7 +4385,7 @@
43854385
CODE_SIGN_IDENTITY = "Apple Development";
43864386
CODE_SIGN_STYLE = Automatic;
43874387
COMBINE_HIDPI_IMAGES = YES;
4388-
CURRENT_PROJECT_VERSION = 446;
4388+
CURRENT_PROJECT_VERSION = 450;
43894389
DEPLOYMENT_LOCATION = NO;
43904390
DEVELOPMENT_TEAM = 866P6MTE92;
43914391
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
@@ -4399,7 +4399,7 @@
43994399
INFOPLIST_FILE = "FSNotes Info (Notarized).plist";
44004400
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
44014401
MACOSX_DEPLOYMENT_TARGET = 10.12;
4402-
MARKETING_VERSION = 4.9.1;
4402+
MARKETING_VERSION = 4.9.2;
44034403
ONLY_ACTIVE_ARCH = YES;
44044404
PRODUCT_BUNDLE_IDENTIFIER = co.fluder.FSNotes;
44054405
PRODUCT_NAME = FSNotes;

FSNotes/MPreviewView.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class MPreviewView: WKWebView, WKUIDelegate, WKNavigationDelegate {
421421
return template.replacingOccurrences(of: "DOWN_HTML", with: htmlString)
422422
}
423423

424-
public static func getPreviewStyle(theme: String? = nil) -> String {
424+
public static func getPreviewStyle(theme: String? = nil, fullScreen: Bool = false) -> String {
425425
var css = String()
426426

427427
if let cssURL = UserDefaultsManagement.markdownPreviewCSS {
@@ -452,7 +452,11 @@ class MPreviewView: WKWebView, WKUIDelegate, WKNavigationDelegate {
452452
return "body {font: \(fs)px '\(familyName)'; padding: 10px 10px; } code, pre {font: \(fs)px Courier New; font-weight: bold; } img {display: block; margin: 0 auto;} \(codeStyle) .hljs {background: #f5f5f5;}"
453453
}
454454
#else
455-
let width = ViewController.shared()!.editArea.getWidth()
455+
var width = ViewController.shared()!.editArea.getWidth()
456+
457+
if fullScreen {
458+
width = 0
459+
}
456460

457461
return "body {font: \(UserDefaultsManagement.fontSize)px '\(familyName)', '-apple-system'; margin: 0 \(width + 5)px; } code, pre {font: \(UserDefaultsManagement.codeFontSize)px '\(UserDefaultsManagement.codeFontName)', Courier, monospace, 'Liberation Mono', Menlo; line-height: 30px;} img {display: block; margin: 0 auto;} \(codeStyle) \(css)"
458462
#endif

FSNotes/ViewController+Print.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extension ViewController {
3535
let baseURL = bundle.url(forResource: "index", withExtension: "html")!
3636

3737
let markdownString = note.getPrettifiedContent()
38-
let css = MPreviewView.getPreviewStyle(theme: "atom-one-light") + " .copyCode { display: none; } body { -webkit-text-size-adjust: none; font-size: 1.0em;} pre, code { border: 1px solid #c0c4ce; border-radius: 3px; } pre, pre code { word-wrap: break-word; }";
38+
let css = MPreviewView.getPreviewStyle(theme: "atom-one-light", fullScreen: true) + " .copyCode { display: none; } body { -webkit-text-size-adjust: none; font-size: 1.0em;} pre, code { border: 1px solid #c0c4ce; border-radius: 3px; } pre, pre code { word-wrap: break-word; }";
3939

4040
var template = try! NSString(contentsOf: baseURL, encoding: String.Encoding.utf8.rawValue)
4141
template = template.replacingOccurrences(of: "DOWN_CSS", with: css) as NSString

0 commit comments

Comments
 (0)