diff --git a/app/components/Button.js b/app/components/Button.js index 14b878a9..7f434f37 100644 --- a/app/components/Button.js +++ b/app/components/Button.js @@ -102,7 +102,7 @@ export const Inner = styled.span` line-height: ${(props) => (props.hasIcon ? 24 : 32)}px; justify-content: center; align-items: center; - min-height: 30px; + min-height: 32px; ${(props) => props.hasIcon && props.hasText && "padding-left: 4px;"}; ${(props) => props.hasIcon && !props.hasText && "padding: 0 4px;"}; diff --git a/app/components/Editor.js b/app/components/Editor.js index ee5f1c90..67d0cce4 100644 --- a/app/components/Editor.js +++ b/app/components/Editor.js @@ -172,6 +172,10 @@ const StyledEditor = styled(RichMarkdownEditor)` font-weight: 500; } + .heading-anchor { + box-sizing: border-box; + } + .heading-name { pointer-events: none; } diff --git a/app/scenes/Document/components/DataLoader.js b/app/scenes/Document/components/DataLoader.js index 46cdcdca..91278f43 100644 --- a/app/scenes/Document/components/DataLoader.js +++ b/app/scenes/Document/components/DataLoader.js @@ -240,13 +240,11 @@ class DataLoader extends React.Component { } const abilities = policies.abilities(document.id); - const key = this.isEditing ? "editing" : "read-only"; return ( {this.isEditing && } { @observable title: string = this.props.document.title; getEditorText: () => string = () => this.props.document.text; - componentDidMount() { - this.updateIsDirty(); - } - componentDidUpdate(prevProps) { const { auth, document } = this.props; + if (prevProps.readOnly && !this.props.readOnly) { + this.updateIsDirty(); + } + if (this.props.readOnly) { this.lastRevision = document.revision; @@ -440,7 +440,7 @@ class DocumentScene extends React.Component { ui={this.props.ui} /> - {readOnly && !isShare && !revision && ( + {!isShare && !revision && ( <> diff --git a/app/scenes/Document/components/Header.js b/app/scenes/Document/components/Header.js index 5c272c4a..c775ea8a 100644 --- a/app/scenes/Document/components/Header.js +++ b/app/scenes/Document/components/Header.js @@ -12,7 +12,7 @@ import { import { transparentize, darken } from "polished"; import * as React from "react"; import { withTranslation, Trans, type TFunction } from "react-i18next"; -import { Redirect } from "react-router-dom"; +import { Link } from "react-router-dom"; import styled from "styled-components"; import breakpoint from "styled-components-breakpoint"; import AuthStore from "stores/AuthStore"; @@ -63,7 +63,6 @@ type Props = { class Header extends React.Component { @observable isScrolled = false; @observable showShareModal = false; - @observable redirectTo: ?string; componentDidMount() { window.addEventListener("scroll", this.handleScroll); @@ -79,18 +78,6 @@ class Header extends React.Component { handleScroll = throttle(this.updateIsScrolled, 50); - handleEdit = () => { - this.redirectTo = editDocumentUrl(this.props.document); - }; - - handleNewFromTemplate = () => { - const { document } = this.props; - - this.redirectTo = newDocumentUrl(document.collectionId, { - templateId: document.id, - }); - }; - handleSave = () => { this.props.onSave({ done: true }); }; @@ -118,8 +105,6 @@ class Header extends React.Component { }; render() { - if (this.redirectTo) return ; - const { shares, document, @@ -276,8 +261,9 @@ class Header extends React.Component { placement="bottom" >