Aztec 是一个 Swift 库,提供一个具有 HTML 可视化编辑功能的 UITextView
子类。
WordPressEditor 是一个 Swift 库,提供一个插件,使 Aztec 可以与 WordPress 内容一起使用。
要运行示例 App,您首先需要从 Aztec 的根目录打开文件 Aztec.xcworkspace
。
确保已选择 AztecExample
目标,然后按 CMD + R 运行它。
这两个库都可以通过 Carthage 获得。 要安装它,只需将以下行添加到您的 Cartfile 中
github "wordpress-mobile/AztecEditor-iOS" "1.0" # or the version number you want
github "wordpress-mobile/WordPressEditor-iOS" "1.0"
按照 这些说明 将 Aztec.framework
或 WordPressEditor.framework
添加到您的 App。
然后
$(SDKROOT)/usr/include/libxml2/
添加到您的“Header Search Paths”。Build Phases
> Link Binary With Libraries
并添加 Aztec.framework
。import Aztec
添加到您项目的源代码中。这两个库都可以通过 CocoaPods 获得。 要安装它们,只需将以下行添加到您的 Podfile 中
pod "WordPress-Aztec-iOS", "1.0" # or the version number you want
pod "WordPress-Editor-iOS", "1.0"
这两个库都可以通过 SPM 获得。 要安装它们,请将该软件包添加到您的软件包依赖项中,并将相应的库添加到您的目标依赖项中。
let package = Package(
name: "YourPackage",
products: [
.library(name: "YourLibrary", targets: ["YourTarget"]),
],
dependencies: [
.package(url: "https://github.com/wordpress-mobile/AztecEditor-iOS", .upToNextMajor(from: "1.20.0")),
],
targets: [
.target(
name: "YourTarget",
dependencies: [
.product(name: "Aztec", package: "AztecEditor-iOS"), // You can choose...
.product(name: "WordPressEditor", package: "AztecEditor-iOS"), // which library you need.
]
),
]
)
您也可以直接通过 Xcode 使用项目仓库 URL (https://github.com/wordpress-mobile/AztecEditor-iOS)!
注意: SPM 支持已在 1.20.0 版本中添加,此版本之前的标签将无法在 SPM 中解析。
安装 Aztec 后,导入模块并使用 Aztec.TextView
视图,如下所示
import Aztec
// ...
let textView = Aztec.TextView(
defaultFont: UIFont,
defaultParagraphStyle: ParagraphStyle = ParagraphStyle.default,
defaultMissingImage: UIImage) {
阅读我们的 贡献指南,了解有关报告问题、贡献代码以及更多贡献方式的信息。
如果您有关于设置的问题或者只是想打个招呼,请加入 WordPress Slack 并在 #mobile
频道上留言。
AztecEditor-iOS 和 WordPress-Editor-iOS 是受 Mozilla Public License Version 2.0 保护的开源项目。