apply renames suggested in PR review
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
757f811126
commit
901e402a5c
3 changed files with 12 additions and 12 deletions
|
@ -415,7 +415,7 @@ export const toRightOf = (elementRect, chevronOffset=12) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Placement method for <ContextMenu /> to position context menu right-aligned and flowing to the left of elementRect
|
// Placement method for <ContextMenu /> to position context menu right-aligned and flowing to the left of elementRect
|
||||||
export const aboveLeft = (elementRect, chevronFace="none") => {
|
export const aboveLeftOf = (elementRect, chevronFace="none") => {
|
||||||
const menuOptions = { chevronFace };
|
const menuOptions = { chevronFace };
|
||||||
|
|
||||||
const buttonRight = elementRect.right + window.pageXOffset;
|
const buttonRight = elementRect.right + window.pageXOffset;
|
||||||
|
|
|
@ -35,7 +35,7 @@ import ActiveWidgetStore from '../../../stores/ActiveWidgetStore';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import {IntegrationManagers} from "../../../integrations/IntegrationManagers";
|
import {IntegrationManagers} from "../../../integrations/IntegrationManagers";
|
||||||
import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore";
|
import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore";
|
||||||
import {aboveLeft, ContextMenu, ContextMenuButton} from "../../structures/ContextMenu";
|
import {aboveLeftOf, ContextMenu, ContextMenuButton} from "../../structures/ContextMenu";
|
||||||
import PersistedElement from "./PersistedElement";
|
import PersistedElement from "./PersistedElement";
|
||||||
|
|
||||||
const ALLOWED_APP_URL_SCHEMES = ['https:', 'http:'];
|
const ALLOWED_APP_URL_SCHEMES = ['https:', 'http:'];
|
||||||
|
@ -678,7 +678,7 @@ export default class AppTile extends React.Component {
|
||||||
|
|
||||||
const WidgetContextMenu = sdk.getComponent('views.context_menus.WidgetContextMenu');
|
const WidgetContextMenu = sdk.getComponent('views.context_menus.WidgetContextMenu');
|
||||||
contextMenu = (
|
contextMenu = (
|
||||||
<ContextMenu {...aboveLeft(elementRect, null)} onFinished={this._closeContextMenu}>
|
<ContextMenu {...aboveLeftOf(elementRect, null)} onFinished={this._closeContextMenu}>
|
||||||
<WidgetContextMenu
|
<WidgetContextMenu
|
||||||
onRevokeClicked={this._onRevokeClicked}
|
onRevokeClicked={this._onRevokeClicked}
|
||||||
onEditClicked={showEditButton ? this._onEditClick : undefined}
|
onEditClicked={showEditButton ? this._onEditClick : undefined}
|
||||||
|
|
|
@ -23,12 +23,12 @@ import { _t } from '../../../languageHandler';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import dis from '../../../dispatcher';
|
import dis from '../../../dispatcher';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
import {aboveLeft, ContextMenu, ContextMenuButton, useContextMenu} from '../../structures/ContextMenu';
|
import {aboveLeftOf, ContextMenu, ContextMenuButton, useContextMenu} from '../../structures/ContextMenu';
|
||||||
import { isContentActionable, canEditContent } from '../../../utils/EventUtils';
|
import { isContentActionable, canEditContent } from '../../../utils/EventUtils';
|
||||||
import {RoomContext} from "../../structures/RoomView";
|
import {RoomContext} from "../../structures/RoomView";
|
||||||
|
|
||||||
const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFocusChange}) => {
|
const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFocusChange}) => {
|
||||||
const [menuDisplayed, _button, openMenu, closeMenu] = useContextMenu();
|
const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onFocusChange(menuDisplayed);
|
onFocusChange(menuDisplayed);
|
||||||
}, [onFocusChange, menuDisplayed]);
|
}, [onFocusChange, menuDisplayed]);
|
||||||
|
@ -52,8 +52,8 @@ const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFo
|
||||||
e2eInfoCallback = onCryptoClick;
|
e2eInfoCallback = onCryptoClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttonRect = _button.current.getBoundingClientRect();
|
const buttonRect = button.current.getBoundingClientRect();
|
||||||
contextMenu = <ContextMenu {...aboveLeft(buttonRect)} onFinished={closeMenu}>
|
contextMenu = <ContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu}>
|
||||||
<MessageContextMenu
|
<MessageContextMenu
|
||||||
mxEvent={mxEvent}
|
mxEvent={mxEvent}
|
||||||
permalinkCreator={permalinkCreator}
|
permalinkCreator={permalinkCreator}
|
||||||
|
@ -71,7 +71,7 @@ const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFo
|
||||||
label={_t("Options")}
|
label={_t("Options")}
|
||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
isExpanded={menuDisplayed}
|
isExpanded={menuDisplayed}
|
||||||
inputRef={_button}
|
inputRef={button}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{ contextMenu }
|
{ contextMenu }
|
||||||
|
@ -79,13 +79,13 @@ const OptionsButton = ({mxEvent, getTile, getReplyThread, permalinkCreator, onFo
|
||||||
};
|
};
|
||||||
|
|
||||||
const ReactButton = ({mxEvent, reactions}) => {
|
const ReactButton = ({mxEvent, reactions}) => {
|
||||||
const [menuDisplayed, _button, openMenu, closeMenu] = useContextMenu();
|
const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu();
|
||||||
|
|
||||||
let contextMenu;
|
let contextMenu;
|
||||||
if (menuDisplayed) {
|
if (menuDisplayed) {
|
||||||
const buttonRect = _button.current.getBoundingClientRect();
|
const buttonRect = button.current.getBoundingClientRect();
|
||||||
const ReactionPicker = sdk.getComponent('emojipicker.ReactionPicker');
|
const ReactionPicker = sdk.getComponent('emojipicker.ReactionPicker');
|
||||||
contextMenu = <ContextMenu {...aboveLeft(buttonRect)} onFinished={closeMenu}>
|
contextMenu = <ContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu}>
|
||||||
<ReactionPicker mxEvent={mxEvent} reactions={reactions} onFinished={closeMenu} />
|
<ReactionPicker mxEvent={mxEvent} reactions={reactions} onFinished={closeMenu} />
|
||||||
</ContextMenu>;
|
</ContextMenu>;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ const ReactButton = ({mxEvent, reactions}) => {
|
||||||
label={_t("React")}
|
label={_t("React")}
|
||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
isExpanded={menuDisplayed}
|
isExpanded={menuDisplayed}
|
||||||
inputRef={_button}
|
inputRef={button}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{ contextMenu }
|
{ contextMenu }
|
||||||
|
|
Loading…
Reference in a new issue