Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a view props instead to update the currently selected formats #105

Closed
wants to merge 4 commits into from

Conversation

Tug
Copy link
Contributor

@Tug Tug commented Dec 21, 2018

This PR removes our existing formatting callbacks (onActiveFormatsChange and onActiveFormatAttributesChange ) and uses a view props (activeFormats) instead to update the currently selected formats.

With WordPress/gutenberg#12249 the formatting will be handled over to gutenberg's format-library and Aztec will be "mostly" rendering the HTML. However, we also want to be able to render formatted text without delay, thus we need Aztec to be able to edit a rich text directly without formatting changes while the text entered cycles back to RN.

FYI, this "feature" is added to the format-library PR with this commit.

I'm not a Swift programmer so I'm interested in your feedback and really welcome contributions on this one :)

Edit: Added an implementation for Android but it's currently buggy

@Tug Tug requested a review from koke December 21, 2018 14:07
@Tug Tug self-assigned this Dec 21, 2018
@Tug Tug added the enhancement New feature or request label Dec 21, 2018
@koke
Copy link
Member

koke commented Dec 21, 2018

We can't really remove those methods until the other PRs are merged, right?

@Tug
Copy link
Contributor Author

Tug commented Dec 21, 2018

Well we 'll need this merged for wordpress-mobile/gutenberg-mobile#275 but I haven't laid out a merge plan yet.

@objc var activeFormats: NSSet? = nil {
didSet {
let currentTypingAttributes = formattingIdentifiersForTypingAttributes()
for (key, value) in formatStringMap where currentTypingAttributes.contains(key) != activeFormats?.contains(value) {
Copy link
Member

@koke koke Dec 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit hard to follow but it seems this is adding any missing format to the typing attributes, but should it also be removing anything that's currently there and not in activeFormats?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's what it does, see apply() actually toggles a given format. It's a bit unfortunate that I didn't find any public method in Aztec to force set a format instead

@koke koke added the work-in-progress Work in progress (don't review, don'y merge) label Dec 21, 2018
@koke
Copy link
Member

koke commented Dec 21, 2018

OK, let's keep reviewing here but not merge until the other parts are ready

@Tug Tug force-pushed the update/active-formats-props branch from 743bc69 to 019e341 Compare December 26, 2018 13:52
@Tug Tug changed the title [iOS] Use a view props instead to update the currently selected formats Use a view props instead to update the currently selected formats Jan 6, 2019
@hypest
Copy link
Contributor

hypest commented Jan 21, 2019

We've folded this repo into gutenberg-mobile so, if this PR is still active please, migrate it to a PR on the gutenberg-mobile repo. Thanks!

@Tug Tug force-pushed the update/active-formats-props branch from f0e362a to b17db43 Compare January 21, 2019 17:07
@hypest hypest closed this Nov 10, 2020
@hypest hypest deleted the branch master November 10, 2020 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request work-in-progress Work in progress (don't review, don'y merge)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants