Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Abstract Editor Control #216

Merged
merged 19 commits into from Aug 18, 2016
Merged

Abstract Editor Control #216

merged 19 commits into from Aug 18, 2016

Conversation

mohdsayed
Copy link
Contributor

No description provided.

@mohdsayed mohdsayed changed the title [WIP] Abstract Editor Control Abstract Editor Control Aug 12, 2016
@mohdsayed
Copy link
Contributor Author

@westonruter The PR is ready for review. I have tested it with multiple editor controls combinations and did not find any issue. I tried to configure pre-commit hook but could not do it correctly, so sorry for the failed checks.

label: postTypeObj.labels.content_field ? postTypeObj.labels.content_field : api.Posts.data.l10n.fieldContentLabel,
active: true,
setting_property: 'post_content',
settings: {
'default': setting.id
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to see what possibilities there are for eliminating setting_property in favor of:

settings: {
    'default': setting.id + '[post_content]'
}

That would seem more elegant, but I think it will require a core change to support.

* Implement longstanding todo to improve how editor control extends the dynamic control.
* Move api.EditorControl to api.Posts.PostEditorControl
* Remove need to inject button since now part of template
* Eliminate use of propertyElements in favor of directly mutating the setting value.
* Eliminate isMeta in favor of being agnostic about what kind of setting is being modified.
* Store a reference to the main textarea and re-use.
@westonruter
Copy link
Contributor

@sayedwp this is ready for re-review. Could you give it a try with your integration?

@westonruter
Copy link
Contributor

westonruter commented Aug 18, 2016 via email

@mohdsayed
Copy link
Contributor Author

@westonruter Tested with my integration , works beautifully. 👍

@westonruter
Copy link
Contributor

@sayedwp I have a proposal for something which could help disambiguate when there are multiple fields that could have an editor open:

customize__wordpress_develop_5

This fixes something I noticed where I would forget what the open editor was for. If you like it, would you apply some style improvements?

@mohdsayed
Copy link
Contributor Author

@westonruter I was just going to say that, and I saw your commit 😄
I had given it a thought even before, when I was going to toggle the editor animation class. I was thinking to give it tabs ( only if there are more than one editor controls) just like browser tabs. But then it will take some 50-60px of space above the editor.

@westonruter
Copy link
Contributor

Probably shouldn't increase the overall height any. If the title is within the bar, could maybe some gray borders on either side make it feel more natural? Maybe tabs in the future of we allow more than one editor to be expanded at once.

@mohdsayed
Copy link
Contributor Author

Agree on not increasing the overall height. Will add some css to make it look natural.

@mohdsayed
Copy link
Contributor Author

@westonruter Is this looking good?

editor

The icons shows that its a standard post, as shown in post editor page

post-editor-page

@westonruter
Copy link
Contributor

westonruter commented Aug 18, 2016 via email

@mohdsayed
Copy link
Contributor Author

Yes, didn't think of that. And that also makes me think that why you have renamed it to "Post Editor Control" from "Editor Control"? I know it would primarily be used for post content however it would also be used for meta

@westonruter
Copy link
Contributor

@sayedwp good point. I guess the main reason why I went with “Post” editor is that “postmeta” is still specific to posts. Also, there is a specific integration with posts in the control (the control is presumed to be added to a Post section):

/**
* Unlink the editor from this post and collapse the editor when the section is collapsed.
*/
section.expanded.bind( function( expanded ) {
if ( expanded ) {
api.Posts.postIdInput.val( section.params.post_id || false );
} else {
api.Posts.postIdInput.val( '' );
control.expanded.set( false );
}
} );

@westonruter
Copy link
Contributor

westonruter commented Aug 18, 2016

Also, I think there should be a more generic EditorControl as well, eventually. Perhaps we can eventually make PostEditorControl extend this base EditorControl.

@mohdsayed
Copy link
Contributor Author

That would make more sense.

@westonruter
Copy link
Contributor

@sayedwp cool, once you've pushed up the style changes to the editor title, I think this is good to merge.

@mohdsayed
Copy link
Contributor Author

@westonruter Great, lets merge it.

@westonruter
Copy link
Contributor

@sayedwp I did some more cleanup of the JS and added a feature where the new editor heading will only show up if there is more than one editor control in a section. If there is only the content editor control, then there would be no need to disambiguate with other controls in the section.

@westonruter westonruter merged commit e647acf into develop Aug 18, 2016
@westonruter westonruter added this to the 0.8 milestone Aug 18, 2016
@westonruter westonruter deleted the feature/editor-control branch August 18, 2016 21:52
@valendesigns
Copy link
Contributor

The weird tab you guys added, which I think looks really strange sitting in the middle there, doesn't include mobile styles. So when you scale the browser down you get this.

mobile-style-bug

@westonruter
Copy link
Contributor

@valendesigns the tab is there to give the user context as to what they are editing. It appears when there are multiple editor controls in a given section.

@sayedwp would you update the styling to factor in mobile?

@mohdsayed
Copy link
Contributor Author

Sure I will update that soon.

@valendesigns
Copy link
Contributor

@westonruter I understand why it was added but from a UX perspective it's misleading. It's not a tab at all. It doesn't bind events or navigate to anything. So to clear up context we've introduced confusion elsewhere. I think it would be better if we removed the tab style and just centered the text IMO. Thoughts?

@westonruter
Copy link
Contributor

I guess the idea is that the entire editor could be considered a tab and that's why that style was chosen. @sayedwp can you work out some non-tab styling for the heading?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants