3 lines
1.8 KiB
JavaScript
3 lines
1.8 KiB
JavaScript
(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[629],{629:function(u,B,x){u=x.nmd(u),ace.define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"],function(g,C,G){"use strict";var p=g("../range").Range;function _(n,e){for(var t=e.column||n.getOption("printMarginColumn"),w=e.allowMerge!=!1,a=Math.min(e.startRow,e.endRow),v=Math.max(e.startRow,e.endRow),i=n.session;a<=v;){var o=i.getLine(a);if(o.length>t){var l=b(o,t,5);if(l){var W=/^\s*/.exec(o)[0];i.replace(new p(a,l.start,a,l.end),`
|
|
`+W)}v++}else if(w&&/\S/.test(o)&&a!=v){var d=i.getLine(a+1);if(d&&/\S/.test(d)){var h=o.replace(/\s+$/,""),k=d.replace(/^\s+/,""),S=h+" "+k,l=b(S,t,5);if(l&&l.start>h.length||S.length<t){var A=new p(a,h.length,a+1,d.length-k.length);i.replace(A," "),a--,v--}else h.length<o.length&&i.remove(new p(a,h.length,a,o.length))}}a++}function b(M,s,D){if(!(M.length<s)){var O=M.slice(0,s),y=M.slice(s),c=/^(?:(\s+)|(\S+)(\s+))/.exec(y),r=/(?:(\s+)|(\s+)(\S+))$/.exec(O),f=0,R=0;if(r&&!r[2]&&(f=s-r[1].length,R=s),c&&!c[2]&&(f||(f=s),R=s+c[1].length),f)return{start:f,end:R};if(r&&r[2]&&r.index>D)return{start:r.index,end:r.index+r[2].length};if(c&&c[2])return f=s+c[2].length,{start:f,end:f+c[3].length}}}}function $(n){if(n.command.name=="insertstring"&&/\S/.test(n.args)){var e=n.editor,t=e.selection.cursor;if(t.column<=e.renderer.$printMarginColumn)return;var w=e.session.$undoManager.$lastDelta;_(e,{startRow:t.row,endRow:t.row,allowMerge:!1}),w!=e.session.$undoManager.$lastDelta&&e.session.markUndoGroup()}}var E=g("../editor").Editor;g("../config").defineOptions(E.prototype,"editor",{hardWrap:{set:function(n){n?this.commands.on("afterExec",$):this.commands.off("afterExec",$)},value:!1}}),C.hardWrap=_}),function(){ace.require(["ace/ext/hardwrap"],function(g){u&&(u.exports=g)})}()}}]);
|