From d62d1d670b1f718010f9ef1af9b19fee820b088b Mon Sep 17 00:00:00 2001 From: David Nagle Date: Fri, 26 Oct 2018 11:17:06 -0700 Subject: [PATCH] Added option to disable scroll sync. --- browser/components/MarkdownSplitEditor.js | 2 ++ browser/main/lib/ConfigManager.js | 1 + browser/main/modals/PreferencesModal/UiTab.js | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/browser/components/MarkdownSplitEditor.js b/browser/components/MarkdownSplitEditor.js index 7d01e3b53..ca2d31087 100644 --- a/browser/components/MarkdownSplitEditor.js +++ b/browser/components/MarkdownSplitEditor.js @@ -30,6 +30,8 @@ class MarkdownSplitEditor extends React.Component { } handleScroll (e) { + if (!this.props.config.preview.scrollSync) return + const previewDoc = _.get(this, 'refs.preview.refs.root.contentWindow.document') const codeDoc = _.get(this, 'refs.code.editor.doc') let srcTop, srcHeight, targetTop, targetHeight diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index 33cab7aac..021ea5cc7 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -62,6 +62,7 @@ export const DEFAULT_CONFIG = { latexBlockClose: '$$', plantUMLServerAddress: 'http://www.plantuml.com/plantuml', scrollPastEnd: false, + scrollSync: true, smartQuotes: true, breaks: true, smartArrows: false, diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index 638fab90b..6a9abe656 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -104,6 +104,7 @@ class UiTab extends React.Component { latexBlockClose: this.refs.previewLatexBlockClose.value, plantUMLServerAddress: this.refs.previewPlantUMLServerAddress.value, scrollPastEnd: this.refs.previewScrollPastEnd.checked, + scrollSync: this.refs.previewScrollSync.checked, smartQuotes: this.refs.previewSmartQuotes.checked, breaks: this.refs.previewBreaks.checked, smartArrows: this.refs.previewSmartArrows.checked, @@ -561,6 +562,16 @@ class UiTab extends React.Component { {i18n.__('Allow preview to scroll past the last line')} +
+ +