MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / aceApply

Function aceApply

api/prettydiff-webtool.ts:168–200  ·  view source on GitHub ↗
(nodeName:string, maxWidth:boolean)

Source from the content-addressed store, hash-verified

166 type:string = "",
167 parent:HTMLElement;
168 const aceApply = function dom_load_aceApply(nodeName:string, maxWidth:boolean):any {
169 const div:HTMLDivElement = document.createElement("div"),
170 node:HTMLDivElement = textarea[nodeName],
171 parent:HTMLElement = <HTMLElement>node.parentNode.parentNode,
172 labels:HTMLCollectionOf<HTMLLabelElement> = parent.getElementsByTagName("label"),
173 label:HTMLLabelElement = labels[labels.length - 1],
174 attributes:NamedNodeMap = node.attributes,
175 p:HTMLParagraphElement = document.createElement("p"),
176 dollar:string = "$",
177 len:number = attributes.length;
178 let a:number = 0,
179 edit:any = {};
180 do {
181 if (attributes[a].name !== "rows" && attributes[a].name !== "cols" && attributes[a].name !== "wrap") {
182 div.setAttribute(attributes[a].name, attributes[a].value);
183 }
184 a = a + 1;
185 } while (a < len);
186 label.parentNode.removeChild(label);
187 p.appendChild(label);
188 p.setAttribute("class", "inputLabel");
189 parent.appendChild(p);
190 parent.appendChild(div);
191 parent.removeChild(node.parentNode);
192 if (maxWidth === true) {
193 div.style.width = "100%";
194 }
195 div.style.fontSize = "1.4em";
196 edit = ace.edit(div);
197 textarea[nodeName] = div.getElementsByTagName("textarea")[0];
198 edit[`${dollar}blockScrolling`] = Infinity;
199 return edit;
200 },
201 aces = function dom_load_aces(event:Event):void {
202 const el:HTMLInputElement = <HTMLInputElement>event.srcElement || <HTMLInputElement>event.target,
203 elId:string = el.getAttribute("id"),

Callers 1

loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected