Skip to content

Commit

Permalink
Remove any formatting from item note editor title
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak committed Aug 10, 2024
1 parent cf97c8f commit 5d18d2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Zotero/Scenes/General/NoteEditorCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ final class NoteEditorCoordinator: NSObject, Coordinator {
let state = NoteEditorState(kind: kind, library: library, title: title, text: initialText, tags: initialTags)
let handler = NoteEditorActionHandler(dbStorage: dbStorage, schemaController: controllers.schemaController, saveCallback: saveCallback)
let viewModel = ViewModel(initialState: state, handler: handler)
let controller = NoteEditorViewController(viewModel: viewModel)
let controller = NoteEditorViewController(viewModel: viewModel, htmlAttributedStringConverter: controllers.htmlAttributedStringConverter)
controller.coordinatorDelegate = self
navigationController?.setViewControllers([controller], animated: animated)
}
Expand Down
6 changes: 4 additions & 2 deletions Zotero/Scenes/General/Views/NoteEditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final class NoteEditorViewController: UIViewController {

private static let jsHandler: String = "textHandler"
private let viewModel: ViewModel<NoteEditorActionHandler>
private unowned let htmlAttributedStringConverter: HtmlAttributedStringConverter
private let disposeBag: DisposeBag

private var debounceDisposeBag: DisposeBag?
Expand All @@ -32,8 +33,9 @@ final class NoteEditorViewController: UIViewController {
}
}

init(viewModel: ViewModel<NoteEditorActionHandler>) {
init(viewModel: ViewModel<NoteEditorActionHandler>, htmlAttributedStringConverter: HtmlAttributedStringConverter) {
self.viewModel = viewModel
self.htmlAttributedStringConverter = htmlAttributedStringConverter
disposeBag = DisposeBag()
super.init(nibName: "NoteEditorViewController", bundle: nil)
}
Expand All @@ -46,7 +48,7 @@ final class NoteEditorViewController: UIViewController {
super.viewDidLoad()

if let data = viewModel.state.title {
navigationItem.titleView = NoteEditorTitleView(type: data.type, title: data.title)
navigationItem.titleView = NoteEditorTitleView(type: data.type, title: htmlAttributedStringConverter.convert(text: data.title).string)
}

view.backgroundColor = .systemBackground
Expand Down

0 comments on commit 5d18d2b

Please sign in to comment.