fix: delete file

This commit is contained in:
JimQing 2020-07-05 11:31:03 +08:00
parent 10712bce17
commit 56d961d9fa
2 changed files with 8 additions and 30 deletions

View File

@ -1,23 +0,0 @@
// 左右栏同步滚动
$(document).ready(() => {
let timeout;
$('div.CodeMirror-scroll, #preview').on("scroll", function callback() {
clearTimeout(timeout);
let source = $(this),
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);
});
});

View File

@ -60,7 +60,7 @@ import {
} from '../scripts/util' } from '../scripts/util'
require('codemirror/mode/javascript/javascript') require('codemirror/mode/javascript/javascript')
import $ from 'jquery' // import $ from 'jquery'
import config from '../scripts/config' import config from '../scripts/config'
import {mapState, mapMutations} from 'vuex'; import {mapState, mapMutations} from 'vuex';
export default { export default {
@ -201,10 +201,12 @@ export default {
}, },
// //
leftAndRightScroll() { leftAndRightScroll() {
$('#preview').on('scroll', function callback() { const _this = this;
clearTimeout(this.timeout)
let source = $(this) document.getElementById('preview').addEventListener("scroll", function callback() {
clearTimeout(_this.timeout)
let source = $(_this)
let target = $(source.is('#preview') ? 'div.CodeMirror-scroll' : '#preview') let target = $(source.is('#preview') ? 'div.CodeMirror-scroll' : '#preview')
target.off('scroll') target.off('scroll')
@ -216,14 +218,13 @@ export default {
let height = percentage * (target0.scrollHeight - target0.offsetHeight) let height = percentage * (target0.scrollHeight - target0.offsetHeight)
target0.scrollTo(0, height) target0.scrollTo(0, height)
this.timeout = setTimeout(() => { _this.timeout = setTimeout(() => {
target.on('scroll', callback) target.on('scroll', callback)
}, 100) }, 100)
}) }, true);
}, },
onEditorRefresh() { onEditorRefresh() {
this.editorRefresh(); this.editorRefresh();
// setTimeout(()=> PR.prettyPrint(), 0);
}, },
endCopy() { endCopy() {
this.backLight = false; this.backLight = false;