Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d162e02

Browse files
Add message right click context menu v2 (#5672)
* migrate the message context menu to IconizedContextMenu Signed-off-by: Michael Weimann <[email protected]> * migrate the message context menu to IconizedContextMenu Signed-off-by: Michael Weimann <[email protected]> * Added right-click menu Signed-off-by: Šimon Brandner <[email protected]> * add message context menu group keys Signed-off-by: Michael Weimann <[email protected]> * add message context menu icons Signed-off-by: Michael Weimann <[email protected]> * add _MessageContextMenu.scss license header Signed-off-by: Michael Weimann <[email protected]> * use null vars for context menu lists * Add allowOverridingNativeContextMenus() Signed-off-by: Šimon Brandner <[email protected]> * Use allowOverridingNativeContextMenus() Signed-off-by: Šimon Brandner <[email protected]> * Fix types Signed-off-by: Šimon Brandner <[email protected]> * Fix types Signed-off-by: Šimon Brandner <[email protected]> * Remove mistaken line Signed-off-by: Šimon Brandner <[email protected]> * Fix styling Signed-off-by: Šimon Brandner <[email protected]> * InputHTMLAttributes -> AllHTMLAttributes Signed-off-by: Šimon Brandner <[email protected]> * Convert to TS Signed-off-by: Šimon Brandner <[email protected]> * Add some types Signed-off-by: Šimon Brandner <[email protected]> * Make onClick optional Signed-off-by: Šimon Brandner <[email protected]> * Add rightClick prop Signed-off-by: Šimon Brandner <[email protected]> * Add copy button Signed-off-by: Šimon Brandner <[email protected]> * What about upgrading deps after the eslint migration, Simon? Signed-off-by: Šimon Brandner <[email protected]> * Add edit button Signed-off-by: Šimon Brandner <[email protected]> * fix Signed-off-by: Šimon Brandner <[email protected]> * Add reply button Signed-off-by: Šimon Brandner <[email protected]> * Add react button Signed-off-by: Šimon Brandner <[email protected]> * Cleanup render() Signed-off-by: Šimon Brandner <[email protected]> * Fix comments Signed-off-by: Šimon Brandner <[email protected]> * Add save button Signed-off-by: Šimon Brandner <[email protected]> * Don't show context menu if editing Signed-off-by: Šimon Brandner <[email protected]> * Add special handling for click a timestamp Signed-off-by: Šimon Brandner <[email protected]> * Fix double empty line Signed-off-by: Šimon Brandner <[email protected]> * Don't show context menu for images Signed-off-by: Šimon Brandner <[email protected]> * Cleanup Signed-off-by: Šimon Brandner <[email protected]> * Fix order Signed-off-by: Šimon Brandner <[email protected]> * Keep action bar shown when right-clicking Signed-off-by: Šimon Brandner <[email protected]> * Highlight event tile when right-clicking Signed-off-by: Šimon Brandner <[email protected]> * Delint Signed-off-by: Šimon Brandner <[email protected]> * Pointless change so that I can re-run the CI Signed-off-by: Šimon Brandner <[email protected]> * Remove dowload button Because we don't use this menu when clicking on images Signed-off-by: Šimon Brandner <[email protected]> * Be more clear for non-bools Signed-off-by: Šimon Brandner <[email protected]> * Use triggerOnMouse down prop Signed-off-by: Šimon Brandner <[email protected]> * Remove a comment Signed-off-by: Šimon Brandner <[email protected]> * Remove unused var Signed-off-by: Šimon Brandner <[email protected]> * Remove unnecessary import Signed-off-by: Šimon Brandner <[email protected]> * Add some missing types Signed-off-by: Šimon Brandner <[email protected]> * Add missing type Signed-off-by: Šimon Brandner <[email protected]> * Remove unused import Signed-off-by: Šimon Brandner <[email protected]> * Add a missing type Signed-off-by: Šimon Brandner <[email protected]> * Fix types Signed-off-by: Šimon Brandner <[email protected]> * Fix types/naming Signed-off-by: Šimon Brandner <[email protected]> * Add missing current Signed-off-by: Šimon Brandner <[email protected]> * Remove unused var Signed-off-by: Šimon Brandner <[email protected]> * Fix editing and replying Signed-off-by: Šimon Brandner <[email protected]> * i18n Signed-off-by: Šimon Brandner <[email protected]> * Fix import Signed-off-by: Šimon Brandner <[email protected]> * Support right-click context menu for threads Signed-off-by: Šimon Brandner <[email protected]> * Make button order match `MessageActionBar` Signed-off-by: Šimon Brandner <[email protected]> * Fix missing permalink button Signed-off-by: Šimon Brandner <[email protected]> * Remove useless part of if statement Signed-off-by: Šimon Brandner <[email protected]> * Some small refactoring for consistency Signed-off-by: Šimon Brandner <[email protected]> * Some more refactoring Signed-off-by: Šimon Brandner <[email protected]> * Fix `editEvent()` call Signed-off-by: Šimon Brandner <[email protected]> * Make editing polls work Signed-off-by: Šimon Brandner <[email protected]> * Fix collapse reply chain button Signed-off-by: Šimon Brandner <[email protected]> * Fix timelineRenderingType Signed-off-by: Šimon Brandner <[email protected]> * Fix reply button Signed-off-by: Šimon Brandner <[email protected]> * Hide right-click context menu behind a labs flag Signed-off-by: Šimon Brandner <[email protected]> * Add missing return type Signed-off-by: Šimon Brandner <[email protected]> * Make `contextMene` optional Signed-off-by: Šimon Brandner <[email protected]> * Move `renderContextMenu()` Signed-off-by: Šimon Brandner <[email protected]> * Simplify `renderContextMenu()` Signed-off-by: Šimon Brandner <[email protected]> * Improve `aboveLeftOf` typing Signed-off-by: Šimon Brandner <[email protected]> * Use `InputHTMLAttributes` Signed-off-by: Šimon Brandner <[email protected]> * Disable message right-click context menu in browser (for now) Signed-off-by: Šimon Brandner <[email protected]> * Give permalink button more props Signed-off-by: Šimon Brandner <[email protected]> Co-authored-by: Michael Weimann <[email protected]>
1 parent 77b0add commit d162e02

File tree

9 files changed

+410
-125
lines changed

9 files changed

+410
-125
lines changed

res/css/views/context_menus/_MessageContextMenu.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ limitations under the License.
9090
mask-image: url('$(res)/img/element-icons/room/pin.svg');
9191
}
9292

