-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Text and Underline annotation support (#809)
- Loading branch information
1 parent
bc61215
commit 0802b12
Showing
56 changed files
with
1,514 additions
and
653 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Zotero/Controllers/Database/Requests/EditAnnotationFontSizeDbRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// EditAnnotationFontSizeDbRequest.swift | ||
// Zotero | ||
// | ||
// Created by Michal Rentka on 01.08.2023. | ||
// Copyright © 2023 Corporation for Digital Scholarship. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import RealmSwift | ||
|
||
struct EditAnnotationFontSizeDbRequest: DbRequest { | ||
let key: String | ||
let libraryId: LibraryIdentifier | ||
let size: UInt | ||
|
||
var needsWrite: Bool { return true } | ||
|
||
func process(in database: Realm) throws { | ||
guard let item = database.objects(RItem.self).filter(.key(self.key, in: self.libraryId)).first else { return } | ||
|
||
let field: RItemField | ||
if let _field = item.fields.filter(.key(FieldKeys.Item.Annotation.Position.fontSize)).first { | ||
field = _field | ||
} else { | ||
field = RItemField() | ||
field.key = FieldKeys.Item.Annotation.Position.fontSize | ||
field.baseKey = FieldKeys.Item.Annotation.position | ||
item.fields.append(field) | ||
} | ||
|
||
field.value = "\(self.size)" | ||
item.changeType = .user | ||
item.changes.append(RObjectChange.create(changes: RItemChanges.fields)) | ||
} | ||
} |
Oops, something went wrong.