ext-rtl-8a6f6336.js 2.8 KB

1
  1. import{g as v}from"./index-3157015c.js";function L(o,h){for(var r=0;r<h.length;r++){const s=h[r];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in o)){const a=Object.getOwnPropertyDescriptor(s,l);a&&Object.defineProperty(o,l,a.get?a:{enumerable:!0,get:()=>s[l]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}var b={exports:{}};(function(o,h){ace.define("ace/ext/rtl",["require","exports","module","ace/editor","ace/config"],function(r,s,l){var a=[{name:"leftToRight",bindKey:{win:"Ctrl-Alt-Shift-L",mac:"Command-Alt-Shift-L"},exec:function(e){e.session.$bidiHandler.setRtlDirection(e,!1)},readOnly:!0},{name:"rightToLeft",bindKey:{win:"Ctrl-Alt-Shift-R",mac:"Command-Alt-Shift-R"},exec:function(e){e.session.$bidiHandler.setRtlDirection(e,!0)},readOnly:!0}],$=r("../editor").Editor;r("../config").defineOptions($.prototype,"editor",{rtlText:{set:function(e){e?(this.on("change",g),this.on("changeSelection",m),this.renderer.on("afterRender",d),this.commands.on("exec",u),this.commands.addCommands(a)):(this.off("change",g),this.off("changeSelection",m),this.renderer.off("afterRender",d),this.commands.off("exec",u),this.commands.removeCommands(a),p(this.renderer)),this.renderer.updateFull()}},rtl:{set:function(e){this.session.$bidiHandler.$isRtl=e,e?(this.setOption("rtlText",!1),this.renderer.on("afterRender",d),this.session.$bidiHandler.seenBidi=!0):(this.renderer.off("afterRender",d),p(this.renderer)),this.renderer.updateFull()}}});function m(e,i){var t=i.getSelection().lead;i.session.$bidiHandler.isRtlLine(t.row)&&t.column===0&&(i.session.$bidiHandler.isMoveLeftOperation&&t.row>0?i.getSelection().moveCursorTo(t.row-1,i.session.getLine(t.row-1).length):i.getSelection().isEmpty()?t.column+=1:t.setPosition(t.row,t.column+1))}function u(e){e.editor.session.$bidiHandler.isMoveLeftOperation=/gotoleft|selectleft|backspace|removewordleft/.test(e.command.name)}function g(e,i){var t=i.session;if(t.$bidiHandler.currentRow=null,t.$bidiHandler.isRtlLine(e.start.row)&&e.action==="insert"&&e.lines.length>1)for(var n=e.start.row;n<e.end.row;n++)t.getLine(n+1).charAt(0)!==t.$bidiHandler.RLE&&(t.doc.$lines[n+1]=t.$bidiHandler.RLE+t.getLine(n+1))}function d(e,i){var t=i.session,n=t.$bidiHandler,f=i.$textLayer.$lines.cells,R=i.layerConfig.width-i.layerConfig.padding+"px";f.forEach(function(x){var c=x.element.style;n&&n.isRtlLine(x.row)?(c.direction="rtl",c.textAlign="right",c.width=R):(c.direction="",c.textAlign="",c.width="")})}function p(e){var i=e.$textLayer.$lines;i.cells.forEach(t),i.cellCache.forEach(t);function t(n){var f=n.element.style;f.direction=f.textAlign=f.width=""}}}),function(){ace.require(["ace/ext/rtl"],function(r){o&&(o.exports=r)})}()})(b);var y=b.exports;const w=v(y),H=L({__proto__:null,default:w},[y]);export{H as e};