Skip to content

Commit

Permalink
custom_ul_symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
tangchi-looki committed Sep 5, 2024
1 parent 0357e94 commit d4c8fe1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Example/RZRichTextView/HowToUseDemo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public extension RZRichTextViewModel {

let viewModel = RZRichTextViewModel.init()
viewModel.canEdit = edit
viewModel.ulSymbol = ""
//viewModel.ulSymbol = "*"
viewModel.ulSymbolAlignment = .center

/// 链接颜色
viewModel.defaultLinkTypingAttributes = [.foregroundColor: UIColor.qhex(0x307bf6), .underlineColor: UIColor.qhex(0x307bf6), .underlineStyle: NSUnderlineStyle.styleSingle.rawValue]
/// 显示音频文件名字
Expand Down
3 changes: 2 additions & 1 deletion RZRichTextView/Classes/RZRichTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ public extension RZRichTextView {
index = 1
}
lastType = .ul
temp.append(("·", range, p, dict))
temp.append((viewModel.ulSymbol, range, p, dict))
} else {
lastType = .none
index = 0
Expand All @@ -648,6 +648,7 @@ public extension RZRichTextView {
.qfont((dict[.font] as? UIFont) ?? .systemFont(ofSize: 16))
.qtextColor((dict[.foregroundColor] as? UIColor) ?? .black)
.qtext("\(index)")
.qtextAliginment(viewModel.ulSymbolAlignment)
self.addSubview(view)
}
}
Expand Down
3 changes: 3 additions & 0 deletions RZRichTextView/Classes/RZRichTextViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ open class RZRichTextViewModel: NSObject {
/// 初始化的时候配置此项,在编辑过程中,如果想禁用编辑,直接设置textView.isEditable = false
open var canEdit: Bool = true

open var ulSymbol:String = "·"
open var ulSymbolAlignment:NSTextAlignment = .right

public override init() {
super.init()
/// 默认居左
Expand Down

0 comments on commit d4c8fe1

Please sign in to comment.