Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
be809a8b
Commit
be809a8b
authored
May 25, 2020
by
刘俊宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成 富文本编辑器ing
parent
f40eb3e8
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
938 additions
and
38 deletions
+938
-38
GeliBusinessPlatform.xcodeproj/project.pbxproj
GeliBusinessPlatform.xcodeproj/project.pbxproj
+30
-0
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
...ata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/BaseView/BaseViewController.swift
GeliBusinessPlatform/BaseView/BaseViewController.swift
+1
-2
GeliBusinessPlatform/Other/LMNote/Hpple/TFHpple.h
GeliBusinessPlatform/Other/LMNote/Hpple/TFHpple.h
+57
-0
GeliBusinessPlatform/Other/LMNote/Hpple/TFHpple.m
GeliBusinessPlatform/Other/LMNote/Hpple/TFHpple.m
+141
-0
GeliBusinessPlatform/Other/LMNote/Hpple/TFHppleElement.h
GeliBusinessPlatform/Other/LMNote/Hpple/TFHppleElement.h
+106
-0
GeliBusinessPlatform/Other/LMNote/Hpple/TFHppleElement.m
GeliBusinessPlatform/Other/LMNote/Hpple/TFHppleElement.m
+254
-0
GeliBusinessPlatform/Other/LMNote/Hpple/XPathQuery.h
GeliBusinessPlatform/Other/LMNote/Hpple/XPathQuery.h
+14
-0
GeliBusinessPlatform/Other/LMNote/Hpple/XPathQuery.m
GeliBusinessPlatform/Other/LMNote/Hpple/XPathQuery.m
+202
-0
GeliBusinessPlatform/Other/LMNote/LMNoteViewController.h
GeliBusinessPlatform/Other/LMNote/LMNoteViewController.h
+9
-0
GeliBusinessPlatform/Other/LMNote/LMNoteViewController.m
GeliBusinessPlatform/Other/LMNote/LMNoteViewController.m
+85
-30
GeliBusinessPlatform/Other/LMNote/OtherViews/LMNImageView.m
GeliBusinessPlatform/Other/LMNote/OtherViews/LMNImageView.m
+16
-2
GeliBusinessPlatform/Other/LMNote/OtherViews/TestClass.swift
GeliBusinessPlatform/Other/LMNote/OtherViews/TestClass.swift
+3
-0
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextStorage+Export.m
...essPlatform/Other/LMNote/TextView/LMNTextStorage+Export.m
+2
-0
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextView.h
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextView.h
+2
-0
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextView.m
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextView.m
+3
-1
GeliBusinessPlatform/SceneDelegate.swift
GeliBusinessPlatform/SceneDelegate.swift
+1
-1
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
...orm/ViewController/商品详情/ProductDetailViewController.swift
+12
-2
No files found.
GeliBusinessPlatform.xcodeproj/project.pbxproj
View file @
be809a8b
...
...
@@ -453,6 +453,10 @@
F969BF08244EC38000C79953
/* GoodsCollectionViewCell.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F969BF06244EC38000C79953
/* GoodsCollectionViewCell.xib */
;
};
F969BF1E244EE67900C79953
/* GoodsManageListVC.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F969BF1C244EE67900C79953
/* GoodsManageListVC.swift */
;
};
F969BF1F244EE67900C79953
/* GoodsManageListVC.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F969BF1D244EE67900C79953
/* GoodsManageListVC.xib */
;
};
F96A581D24790D9A0070A057
/* libxml2.2.tbd in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F96A581C24790D9A0070A057
/* libxml2.2.tbd */
;
};
F96A585024790E300070A057
/* TFHpple.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F96A584B24790E300070A057
/* TFHpple.m */
;
};
F96A585124790E300070A057
/* TFHppleElement.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F96A584E24790E300070A057
/* TFHppleElement.m */
;
};
F96A585224790E300070A057
/* XPathQuery.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F96A584F24790E300070A057
/* XPathQuery.m */
;
};
F96E9D59246656A700B5B94A
/* HGImageCompleteButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F96E9D54246656A700B5B94A
/* HGImageCompleteButton.swift */
;
};
F96E9D5A246656A700B5B94A
/* HGImageCollectionViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F96E9D55246656A700B5B94A
/* HGImageCollectionViewController.swift */
;
};
F96E9D5B246656A700B5B94A
/* HGImageCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F96E9D56246656A700B5B94A
/* HGImageCollectionViewCell.swift */
;
};
...
...
@@ -998,6 +1002,13 @@
F969BF06244EC38000C79953
/* GoodsCollectionViewCell.xib */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.xib
;
path
=
GoodsCollectionViewCell.xib
;
sourceTree
=
"<group>"
;
};
F969BF1C244EE67900C79953
/* GoodsManageListVC.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GoodsManageListVC.swift
;
sourceTree
=
"<group>"
;
};
F969BF1D244EE67900C79953
/* GoodsManageListVC.xib */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.xib
;
path
=
GoodsManageListVC.xib
;
sourceTree
=
"<group>"
;
};
F96A581C24790D9A0070A057
/* libxml2.2.tbd */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"sourcecode.text-based-dylib-definition"
;
name
=
libxml2.2.tbd
;
path
=
usr/lib/libxml2.2.tbd
;
sourceTree
=
SDKROOT
;
};
F96A584A24790E300070A057
/* TFHppleElement.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
TFHppleElement.h
;
sourceTree
=
"<group>"
;
};
F96A584B24790E300070A057
/* TFHpple.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TFHpple.m
;
sourceTree
=
"<group>"
;
};
F96A584C24790E300070A057
/* XPathQuery.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
XPathQuery.h
;
sourceTree
=
"<group>"
;
};
F96A584D24790E300070A057
/* TFHpple.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
TFHpple.h
;
sourceTree
=
"<group>"
;
};
F96A584E24790E300070A057
/* TFHppleElement.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TFHppleElement.m
;
sourceTree
=
"<group>"
;
};
F96A584F24790E300070A057
/* XPathQuery.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
XPathQuery.m
;
sourceTree
=
"<group>"
;
};
F96E9D54246656A700B5B94A
/* HGImageCompleteButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
HGImageCompleteButton.swift
;
sourceTree
=
"<group>"
;
};
F96E9D55246656A700B5B94A
/* HGImageCollectionViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
HGImageCollectionViewController.swift
;
sourceTree
=
"<group>"
;
};
F96E9D56246656A700B5B94A
/* HGImageCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
HGImageCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1023,6 +1034,7 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
F96A581D24790D9A0070A057
/* libxml2.2.tbd in Frameworks */
,
E0707DC72462457200E039A8
/* libz.tbd in Frameworks */
,
E0404F842476355500D9ACE8
/* SDWebImageMapKit in Frameworks */
,
F93E32092473CD6500524DFC
/* libresolv.tbd in Frameworks */
,
...
...
@@ -1091,6 +1103,7 @@
824621C23DA37CD28A2F345F
/* Frameworks */
=
{
isa
=
PBXGroup
;
children
=
(
F96A581C24790D9A0070A057
/* libxml2.2.tbd */
,
F93E32082473CD6500524DFC
/* libresolv.tbd */
,
E03984972468F2DA00DFA56F
/* SafariServices.framework */
,
E03984952468F2D100DFA56F
/* Photos.framework */
,
...
...
@@ -2106,6 +2119,7 @@
F956D560246A2D9C003FF510
/* LMNote */
=
{
isa
=
PBXGroup
;
children
=
(
F96A584924790E300070A057
/* Hpple */
,
F956D561246A2D9C003FF510
/* TextView */
,
F956D56A246A2D9C003FF510
/* OtherViews */
,
F956D575246A2D9C003FF510
/* LMNoteViewController.h */
,
...
...
@@ -2355,6 +2369,19 @@
path
=
"商品管理"
;
sourceTree
=
"<group>"
;
};
F96A584924790E300070A057
/* Hpple */
=
{
isa
=
PBXGroup
;
children
=
(
F96A584A24790E300070A057
/* TFHppleElement.h */
,
F96A584B24790E300070A057
/* TFHpple.m */
,
F96A584C24790E300070A057
/* XPathQuery.h */
,
F96A584D24790E300070A057
/* TFHpple.h */
,
F96A584E24790E300070A057
/* TFHppleElement.m */
,
F96A584F24790E300070A057
/* XPathQuery.m */
,
);
path
=
Hpple
;
sourceTree
=
"<group>"
;
};
F96E9D53246656A700B5B94A
/* HGImage */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -2821,6 +2848,7 @@
E0516F7F244806C500E373CE
/* MsgCenterViewController.swift in Sources */
,
F94A315724628AC600FEC38E
/* WorkItemCollectionViewCell.swift in Sources */
,
F950FDA52451453A00C40530
/* ShopInfoModel.swift in Sources */
,
F96A585024790E300070A057
/* TFHpple.m in Sources */
,
E0516F822448086700E373CE
/* MsgCenterCell.swift in Sources */
,
F95A9ED524551DF900867849
/* UIView+constraints.swift in Sources */
,
F956D5B9246A33E2003FF510
/* OrderInterface.swift in Sources */
,
...
...
@@ -2835,6 +2863,7 @@
E0B5308624728FB600FFCC15
/* WarehouseInterface.swift in Sources */
,
E02FD9EC2455627300E10E27
/* ChuKuViewController.swift in Sources */
,
E07B1E6F245929060055BA3C
/* GYSGLViewController.swift in Sources */
,
F96A585124790E300070A057
/* TFHppleElement.m in Sources */
,
E0D197BB2448431C002B080C
/* BabyCallback.m in Sources */
,
F950FDDD24518B9500C40530
/* FSCalendarCollectionViewLayout.m in Sources */
,
E07B1E5E24591AA50055BA3C
/* KeHuXQViewController.swift in Sources */
,
...
...
@@ -2884,6 +2913,7 @@
E0C4F4B5244EE9EE00CC7E2F
/* YuShouCell.swift in Sources */
,
F933F6C52452C68B00189561
/* PKHUDSuccessView.swift in Sources */
,
E09B03A82445B04E00211A51
/* BaseView.swift in Sources */
,
F96A585224790E300070A057
/* XPathQuery.m in Sources */
,
F933F6CB2452C68B00189561
/* Window.swift in Sources */
,
E0DDCB0F244AD8C500DF54C7
/* DaiQueRenCell.swift in Sources */
,
E042F74024528CD500CDFA12
/* TitleAndOnlyBtnCell.swift in Sources */
,
...
...
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
View file @
be809a8b
No preview for this file type
GeliBusinessPlatform/BaseView/BaseViewController.swift
View file @
be809a8b
...
...
@@ -35,8 +35,7 @@ class BaseViewController: UIViewController ,NavBarViewDelegate{
self
.
automaticallyAdjustsScrollViewInsets
=
false
;
}
self
.
view
.
backgroundColor
=
UIColor
(
named
:
"app底色"
)
// Do any additional setup after loading the view.
}
override
func
didReceiveMemoryWarning
()
{
...
...
GeliBusinessPlatform/Other/LMNote/Hpple/TFHpple.h
0 → 100755
View file @
be809a8b
//
// TFHpple.h
// Hpple
//
// Created by Geoffrey Grosenbach on 1/31/09.
//
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
//
// MIT LICENSE
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "TFHppleElement.h"
@interface
TFHpple
:
NSObject
-
(
id
)
initWithData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
encoding
isXML
:(
BOOL
)
isDataXML
;
-
(
id
)
initWithData
:(
NSData
*
)
theData
isXML
:(
BOOL
)
isDataXML
;
-
(
id
)
initWithXMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
encoding
;
-
(
id
)
initWithXMLData
:(
NSData
*
)
theData
;
-
(
id
)
initWithHTMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
encoding
;
-
(
id
)
initWithHTMLData
:(
NSData
*
)
theData
;
+
(
TFHpple
*
)
hppleWithData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
encoding
isXML
:(
BOOL
)
isDataXML
;
+
(
TFHpple
*
)
hppleWithData
:(
NSData
*
)
theData
isXML
:(
BOOL
)
isDataXML
;
+
(
TFHpple
*
)
hppleWithXMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
encoding
;
+
(
TFHpple
*
)
hppleWithXMLData
:(
NSData
*
)
theData
;
+
(
TFHpple
*
)
hppleWithHTMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
encoding
;
+
(
TFHpple
*
)
hppleWithHTMLData
:(
NSData
*
)
theData
;
-
(
NSArray
*
)
searchWithXPathQuery
:(
NSString
*
)
xPathOrCSS
;
-
(
TFHppleElement
*
)
peekAtSearchWithXPathQuery
:(
NSString
*
)
xPathOrCSS
;
@property
(
nonatomic
,
readonly
)
NSData
*
data
;
@property
(
nonatomic
,
readonly
)
NSString
*
encoding
;
@end
GeliBusinessPlatform/Other/LMNote/Hpple/TFHpple.m
0 → 100755
View file @
be809a8b
//
// TFHpple.m
// Hpple
//
// Created by Geoffrey Grosenbach on 1/31/09.
//
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
//
// MIT LICENSE
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import "TFHpple.h"
#import "XPathQuery.h"
@interface
TFHpple
()
{
NSData
*
data
;
NSString
*
encoding
;
BOOL
isXML
;
}
@end
@implementation
TFHpple
@synthesize
data
;
@synthesize
encoding
;
-
(
id
)
initWithData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
theEncoding
isXML
:(
BOOL
)
isDataXML
{
if
(
!
(
self
=
[
super
init
]))
{
return
nil
;
}
data
=
theData
;
encoding
=
theEncoding
;
isXML
=
isDataXML
;
return
self
;
}
-
(
id
)
initWithData
:(
NSData
*
)
theData
isXML
:(
BOOL
)
isDataXML
{
return
[
self
initWithData
:
theData
encoding
:
nil
isXML
:
isDataXML
];
}
-
(
id
)
initWithXMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
theEncoding
{
return
[
self
initWithData
:
theData
encoding
:
theEncoding
isXML
:
YES
];
}
-
(
id
)
initWithXMLData
:(
NSData
*
)
theData
{
return
[
self
initWithData
:
theData
encoding
:
nil
isXML
:
YES
];
}
-
(
id
)
initWithHTMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
theEncoding
{
return
[
self
initWithData
:
theData
encoding
:
theEncoding
isXML
:
NO
];
}
-
(
id
)
initWithHTMLData
:(
NSData
*
)
theData
{
return
[
self
initWithData
:
theData
encoding
:
nil
isXML
:
NO
];
}
+
(
TFHpple
*
)
hppleWithData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
theEncoding
isXML
:(
BOOL
)
isDataXML
{
return
[[[
self
class
]
alloc
]
initWithData
:
theData
encoding
:
theEncoding
isXML
:
isDataXML
];
}
+
(
TFHpple
*
)
hppleWithData
:(
NSData
*
)
theData
isXML
:(
BOOL
)
isDataXML
{
return
[[
self
class
]
hppleWithData
:
theData
encoding
:
nil
isXML
:
isDataXML
];
}
+
(
TFHpple
*
)
hppleWithHTMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
theEncoding
{
return
[[
self
class
]
hppleWithData
:
theData
encoding
:
theEncoding
isXML
:
NO
];
}
+
(
TFHpple
*
)
hppleWithHTMLData
:(
NSData
*
)
theData
{
return
[[
self
class
]
hppleWithData
:
theData
encoding
:
nil
isXML
:
NO
];
}
+
(
TFHpple
*
)
hppleWithXMLData
:(
NSData
*
)
theData
encoding
:(
NSString
*
)
theEncoding
{
return
[[
self
class
]
hppleWithData
:
theData
encoding
:
theEncoding
isXML
:
YES
];
}
+
(
TFHpple
*
)
hppleWithXMLData
:(
NSData
*
)
theData
{
return
[[
self
class
]
hppleWithData
:
theData
encoding
:
nil
isXML
:
YES
];
}
#pragma mark -
// Returns all elements at xPath.
-
(
NSArray
*
)
searchWithXPathQuery
:(
NSString
*
)
xPathOrCSS
{
NSArray
*
detailNodes
=
nil
;
if
(
isXML
)
{
detailNodes
=
PerformXMLXPathQueryWithEncoding
(
data
,
xPathOrCSS
,
encoding
);
}
else
{
detailNodes
=
PerformHTMLXPathQueryWithEncoding
(
data
,
xPathOrCSS
,
encoding
);
}
NSMutableArray
*
hppleElements
=
[
NSMutableArray
array
];
for
(
id
node
in
detailNodes
)
{
[
hppleElements
addObject
:[
TFHppleElement
hppleElementWithNode
:
node
isXML
:
isXML
withEncoding
:
encoding
]];
}
return
hppleElements
;
}
// Returns first element at xPath
-
(
TFHppleElement
*
)
peekAtSearchWithXPathQuery
:(
NSString
*
)
xPathOrCSS
{
NSArray
*
elements
=
[
self
searchWithXPathQuery
:
xPathOrCSS
];
if
([
elements
count
]
>=
1
)
{
return
[
elements
objectAtIndex
:
0
];
}
return
nil
;
}
@end
GeliBusinessPlatform/Other/LMNote/Hpple/TFHppleElement.h
0 → 100755
View file @
be809a8b
//
// TFHppleElement.h
// Hpple
//
// Created by Geoffrey Grosenbach on 1/31/09.
//
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
//
// MIT LICENSE
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <Foundation/Foundation.h>
@interface
TFHppleElement
:
NSObject
-
(
id
)
initWithNode
:(
NSDictionary
*
)
theNode
isXML
:
(
BOOL
)
isDataXML
withEncoding
:(
NSString
*
)
theEncoding
;
+
(
TFHppleElement
*
)
hppleElementWithNode
:(
NSDictionary
*
)
theNode
isXML
:
(
BOOL
)
isDataXML
withEncoding
:(
NSString
*
)
theEncoding
;
@property
(
nonatomic
,
copy
,
readonly
)
NSString
*
raw
;
// Returns this tag's innerHTML content.
@property
(
nonatomic
,
copy
,
readonly
)
NSString
*
content
;
// Returns the name of the current tag, such as "h3".
@property
(
nonatomic
,
copy
,
readonly
)
NSString
*
tagName
;
// Returns tag attributes with name as key and content as value.
// href = 'http://peepcode.com'
// class = 'highlight'
@property
(
nonatomic
,
strong
,
readonly
)
NSDictionary
*
attributes
;
// Returns the children of a given node
@property
(
nonatomic
,
strong
,
readonly
)
NSArray
*
children
;
// Returns the first child of a given node
@property
(
nonatomic
,
strong
,
readonly
)
TFHppleElement
*
firstChild
;
// the parent of a node
@property
(
nonatomic
,
unsafe_unretained
,
readonly
)
TFHppleElement
*
parent
;
// Returns YES if the node has any child
// This is more efficient than using the children property since no NSArray is constructed
-
(
BOOL
)
hasChildren
;
// Returns YES if this is a text node
-
(
BOOL
)
isTextNode
;
// Provides easy access to the content of a specific attribute,
// such as 'href' or 'class'.
-
(
NSString
*
)
objectForKey
:(
NSString
*
)
theKey
;
// Returns the children whose tag name equals the given string
// (comparison is performed with NSString's isEqualToString)
// Returns an empty array if no matching child is found
-
(
NSArray
*
)
childrenWithTagName
:(
NSString
*
)
tagName
;
// Returns the first child node whose tag name equals the given string
// (comparison is performed with NSString's isEqualToString)
// Returns nil if no matching child is found
-
(
TFHppleElement
*
)
firstChildWithTagName
:(
NSString
*
)
tagName
;
// Returns the children whose class equals the given string
// (comparison is performed with NSString's isEqualToString)
// Returns an empty array if no matching child is found
-
(
NSArray
*
)
childrenWithClassName
:(
NSString
*
)
className
;
// Returns the first child whose class requals the given string
// (comparison is performed with NSString's isEqualToString)
// Returns nil if no matching child is found
-
(
TFHppleElement
*
)
firstChildWithClassName
:(
NSString
*
)
className
;
// Returns the first text node from this element's children
// Returns nil if there is no text node among the children
-
(
TFHppleElement
*
)
firstTextChild
;
// Returns the string contained by the first text node from this element's children
// Convenience method which can be used instead of firstTextChild.content
-
(
NSString
*
)
text
;
// Returns elements searched with xpath
-
(
NSArray
*
)
searchWithXPathQuery
:(
NSString
*
)
xPathOrCSS
;
// Custom keyed subscripting
-
(
id
)
objectForKeyedSubscript
:(
id
)
key
;
@end
GeliBusinessPlatform/Other/LMNote/Hpple/TFHppleElement.m
0 → 100755
View file @
be809a8b
//
// TFHppleElement.m
// Hpple
//
// Created by Geoffrey Grosenbach on 1/31/09.
//
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
//
// MIT LICENSE
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import "TFHppleElement.h"
#import "XPathQuery.h"
static
NSString
*
const
TFHppleNodeContentKey
=
@"nodeContent"
;
static
NSString
*
const
TFHppleNodeNameKey
=
@"nodeName"
;
static
NSString
*
const
TFHppleNodeChildrenKey
=
@"nodeChildArray"
;
static
NSString
*
const
TFHppleNodeAttributeArrayKey
=
@"nodeAttributeArray"
;
static
NSString
*
const
TFHppleNodeAttributeNameKey
=
@"attributeName"
;
static
NSString
*
const
TFHppleTextNodeName
=
@"text"
;
@interface
TFHppleElement
()
{
NSDictionary
*
node
;
BOOL
isXML
;
NSString
*
encoding
;
__unsafe_unretained
TFHppleElement
*
parent
;
}
@property
(
nonatomic
,
unsafe_unretained
,
readwrite
)
TFHppleElement
*
parent
;
@end
@implementation
TFHppleElement
@synthesize
parent
;
-
(
id
)
initWithNode
:(
NSDictionary
*
)
theNode
isXML
:
(
BOOL
)
isDataXML
withEncoding
:(
NSString
*
)
theEncoding
{
if
(
!
(
self
=
[
super
init
]))
return
nil
;
isXML
=
isDataXML
;
node
=
theNode
;
encoding
=
theEncoding
;
return
self
;
}
+
(
TFHppleElement
*
)
hppleElementWithNode
:(
NSDictionary
*
)
theNode
isXML
:
(
BOOL
)
isDataXML
withEncoding
:(
NSString
*
)
theEncoding
{
return
[[[
self
class
]
alloc
]
initWithNode
:
theNode
isXML
:
isDataXML
withEncoding
:
theEncoding
];
}
#pragma mark -
-
(
NSString
*
)
raw
{
return
[
node
objectForKey
:
@"raw"
];
}
-
(
NSString
*
)
content
{
return
[
node
objectForKey
:
TFHppleNodeContentKey
];
}
-
(
NSString
*
)
tagName
{
return
[
node
objectForKey
:
TFHppleNodeNameKey
];
}
-
(
NSArray
*
)
children
{
NSMutableArray
*
children
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
child
in
[
node
objectForKey
:
TFHppleNodeChildrenKey
])
{
TFHppleElement
*
element
=
[
TFHppleElement
hppleElementWithNode
:
child
isXML
:
isXML
withEncoding
:
encoding
];
element
.
parent
=
self
;
[
children
addObject
:
element
];
}
return
children
;
}
-
(
TFHppleElement
*
)
firstChild
{
NSArray
*
children
=
self
.
children
;
if
(
children
.
count
)
return
[
children
objectAtIndex
:
0
];
return
nil
;
}
-
(
NSDictionary
*
)
attributes
{
NSMutableDictionary
*
translatedAttributes
=
[
NSMutableDictionary
dictionary
];
for
(
NSDictionary
*
attributeDict
in
[
node
objectForKey
:
TFHppleNodeAttributeArrayKey
])
{
if
([
attributeDict
objectForKey
:
TFHppleNodeContentKey
]
&&
[
attributeDict
objectForKey
:
TFHppleNodeAttributeNameKey
])
{
[
translatedAttributes
setObject
:[
attributeDict
objectForKey
:
TFHppleNodeContentKey
]
forKey:
[
attributeDict
objectForKey
:
TFHppleNodeAttributeNameKey
]];
}
}
return
translatedAttributes
;
}
-
(
NSString
*
)
objectForKey
:(
NSString
*
)
theKey
{
return
[[
self
attributes
]
objectForKey
:
theKey
];
}
-
(
id
)
description
{
return
[
node
description
];
}
-
(
BOOL
)
hasChildren
{
if
([
node
objectForKey
:
TFHppleNodeChildrenKey
])
return
YES
;
else
return
NO
;
}
-
(
BOOL
)
isTextNode
{
// we must distinguish between real text nodes and standard nodes with tha name "text" (<text>)
// real text nodes must have content
if
([
self
.
tagName
isEqualToString
:
TFHppleTextNodeName
]
&&
(
self
.
content
))
return
YES
;
else
return
NO
;
}
-
(
NSArray
*
)
childrenWithTagName
:(
NSString
*
)
tagName
{
NSMutableArray
*
matches
=
[
NSMutableArray
array
];
for
(
TFHppleElement
*
child
in
self
.
children
)
{
if
([
child
.
tagName
isEqualToString
:
tagName
])
[
matches
addObject
:
child
];
}
return
matches
;
}
-
(
TFHppleElement
*
)
firstChildWithTagName
:(
NSString
*
)
tagName
{
for
(
TFHppleElement
*
child
in
self
.
children
)
{
if
([
child
.
tagName
isEqualToString
:
tagName
])
return
child
;
}
return
nil
;
}
-
(
NSArray
*
)
childrenWithClassName
:(
NSString
*
)
className
{
NSMutableArray
*
matches
=
[
NSMutableArray
array
];
for
(
TFHppleElement
*
child
in
self
.
children
)
{
if
([[
child
objectForKey
:
@"class"
]
isEqualToString
:
className
])
[
matches
addObject
:
child
];
}
return
matches
;
}
-
(
TFHppleElement
*
)
firstChildWithClassName
:(
NSString
*
)
className
{
for
(
TFHppleElement
*
child
in
self
.
children
)
{
if
([[
child
objectForKey
:
@"class"
]
isEqualToString
:
className
])
return
child
;
}
return
nil
;
}
-
(
TFHppleElement
*
)
firstTextChild
{
for
(
TFHppleElement
*
child
in
self
.
children
)
{
if
([
child
isTextNode
])
return
child
;
}
return
[
self
firstChildWithTagName
:
TFHppleTextNodeName
];
}
-
(
NSString
*
)
text
{
return
self
.
firstTextChild
.
content
;
}
// Returns all elements at xPath.
-
(
NSArray
*
)
searchWithXPathQuery
:(
NSString
*
)
xPathOrCSS
{
NSData
*
data
=
[
self
.
raw
dataUsingEncoding
:
NSUTF8StringEncoding
];
NSArray
*
detailNodes
=
nil
;
if
(
isXML
)
{
detailNodes
=
PerformXMLXPathQueryWithEncoding
(
data
,
xPathOrCSS
,
encoding
);
}
else
{
detailNodes
=
PerformHTMLXPathQueryWithEncoding
(
data
,
xPathOrCSS
,
encoding
);
}
NSMutableArray
*
hppleElements
=
[
NSMutableArray
array
];
for
(
id
newNode
in
detailNodes
)
{
[
hppleElements
addObject
:[
TFHppleElement
hppleElementWithNode
:
newNode
isXML
:
isXML
withEncoding
:
encoding
]];
}
return
hppleElements
;
}
// Returns first element at xPath
-
(
TFHppleElement
*
)
peekAtSearchWithXPathQuery
:(
NSString
*
)
xPathOrCSS
{
NSArray
*
elements
=
[
self
searchWithXPathQuery
:
xPathOrCSS
];
if
([
elements
count
]
>=
1
)
{
return
[
elements
objectAtIndex
:
0
];
}
return
nil
;
}
// Custom keyed subscripting
-
(
id
)
objectForKeyedSubscript
:(
id
)
key
{
return
[
self
objectForKey
:
key
];
}
@end
GeliBusinessPlatform/Other/LMNote/Hpple/XPathQuery.h
0 → 100755
View file @
be809a8b
//
// XPathQuery.h
// FuelFinder
//
// Created by Matt Gallagher on 4/08/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
NSArray
*
PerformHTMLXPathQuery
(
NSData
*
document
,
NSString
*
query
);
NSArray
*
PerformHTMLXPathQueryWithEncoding
(
NSData
*
document
,
NSString
*
query
,
NSString
*
encoding
);
NSArray
*
PerformXMLXPathQuery
(
NSData
*
document
,
NSString
*
query
);
NSArray
*
PerformXMLXPathQueryWithEncoding
(
NSData
*
document
,
NSString
*
query
,
NSString
*
encoding
);
GeliBusinessPlatform/Other/LMNote/Hpple/XPathQuery.m
0 → 100755
View file @
be809a8b
//
// XPathQuery.m
// FuelFinder
//
// Created by Matt Gallagher on 4/08/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "XPathQuery.h"
#import <libxml/tree.h>
#import <libxml/parser.h>
#import <libxml/HTMLparser.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>
NSDictionary
*
DictionaryForNode
(
xmlNodePtr
currentNode
,
NSMutableDictionary
*
parentResult
,
BOOL
parentContent
);
NSArray
*
PerformXPathQuery
(
xmlDocPtr
doc
,
NSString
*
query
);
NSDictionary
*
DictionaryForNode
(
xmlNodePtr
currentNode
,
NSMutableDictionary
*
parentResult
,
BOOL
parentContent
)
{
NSMutableDictionary
*
resultForNode
=
[
NSMutableDictionary
dictionary
];
if
(
currentNode
->
name
)
{
NSString
*
currentNodeContent
=
[
NSString
stringWithCString
:(
const
char
*
)
currentNode
->
name
encoding:
NSUTF8StringEncoding
];
resultForNode
[
@"nodeName"
]
=
currentNodeContent
;
}
xmlChar
*
nodeContent
=
xmlNodeGetContent
(
currentNode
);
if
(
nodeContent
!=
NULL
)
{
NSString
*
currentNodeContent
=
[
NSString
stringWithCString
:(
const
char
*
)
nodeContent
encoding:
NSUTF8StringEncoding
];
if
([
resultForNode
[
@"nodeName"
]
isEqual
:
@"text"
]
&&
parentResult
)
{
if
(
parentContent
)
{
NSCharacterSet
*
charactersToTrim
=
[
NSCharacterSet
whitespaceAndNewlineCharacterSet
];
parentResult
[
@"nodeContent"
]
=
[
currentNodeContent
stringByTrimmingCharactersInSet
:
charactersToTrim
];
/** Memory leak point release, Prevent memory leak */
xmlFree
(
nodeContent
);
/** Memory leak point release, Prevent memory leak */
return
nil
;
}
if
(
currentNodeContent
!=
nil
)
{
resultForNode
[
@"nodeContent"
]
=
currentNodeContent
;
}
/** Memory leak point release, Prevent memory leak */
xmlFree
(
nodeContent
);
/** Memory leak point release, Prevent memory leak */
return
resultForNode
;
}
else
{
resultForNode
[
@"nodeContent"
]
=
currentNodeContent
;
}
xmlFree
(
nodeContent
);
}
xmlAttr
*
attribute
=
currentNode
->
properties
;
if
(
attribute
)
{
NSMutableArray
*
attributeArray
=
[
NSMutableArray
array
];
while
(
attribute
)
{
NSMutableDictionary
*
attributeDictionary
=
[
NSMutableDictionary
dictionary
];
NSString
*
attributeName
=
[
NSString
stringWithCString
:(
const
char
*
)
attribute
->
name
encoding:
NSUTF8StringEncoding
];
if
(
attributeName
)
{
attributeDictionary
[
@"attributeName"
]
=
attributeName
;
}
if
(
attribute
->
children
)
{
NSDictionary
*
childDictionary
=
DictionaryForNode
(
attribute
->
children
,
attributeDictionary
,
true
);
if
(
childDictionary
)
{
attributeDictionary
[
@"attributeContent"
]
=
childDictionary
;
}
}
if
([
attributeDictionary
count
]
>
0
)
{
[
attributeArray
addObject
:
attributeDictionary
];
}
attribute
=
attribute
->
next
;
}
if
([
attributeArray
count
]
>
0
)
{
resultForNode
[
@"nodeAttributeArray"
]
=
attributeArray
;
}
}
xmlNodePtr
childNode
=
currentNode
->
children
;
if
(
childNode
)
{
NSMutableArray
*
childContentArray
=
[
NSMutableArray
array
];
while
(
childNode
)
{
NSDictionary
*
childDictionary
=
DictionaryForNode
(
childNode
,
resultForNode
,
false
);
if
(
childDictionary
)
{
[
childContentArray
addObject
:
childDictionary
];
}
childNode
=
childNode
->
next
;
}
if
([
childContentArray
count
]
>
0
)
{
resultForNode
[
@"nodeChildArray"
]
=
childContentArray
;
}
}
xmlBufferPtr
buffer
=
xmlBufferCreate
();
xmlNodeDump
(
buffer
,
currentNode
->
doc
,
currentNode
,
0
,
0
);
NSString
*
rawContent
=
[
NSString
stringWithCString
:(
const
char
*
)
buffer
->
content
encoding
:
NSUTF8StringEncoding
];
if
(
rawContent
!=
nil
)
{
resultForNode
[
@"raw"
]
=
rawContent
;
}
xmlBufferFree
(
buffer
);
return
resultForNode
;
}
NSArray
*
PerformXPathQuery
(
xmlDocPtr
doc
,
NSString
*
query
)
{
xmlXPathContextPtr
xpathCtx
;
xmlXPathObjectPtr
xpathObj
;
/* Make sure that passed query is non-nil and is NSString object */
if
(
query
==
nil
||
!
[
query
isKindOfClass
:[
NSString
class
]])
{
return
nil
;
}
/* Create xpath evaluation context */
xpathCtx
=
xmlXPathNewContext
(
doc
);
if
(
xpathCtx
==
NULL
)
{
NSLog
(
@"Unable to create XPath context."
);
return
nil
;
}
/* Evaluate xpath expression */
xpathObj
=
xmlXPathEvalExpression
((
xmlChar
*
)[
query
cStringUsingEncoding
:
NSUTF8StringEncoding
],
xpathCtx
);
if
(
xpathObj
==
NULL
)
{
NSLog
(
@"Unable to evaluate XPath."
);
xmlXPathFreeContext
(
xpathCtx
);
return
nil
;
}
xmlNodeSetPtr
nodes
=
xpathObj
->
nodesetval
;
if
(
!
nodes
)
{
NSLog
(
@"Nodes was nil."
);
xmlXPathFreeObject
(
xpathObj
);
xmlXPathFreeContext
(
xpathCtx
);
return
nil
;
}
NSMutableArray
*
resultNodes
=
[
NSMutableArray
array
];
for
(
NSInteger
i
=
0
;
i
<
nodes
->
nodeNr
;
i
++
)
{
NSDictionary
*
nodeDictionary
=
DictionaryForNode
(
nodes
->
nodeTab
[
i
],
nil
,
false
);
if
(
nodeDictionary
)
{
[
resultNodes
addObject
:
nodeDictionary
];
}
}
/* Cleanup */
xmlXPathFreeObject
(
xpathObj
);
xmlXPathFreeContext
(
xpathCtx
);
return
resultNodes
;
}
NSArray
*
PerformHTMLXPathQuery
(
NSData
*
document
,
NSString
*
query
)
{
return
PerformHTMLXPathQueryWithEncoding
(
document
,
query
,
nil
);
}
NSArray
*
PerformHTMLXPathQueryWithEncoding
(
NSData
*
document
,
NSString
*
query
,
NSString
*
encoding
)
{
xmlDocPtr
doc
;
/* Load XML document */
const
char
*
encoded
=
encoding
?
[
encoding
cStringUsingEncoding
:
NSUTF8StringEncoding
]
:
NULL
;
doc
=
htmlReadMemory
([
document
bytes
],
(
int
)[
document
length
],
""
,
encoded
,
HTML_PARSE_NOWARNING
|
HTML_PARSE_NOERROR
);
if
(
doc
==
NULL
)
{
NSLog
(
@"Unable to parse."
);
return
nil
;
}
NSArray
*
result
=
PerformXPathQuery
(
doc
,
query
);
xmlFreeDoc
(
doc
);
return
result
;
}
NSArray
*
PerformXMLXPathQuery
(
NSData
*
document
,
NSString
*
query
)
{
return
PerformXMLXPathQueryWithEncoding
(
document
,
query
,
nil
);
}
NSArray
*
PerformXMLXPathQueryWithEncoding
(
NSData
*
document
,
NSString
*
query
,
NSString
*
encoding
)
{
xmlDocPtr
doc
;
/* Load XML document */
const
char
*
encoded
=
encoding
?
[
encoding
cStringUsingEncoding
:
NSUTF8StringEncoding
]
:
NULL
;
doc
=
xmlReadMemory
([
document
bytes
],
(
int
)[
document
length
],
""
,
encoded
,
XML_PARSE_RECOVER
);
if
(
doc
==
NULL
)
{
NSLog
(
@"Unable to parse."
);
return
nil
;
}
NSArray
*
result
=
PerformXPathQuery
(
doc
,
query
);
xmlFreeDoc
(
doc
);
return
result
;
}
GeliBusinessPlatform/Other/LMNote/LMNoteViewController.h
View file @
be809a8b
...
...
@@ -10,10 +10,19 @@
@class
LMNDraft
;
@protocol
LMNoteViewControllerDelegate
<
NSObject
>
-
(
void
)
getHTMLByVc
:(
NSString
*
)
model
;
@end
@interface
LMNoteViewController
:
UIViewController
@property
(
nonatomic
,
readonly
)
LMNDraft
*
draft
;
-
(
instancetype
)
initWithDraft
:(
LMNDraft
*
)
draft
;
@property
(
nonatomic
,
weak
)
id
<
LMNoteViewControllerDelegate
>
delegatedata
;
@end
GeliBusinessPlatform/Other/LMNote/LMNoteViewController.m
View file @
be809a8b
...
...
@@ -15,7 +15,10 @@
#import "LMNImageView.h"
#import "LMNImageInputViewController.h"
#import "LMNWebViewController.h"
//#import "TestClass-Swift.h"
#import "TestClass-Swift.h"
#import <SDWebImage/SDWebImage.h>
#import "TFHpple.h"
// 屏幕宽度
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
// 屏幕高度
...
...
@@ -38,6 +41,8 @@
@property
(
nonatomic
,
assign
)
NSInteger
cursorIndex
;
@property
(
nonatomic
,
assign
)
CGFloat
keyboardHeight
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
imgIndexArr
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
imgUrlArr
;
@end
...
...
@@ -64,7 +69,8 @@
textView
;
});
[
self
.
view
addSubview
:
self
.
textView
];
NSLog
(
@"old=
\n
%@"
,
self
.
draft
.
textStorage
);
self
.
editButton
=
({
UIButton
*
button
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
button
setImage
:[
UIImage
imageNamed
:
@"lmn_btn_edit"
]
forState
:
UIControlStateNormal
];
...
...
@@ -85,7 +91,7 @@
});
[
self
.
view
addSubview
:
self
.
toolBar
];
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
...
...
@@ -118,6 +124,15 @@
-
(
void
)
outVC
{
NSLog
(
@"outvc====outvc"
);
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
// self.textView.text = @"ugh\nCccc\nThe new kJt";
// [self.textView updateExclusionPaths];
// [self.textView insertImage:[UIImage imageNamed:@"lmn_tool_image"] atIndex:self.cursorIndex];
//
// [self.textView.imgArr addObject:url];
// imageView.imageUrl = url;
}
-
(
void
)
layoutTextView
{
...
...
@@ -164,6 +179,7 @@
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
self
.
navigationController
.
navigationBar
setHidden
:
NO
];
[
self
addObservers
];
}
...
...
@@ -205,6 +221,8 @@
if
(
firstLine
.
length
>
0
)
{
self
.
draft
.
name
=
firstLine
;
self
.
draft
.
textStorage
=
(
LMNTextStorage
*
)
self
.
textView
.
textStorage
;
NSLog
(
@"last=
\n
%@"
,
self
.
textView
.
textStorage
);
[
self
.
draft
save
];
}
else
{
...
...
@@ -214,14 +232,49 @@
-
(
void
)
export
{
[
self
.
textView
exportHTML
:
^
(
BOOL
succeed
,
NSString
*
html
)
{
NSLog
(
@"html:
\n
%@"
,
[
NSString
stringWithFormat
:
@"<html>%@</html>"
,
html
]);
LMNWebViewController
*
vc
=
[[
LMNWebViewController
alloc
]
init
];
vc
.
html
=
[
NSString
stringWithFormat
:
@"<html>%@</html>"
,
html
];
[
self
.
navigationController
pushViewController
:
vc
animated
:
YES
];
if
(
self
.
delegatedata
&&
[
self
.
delegatedata
respondsToSelector
:
@selector
(
getHTMLByVc
:)])
{
[
self
.
delegatedata
getHTMLByVc
:
html
];
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
}];
}
-
(
NSString
*
)
getStingByData
:(
NSString
*
)
htmlString
{
// 将html字符串转为NSData
NSString
*
content
=
@""
;
self
.
imgIndexArr
=
[
NSMutableArray
arrayWithCapacity
:
10
];
self
.
imgUrlArr
=
[
NSMutableArray
arrayWithCapacity
:
10
];
NSData
*
data
=
[
htmlString
dataUsingEncoding
:
NSUTF8StringEncoding
];
// 创建Hpple对象
TFHpple
*
doc
=
[[
TFHpple
alloc
]
initWithHTMLData
:
data
];
// 搜索XPath寻找标签
NSArray
*
elements
=
[
doc
searchWithXPathQuery
:
@"//p"
];
for
(
TFHppleElement
*
element
in
elements
)
{
NSLog
(
@"content:%@"
,
[
element
content
]);
if
(
content
.
length
==
0
)
{
content
=
[
element
content
];
}
else
{
content
=
[
NSString
stringWithFormat
:
@"%@
\n
%@"
,
content
,[
element
content
]];
}
TFHppleElement
*
imgDic
=
[
element
firstChildWithTagName
:
@"img"
];
if
(
imgDic
)
{
NSString
*
src
=
[[
imgDic
attributes
]
objectForKey
:
@"src"
];
NSLog
(
@"src:%@"
,
src
);
if
(
content
.
length
==
0
)
{
[
self
.
imgIndexArr
addObject
:
@"0"
];
}
else
{
NSString
*
index
=
[
NSString
stringWithFormat
:
@"%ld"
,(
content
.
length
+
1
)];
[
self
.
imgIndexArr
addObject
:
index
];
}
NSString
*
imgSrc
=
@"https://c.gelifood.com/"
;
NSString
*
imgurl
=
[
src
stringByReplacingOccurrencesOfString
:
imgSrc
withString
:
@""
];
[
self
.
imgUrlArr
addObject
:
imgurl
];
}
}
return
content
;
}
#pragma mark - input
-
(
LMNImageInputViewController
*
)
imageInputViewController
...
...
@@ -407,7 +460,7 @@
{
[
self
hideInputView
];
self
.
editButton
.
hidden
=
NO
;
CGFloat
imageWidth
=
CGRectGetWidth
([
UIScreen
mainScreen
].
bounds
)
-
40
.
f
;
CGSize
targetSize
=
CGSizeMake
(
imageWidth
,
imageWidth
);
PHImageRequestOptions
*
options
=
[[
PHImageRequestOptions
alloc
]
init
];
...
...
@@ -415,29 +468,31 @@
options
.
networkAccessAllowed
=
YES
;
__block
LMNImageView
*
imageView
=
nil
;
[[
PHImageManager
defaultManager
]
requestImageForAsset
:
asset
targetSize
:
targetSize
contentMode
:
PHImageContentModeAspectFill
options
:
options
resultHandler
:^
(
UIImage
*
result
,
NSDictionary
*
info
)
{
if
(
!
imageView
)
{
imageView
=
[
self
.
textView
insertImage
:
result
atIndex
:
self
.
cursorIndex
];
}
else
{
imageView
.
image
=
result
;
}
//请求上传图片
// TestClass *model = [[TestClass alloc]init];
// NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:10];
// [dict setValue:@"RQdwz5QKpeg=" forKey:@"user_token"];
// [model saveFileWithImage:result params:dict success:^(NSDictionary<NSString *,id> * data) {
// if ([[NSString stringWithFormat:@"%@",data[@"code"]]isEqualToString:@"1"]) {
//
// NSDictionary *dataDic = data[@"data"];
// NSString *url = dataDic[@"url"];
// [self.textView.imgArr addObject:url];
// imageView.imageUrl = url;
// }
//
// } failture:^(NSError * error) {
//
// }];
TestClass
*
model
=
[[
TestClass
alloc
]
init
];
NSMutableDictionary
*
dict
=
[
NSMutableDictionary
dictionaryWithCapacity
:
10
];
[
dict
setValue
:
@"RQdwz5QKpeg="
forKey
:
@"user_token"
];
[
model
saveFileWithImage
:
result
params
:
dict
success
:^
(
NSDictionary
<
NSString
*
,
id
>
*
data
)
{
if
([[
NSString
stringWithFormat
:
@"%@"
,
data
[
@"code"
]]
isEqualToString
:
@"1"
])
{
if
(
!
imageView
)
{
// imageView = [self.textView insertImage:result atIndex:self.cursorIndex];
imageView
=
[
self
.
textView
insertImage
:[
UIImage
imageNamed
:
@"lmn_tool_image"
]
atIndex
:
self
.
cursorIndex
];
}
else
{
imageView
.
image
=
result
;
}
NSDictionary
*
dataDic
=
data
[
@"data"
];
NSString
*
url
=
dataDic
[
@"url"
];
[
self
.
textView
.
imgArr
addObject
:
url
];
imageView
.
imageUrl
=
url
;
}
}
failture
:^
(
NSError
*
error
)
{
}];
}];
}
...
...
GeliBusinessPlatform/Other/LMNote/OtherViews/LMNImageView.m
View file @
be809a8b
...
...
@@ -8,6 +8,7 @@
#import "LMNImageView.h"
#import "LMNImageLine.h"
#import <SDWebImage/SDWebImage.h>
@interface
LMNImageView
()
...
...
@@ -74,10 +75,23 @@ static CGFloat const kVerticalMargin = kVerticalInset + kMargin;
-
(
void
)
setImage
:(
UIImage
*
)
image
{
_image
=
image
;
self
.
imageView
.
image
=
image
;
//
_image = image;
//
self.imageView.image = image;
[
self
setNeedsDisplay
];
}
-
(
void
)
setImageUrl
:(
NSString
*
)
imageUrl
{
_imageUrl
=
imageUrl
;
[
self
.
imageView
sd_setImageWithURL
:[
NSURL
URLWithString
:[
NSString
stringWithFormat
:
@"http://z.gelifood.com/%@"
,
imageUrl
]]
placeholderImage:
[
UIImage
imageNamed
:
@"lmn_tool_image"
]
options
:(
SDWebImageRetryFailed
)
completed
:^
(
UIImage
*
image
,
NSError
*
error
,
SDImageCacheType
cacheType
,
NSURL
*
imageURL
)
{
CGSize
size
=
image
.
size
;
NSLog
(
@"网络图片大小=%f,%f"
,
size
.
width
,
size
.
height
);
}];
[
self
setNeedsDisplay
];
}
#pragma mark - editing
...
...
GeliBusinessPlatform/Other/LMNote/OtherViews/TestClass.swift
View file @
be809a8b
...
...
@@ -17,9 +17,12 @@ class TestClass: NSObject {
//MARK:--图片(文件)上传
@objc
func
saveFile
(
image
:
UIImage
,
params
:[
String
:
Any
],
success
:
@escaping
(
_
res
:
Dictionary
<
String
,
Any
>
)
->
(),
failture
:
@escaping
(
_
error
:
Error
)
->
())
{
HUD
.
flash
(
.
progress
)
NetworkRequest
.
sharedInstance
.
uploadImage
(
url
:
"图片(文件)上传"
,
image
:
image
,
params
:
params
,
success
:
{
(
data
)
in
HUD
.
hide
()
success
(
data
)
})
{
(
error
)
in
HUD
.
flash
(
.
label
(
"上传图片失败"
),
delay
:
1.2
)
failture
(
error
)
}
}
...
...
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextStorage+Export.m
View file @
be809a8b
...
...
@@ -28,6 +28,7 @@
range
.
length
-=
1
;
}
NSAttributedString
*
attributedText
=
[
self
attributedSubstringFromRange
:
range
];
if
([
line
isKindOfMode
:
LMNLineModeModeImage
])
{
// TODO: 图片部分逻辑未处理。
...
...
@@ -46,6 +47,7 @@
UIFont
*
font
=
attributes
[
NSFontAttributeName
];
BOOL
underline
=
[
attributes
[
NSUnderlineStyleAttributeName
]
boolValue
];
BOOL
strikethrough
=
[
attributes
[
NSStrikethroughStyleAttributeName
]
integerValue
]
==
1
;
NSString
*
fragment
=
[
self
htmlWithContent
:
text
font
:
font
underline
:
underline
strikethrough
:
strikethrough
];
[
lineHTML
appendString
:
fragment
];
}
while
(
NSMaxRange
(
effectiveRange
)
<
attributedText
.
length
);
...
...
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextView.h
View file @
be809a8b
...
...
@@ -23,5 +23,7 @@
-
(
void
)
setTextAlignmentForSelection
:(
NSTextAlignment
)
alignment
;
-
(
LMNImageView
*
)
insertImage
:(
UIImage
*
)
image
atIndex
:(
NSInteger
)
index
;
-
(
void
)
exportHTML
:(
void
(
^
)(
BOOL
succeed
,
NSString
*
html
))
completion
;
-
(
void
)
insertText
:(
NSString
*
)
text
;
-
(
void
)
updateExclusionPaths
;
@end
GeliBusinessPlatform/Other/LMNote/TextView/LMNTextView.m
View file @
be809a8b
...
...
@@ -141,6 +141,8 @@ static CGFloat const kDefaultTextInset = 5.f; // 默认文字会有5.f的缩
-
(
void
)
updateExclusionPaths
{
NSString
*
text
=
self
.
text
;
NSLog
(
@"updateExclusionPaths=%@"
,
text
);
UIEdgeInsets
textContainerInset
=
self
.
textContainerInset
;
NSTextContainer
*
textContainer
=
self
.
textContainer
;
LMNTextStorage
*
textStorage
=
_textStorage
;
...
...
@@ -403,7 +405,7 @@ static CGFloat const kDefaultTextInset = 5.f; // 默认文字会有5.f的缩
UIEdgeInsets
textContainerInset
=
self
.
textContainerInset
;
width
-=
(
textContainerInset
.
left
+
textContainerInset
.
right
+
kDefaultTextInset
*
2
);
CGSize
size
=
[
LMNImageView
sizeThatFit
:
image
limitWidth
:
width
];
LMNImageView
*
imageView
=
[[
LMNImageView
alloc
]
initWithImage
:
image
];
imageView
.
delegate
=
self
;
[
self
addSubview
:
imageView
];
...
...
GeliBusinessPlatform/SceneDelegate.swift
View file @
be809a8b
...
...
@@ -94,7 +94,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
// Create the SwiftUI view that provides the window contents.
tabBarController
.
viewControllers
=
[
v1
,
v2
,
v3
,
v4
,
v5
]
tabBarController
.
selectedIndex
=
2
tabBarController
.
selectedIndex
=
1
let
contentView
=
tabBarController
...
...
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
View file @
be809a8b
...
...
@@ -16,7 +16,7 @@ protocol ProductDetailViewControllerDelegate {
func
reloadDataByProductDetailViewController
()
}
class
ProductDetailViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
,
YuShouWeiKuanFaHuoCellDelegate
,
UITextFieldDelegate
,
ShowTimeSelectViewDelegate
{
class
ProductDetailViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
,
YuShouWeiKuanFaHuoCellDelegate
,
UITextFieldDelegate
,
ShowTimeSelectViewDelegate
,
LMNoteViewControllerDelegate
{
var
delegate
:
ProductDetailViewControllerDelegate
?
func
GLASClose
(
view
:
GLAlertSelectView
,
selectnum
:
Int
,
selectArr
:
Array
<
Int
>
)
{
...
...
@@ -247,7 +247,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
"coun_id"
:
"1"
,
//国家id 1(中国)
"gs_id"
:
gs_id
as
Any
,
//商品状态
"transportation"
:
transportation
as
Any
,
//运输方式,1冷链,2常温,3热链
"goods_desc"
:
""
,
//商品详情 html p标签
"goods_desc"
:
goodsDesc
as
Any
,
//商品详情 html p标签
"specifications"
:
specifications
as
Any
,
//默认规格,选sku中最低价格(需判定阶梯价)的 规格值
"shop_price"
:
shop_price
as
Any
,
//默认售价,选sku中最低价格(需判定阶梯价)的价格
"goods_unit"
:
goods_unit
as
Any
,
//默认商品单位,选sku中最低价格(需判定阶梯价)的单位
...
...
@@ -465,6 +465,10 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
cell
.
imgBtn
.
tag
=
indexPath
.
row
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"tjxq"
),
for
:
.
normal
)
cell
.
btmH
.
constant
=
25
if
goodsDesc
.
count
>
0
{
let
goodsDescHmtl
=
"<html>"
+
goodsDesc
+
"</html>"
//增加一个半屏高度web
}
return
cell
}
}
...
...
@@ -476,6 +480,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
func
AddGuiGeCellClick
(
cell
:
AddGuiGeCell
)
{
print
(
"底部广告软文跳转"
)
let
vc
=
LMNoteViewController
()
vc
.
delegatedata
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
//MARK: -- 点击按钮事件,跳转或者展示选择界面
...
...
@@ -1207,4 +1212,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
//MARK:---商品详情回调的数据
var
goodsDesc
=
""
func
getHTMLByVc
(
_
model
:
String
!
)
{
goodsDesc
=
model
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment