Added expanding based on the option
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
7f727be4f6
commit
49dce58027
2 changed files with 15 additions and 2 deletions
|
@ -493,7 +493,6 @@ $left-gutter: 64px;
|
||||||
// https://github.com/vector-im/vector-web/issues/754
|
// https://github.com/vector-im/vector-web/issues/754
|
||||||
overflow-x: overlay;
|
overflow-x: overlay;
|
||||||
overflow-y: visible;
|
overflow-y: visible;
|
||||||
max-height: 30vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
|
@ -502,6 +501,12 @@ $left-gutter: 64px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_EventTile_content_collapsedCode {
|
||||||
|
pre {
|
||||||
|
max-height: 30vh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mx_EventTile:hover .mx_EventTile_body pre,
|
.mx_EventTile:hover .mx_EventTile_body pre,
|
||||||
.mx_EventTile.focus-visible:focus-within .mx_EventTile_body pre {
|
.mx_EventTile.focus-visible:focus-within .mx_EventTile_body pre {
|
||||||
border: 1px solid #e5e5e5; // deliberate constant as we're behind an invert filter
|
border: 1px solid #e5e5e5; // deliberate constant as we're behind an invert filter
|
||||||
|
|
|
@ -35,6 +35,7 @@ import {isPermalinkHost} from "../../../utils/permalinks/Permalinks";
|
||||||
import {toRightOf} from "../../structures/ContextMenu";
|
import {toRightOf} from "../../structures/ContextMenu";
|
||||||
import {copyPlaintext} from "../../../utils/strings";
|
import {copyPlaintext} from "../../../utils/strings";
|
||||||
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
export default class TextualBody extends React.Component {
|
export default class TextualBody extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -69,6 +70,7 @@ export default class TextualBody extends React.Component {
|
||||||
|
|
||||||
// track whether the preview widget is hidden
|
// track whether the preview widget is hidden
|
||||||
widgetHidden: false,
|
widgetHidden: false,
|
||||||
|
codeBlockExpanded: SettingsStore.getValue("expandCodeByDefault"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +436,12 @@ export default class TextualBody extends React.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultCaseClasses = classNames({
|
||||||
|
mx_MTextBody: true,
|
||||||
|
mx_EventTile_content: true,
|
||||||
|
mx_EventTile_content_collapsedCode: !this.state.codeBlockExpanded,
|
||||||
|
});
|
||||||
|
|
||||||
switch (content.msgtype) {
|
switch (content.msgtype) {
|
||||||
case "m.emote":
|
case "m.emote":
|
||||||
return (
|
return (
|
||||||
|
@ -459,7 +467,7 @@ export default class TextualBody extends React.Component {
|
||||||
);
|
);
|
||||||
default: // including "m.text"
|
default: // including "m.text"
|
||||||
return (
|
return (
|
||||||
<span className="mx_MTextBody mx_EventTile_content">
|
<span className={defaultCaseClasses}>
|
||||||
{ body }
|
{ body }
|
||||||
{ widgets }
|
{ widgets }
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue