diff --git a/core/factory.php b/core/factory.php index cdfc22e..7794018 100644 --- a/core/factory.php +++ b/core/factory.php @@ -172,7 +172,7 @@ class Editor - + - + - `),$(".cm-modal__wrapper-footer--cancle, .cm-modal__wrapper-header--close").on("click",()=>$(".cm-modal").removeClass("active")),$(".cm-modal__wrapper-footer--confirm").on("click",()=>{this.options.confirm(),$(".cm-modal").removeClass("active")})}_openModal(t={}){this.options=Object.assign({title:"提示",innerHtml:"内容",hasFooter:!0,confirm:()=>{},handler:()=>{}},t),$(".cm-modal__wrapper-header--text").html(this.options.title),$(".cm-modal__wrapper-bodyer").html(this.options.innerHtml),this.options.hasFooter?$(".cm-modal__wrapper-footer").show():$(".cm-modal__wrapper-footer").hide(),$(".cm-modal").addClass("active"),this.options.handler()}_getLineCh(t){var e=t.state.selection.main.head;return e-t.state.doc.lineAt(e).from}_replaceSelection(t,e){t.dispatch(t.state.replaceSelection(e))}_setCursor(t,e){t.dispatch({selection:{anchor:e}})}_getSelection(t){return t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to)}_insetAmboText(t,e){var i=t.state.selection.main.head,n=this._getSelection(t);this._replaceSelection(t,` ${e+n+e} `),""===n&&this._setCursor(t,i+e.length+1),t.focus()}_createTableLists(s,t,o="",a){$.ajax({url:t,dataType:"json",success:t=>{let e="",i="";for(var n in t){const r=t[n].split(" ");e+=`
${n}
`,i+=`
${r.map(t=>`
${t}
`).join(" ")}
`}this._openModal({title:a,hasFooter:!1,innerHtml:`
${e}
${i}`,handler:()=>{$(".cm-modal__wrapper-bodyer .tabbar-item").on("click",function(){const t=$(this);var e=t.attr("data-show");const i=$(".cm-modal__wrapper-bodyer .tabbar");t.addClass("active").siblings().removeClass("active"),i.stop().animate({scrollLeft:t[0].offsetLeft-i[0].offsetWidth/2+t[0].offsetWidth/2-15}),$(".cm-modal__wrapper-bodyer .lists").removeClass("active"),$(".cm-modal__wrapper-bodyer .lists[data-show='"+e+"']").addClass("active")});const e=this;$(".cm-modal__wrapper-bodyer .lists-item").on("click",function(){var t=$(this).attr("data-text");e._replaceSelection(s,` ${t} `),$(".cm-modal").removeClass("active"),s.focus()})}})}})}handleFullScreen(t){t.toggleClass("active"),$("body").toggleClass("fullscreen"),$(".cm-container").toggleClass("fullscreen"),$(".cm-preview").width(0)}handlePublish(){$("#btn-submit").click()}handleUndo(t){So(t),t.focus()}handleRedo(t){Po(t),t.focus()}handleIndent(t){this._replaceSelection(t," "),t.focus()}handleTime(t){const e=new Date;var i=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,0),r=String(e.getDate()).padStart(2,0),s=String(e.getHours()).padStart(2,0),o=String(e.getMinutes()).padStart(2,0),a=String(e.getSeconds()).padStart(2,0),l=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"][e.getDay()],l=`${this._getLineCh(t)?"\n":""}${i}-${n}-${r} ${s}:${o}:${a} ${l}\n`;this._replaceSelection(t,l),t.focus()}handleHr(t){var e=`${this._getLineCh(t)?"\n":""}\n------------\n\n`;this._replaceSelection(t,e),t.focus()}handleClean(t){t.dispatch({changes:{from:0,to:t.state.doc.length,insert:""}}),t.focus()}handleOrdered(t){const e=this._getSelection(t);if(""===e){var i=(this._getLineCh(t)?"\n\n":"")+"1. ";this._replaceSelection(t,i)}else{const n=e.split("\n");for(let t=0,e=n.length;t `);else{const n=e.split("\n");for(let t=0,e=n.length;t "+n[t];var i=(this._getLineCh(t)?"\n":"")+n.join("\n");this._replaceSelection(t,i)}t.focus()}handleDownload(t){var e=$("#title").val()||"新文章";const i=document.createElement("a");t=new Blob([t.state.doc.toString()]);i.download=e+".md",i.href=URL.createObjectURL(t),i.click(),URL.revokeObjectURL(t)}handleTitle(e,t){const i=$(` + `),$(".cm-modal__wrapper-footer--cancle, .cm-modal__wrapper-header--close").on("click",()=>$(".cm-modal").removeClass("active")),$(".cm-modal__wrapper-footer--confirm").on("click",()=>{this.options.confirm(),$(".cm-modal").removeClass("active")})}_openModal(t={}){this.options=Object.assign({title:"提示",innerHtml:"内容",hasFooter:!0,confirm:()=>{},handler:()=>{}},t),$(".cm-modal__wrapper-header--text").html(this.options.title),$(".cm-modal__wrapper-bodyer").html(this.options.innerHtml),this.options.hasFooter?$(".cm-modal__wrapper-footer").show():$(".cm-modal__wrapper-footer").hide(),$(".cm-modal").addClass("active"),this.options.handler()}_getLineCh(t){var e=t.state.selection.main.head;return e-t.state.doc.lineAt(e).from}_replaceSelection(t,e){t.dispatch(t.state.replaceSelection(e))}_setCursor(t,e){t.dispatch({selection:{anchor:e}})}_getSelection(t){return t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to)}_insetAmboText(t,e){var i=t.state.selection.main.head,n=this._getSelection(t);this._replaceSelection(t,` ${e+n+e} `),""===n&&this._setCursor(t,i+e.length+1),t.focus()}_createTableLists(s,t,o="",a){$.ajax({url:t,dataType:"json",success:t=>{let e="",i="";for(var n in t){const r=t[n].split(" ");e+=`
${n}
`,i+=`
${r.map(t=>`
${t}
`).join(" ")}
`}this._openModal({title:a,hasFooter:!1,innerHtml:`
${e}
${i}`,handler:()=>{$(".cm-modal__wrapper-bodyer .tabbar-item").on("click",function(){const t=$(this);var e=t.attr("data-show");const i=$(".cm-modal__wrapper-bodyer .tabbar");t.addClass("active").siblings().removeClass("active"),i.stop().animate({scrollLeft:t[0].offsetLeft-i[0].offsetWidth/2+t[0].offsetWidth/2-15}),$(".cm-modal__wrapper-bodyer .lists").removeClass("active"),$(".cm-modal__wrapper-bodyer .lists[data-show='"+e+"']").addClass("active")});const e=this;$(".cm-modal__wrapper-bodyer .lists-item").on("click",function(){var t=$(this).attr("data-text");e._replaceSelection(s,` ${t} `),$(".cm-modal").removeClass("active"),s.focus()})}})}})}_updateScroller(t,e){t=t.scrollTop/(t.scrollHeight-t.offsetHeight);e.scrollTop=t*(e.scrollHeight-e.offsetHeight)}handleFullScreen(t){t.toggleClass("active"),$("body").toggleClass("fullscreen"),$(".cm-container").toggleClass("fullscreen"),$(".cm-preview").width(0)}handlePublish(){$("#btn-submit").click()}handleUndo(t){So(t),t.focus()}handleRedo(t){Po(t),t.focus()}handleIndent(t){this._replaceSelection(t," "),t.focus()}handleTime(t){const e=new Date;var i=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,0),r=String(e.getDate()).padStart(2,0),s=String(e.getHours()).padStart(2,0),o=String(e.getMinutes()).padStart(2,0),a=String(e.getSeconds()).padStart(2,0),l=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"][e.getDay()],l=`${this._getLineCh(t)?"\n":""}${i}-${n}-${r} ${s}:${o}:${a} ${l}\n`;this._replaceSelection(t,l),t.focus()}handleHr(t){var e=`${this._getLineCh(t)?"\n":""}\n------------\n\n`;this._replaceSelection(t,e),t.focus()}handleClean(t){t.dispatch({changes:{from:0,to:t.state.doc.length,insert:""}}),t.focus()}handleOrdered(t){const e=this._getSelection(t);if(""===e){var i=(this._getLineCh(t)?"\n\n":"")+"1. ";this._replaceSelection(t,i)}else{const n=e.split("\n");for(let t=0,e=n.length;t `);else{const n=e.split("\n");for(let t=0,e=n.length;t "+n[t];var i=(this._getLineCh(t)?"\n":"")+n.join("\n");this._replaceSelection(t,i)}t.focus()}handleDownload(t){var e=$("#title").val()||"新文章";const i=document.createElement("a");t=new Blob([t.state.doc.toString()]);i.download=e+".md",i.href=URL.createObjectURL(t),i.click(),URL.revokeObjectURL(t)}handleTitle(e,t){const i=$(`
${t.innerHTML}
@@ -285,4 +285,4 @@
- `),Zh($("#text").val());let e=null;const s=new ir({state:pt.create({doc:$("#text").val(),extensions:[...this.plugins,qh({base:_h}),Or.of([Qo,...Cs,...vo,...zo]),ir.updateListener.of(t=>{t.docChanged&&e!==t.state.doc.toString()&&(e=t.state.doc.toString(),window.requestAnimationFrame?window.requestAnimationFrame(()=>Zh(t.state.doc.toString())):Zh(t.state.doc.toString()))}),ir.domEventHandlers({paste:e=>{var n=e.clipboardData;if(n&&n.items){const r=n.items;if(r.length){let i=null;for(let t=0;t{const t=$.ajaxSettings.xhr();if(t.upload)return t.upload.addEventListener("progress",t=>{t=t.loaded/t.total*100;$(".cm-progress-left").width(t/2+"%"),$(".cm-progress-right").width(t/2+"%")},!1),t},success:t=>{$(".cm-progress-left").width(0),$(".cm-progress-right").width(0),this._isPasting=!1;t=`${super._getLineCh(s)?"\n":""}![${t[1].title}](${t[0]})\n`;super._replaceSelection(s,t),s.focus()},error:()=>{$(".cm-progress-left").width(0),$(".cm-progress-right").width(0),this._isPasting=!1}})}}}}}}})],tabSize:4})});$(".cm-mainer").prepend(s.dom),$("#text")[0].form&&$("#text")[0].form.addEventListener("submit",()=>$("#text").val(s.state.doc.toString())),this.cm=s}init_Preview(){const n=(t,e,i)=>{let n=e+(t-i);n<=0&&(n=0),n>=$(".cm-mainer").outerWidth()-16&&(n=$(".cm-mainer").outerWidth()-16),$(".cm-preview").width(n)};$(".cm-resize").on({mousedown:t=>{t.preventDefault(),t.stopPropagation();const e=$(".cm-preview").outerWidth(),i=t.clientX;return $(".cm-preview").addClass("move"),document.onmousemove=t=>{window.requestAnimationFrame?requestAnimationFrame(()=>n(i,e,t.clientX)):n(i,e,t.clientX)},!(document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,$(".cm-preview").removeClass("move")})},touchstart:t=>{t.preventDefault(),t.stopPropagation();const e=$(".cm-preview").outerWidth(),i=t.originalEvent.targetTouches[0].clientX;return $(".cm-preview").addClass("move"),document.ontouchmove=t=>{window.requestAnimationFrame?requestAnimationFrame(()=>n(i,e,t.targetTouches[0].clientX)):n(i,e,t.targetTouches[0].clientX)},!(document.ontouchend=()=>{document.ontouchmove=null,document.ontouchend=null,$(".cm-preview").removeClass("move")})}})}init_Tools(){Vh.forEach(e=>{if("title"===e.type)super.handleTitle(this.cm,e);else{const i=$(`
${e.innerHTML}
`);i.on("click",t=>{switch(t.preventDefault(),e.type){case"fullScreen":super.handleFullScreen(i);break;case"publish":super.handlePublish();break;case"undo":super.handleUndo(this.cm);break;case"redo":super.handleRedo(this.cm);break;case"time":super.handleTime(this.cm);break;case"bold":super._insetAmboText(this.cm,"**");break;case"italic":super._insetAmboText(this.cm,"*");break;case"delete":super._insetAmboText(this.cm,"~~");break;case"code-inline":super._insetAmboText(this.cm,"`");break;case"indent":super.handleIndent(this.cm);break;case"hr":super.handleHr(this.cm);break;case"clean":super.handleClean(this.cm);break;case"ordered-list":super.handleOrdered(this.cm);break;case"unordered-list":super.handleUnordered(this.cm);break;case"quote":super.handleQuote(this.cm);break;case"download":super.handleDownload(this.cm);break;case"link":super.handleLink(this.cm);break;case"image":super.handleImage(this.cm);break;case"table":super.handleTable(this.cm);break;case"code-block":super.handleCodeBlock(this.cm);break;case"about":super.handleAbout();break;case"character":super._createTableLists(this.cm,JoeConfig.characterAPI,"星星符号","字符大全");break;case"emoji":super._createTableLists(this.cm,JoeConfig.emojiAPI,"表情","符号表情(需数据库支持)");break;case"task-no":super.handleTask(this.cm,!1);break;case"task-yes":super.handleTask(this.cm,!0);break;case"netease-list":super.handleNetease(this.cm,!0);break;case"netease-single":super.handleNetease(this.cm,!1);break;case"bilibili":super.handleBilibili(this.cm);break;case"dplayer":super.handleDplayer(this.cm);break;case"draft":super.handleDraft();break;case"expression":super.handleExpression(this.cm);break;case"mtitle":super.handleMtitle(this.cm);break;case"html":super.handleHtml(this.cm);break;case"abtn":super.handleAbtn(this.cm);break;case"anote":super.handleAnote(this.cm);break;case"dotted":super.handleDotted(this.cm);break;case"hide":super.handleHide(this.cm);break;case"card-default":super.handleCardDefault(this.cm);break;case"message":super.handleMessage(this.cm);break;case"progress":super.handleProgress(this.cm);break;case"callout":super.handleCallout(this.cm);break;case"mp3":super.handleMp3(this.cm);break;case"tabs":super.handleTabs(this.cm);break;case"card-list":super.handleCardList(this.cm);break;case"timeline":super.handleTimeline(this.cm);break;case"copy":super.handleCopy(this.cm);break;case"card-describe":super.handleCardDescribe(this.cm);break;case"lamp":super.handleLamp(this.cm);break;case"collapse":super.handleCollapse(this.cm);break;case"cloud":super.handleCloud(this.cm);break;case"gird":super.handleGird(this.cm);break;case"alert":super.handleAlert(this.cm);break;case"preview":i.toggleClass("active"),i.hasClass("active")?window.JoeConfig.canPreview=!0:window.JoeConfig.canPreview=!1,Zh(this.cm.state.doc.toString())}}),$(".cm-tools").append(i)}})}init_Insert(){Typecho.insertFileToEditor=(t,e,i)=>{e=`${super._getLineCh(this.cm)?"\n":""}${i?"!":""}[${t}](${e})\n`;super._replaceSelection(this.cm,e),this.cm.focus()}}init_AutoSave(){if(1===window.JoeConfig.autoSave){const o=$("#text")[0].form;let i=$(o).find('input[name="cid"]').val(),n=null,r=$(o).find('input[name="title"]').val(),s=$(o).find('textarea[name="text"]').val();setInterval(()=>{$(o).find('input[name="cid"]').val(i),$(o).find('textarea[name="text"]').val(this.cm.state.doc.toString());let t=$(o).find('input[name="title"]').val();var e=$(o).find('textarea[name="text"]').val();""!==t.trim()&&(r===t&&s===e||(r=t,s=e,$(".cm-autosave").addClass("active"),$.ajax({url:o.action,type:"POST",data:$(o).serialize()+"&do=save",dataType:"json",success:t=>{i=t.cid,n=setTimeout(()=>{$(".cm-autosave").removeClass("active"),clearTimeout(n)},1e3)}})))},5e3)}}}document.addEventListener("DOMContentLoaded",()=>new Eh)}(); + `),Zh($("#text").val());let e=null;const s=new ir({state:pt.create({doc:$("#text").val(),extensions:[...this.plugins,qh({base:_h}),Or.of([Qo,...Cs,...vo,...zo]),ir.updateListener.of(t=>{t.docChanged&&e!==t.state.doc.toString()&&(e=t.state.doc.toString(),window.requestAnimationFrame?window.requestAnimationFrame(()=>Zh(t.state.doc.toString())):Zh(t.state.doc.toString()))}),ir.domEventHandlers({paste:e=>{var n=e.clipboardData;if(n&&n.items){const r=n.items;if(r.length){let i=null;for(let t=0;t{const t=$.ajaxSettings.xhr();if(t.upload)return t.upload.addEventListener("progress",t=>{t=t.loaded/t.total*100;$(".cm-progress-left").width(t/2+"%"),$(".cm-progress-right").width(t/2+"%")},!1),t},success:t=>{$(".cm-progress-left").width(0),$(".cm-progress-right").width(0),this._isPasting=!1;t=`${super._getLineCh(s)?"\n":""}![${t[1].title}](${t[0]})\n`;super._replaceSelection(s,t),s.focus()},error:()=>{$(".cm-progress-left").width(0),$(".cm-progress-right").width(0),this._isPasting=!1}})}}}}}},scroll:t=>{window.JoeConfig.canPreview&&t&&t.target&&"cm-scroller"===t.target.className&&(window.requestAnimationFrame?window.requestAnimationFrame(()=>super._updateScroller(t.target,document.querySelector(".cm-preview"))):super._updateScroller(t.target,document.querySelector(".cm-preview")))}})],tabSize:4})});$(".cm-mainer").prepend(s.dom),$("#text")[0].form&&$("#text")[0].form.addEventListener("submit",()=>$("#text").val(s.state.doc.toString())),this.cm=s}init_Preview(){const n=(t,e,i)=>{let n=e+(t-i);n<=0&&(n=0),n>=$(".cm-mainer").outerWidth()-16&&(n=$(".cm-mainer").outerWidth()-16),$(".cm-preview").width(n)};$(".cm-resize").on({mousedown:t=>{t.preventDefault(),t.stopPropagation();const e=$(".cm-preview").outerWidth(),i=t.clientX;return $(".cm-preview").addClass("move"),document.onmousemove=t=>{window.requestAnimationFrame?requestAnimationFrame(()=>n(i,e,t.clientX)):n(i,e,t.clientX)},!(document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,$(".cm-preview").removeClass("move")})},touchstart:t=>{t.preventDefault(),t.stopPropagation();const e=$(".cm-preview").outerWidth(),i=t.originalEvent.targetTouches[0].clientX;return $(".cm-preview").addClass("move"),document.ontouchmove=t=>{window.requestAnimationFrame?requestAnimationFrame(()=>n(i,e,t.targetTouches[0].clientX)):n(i,e,t.targetTouches[0].clientX)},!(document.ontouchend=()=>{document.ontouchmove=null,document.ontouchend=null,$(".cm-preview").removeClass("move")})}})}init_Tools(){Vh.forEach(e=>{if("title"===e.type)super.handleTitle(this.cm,e);else{const i=$(`
${e.innerHTML}
`);i.on("click",t=>{switch(t.preventDefault(),e.type){case"fullScreen":super.handleFullScreen(i);break;case"publish":super.handlePublish();break;case"undo":super.handleUndo(this.cm);break;case"redo":super.handleRedo(this.cm);break;case"time":super.handleTime(this.cm);break;case"bold":super._insetAmboText(this.cm,"**");break;case"italic":super._insetAmboText(this.cm,"*");break;case"delete":super._insetAmboText(this.cm,"~~");break;case"code-inline":super._insetAmboText(this.cm,"`");break;case"indent":super.handleIndent(this.cm);break;case"hr":super.handleHr(this.cm);break;case"clean":super.handleClean(this.cm);break;case"ordered-list":super.handleOrdered(this.cm);break;case"unordered-list":super.handleUnordered(this.cm);break;case"quote":super.handleQuote(this.cm);break;case"download":super.handleDownload(this.cm);break;case"link":super.handleLink(this.cm);break;case"image":super.handleImage(this.cm);break;case"table":super.handleTable(this.cm);break;case"code-block":super.handleCodeBlock(this.cm);break;case"about":super.handleAbout();break;case"character":super._createTableLists(this.cm,JoeConfig.characterAPI,"星星符号","字符大全");break;case"emoji":super._createTableLists(this.cm,JoeConfig.emojiAPI,"表情","符号表情(需数据库支持)");break;case"task-no":super.handleTask(this.cm,!1);break;case"task-yes":super.handleTask(this.cm,!0);break;case"netease-list":super.handleNetease(this.cm,!0);break;case"netease-single":super.handleNetease(this.cm,!1);break;case"bilibili":super.handleBilibili(this.cm);break;case"dplayer":super.handleDplayer(this.cm);break;case"draft":super.handleDraft();break;case"expression":super.handleExpression(this.cm);break;case"mtitle":super.handleMtitle(this.cm);break;case"html":super.handleHtml(this.cm);break;case"abtn":super.handleAbtn(this.cm);break;case"anote":super.handleAnote(this.cm);break;case"dotted":super.handleDotted(this.cm);break;case"hide":super.handleHide(this.cm);break;case"card-default":super.handleCardDefault(this.cm);break;case"message":super.handleMessage(this.cm);break;case"progress":super.handleProgress(this.cm);break;case"callout":super.handleCallout(this.cm);break;case"mp3":super.handleMp3(this.cm);break;case"tabs":super.handleTabs(this.cm);break;case"card-list":super.handleCardList(this.cm);break;case"timeline":super.handleTimeline(this.cm);break;case"copy":super.handleCopy(this.cm);break;case"card-describe":super.handleCardDescribe(this.cm);break;case"lamp":super.handleLamp(this.cm);break;case"collapse":super.handleCollapse(this.cm);break;case"cloud":super.handleCloud(this.cm);break;case"gird":super.handleGird(this.cm);break;case"alert":super.handleAlert(this.cm);break;case"preview":i.toggleClass("active"),i.hasClass("active")?window.JoeConfig.canPreview=!0:window.JoeConfig.canPreview=!1,Zh(this.cm.state.doc.toString()),window.JoeConfig.canPreview&&super._updateScroller(document.querySelector(".cm-scroller"),document.querySelector(".cm-preview"))}}),$(".cm-tools").append(i)}})}init_Insert(){Typecho.insertFileToEditor=(t,e,i)=>{e=`${super._getLineCh(this.cm)?"\n":""}${i?"!":""}[${t}](${e})\n`;super._replaceSelection(this.cm,e),this.cm.focus()}}init_AutoSave(){if(1===window.JoeConfig.autoSave){const o=$("#text")[0].form;let i=$(o).find('input[name="cid"]').val(),n=null,r=$(o).find('input[name="title"]').val(),s=$(o).find('textarea[name="text"]').val();setInterval(()=>{$(o).find('input[name="cid"]').val(i),$(o).find('textarea[name="text"]').val(this.cm.state.doc.toString());let t=$(o).find('input[name="title"]').val();var e=$(o).find('textarea[name="text"]').val();""!==t.trim()&&(r===t&&s===e||(r=t,s=e,$(".cm-autosave").addClass("active"),$.ajax({url:o.action,type:"POST",data:$(o).serialize()+"&do=save",dataType:"json",success:t=>{i=t.cid,n=setTimeout(()=>{$(".cm-autosave").removeClass("active"),clearTimeout(n)},1e3)}})))},5e3)}}}document.addEventListener("DOMContentLoaded",()=>new Eh)}(); diff --git a/typecho/write/js/joe.write.js b/typecho/write/js/joe.write.js index e9942aa..d3400d4 100644 --- a/typecho/write/js/joe.write.js +++ b/typecho/write/js/joe.write.js @@ -122,6 +122,13 @@ class Joe extends JoeAction { this._isPasting = false; } }); + }, + scroll: e => { + if (!window.JoeConfig.canPreview) return; + if (e && e.target && e.target.className === 'cm-scroller') { + if (window.requestAnimationFrame) window.requestAnimationFrame(() => super._updateScroller(e.target, document.querySelector('.cm-preview'))); + else super._updateScroller(e.target, document.querySelector('.cm-preview')); + } } }) ], @@ -351,6 +358,7 @@ class Joe extends JoeAction { if (el.hasClass('active')) window.JoeConfig.canPreview = true; else window.JoeConfig.canPreview = false; createPreviewHtml(this.cm.state.doc.toString()); + window.JoeConfig.canPreview && super._updateScroller(document.querySelector('.cm-scroller'), document.querySelector('.cm-preview')); break; } });