diff --git a/packages/app-desktop/gui/ErrorBoundary.tsx b/packages/app-desktop/gui/ErrorBoundary.tsx index b7df358e1f..ebd5fbde8e 100644 --- a/packages/app-desktop/gui/ErrorBoundary.tsx +++ b/packages/app-desktop/gui/ErrorBoundary.tsx @@ -3,6 +3,8 @@ import versionInfo, { PackageInfo } from '@joplin/lib/versionInfo'; import PluginService, { Plugins } from '@joplin/lib/services/plugins/PluginService'; import Setting from '@joplin/lib/models/Setting'; import restart from '../services/restart'; +import BannerContent from './NoteEditor/WarningBanner/BannerContent'; +import { _ } from '@joplin/lib/locale'; const packageInfo: PackageInfo = require('../packageInfo.js'); const ipcRenderer = require('electron').ipcRenderer; @@ -30,6 +32,19 @@ interface Props { children: any; } +interface BannerProps { + isVisible: boolean; +} + +const SwitchToNewEditorBanner = (props: BannerProps) => Setting.setValue('editor.legacyMarkdown', false)} + visible={props.isVisible} +> + {_('The legacy Markdown editor might be incompatible with a number of plugins. We recommend using the new editor.')} +
+
; + export default class ErrorBoundary extends React.Component { public state: State = { error: null, errorInfo: null, pluginInfos: [], plugins: {} }; @@ -130,8 +145,11 @@ export default class ErrorBoundary extends React.Component { } } + const isLegacyEditorError = !!this.state.error.stack.includes('CodeMirror/v5'); + return (
+

Error

{this.renderMessage()}

To report the error, please copy the *entire content* of this page and post it on Joplin forum or GitHub.

diff --git a/packages/app-desktop/gui/NoteEditor/WarningBanner/BannerContent.tsx b/packages/app-desktop/gui/NoteEditor/WarningBanner/BannerContent.tsx index cc57f604e5..60cbdea05e 100644 --- a/packages/app-desktop/gui/NoteEditor/WarningBanner/BannerContent.tsx +++ b/packages/app-desktop/gui/NoteEditor/WarningBanner/BannerContent.tsx @@ -5,7 +5,7 @@ interface Props { children: React.ReactNode; acceptMessage: string; onAccept: ()=> void; - onDismiss: ()=> void; + onDismiss?: ()=> void; visible: boolean; } @@ -17,7 +17,7 @@ const BannerContent: React.FC = props => { return
{props.children}   [ {props.acceptMessage} ] -   [ {_('Dismiss')} ] +   { props.onDismiss ? [ {_('Dismiss')} ] : null }
; };