Feature to change preview font size for plain/text files. #190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
First of all thank you for the app and server!
In short what this pr doing:
And details:
One of my way to use Seafile on iOS it's reading and editing text files. I am using iPhone SE and standard WebView font size sometimes very difficult to read so I decided to contribute a bit to the project.
This PR contains from 2 major parts:
View element that display quick settings for changing font size (it's small orange box on the right bottom corner with the arrow). I decided to create this instead of putting this to common settings for two reasons: the first one - I found it's not easy to understand philosophy of settings screen at all and the second is that's much more intuitive to change font size right in context of viewing a file.
The second part is about actually changing the font and storing it between app launches. For storing data I used
[NSUserDefaults standardUserDefaults]
but not sure if it's correct or not, because in some places app uses defaults for domain and in some - standard.For handling changes I added observer for this property in user defaults.
And for actually setting font size I used js string
document.body.style.fontSize = '%@';
in thewebView
. Sizes are provided in%
to reflect user defined settings for the system fonts and default value is100%
.Bugs: I found that with some sizes update did not work (for example when font size changed from 400% to 420% then to 440% e.t.c.) but after closing the view and opening it again it uses correct size. I am not sure why it happens, maybe some MobileSafari specific.
Best regards
Maks