Text displays as monospace, smart quotes no longer active

parent e91399db
......@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
A7B059DE2108D8E3005FFC0D /* NSTextView+PlainText.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B059DD2108D8E3005FFC0D /* NSTextView+PlainText.swift */; };
A7EC4AEE1D9952B1001EB7D1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EC4AED1D9952B1001EB7D1 /* AppDelegate.swift */; };
A7EC4AF01D9952B1001EB7D1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EC4AEF1D9952B1001EB7D1 /* ViewController.swift */; };
A7EC4AF21D9952B1001EB7D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A7EC4AF11D9952B1001EB7D1 /* Assets.xcassets */; };
......@@ -41,6 +42,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
A7B059DD2108D8E3005FFC0D /* NSTextView+PlainText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSTextView+PlainText.swift"; sourceTree = "<group>"; };
A7EC4AEA1D9952B1001EB7D1 /* BetterTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BetterTester.app; sourceTree = BUILT_PRODUCTS_DIR; };
A7EC4AED1D9952B1001EB7D1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
A7EC4AEF1D9952B1001EB7D1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
......@@ -102,6 +104,7 @@
A7EC4AF11D9952B1001EB7D1 /* Assets.xcassets */,
A7EC4AF31D9952B1001EB7D1 /* Main.storyboard */,
A7EC4AF61D9952B1001EB7D1 /* Info.plist */,
A7B059DD2108D8E3005FFC0D /* NSTextView+PlainText.swift */,
);
path = BetterTester;
sourceTree = "<group>";
......@@ -256,6 +259,7 @@
buildActionMask = 2147483647;
files = (
A7EC4AF01D9952B1001EB7D1 /* ViewController.swift in Sources */,
A7B059DE2108D8E3005FFC0D /* NSTextView+PlainText.swift in Sources */,
A7EC4AEE1D9952B1001EB7D1 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -330,7 +334,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
......@@ -373,7 +377,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A319" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<capability name="stacking Non-gravity area distributions on NSStackView" minToolsVersion="7.0" minSystemVersion="10.11"/>
</dependencies>
<scenes>
......@@ -669,6 +670,9 @@
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="P5E-hq-skA"/>
</connections>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
......@@ -695,7 +699,7 @@
<rect key="frame" x="1" y="1" width="712" height="447"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView importsGraphics="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="14g-jm-H7Z">
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" findStyle="panel" allowsUndo="YES" allowsNonContiguousLayout="YES" id="14g-jm-H7Z">
<rect key="frame" x="0.0" y="0.0" width="712" height="447"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......@@ -709,11 +713,11 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="PMC-t5-zTa">
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="PMC-t5-zTa">
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="PX3-uc-COx">
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="PX3-uc-COx">
<rect key="frame" x="697" y="1" width="16" height="447"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
......
//
// NSTextView+PlainText.swift
// GetStarted_NH_MacOS
//
// Created by Brian Clear on 12/07/2018.
// Copyright © 2018 City of London Consulting Limited. All rights reserved.
//
import Foundation
import AppKit
extension NSTextView {
/*
Usage:
@IBOutlet var textViewJSONPushBody: NSTextView!
viewDidLoad(){
//JSON editor
self.textViewJSONPushBody.makePlainText(withFontSize: 12.0)
//Log view - smaller
//defaults to sys font - small size
self.textViewConsole.makePlainText()
self.textViewConsole.makePlainText(withFontSize: 10.0)
}
*/
func makePlainText(withFontSize
fontSize: CGFloat = NSFont.smallSystemFontSize())
{
//---------------------------------------------------------
//FONT - monospaced
//---------------------------------------------------------
//small font
//self.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize)
//medium font
self.font = NSFont.userFixedPitchFont(ofSize: NSFont.systemFontSize())
//---------------------------------------------------------
self.isRulerVisible = false
self.isFieldEditor = false
self.isRichText = false
//---------------------------------------------------------
//smart quotes mess up json
//https://stackoverflow.com/questions/19801601/nstextview-with-smart-quotes-disabled-still-replaces-quotes
self.isAutomaticQuoteSubstitutionEnabled = false
//---------------------------------------------------------
self.isAutomaticLinkDetectionEnabled = false
self.isContinuousSpellCheckingEnabled = false
self.isGrammarCheckingEnabled = false
self.isAutomaticDashSubstitutionEnabled = false
self.isAutomaticDataDetectionEnabled = false
self.isAutomaticSpellingCorrectionEnabled = false
self.isAutomaticTextReplacementEnabled = false
self.isIncrementalSearchingEnabled = false
self.isAutomaticTextCompletionEnabled = false
//---------------------------------------------------------
//see also
//https://stackoverflow.com/questions/19801601/nstextview-with-smart-quotes-disabled-still-replaces-quotes
//self.enabledTextCheckingTypes =
//---------------------------------------------------------
}
}
......@@ -19,6 +19,10 @@ class ViewController: NSViewController, NSTextViewDelegate
// MARK: - Internal
override func viewDidLoad() {
textView.makePlainText(withFontSize: 12.0)
}
/// Saves the passed block rules to the shared container.
func saveBlockRulesToSharedContainer(rules:Data)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment