diff --git a/public/assets/scripts/sync-scroll.js b/public/assets/scripts/sync-scroll.js index c2f1231..6d386f8 100644 --- a/public/assets/scripts/sync-scroll.js +++ b/public/assets/scripts/sync-scroll.js @@ -1,23 +1,4 @@ // 左右栏同步滚动 $(document).ready(() => { - let timeout - $('div.CodeMirror-scroll, #preview').on('scroll', function callback () { - clearTimeout(timeout) - let source = $(this) - let target = $(source.is('#preview') ? 'div.CodeMirror-scroll' : '#preview') - - target.off('scroll') - - let source0 = source[0] - let target0 = target[0] - - let percentage = source0.scrollTop / (source0.scrollHeight - source0.offsetHeight) - let height = percentage * (target0.scrollHeight - target0.offsetHeight) - target0.scrollTo(0, height) - - timeout = setTimeout(() => { - target.on('scroll', callback) - }, 100) - }) }) diff --git a/public/index.html b/public/index.html index fdf725d..8148158 100644 --- a/public/index.html +++ b/public/index.html @@ -71,7 +71,7 @@ - + diff --git a/src/main.js b/src/main.js index df1375a..9c083f7 100644 --- a/src/main.js +++ b/src/main.js @@ -5,7 +5,9 @@ import store from './store' import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' import './element' - +import 'codemirror/lib/codemirror.css'; +import "codemirror/theme/ambiance.css"; +import "codemirror/addon/hint/show-hint.css"; Vue.use(ElementUI) Vue.config.productionTip = false