-
Notifications
You must be signed in to change notification settings - Fork 710
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
ContextMenu: add a css class to entries #10351
base: master
Are you sure you want to change the base?
Conversation
There is the |
Hiding say "Insert Comment" context menu entry can be achieved with CSS: li:has(.insert-comment) + li.context-menu-separator {
/* hide the next separator /*
display: none;
}
li:has(.insert-comment)
{
/* hides the line that has the insert-comment action */
display: none;
} |
In |
the |
The itemName here is not an uno command but some descriptive text from translation: I could work with the uno-command, and use then the "insert-annotation" class instead. It would be consistent with the rest of the logic. This function reuses same entries for different actions, I don't think it matches well my need:
Since |
087fc77
to
c3d00e3
Compare
Updated to use the more stable uno command as class, i.e InsertAnnotation => insert-annotation |
LGTM but I think this should have a ack from someone on the dev team. |
multiple asserts failing https://cpci.cbg.collabora.co.uk:8080/job/github_online_master_debug_vs_co-24.04_cypress_desktop/2211/consoleFull but all of them seem unrelated (Calc: address input or calc paste). Pressing retry |
@pedropintosilva CI passed (finally), there was spurious build issue |
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.
thanks this is a very good idea so, we can then if needed emphasize certain context menu entries etc!
The possible issue I see is that I don't follow why we need toSnakeCase
or at least why we need the replacement of ...
. As far as I understand commandName never has ...
. The item.text on the other hand can have ellipsis but you are anyhow already commandName
Could we put in the commit message some explanation? what exactly do we want to achieve here?
As I assume it is for icon? |
@@ -309,9 +309,13 @@ L.Control.ContextMenu = L.Control.extend({ | |||
itemName = _UNO(item.command, docType, true); | |||
} | |||
|
|||
var toSnakeCase = function (text) { | |||
return text.replace(/[ _]/gi, '-').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase().replace('...', ''); |
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.
what if we have more than 2 words? or single one?
can't we just do split
and then join
?
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.
'/g' ensures it applies on all the string:
toSnakeCase("InserAnnotationTest")
=> "inser-annotation-test"
toSnakeCase("Insert test")
=> "insert-test"
toSnakeCase("Insert")
=> "insert"
The '...' is the remnant of previous design. |
Context menu entries will now get a class corresponding to the uno command name associated, in a snake-case format. I.e InsertAnnotation => insert-annotation This allows to change style individual context menu entry or even remove them. Signed-off-by: Méven Car <[email protected]> Change-Id: I71ce81efcbbb0c6a57d808d5f5d0e691567dfad5
c3d00e3
to
25d6058
Compare
I have added to the commit text:
The current focus of this is to be able to hide context menu entries through CSS. Note: We will need to have a filter for contextMenu entries following |
Change-Id: I71ce81efcbbb0c6a57d808d5f5d0e691567dfad5
Summary
Context menu entries will now get a class corresponding to the uno
command name associated, in a snake-case format.
I.e InsertAnnotation => insert-annotation
This allows to change style individual context menu entry or even remove them.
Checklist
make prettier-write
and formatted the code.make run
and manually verified that everything looks okay