diff --git a/src/Common.js b/src/Common.js
index f0d8992a..1db4c678 100644
--- a/src/Common.js
+++ b/src/Common.js
@@ -195,7 +195,7 @@ export class ClickHandler extends PureComponent {
return (
+ onClick={this.on_end_bound} >
{this.props.children}
)
diff --git a/src/Flows.js b/src/Flows.js
index 3203cf10..b6a361f1 100644
--- a/src/Flows.js
+++ b/src/Flows.js
@@ -281,7 +281,7 @@ class FlowSidebar extends PureComponent {
}
show_reply_bar(name,event) {
- if(this.reply_ref.current && event.target.tagName.toLowerCase()!=='a') {
+ if(this.reply_ref.current && !event.target.closest('a')) {
let text=this.reply_ref.current.get();
if(/^\s*(Re (洞主|\b[A-Z][a-z]+){0,2}:)?\s*$/.test(text)) {// text is nearly empty so we can replace it
let should_text='Re '+name+': ';
diff --git a/src/Sidebar.css b/src/Sidebar.css
index 9841c483..b6ebe3f3 100644
--- a/src/Sidebar.css
+++ b/src/Sidebar.css
@@ -1,4 +1,5 @@
.sidebar-shadow {
+ will-change: opacity;
opacity: 0;
background-color: black;
pointer-events: none;
@@ -27,6 +28,7 @@
}
.sidebar, .sidebar-title {
+ will-change: left;
left: 100%;
transition: left 150ms ease-out;
z-index: 21;
diff --git a/src/Sidebar.js b/src/Sidebar.js
index e5beeb98..571b2eb9 100644
--- a/src/Sidebar.js
+++ b/src/Sidebar.js
@@ -1,17 +1,29 @@
-import React, {Component} from 'react';
+import React, {Component, PureComponent} from 'react';
import './Sidebar.css';
-export function Sidebar(props) {
- return (
-
-
-
- {props.content}
-
-
-
- {props.title}
+export class Sidebar extends PureComponent {
+ constructor(props) {
+ super(props);
+ this.sidebar_ref=React.createRef();
+ }
+
+ componentWillReceiveProps(nextProps) {
+ //console.log('sidebar top');
+ this.sidebar_ref.current.scrollTo(0,0);
+ }
+
+ render() {
+ return (
+
+
+
+ {this.props.content}
+
+
-
- );
+ );
+ }
}
\ No newline at end of file
diff --git a/src/Title.js b/src/Title.js
index 44c911a3..ff5d3daf 100644
--- a/src/Title.js
+++ b/src/Title.js
@@ -138,7 +138,7 @@ class ControlBar extends PureComponent {
this.props.show_sidebar(
'发表树洞',
{
- this.props.show_sidebar('',null);
+ this.props.show_sidebar(null,null);
this.do_refresh();
}} />
)
diff --git a/src/UserAction.css b/src/UserAction.css
index aca6ff64..620c41b6 100644
--- a/src/UserAction.css
+++ b/src/UserAction.css
@@ -10,7 +10,7 @@
}
.reply-sticky {
position: sticky;
- bottom: 1em;
+ bottom: 0;
}
.reply-form textarea {
diff --git a/src/UserAction.js b/src/UserAction.js
index aad49c99..af15737b 100644
--- a/src/UserAction.js
+++ b/src/UserAction.js
@@ -107,7 +107,7 @@ export class LoginForm extends Component {
set_token(token);
})
.catch((e)=>{
- alert('Token检验失败');
+ alert('Token检验失败\n'+e);
this.setState({
loading_status: 'done',
});
diff --git a/src/index.css b/src/index.css
index 22cf5286..61bea1fa 100644
--- a/src/index.css
+++ b/src/index.css
@@ -50,7 +50,7 @@ audio {
}
pre {
- white-space: pre-wrap;
+ white-space: pre-line;
}
button, .button {