93+
.mx_MessageContextMenu_iconCopy::before {
94+
mask-image: url($copy-button-url);
95+
}
96+
97+
.mx_MessageContextMenu_iconEdit::before {
98+
mask-image: url('$(res)/img/element-icons/room/message-bar/edit.svg');
99+
}
100+
101+
.mx_MessageContextMenu_iconReply::before {
102+
mask-image: url('$(res)/img/element-icons/room/message-bar/reply.svg');
103+
}
104+
105+
.mx_MessageContextMenu_iconReact::before {
106+
mask-image: url('$(res)/img/element-icons/room/message-bar/emoji.svg');
107+
}
108+
93109
.mx_MessageContextMenu_iconViewInRoom::before {
94110
mask-image: url('$(res)/img/element-icons/view-in-room.svg');
95111
}

src/BasePlatform.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ export default abstract class BasePlatform {
145145
return false;
146146
}
147147

148+
/**
149+
* Returns true if platform allows overriding native context menus
150+
*/
151+
public allowOverridingNativeContextMenus(): boolean {
152+
return false;
153+
}
154+
148155
/**
149156
* Returns true if the platform supports displaying
150157
* notifications, otherwise false.

src/components/structures/ContextMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ export type AboveLeftOf = IPosition & {
429429
// Placement method for <ContextMenu /> to position context menu right-aligned and flowing to the left of elementRect,
430430
// and either above or below: wherever there is more space (maybe this should be aboveOrBelowLeftOf?)
431431
export const aboveLeftOf = (
432-
elementRect: DOMRect,
432+
elementRect: Pick<DOMRect, "right" | "top" | "bottom">,
433433
chevronFace = ChevronFace.None,
434434
vPadding = 0,
435435
): AboveLeftOf => {

0 commit comments

Comments
 (0)