summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--public/js/index.js12
-rw-r--r--public/js/lib/editor/modeType.js11
-rw-r--r--public/js/syncscroll.js5
3 files changed, 15 insertions, 13 deletions
diff --git a/public/js/index.js b/public/js/index.js
index d28f4d6c..27b0295d 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -80,6 +80,7 @@ import { preventXSS } from './render'
import Editor from './lib/editor'
import getUIElements from './lib/editor/ui-elements'
+import modeType from './lib/editor/modeType'
var defaultTextHeight = 20
var viewportMargin = 20
@@ -226,17 +227,6 @@ var supportExtraTags = [
}
}
]
-window.modeType = {
- edit: {
- name: 'edit'
- },
- view: {
- name: 'view'
- },
- both: {
- name: 'both'
- }
-}
var statusType = {
connected: {
msg: 'CONNECTED',
diff --git a/public/js/lib/editor/modeType.js b/public/js/lib/editor/modeType.js
new file mode 100644
index 00000000..f3212105
--- /dev/null
+++ b/public/js/lib/editor/modeType.js
@@ -0,0 +1,11 @@
+export default {
+ edit: {
+ name: 'edit'
+ },
+ view: {
+ name: 'view'
+ },
+ both: {
+ name: 'both'
+ }
+}
diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js
index c227f83f..ad21e57b 100644
--- a/public/js/syncscroll.js
+++ b/public/js/syncscroll.js
@@ -5,6 +5,7 @@
import markdownitContainer from 'markdown-it-container'
import { md } from './extra'
+import modeType from './lib/editor/modeType'
function addPart (tokens, idx) {
if (tokens[idx].map && tokens[idx].level === 0) {
@@ -228,7 +229,7 @@ function buildMapInner (callback) {
let viewScrollingTimer = null
export function syncScrollToEdit (event, preventAnimate) {
- if (window.currentMode !== window.modeType.both || !window.syncscroll || !editArea) return
+ if (window.currentMode !== modeType.both || !window.syncscroll || !editArea) return
if (window.preventSyncScrollToEdit) {
if (typeof window.preventSyncScrollToEdit === 'number') {
window.preventSyncScrollToEdit--
@@ -310,7 +311,7 @@ function viewScrollingTimeoutInner () {
let editScrollingTimer = null
export function syncScrollToView (event, preventAnimate) {
- if (window.currentMode !== window.modeType.both || !window.syncscroll || !viewArea) return
+ if (window.currentMode !== modeType.both || !window.syncscroll || !viewArea) return
if (window.preventSyncScrollToView) {
if (typeof preventSyncScrollToView === 'number') {
window.preventSyncScrollToView--