Remove wider mode #999

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2021-02-02 23:13:31 +01:00 committed by GitHub
parent f7be49bbc3
commit 0180c75e55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 15 additions and 125 deletions

View file

@ -55,9 +55,7 @@ export const Cheatsheet: React.FC = () => {
<td>
<BasicMarkdownRenderer
content={code}
wide={false}
markdownIt={markdownIt}
/>
markdownIt={markdownIt}/>
</td>
<td className={'markdown-body'}>
<HighlightedCode code={code} wrapLines={true} startLineNumber={1} language={'markdown'}/>

View file

@ -8,7 +8,6 @@ import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { useLocation } from 'react-router'
import useMedia from 'use-media'
import { useApplyDarkMode } from '../../hooks/common/use-apply-dark-mode'
import { useDocumentTitleWithNoteTitle } from '../../hooks/common/use-document-title-with-note-title'
import { useNoteMarkdownContent } from '../../hooks/common/use-note-markdown-content'
@ -47,7 +46,6 @@ export const EditorPage: React.FC = () => {
useTranslation()
const { search } = useLocation()
const markdownContent = useNoteMarkdownContent()
const isWide = useMedia({ minWidth: 576 }, true)
const scrollSource = useRef<ScrollSource>(ScrollSource.EDITOR)
const editorMode: EditorMode = useSelector((state: ApplicationState) => state.editorConfig.editorMode)
@ -66,12 +64,6 @@ export const EditorPage: React.FC = () => {
}
}, [search])
useEffect(() => {
if (!isWide && editorMode === EditorMode.BOTH) {
setEditorMode(EditorMode.PREVIEW)
}
}, [editorMode, isWide])
const onMarkdownRendererScroll = useCallback((newScrollState: ScrollState) => {
if (scrollSource.current === ScrollSource.RENDERER && editorSyncScroll) {
setScrollState((old) => ({ editorScrollState: newScrollState, rendererScrollState: old.rendererScrollState }))
@ -128,7 +120,6 @@ export const EditorPage: React.FC = () => {
onTaskCheckedChange={SetCheckboxInMarkdownContent}
onFrontmatterChange={setNoteFrontmatter}
onScroll={onMarkdownRendererScroll}
wide={editorMode === EditorMode.PREVIEW}
scrollState={scrollState.rendererScrollState}/>
}
containerClassName={'overflow-hidden'}/>

View file

@ -23,7 +23,6 @@ export const RenderIframe: React.FC<MarkdownDocumentProps> = (
onFrontmatterChange,
scrollState,
onFirstHeadingChange,
wide,
onScroll,
onMakeScrollSource,
extraClasses
@ -46,8 +45,7 @@ export const RenderIframe: React.FC<MarkdownDocumentProps> = (
useEffect(() => iframeCommunicator.onSetScrollSourceToRenderer(onMakeScrollSource), [iframeCommunicator, onMakeScrollSource])
useEffect(() => iframeCommunicator.onTaskCheckboxChange(onTaskCheckedChange), [iframeCommunicator, onTaskCheckedChange])
useEffect(() => iframeCommunicator.onImageClicked(setLightboxDetails), [iframeCommunicator])
useEffect(() => iframeCommunicator.onRendererReady(() => setRendererReady(true)), [darkMode, iframeCommunicator, scrollState, wide])
useEffect(() => iframeCommunicator.onRendererReady(() => setRendererReady(true)), [darkMode, iframeCommunicator, scrollState])
useEffect(() => {
if (rendererReady) {
iframeCommunicator.sendSetDarkmode(darkMode)
@ -62,12 +60,6 @@ export const RenderIframe: React.FC<MarkdownDocumentProps> = (
}
}, [iframeCommunicator, rendererReady, scrollState])
useEffect(() => {
if (rendererReady) {
iframeCommunicator.sendSetWide(wide ?? false)
}
}, [iframeCommunicator, rendererReady, wide])
useEffect(() => {
if (rendererReady) {
iframeCommunicator.sendSetBaseUrl(window.location.toString())