-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Old style for classic block #4948
Conversation
Related: #4928. |
I'll copy over parts of the "inline" theme from TinyMCE in the next commit so we have more control. |
I don't really see a way of fixing the focus problem without having to copy over a significant amount of code to the classic block to overwrite the theme. It would be nicer if the inline theme just had a setting to show toolbars all the time instead of just when the editor is focussed. |
Or for |
Sorry I missed this. This is looking really good. Here's the toolbar issue in GIF form: It would be nice if we could address this, but it doesn't feel like the end of the world to me. Unless we can do some simple hack like run an onload focus for each classic block (hacky), I think it might be worth getting this in and iterating. |
@jasmussen I don't like the idea of manually moving around focus when the page initialises, but it could work... cc @afercia |
I can live without it, it'd just be nice if we could find a way to show the toolbar on the classic blocks from the start. But can live without it. |
d4ae3e6
to
5cd805a
Compare
Rebased, hopefully the error is gone. Also added the focus and attempted to reset focus to the previous element, but for some reason it still has the caret in the last classic block... TBH I can live with this so the UI shows up while we wait for a setting in TinyMCE. |
5cd805a
to
a90e66f
Compare
What we could do is to add a new way of initializing the editor. Currently there is inline and iframe mode what's needed here is some form of inplace editing where a div is converted to contenteditable and the ui is appended before that target element. Not exactly sure how that should be exposed though the api though. But this is something we have seen people asking for before being able to convert div elements to editors but have the ui in place and not hide on blur. |
I feel like maybe we should merge this in as is, and then open a separate ticket based on #4948 (comment). Thoughts, @gziolo @karmatosed ? |
Seems like a very solid plan @jasmussen. |
Have you tested it with more than one instance of the classic editor? |
As I expected, the focus stays in the last Classic block in the document after it gets loaded. I don't think this is an expected behavior. We should look into an alternative solution to make this work. |
@gziolo See the PR description and comments. No easy solution. Maybe we should just keep on hiding it for now and only update the styles. |
Yes, let’s do the tweak with styles first. I think we can also test if showing always the border for the classic block would be sufficient. Maybe we don’t need this toolbar when block is not selected. |
Another idea, after checking the screencast from @jasmussen. Would it help to add a placeholder for the toolbar to avoid this flickering effect? |
By the way, can we add an icon to convert to blocks inside the toolbar? That would be awesome 😍 |
Both of those are good ideas. We have a hover label currently, perhaps that could be the "until you select" toolbar. |
a90e66f
to
4da48d7
Compare
@jasmussen @gziolo Updated. This should be a lot better. Still not perfect as long as we can't create the toolbar immediately. |
Sure, but separately please :) |
Nice work Ella, here's a GIF: I pushed a little polish so it looks like this: That included removing the hover label. This label is likely to go through some iteration regardless, and perhaps become a drag handle, but once we do that it migh sit to the left instead of the top. With this latest polish, if you approve the code, I think this is good to go! Stellar work, excited to get this in! |
@jasmussen @gziolo Thanks for the changes and testing! |
Agreed with @jasmussen, this looks great and make it very clear that we are dealing with Classic block. Thanks for making all the adjustments to this PR, excellent job @iseulde 💯 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasmussen is fixing one more small UI glitch and we should merge 👍
blocks/library/freeform/editor.scss
Outdated
@@ -140,7 +140,7 @@ div[data-type="core/freeform"] .editor-block-contextual-toolbar + div { | |||
|
|||
.freeform-toolbar { | |||
width: auto; | |||
margin: - $block-padding; | |||
margin: -#{ $block-padding + 1 } -#{ $block-padding } -#{ $block-padding } -#{ $block-padding }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code deserves a comment. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂
On it in a minute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works, computes px value :)
So, turns out the past change was due to a rounding error, which I will look at separately. I reverted, so no comment necessary :) Good to go. |
Okay :) We can iterate in separate PRs :) |
🔥 🔥 🔥 🔥 |
Description
Fixes #4926. Gives the classic block the old look.
One problem: the toolbar will only start showing on first time focus. :( @spocke, would it be possible at all to add a setting to the modern/inline theme to always show the toolbar? It might also be good to make a separate "theme" for this as we're not using quite a bit of logic in it.
How Has This Been Tested?
Create a classic block.
Checklist: