";
26 |
27 | // Set the base URL if you would like to use relative links, such as to images.
28 | self.baseURL = [NSURL URLWithString:@"http://www.zedsaid.com"];
29 |
30 | // Set the toolbar item color
31 | self.toolbarItemTintColor = [UIColor redColor];
32 |
33 | // Set the toolbar selected color
34 | self.toolbarItemSelectedTintColor = [UIColor blackColor];
35 |
36 | // Set the HTML contents of the editor
37 | [self setHTML:html];
38 |
39 | }
40 |
41 | - (void)didReceiveMemoryWarning
42 | {
43 | [super didReceiveMemoryWarning];
44 | // Dispose of any resources that can be recreated.
45 | }
46 |
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRBrightnessCursor.h:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2011 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #import
29 |
30 | @interface HRBrightnessCursor : UIView
31 |
32 | - (id)initWithPoint:(CGPoint)point;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRColorPickerMacros.h:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2012 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #ifndef HRColorPickerMacros_h
29 | #define HRColorPickerMacros_h
30 |
31 | #if !__has_feature(objc_arc_weak)
32 | #define weak unsafe_unretained
33 | #undef __weak
34 | #define __weak __unsafe_unretained
35 | #endif
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRCgUtil.h:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2011 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #import "HRColorUtil.h"
29 |
30 | // 角丸のパスをセット
31 | void HRSetRoundedRectanglePath(CGContextRef context,const CGRect rect,CGFloat radius);
32 | // かっこいい角丸の四角を描きます。色付き。
33 | void HRDrawSquareColorBatch(CGContextRef context,CGPoint position,HRRGBColor* color,float size);
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/CYRTextStorage.h:
--------------------------------------------------------------------------------
1 | //
2 | // CYRTextStorage.h
3 | //
4 | // Version 0.2.0
5 | //
6 | // Created by Illya Busigin on 01/05/2014.
7 | // Copyright (c) 2014 Cyrillian, Inc.
8 | //
9 | // Distributed under MIT license.
10 | // Get the latest version from here:
11 | //
12 | // https://github.com/illyabusigin/CYRTextView
13 | //
14 | // The MIT License (MIT)
15 | //
16 | // Copyright (c) 2014 Cyrillian, Inc.
17 | //
18 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
19 | // this software and associated documentation files (the "Software"), to deal in
20 | // the Software without restriction, including without limitation the rights to
21 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
22 | // the Software, and to permit persons to whom the Software is furnished to do so,
23 | // subject to the following conditions:
24 | //
25 | // The above copyright notice and this permission notice shall be included in all
26 | // copies or substantial portions of the Software.
27 | //
28 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
30 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
31 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
32 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 |
35 | #import
36 |
37 | @interface CYRTextStorage : NSTextStorage
38 |
39 | @property (nonatomic, strong) NSArray *tokens;
40 | @property (nonatomic, strong) UIFont *defaultFont;
41 |
42 | - (void)update;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor.xcodeproj/project.xcworkspace/xcshareddata/ZSSRichTextEditor.xcscmblueprint:
--------------------------------------------------------------------------------
1 | {
2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "6C2C2B670C50C326F4CDE75C16826EDA0491AEF0",
3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4 |
5 | },
6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7 | "6C2C2B670C50C326F4CDE75C16826EDA0491AEF0" : 0,
8 | "D4901E2DECC4ACCA927A8E9BA33FBB59E4A0AF3D" : 0
9 | },
10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "1D85276D-8013-471B-8035-FD0DD32B9643",
11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12 | "6C2C2B670C50C326F4CDE75C16826EDA0491AEF0" : "ZSSRichTextEditor\/",
13 | "D4901E2DECC4ACCA927A8E9BA33FBB59E4A0AF3D" : ""
14 | },
15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "ZSSRichTextEditor",
16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204,
17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "ZSSRichTextEditor.xcodeproj",
18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19 | {
20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/nnhubbard\/ZSSRichTextEditor.git",
21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "6C2C2B670C50C326F4CDE75C16826EDA0491AEF0"
23 | },
24 | {
25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/bitbucket.org\/zedsaid\/simple-geocaching.git",
26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D4901E2DECC4ACCA927A8E9BA33FBB59E4A0AF3D"
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRColorCursor.h:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2011 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #import
29 | #import "HRColorUtil.h"
30 |
31 | @interface HRColorCursor : UIView{
32 | HRRGBColor _currentColor;
33 | }
34 |
35 |
36 | + (CGSize) cursorSize;
37 | + (float) outlineSize;
38 | + (float) shadowSize;
39 |
40 | - (id)initWithPoint:(CGPoint)point;
41 | - (void)setColorRed:(float)red andGreen:(float)green andBlue:(float)blue;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod spec lint ZSSRichTextEditor.podspec' to ensure this is a
3 | # valid spec and to remove all comments including this before submitting the spec.
4 | #
5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
7 | #
8 |
9 | Pod::Spec.new do |s|
10 |
11 | s.name = "ZSSRichTextEditor"
12 | s.version = "0.5.2.2"
13 | s.summary = "ZSSRichTextEditor is a beautiful Rich Text WYSIWYG Editor for iOS."
14 |
15 | s.description = <<-DESC
16 | `ZSSRichTextEditor` is a beautiful Rich Text `WYSIWYG Editor` for `iOS`. It includes all of the standard editor tools one would expect from a `WYSIWYG` editor as well as an amazing source view with syntax highlighting.
17 | DESC
18 |
19 | s.homepage = "https://github.com/nnhubbard/ZSSRichTextEditor"
20 | s.screenshots = "https://camo.githubusercontent.com/2bcf02776f39cae560c57793adbd5eaf4fff9223/687474703a2f2f662e636c2e6c792f6974656d732f304c3363304e337531343251325330763159306f2f64656d6f312e676966", "https://camo.githubusercontent.com/3f9c01eba9c69d030a69faaa1a2e01a733244627/687474703a2f2f636c2e6c792f696d6167652f3369343134303367323030422f64656d6f2e676966"
21 |
22 | s.license = "MIT"
23 |
24 | s.author = { "Nic Hubbard" => "nic@zedsaid.com" }
25 |
26 | s.platform = :ios, "8.0"
27 |
28 | s.source = { :git => "https://github.com/nnhubbard/ZSSRichTextEditor.git", :tag => "0.5.2.1" }
29 |
30 | s.source_files = "**/*.{h,m}"
31 | s.exclude_files = "**/ZSSDemo*.{h,m}", "**/ZSSAppDelegate*.{h,m}", "**/main.m"
32 | s.resources = "**/ZSS*.png", "**/ZSSRichTextEditor.js", "**/editor.html", "**/jQuery.js", "**/JSBeautifier.js"
33 |
34 | s.frameworks = "CoreGraphics", "CoreText"
35 |
36 | s.requires_arc = true
37 | end
38 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/CYRToken.h:
--------------------------------------------------------------------------------
1 | //
2 | // CYRTextAttribute.h
3 | //
4 | // Version 0.2.0
5 | //
6 | // Created by Illya Busigin on 01/05/2014.
7 | // Copyright (c) 2014 Cyrillian, Inc.
8 | //
9 | // Distributed under MIT license.
10 | // Get the latest version from here:
11 | //
12 | // https://github.com/illyabusigin/CYRTextView
13 | //
14 | // The MIT License (MIT)
15 | //
16 | // Copyright (c) 2014 Cyrillian, Inc.
17 | //
18 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
19 | // this software and associated documentation files (the "Software"), to deal in
20 | // the Software without restriction, including without limitation the rights to
21 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
22 | // the Software, and to permit persons to whom the Software is furnished to do so,
23 | // subject to the following conditions:
24 | //
25 | // The above copyright notice and this permission notice shall be included in all
26 | // copies or substantial portions of the Software.
27 | //
28 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
30 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
31 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
32 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 |
35 | #import
36 |
37 | @interface CYRToken : NSObject
38 |
39 | @property (nonatomic, strong) NSString *name;
40 | @property (nonatomic, strong) NSString *expression;
41 | @property (nonatomic, strong) NSDictionary *attributes;
42 |
43 | + (instancetype)tokenWithName:(NSString *)name expression:(NSString *)expression attributes:(NSDictionary *)attributes;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/editor.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ZSSRichTextEditor
5 |
6 |
7 |
8 |
15 |
16 |
17 |
20 |
21 |
22 |
25 |
26 |
27 |
30 |
31 |
32 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/CYRToken.m:
--------------------------------------------------------------------------------
1 | //
2 | // CYRTextAttribute.m
3 | //
4 | // Version 0.2.0
5 | //
6 | // Created by Illya Busigin on 01/05/2014.
7 | // Copyright (c) 2014 Cyrillian, Inc.
8 | //
9 | // Distributed under MIT license.
10 | // Get the latest version from here:
11 | //
12 | // https://github.com/illyabusigin/CYRTextView
13 | //
14 | // The MIT License (MIT)
15 | //
16 | // Copyright (c) 2014 Cyrillian, Inc.
17 | //
18 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
19 | // this software and associated documentation files (the "Software"), to deal in
20 | // the Software without restriction, including without limitation the rights to
21 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
22 | // the Software, and to permit persons to whom the Software is furnished to do so,
23 | // subject to the following conditions:
24 | //
25 | // The above copyright notice and this permission notice shall be included in all
26 | // copies or substantial portions of the Software.
27 | //
28 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
30 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
31 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
32 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 |
35 | #import "CYRToken.h"
36 |
37 | @implementation CYRToken
38 |
39 | + (instancetype)tokenWithName:(NSString *)name expression:(NSString *)expression attributes:(NSDictionary *)attributes
40 | {
41 | CYRToken *textAttribute = [CYRToken new];
42 |
43 | textAttribute.name = name;
44 | textAttribute.expression = expression;
45 | textAttribute.attributes = attributes;
46 |
47 | return textAttribute;
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/CYRLayoutManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // CYRLayoutManager.h
3 | //
4 | // Version 0.2.0
5 | //
6 | // Created by Illya Busigin on 01/05/2014.
7 | // Copyright (c) 2014 Cyrillian, Inc.
8 | //
9 | // Distributed under MIT license.
10 | // Get the latest version from here:
11 | //
12 | // https://github.com/illyabusigin/CYRTextView
13 | // Original implementation taken from: https://github.com/alldritt/TextKit_LineNumbers
14 | //
15 | // The MIT License (MIT)
16 | //
17 | // Copyright (c) 2014 Cyrillian, Inc.
18 | //
19 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
20 | // this software and associated documentation files (the "Software"), to deal in
21 | // the Software without restriction, including without limitation the rights to
22 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
23 | // the Software, and to permit persons to whom the Software is furnished to do so,
24 | // subject to the following conditions:
25 | //
26 | // The above copyright notice and this permission notice shall be included in all
27 | // copies or substantial portions of the Software.
28 | //
29 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
31 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
32 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
33 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
34 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 |
36 | #import
37 |
38 | @interface CYRLayoutManager : NSLayoutManager
39 |
40 | @property (nonatomic, strong) UIFont *lineNumberFont;
41 | @property (nonatomic, strong) UIColor *lineNumberColor;
42 |
43 | @property (nonatomic, readonly) CGFloat gutterWidth;
44 | @property (nonatomic, assign) NSRange selectedRange;
45 |
46 | - (CGRect)paragraphRectForRange:(NSRange)range;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/ZSSRichTextEditor-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIcons
12 |
13 | CFBundleIcons~ipad
14 |
15 | CFBundleIdentifier
16 | $(PRODUCT_BUNDLE_IDENTIFIER)
17 | CFBundleInfoDictionaryVersion
18 | 6.0
19 | CFBundleName
20 | ${PRODUCT_NAME}
21 | CFBundlePackageType
22 | APPL
23 | CFBundleShortVersionString
24 | 1.0
25 | CFBundleSignature
26 | ????
27 | CFBundleVersion
28 | 1.0
29 | LSRequiresIPhoneOS
30 |
31 | NSMicrophoneUsageDescription
32 | Microphone used in ZSSRichTextEditor
33 | NSPhotoLibraryUsageDescription
34 | Photos used in ZSSRichTextEditor
35 | UILaunchStoryboardName
36 | Launch Screen
37 | UIRequiredDeviceCapabilities
38 |
39 | armv7
40 |
41 | UISupportedInterfaceOrientations
42 |
43 | UIInterfaceOrientationPortrait
44 | UIInterfaceOrientationLandscapeLeft
45 | UIInterfaceOrientationLandscapeRight
46 | UIInterfaceOrientationPortraitUpsideDown
47 |
48 | UISupportedInterfaceOrientations~ipad
49 |
50 | UIInterfaceOrientationPortrait
51 | UIInterfaceOrientationPortraitUpsideDown
52 | UIInterfaceOrientationLandscapeLeft
53 | UIInterfaceOrientationLandscapeRight
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/CYRTextView.h:
--------------------------------------------------------------------------------
1 | //
2 | // CYRTextView.h
3 | //
4 | // Version 0.2.0
5 | //
6 | // Created by Illya Busigin on 01/05/2014.
7 | // Copyright (c) 2014 Cyrillian, Inc.
8 | // Copyright (c) 2013 Dominik Hauser
9 | // Copyright (c) 2013 Sam Rijs
10 | //
11 | // Distributed under MIT license.
12 | // Get the latest version from here:
13 | //
14 | // https://github.com/illyabusigin/CYRTextView
15 | // Gestures sourced from: https://github.com/srijs/NLTextView
16 | //
17 | // The MIT License (MIT)
18 | //
19 | // Copyright (c) 2014 Cyrillian, Inc.
20 | //
21 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
22 | // this software and associated documentation files (the "Software"), to deal in
23 | // the Software without restriction, including without limitation the rights to
24 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
25 | // the Software, and to permit persons to whom the Software is furnished to do so,
26 | // subject to the following conditions:
27 | //
28 | // The above copyright notice and this permission notice shall be included in all
29 | // copies or substantial portions of the Software.
30 | //
31 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
33 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
34 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
35 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 |
38 | #import
39 | #import "CYRToken.h"
40 |
41 | @interface CYRTextView : UITextView
42 |
43 | @property (nonatomic, strong) NSArray *tokens;
44 | @property (nonatomic, strong) UIPanGestureRecognizer *singleFingerPanRecognizer;
45 | @property (nonatomic, strong) UIPanGestureRecognizer *doubleFingerPanRecognizer;
46 |
47 | @property UIColor *gutterBackgroundColor;
48 | @property UIColor *gutterLineColor;
49 |
50 | @property (nonatomic, assign) BOOL lineCursorEnabled;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor.xcodeproj/project.xcworkspace/xcshareddata/ZSSRichTextEditor.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 1D85276D-8013-471B-8035-FD0DD32B9643
9 | IDESourceControlProjectName
10 | ZSSRichTextEditor
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 6C2C2B670C50C326F4CDE75C16826EDA0491AEF0
14 | https://github.com/nnhubbard/ZSSRichTextEditor.git
15 | D4901E2DECC4ACCA927A8E9BA33FBB59E4A0AF3D
16 | https://bitbucket.org/zedsaid/simple-geocaching.git
17 |
18 | IDESourceControlProjectPath
19 | ZSSRichTextEditor.xcodeproj
20 | IDESourceControlProjectRelativeInstallPathDictionary
21 |
22 | 6C2C2B670C50C326F4CDE75C16826EDA0491AEF0
23 | ../..
24 | D4901E2DECC4ACCA927A8E9BA33FBB59E4A0AF3D
25 | ../../..
26 |
27 | IDESourceControlProjectURL
28 | https://github.com/nnhubbard/ZSSRichTextEditor.git
29 | IDESourceControlProjectVersion
30 | 111
31 | IDESourceControlProjectWCCIdentifier
32 | 6C2C2B670C50C326F4CDE75C16826EDA0491AEF0
33 | IDESourceControlProjectWCConfigurations
34 |
35 |
36 | IDESourceControlRepositoryExtensionIdentifierKey
37 | public.vcs.git
38 | IDESourceControlWCCIdentifierKey
39 | D4901E2DECC4ACCA927A8E9BA33FBB59E4A0AF3D
40 | IDESourceControlWCCName
41 |
42 |
43 |
44 | IDESourceControlRepositoryExtensionIdentifierKey
45 | public.vcs.git
46 | IDESourceControlWCCIdentifierKey
47 | 6C2C2B670C50C326F4CDE75C16826EDA0491AEF0
48 | IDESourceControlWCCName
49 | ZSSRichTextEditor
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Classes/ZSSCustomButtonsViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZSSCustomButtonsViewController.m
3 | // ZSSRichTextEditor
4 | //
5 | // Created by Nicholas Hubbard on 8/14/14.
6 | // Copyright (c) 2014 Zed Said Studio. All rights reserved.
7 | //
8 |
9 | #import "ZSSCustomButtonsViewController.h"
10 | #import "ZSSBarButtonItem.h"
11 |
12 | @interface ZSSCustomButtonsViewController ()
13 |
14 | @end
15 |
16 | @implementation ZSSCustomButtonsViewController
17 |
18 |
19 | - (void)viewDidLoad
20 | {
21 | [super viewDidLoad];
22 |
23 |
24 | self.title = @"Custom Buttons";
25 |
26 | // HTML Content to set in the editor
27 | NSString *html = @"
This editor is using custom buttons.
";
28 |
29 | // Set the HTML contents of the editor
30 | [self setHTML:html];
31 |
32 | // Don't allow editor toolbar buttons (you can if you want)
33 | self.enabledToolbarItems = @[ZSSRichTextEditorToolbarNone];
34 |
35 | // Create the custom buttons
36 | UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 50, 28.0f)];
37 | [myButton setTitle:@"Test" forState:UIControlStateNormal];
38 | [myButton addTarget:self
39 | action:@selector(didTapCustomToolbarButton:)
40 | forControlEvents:UIControlEventTouchUpInside];
41 | [self addCustomToolbarItemWithButton:myButton];
42 |
43 | // Custom image button
44 | ZSSBarButtonItem *item = [[ZSSBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ZSSinsertkeyword.png"] style:UIBarButtonItemStylePlain target:self action:@selector(didTapCustomToolbarButton:)];
45 | [self addCustomToolbarItem:item];
46 |
47 | }
48 |
49 |
50 | - (void)didTapCustomToolbarButton:(UIButton *)button {
51 |
52 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Custom Button!"
53 | message:nil
54 | delegate:self
55 | cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
56 | otherButtonTitles:nil];
57 | [alertView show];
58 |
59 | }
60 |
61 |
62 | - (void)didReceiveMemoryWarning
63 | {
64 | [super didReceiveMemoryWarning];
65 | // Dispose of any resources that can be recreated.
66 | }
67 |
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Classes/ZSSDemoPickerViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZSSDemoPickerViewController.m
3 | // ZSSRichTextEditor
4 | //
5 | // Created by Nicholas Hubbard on 1/30/14.
6 | // Copyright (c) 2014 Zed Said Studio. All rights reserved.
7 | //
8 |
9 | #import "ZSSDemoPickerViewController.h"
10 |
11 |
12 | @interface ZSSDemoPickerViewController ()
13 | @property (nonatomic, strong) UITextField *textField;
14 | @end
15 |
16 | @implementation ZSSDemoPickerViewController
17 |
18 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
19 | {
20 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
21 | if (self) {
22 | // Custom initialization
23 | }
24 | return self;
25 | }
26 |
27 | - (void)viewDidLoad
28 | {
29 | [super viewDidLoad];
30 | // Do any additional setup after loading the view.
31 |
32 | self.title = @"Picker";
33 | self.view.backgroundColor = [UIColor whiteColor];
34 | UIBarButtonItem *save = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveURL)];
35 | self.navigationItem.rightBarButtonItem = save;
36 |
37 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)];
38 |
39 | self.textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 20, self.view.frame.size.width - 40, 40)];
40 | self.textField.text = !self.isInsertImagePicker ? @"http://www.apple.com" : @"http://fineprintnyc.com/images/blog/history-of-apple-logo/apple-logo-2.jpg";
41 | self.textField.layer.borderColor = [UIColor grayColor].CGColor;
42 | self.textField.layer.borderWidth = 0.5f;
43 | self.textField.clearButtonMode = UITextFieldViewModeAlways;
44 | [self.view addSubview:self.textField];
45 |
46 | }
47 |
48 | - (void)cancel {
49 | [self dismissViewControllerAnimated:YES completion:nil];
50 | }
51 |
52 | - (void)saveURL {
53 |
54 | [self dismissViewControllerAnimated:YES completion:nil];
55 |
56 | ZSSDemoViewController *vc = self.demoView;
57 | if (!self.isInsertImagePicker) {
58 | [vc showInsertLinkDialogWithLink:self.textField.text title:nil];
59 | } else {
60 | [vc showInsertImageDialogWithLink:self.textField.text alt:nil];
61 | }
62 |
63 | }
64 |
65 | - (void)didReceiveMemoryWarning
66 | {
67 | [super didReceiveMemoryWarning];
68 | // Dispose of any resources that can be recreated.
69 | }
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Classes/ZSSAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZSSAppDelegate.m
3 | // ZSSRichTextEditor
4 | //
5 | // Created by Nicholas Hubbard on 11/28/13.
6 | // Copyright (c) 2013 Zed Said Studio. All rights reserved.
7 | //
8 |
9 | #import "ZSSAppDelegate.h"
10 |
11 | @implementation ZSSAppDelegate
12 |
13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14 | {
15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
16 | // Override point for customization after application launch.
17 | self.mainViewController = [[ZSSDemoList alloc] init];
18 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:self.mainViewController];
19 | nav.navigationBar.translucent = NO;
20 | self.window.rootViewController = nav;
21 | self.window.backgroundColor = [UIColor whiteColor];
22 | [self.window makeKeyAndVisible];
23 | return YES;
24 | }
25 |
26 | - (void)applicationWillResignActive:(UIApplication *)application
27 | {
28 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
29 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
30 | }
31 |
32 | - (void)applicationDidEnterBackground:(UIApplication *)application
33 | {
34 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
35 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
36 | }
37 |
38 | - (void)applicationWillEnterForeground:(UIApplication *)application
39 | {
40 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
41 | }
42 |
43 | - (void)applicationDidBecomeActive:(UIApplication *)application
44 | {
45 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
46 | }
47 |
48 | - (void)applicationWillTerminate:(UIApplication *)application
49 | {
50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-Notification@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-Notification@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-Small@2x.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-Small@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-Small-40@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-Small-40@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-60@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-60@3x.png",
49 | "scale" : "3x"
50 | },
51 | {
52 | "size" : "20x20",
53 | "idiom" : "ipad",
54 | "filename" : "Icon-Notification.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-Notification@2x.png",
61 | "scale" : "2x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-Small.png",
67 | "scale" : "1x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-Small@2x.png",
73 | "scale" : "2x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-Small-40.png",
79 | "scale" : "1x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-Small-40@2x.png",
85 | "scale" : "2x"
86 | },
87 | {
88 | "size" : "76x76",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-76.png",
91 | "scale" : "1x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-76@2x.png",
97 | "scale" : "2x"
98 | },
99 | {
100 | "size" : "83.5x83.5",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-83.5@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "1024x1024",
107 | "idiom" : "ios-marketing",
108 | "filename" : "icon.png",
109 | "scale" : "1x"
110 | }
111 | ],
112 | "info" : {
113 | "version" : 1,
114 | "author" : "xcode"
115 | }
116 | }
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRColorUtil.h:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2011 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #import
29 |
30 | /////////////////////////////////////////////////////////////////////////////
31 | //
32 | // 0.0f~1.0fの値をとるRGBの構造体です
33 | //
34 | /////////////////////////////////////////////////////////////////////////////
35 |
36 | typedef struct{
37 | float r;
38 | float g;
39 | float b;
40 | } HRRGBColor;
41 |
42 | /////////////////////////////////////////////////////////////////////////////
43 | //
44 | // 0.0f~1.0fの値をとるHSVの構造体です
45 | //
46 | /////////////////////////////////////////////////////////////////////////////
47 |
48 | typedef struct{
49 | float h;
50 | float s;
51 | float v;
52 | } HRHSVColor;
53 |
54 | // 値のチェックしてません。数値として入れさせるなら自前でチェックして下さい。
55 |
56 | /////////////////////////////////////////////////////////////////////////////
57 | //
58 | // 変換用の関数
59 | //
60 | /////////////////////////////////////////////////////////////////////////////
61 |
62 | void HSVColorFromRGBColor(const HRRGBColor*,HRHSVColor*);
63 | void RGBColorFromHSVColor(const HRHSVColor*,HRRGBColor*);
64 | void RGBColorFromUIColor(const UIColor*,HRRGBColor*);
65 |
66 | // 16進数のカラーコードを取得 (例:#ffffff)
67 | // NSString* hexColorStr = [NSString stringWithFormat:@"#%06x",HexColorFromUIColor([UIColor redColor])]; で文字列に変換されます
68 | int HexColorFromRGBColor(const HRRGBColor*);
69 | int HexColorFromUIColor(const UIColor*);
70 |
71 |
72 | // 同値チェック
73 | bool HRHSVColorEqualToColor(const HRHSVColor*,const HRHSVColor*);
74 |
75 |
76 | // 0.0f~1.0fに納まるxとy、彩度の下限、輝度からHSVを求める
77 | void HSVColorAt(HRHSVColor* hsv,float x,float y,float saturationLowerLimit,float brightness);
78 |
79 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRColorPickerViewController.h:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2011 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #import
29 | #import "HRColorPickerMacros.h"
30 |
31 | @class HRColorPickerView;
32 |
33 | @protocol HRColorPickerViewControllerDelegate
34 | - (void)setSelectedColor:(UIColor*)color tag:(int)tag;
35 | @end
36 |
37 | #define HRColorPickerDelegate HRColorPickerViewControllerDelegate
38 | // Delegateの名前変えました。すみません。
39 |
40 | typedef enum {
41 | HCPCSaveStyleSaveAlways,
42 | HCPCSaveStyleSaveAndCancel
43 | } HCPCSaveStyle;
44 |
45 | @interface HRColorPickerViewController : UIViewController {
46 | id __weak delegate;
47 | HRColorPickerView* colorPickerView;
48 |
49 | UIColor *_color;
50 | BOOL _fullColor;
51 | HCPCSaveStyle _saveStyle;
52 |
53 | }
54 |
55 | @property (nonatomic) int tag;
56 |
57 | + (HRColorPickerViewController *)colorPickerViewControllerWithColor:(UIColor *)color;
58 | + (HRColorPickerViewController *)cancelableColorPickerViewControllerWithColor:(UIColor *)color;
59 | + (HRColorPickerViewController *)fullColorPickerViewControllerWithColor:(UIColor *)color;
60 | + (HRColorPickerViewController *)cancelableFullColorPickerViewControllerWithColor:(UIColor *)color;
61 |
62 | /** Initialize controller with selected color.
63 | * @param defaultColor selected color
64 | * @param fullColor If YES, browseable full color. If NO color was limited.
65 | * @param saveStyle If it's HCPCSaveStyleSaveAlways, save color when self is closing. If it's HCPCSaveStyleSaveAndCancel, shows Cancel and Save button.
66 | */
67 | - (id)initWithColor:(UIColor*)defaultColor fullColor:(BOOL)fullColor saveStyle:(HCPCSaveStyle)saveStyle;
68 |
69 | /** @deprecated use -save: instead of this . */
70 | - (void)saveColor:(id)sender;
71 |
72 | - (void)save;
73 | - (void)save:(id)sender;
74 | - (void)cancel:(id)sender;
75 |
76 |
77 | @property (weak) id delegate;
78 |
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRColorCursor.m:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2011 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #import "HRColorCursor.h"
29 | #import "HRCgUtil.h"
30 |
31 | @implementation HRColorCursor
32 |
33 | + (CGSize) cursorSize
34 | {
35 | return CGSizeMake(30.0, 30.0f);
36 | }
37 |
38 | + (float) outlineSize
39 | {
40 | return 4.0f;
41 | }
42 |
43 | + (float) shadowSize
44 | {
45 | return 2.0f;
46 | }
47 |
48 |
49 | - (id)initWithPoint:(CGPoint)point
50 | {
51 | CGSize size = [HRColorCursor cursorSize];
52 | CGRect frame = CGRectMake(point.x, point.y, size.width, size.height);
53 | self = [super initWithFrame:frame];
54 | if (self) {
55 | [self setBackgroundColor:[UIColor clearColor]];
56 | [self setUserInteractionEnabled:FALSE];
57 | _currentColor.r = _currentColor.g = _currentColor.b = 1.0f;
58 | }
59 | return self;
60 | }
61 |
62 | - (void)setColorRed:(float)red andGreen:(float)green andBlue:(float)blue{
63 | _currentColor.r = red;
64 | _currentColor.g = green;
65 | _currentColor.b = blue;
66 | [self setNeedsDisplay];
67 | }
68 |
69 | - (void)drawRect:(CGRect)rect
70 | {
71 | CGContextRef context = UIGraphicsGetCurrentContext();
72 | float outlineSize = [HRColorCursor outlineSize];
73 | CGSize cursorSize = [HRColorCursor cursorSize];
74 | float shadowSize = [HRColorCursor shadowSize];
75 |
76 | CGContextSaveGState(context);
77 | HRSetRoundedRectanglePath(context, CGRectMake(shadowSize, shadowSize, cursorSize.width - shadowSize*2.0f, cursorSize.height - shadowSize*2.0f), 2.0f);
78 | [[UIColor whiteColor] set];
79 | CGContextSetShadow(context, CGSizeMake(0.0f, 1.0f), shadowSize);
80 | CGContextDrawPath(context, kCGPathFill);
81 | CGContextRestoreGState(context);
82 |
83 |
84 | [[UIColor colorWithRed:_currentColor.r green:_currentColor.g blue:_currentColor.b alpha:1.0f] set];
85 | CGContextFillRect(context, CGRectMake(outlineSize + shadowSize, outlineSize + shadowSize, cursorSize.width - (outlineSize + shadowSize)*2.0f, cursorSize.height - (outlineSize + shadowSize)*2.0f));
86 | }
87 |
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Launch Screen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Classes/ZSSDemoViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZSSDemoViewController.m
3 | // ZSSRichTextEditor
4 | //
5 | // Created by Nicholas Hubbard on 11/29/13.
6 | // Copyright (c) 2013 Zed Said Studio. All rights reserved.
7 | //
8 |
9 | #import "ZSSDemoViewController.h"
10 | #import "ZSSDemoPickerViewController.h"
11 |
12 |
13 | #import "DemoModalViewController.h"
14 |
15 |
16 | @interface ZSSDemoViewController ()
17 |
18 | @end
19 |
20 | @implementation ZSSDemoViewController
21 |
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 |
26 | self.title = @"Standard";
27 |
28 | //Set Custom CSS
29 | NSString *customCSS = @"";
30 | [self setCSS:customCSS];
31 |
32 | self.alwaysShowToolbar = YES;
33 | self.receiveEditorDidChangeEvents = NO;
34 |
35 | // Export HTML
36 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Export" style:UIBarButtonItemStylePlain target:self action:@selector(exportHTML)];
37 |
38 | // HTML Content to set in the editor
39 | NSString *html = @""
40 | "
";
41 |
42 | // Set the base URL if you would like to use relative links, such as to images.
43 | self.baseURL = [NSURL URLWithString:@"http://www.zedsaid.com"];
44 | self.shouldShowKeyboard = NO;
45 | // Set the HTML contents of the editor
46 | [self setPlaceholder:@"This is a placeholder that will show when there is no content(html)"];
47 |
48 | [self setHTML:html];
49 |
50 | }
51 |
52 |
53 | - (void)showInsertURLAlternatePicker {
54 |
55 | [self dismissAlertView];
56 |
57 | ZSSDemoPickerViewController *picker = [[ZSSDemoPickerViewController alloc] init];
58 | picker.demoView = self;
59 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:picker];
60 | nav.navigationBar.translucent = NO;
61 | [self presentViewController:nav animated:YES completion:nil];
62 |
63 | }
64 |
65 |
66 | - (void)showInsertImageAlternatePicker {
67 |
68 | [self dismissAlertView];
69 |
70 | ZSSDemoPickerViewController *picker = [[ZSSDemoPickerViewController alloc] init];
71 | picker.demoView = self;
72 | picker.isInsertImagePicker = YES;
73 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:picker];
74 | nav.navigationBar.translucent = NO;
75 | [self presentViewController:nav animated:YES completion:nil];
76 |
77 | }
78 |
79 |
80 | - (void)exportHTML {
81 | [self getHTML:^(NSString *result, NSError * _Nullable error) {
82 | NSLog(@"%@", result);
83 | }];
84 | }
85 |
86 | - (void)editorDidChangeWithText:(NSString *)text andHTML:(NSString *)html {
87 |
88 | NSLog(@"Text Has Changed: %@", text);
89 |
90 | NSLog(@"HTML Has Changed: %@", html);
91 |
92 | }
93 |
94 | - (void)hashtagRecognizedWithWord:(NSString *)word {
95 |
96 | NSLog(@"Hashtag has been recognized: %@", word);
97 |
98 | }
99 |
100 | - (void)mentionRecognizedWithWord:(NSString *)word {
101 |
102 | NSLog(@"Mention has been recognized: %@", word);
103 |
104 | }
105 |
106 | - (void)didReceiveMemoryWarning
107 | {
108 | [super didReceiveMemoryWarning];
109 | // Dispose of any resources that can be recreated.
110 | }
111 |
112 | @end
113 |
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Source/Third Party/HRCgUtil.m:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 2011 Ryota Hayashi
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | *
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | *
25 | * $FreeBSD$
26 | */
27 |
28 | #import "HRCgUtil.h"
29 |
30 | void HRSetRoundedRectanglePath(CGContextRef context,const CGRect rect,CGFloat radius){
31 | CGFloat lx = CGRectGetMinX(rect);
32 | CGFloat cx = CGRectGetMidX(rect);
33 | CGFloat rx = CGRectGetMaxX(rect);
34 | CGFloat by = CGRectGetMinY(rect);
35 | CGFloat cy = CGRectGetMidY(rect);
36 | CGFloat ty = CGRectGetMaxY(rect);
37 |
38 | CGContextMoveToPoint(context, lx, cy);
39 | CGContextAddArcToPoint(context, lx, by, cx, by, radius);
40 | CGContextAddArcToPoint(context, rx, by, rx, cy, radius);
41 | CGContextAddArcToPoint(context, rx, ty, cx, ty, radius);
42 | CGContextAddArcToPoint(context, lx, ty, lx, cy, radius);
43 | CGContextClosePath(context);
44 | }
45 |
46 | void HRDrawSquareColorBatch(CGContextRef context,CGPoint position,HRRGBColor* color,float size){
47 | float cx = position.x;
48 | float cy = position.y;
49 |
50 | float rRize = size;
51 | float backRSize = rRize + 3.0f;
52 | float shadowRSize = backRSize + 3.0f;
53 |
54 | CGRect rectEllipse = CGRectMake(cx - rRize, cy - rRize, rRize*2, rRize*2);
55 | CGRect rectBackEllipse = CGRectMake(cx - backRSize, cy - backRSize, backRSize*2, backRSize*2);
56 | CGRect rectShadowEllipse = CGRectMake(cx - shadowRSize, cy - shadowRSize, shadowRSize*2, shadowRSize*2);
57 |
58 | CGContextSaveGState(context);
59 | HRSetRoundedRectanglePath(context, rectBackEllipse,8.0f);
60 | CGContextClip(context);
61 | HRSetRoundedRectanglePath(context, rectShadowEllipse,8.0f);
62 | CGContextSetLineWidth(context, 5.5f);
63 | [[UIColor whiteColor] set];
64 | CGContextSetShadowWithColor(context, CGSizeMake(0.0f, 1.0f), 4.0f, [UIColor colorWithWhite:0.0f alpha:0.2f].CGColor);
65 | CGContextDrawPath(context, kCGPathStroke);
66 | CGContextRestoreGState(context);
67 |
68 | CGContextSaveGState(context);
69 | CGContextSetRGBFillColor(context, color->r, color->g, color->b, 1.0f);
70 | CGContextSetShadowWithColor(context, CGSizeMake(0.0f, 0.5f), 0.5f, [UIColor colorWithWhite:0.0f alpha:0.2f].CGColor);
71 | HRSetRoundedRectanglePath(context, rectEllipse,5.0f);
72 | CGContextDrawPath(context, kCGPathFill);
73 | CGContextRestoreGState(context);
74 | }
--------------------------------------------------------------------------------
/ZSSRichTextEditor/Classes/ZSSLargeViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZSSLargeViewController.m
3 | // ZSSRichTextEditor
4 | //
5 | // Created by Nicholas Hubbard on 8/13/14.
6 | // Copyright (c) 2014 Zed Said Studio. All rights reserved.
7 | //
8 |
9 | #import "ZSSLargeViewController.h"
10 |
11 | @interface ZSSLargeViewController ()
12 |
13 | @end
14 |
15 | @implementation ZSSLargeViewController
16 |
17 |
18 | - (void)viewDidLoad
19 | {
20 | [super viewDidLoad];
21 |
22 | self.title = @"Large";
23 |
24 | self.alwaysShowToolbar = YES;
25 |
26 | // HTML Content to set in the editor
27 | NSString *html = @"
Large Editor
"
28 | "
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam at enim at nibh pulvinar sagittis eu non lacus. Quisque suscipit tempor urna vel pretium. Curabitur id enim auctor, cursus elit ac, porttitor sem. Ut suscipit purus odio, vitae sollicitudin sapien placerat in. Duis adipiscing urna id viverra tincidunt. Duis sit amet adipiscing justo, vitae facilisis ipsum. Vivamus scelerisque justo ut libero dictum, id tempor ipsum tempus. Nam nec dui dapibus, tristique dolor et, sollicitudin enim. Nullam sagittis arcu tortor, mollis porta mi laoreet ac. Proin lobortis bibendum urna, in ultrices dolor hendrerit quis. Morbi felis quam, luctus nec suscipit porttitor, lacinia vitae velit. Nulla ultricies pellentesque porta. Suspendisse suscipit sagittis metus non rhoncus.
"
29 | "
Phasellus adipiscing justo ipsum, eget feugiat dui elementum id. Pellentesque eu dolor eu arcu bibendum sollicitudin. Aenean ac dolor non lectus laoreet semper at vel est. Curabitur sit amet odio laoreet turpis mattis suscipit at sed lacus. Nunc tincidunt ipsum nulla, ac blandit leo lobortis eu. Curabitur mauris mauris, vestibulum at urna sit amet, condimentum venenatis ante. Nullam a risus nisi. Donec sit amet imperdiet mi.
"
30 | "
Sed in lorem luctus lorem feugiat viverra facilisis ut velit. Maecenas convallis leo purus. Integer vestibulum mi eget quam auctor vehicula. Phasellus id eleifend nunc. Mauris pretium blandit orci a accumsan. Aliquam hendrerit sit amet ligula et dignissim. Pellentesque feugiat scelerisque sapien nec scelerisque. Nunc ac placerat lectus. Proin sed dolor in leo congue facilisis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque arcu velit, tempus sit amet elit at, aliquet iaculis dolor. Nam eget sollicitudin libero. Mauris dignissim, risus sit amet tempor tempus, risus mauris faucibus massa, sed elementum mauris turpis et arcu.
"
31 | "
Aliquam mattis libero arcu, a ultrices risus mattis sed. Vivamus facilisis consectetur ipsum at volutpat. Duis eget lorem sodales, congue libero dapibus, dignissim odio. Vivamus hendrerit ante at metus feugiat fringilla. Quisque imperdiet magna in tristique sagittis. Nulla neque turpis, tempus a leo eget, auctor interdum dui. In porta mi non libero lacinia pulvinar. Nunc a augue eget est malesuada eleifend a et orci. Aenean in tempus purus. Curabitur auctor viverra massa. Proin in justo pretium lacus pretium ullamcorper. Morbi elementum leo nibh, quis sodales nibh scelerisque ut.
"
32 | "
Mauris sed consequat augue. Aliquam accumsan erat lacus, consequat volutpat augue imperdiet vitae. Sed tempus dui quis faucibus tempor. Aliquam ultricies in turpis et vehicula. Suspendisse potenti. Duis iaculis rhoncus enim sed tempus. Cras non metus sed erat accumsan gravida vitae in lacus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Integer vel cursus ligula, a auctor lacus. In rhoncus massa varius sagittis ultrices. Donec aliquam, nisl sit amet hendrerit pretium, lorem quam mollis purus, ac interdum elit mi et neque. Etiam porta rutrum lacinia. Nullam nec vestibulum ligula. Nam nec ipsum odio. Lorem ipsum dolor sit amet, consectetur adipiscing elit.