11import Listener from '/WebServerAI/assets/AI/js/components/Learner.js' ;
22import Extensions from '/WebServerAI/assets/AI/js/components/extenstions.js' ;
33import { filter , caches } from '/WebServerAI/assets/AI/js/components/security.js' ;
4- import { loadEditables } from '/WebServerAI/assets/AI/js/components/editable.js' ;
54import { rgbaToHex , calculateContrastRatio , keyboardFocusable , isDecimal , isWSActive } from '/WebServerAI/assets/AI/js/components/utils.js' ;
6- var responce , elemRole = '' , codeTheme = 'default' ;
5+ var responce , elemRole = '' , codeTheme = 'default' , bodyHistory ;
76
87window . WebServerAI = class {
98 /**
@@ -160,6 +159,13 @@ window.WebServerAI = class {
160159 year : 'numeric'
161160 } ) ;
162161 }
162+
163+ #getNthChild( childNode ) {
164+ const parent = childNode . parentNode ,
165+ nthchild = Array . prototype . indexOf . call ( parent . children , childNode ) + 1 ;
166+ return ':nth-child(' + nthchild + ')' ;
167+ }
168+
163169 /**
164170 * Get all parents to the branch
165171 * @param {Element } t Targetted element
@@ -170,9 +176,10 @@ window.WebServerAI = class {
170176 currentBase = t ,
171177 toPath = '' ;
172178 while ( currentBase . tagName . toLocaleLowerCase ( ) !== document . documentElement . tagName . toLocaleLowerCase ( ) ) {
173- const elem = ( currentBase . tagName . toLowerCase ( ) + ( currentBase . id ? '#' + currentBase . id : '' ) + ( currentBase . classList . length > 0 ? '.' + currentBase . className . replace ( ' ' , '.' ) : '' ) ) ;
174- branch . push ( elem ) ;
175- currentBase = currentBase . parentElement ;
179+ const nthChild = this . #getNthChild( currentBase ) ;
180+ const elem = ( currentBase . tagName . toLowerCase ( ) + ( nthChild ? nthChild : '' ) + ( currentBase . id ? '#' + currentBase . id : '' ) + ( currentBase . classList . length > 0 ? '.' + currentBase . className . replace ( ' ' , '.' ) : '' ) ) ;
181+ branch . push ( elem ) ;
182+ currentBase = currentBase . parentElement ;
176183 }
177184 branch . push ( 'html' ) ;
178185 branch . reverse ( ) . forEach ( ( i ) => {
@@ -292,6 +299,7 @@ window.WebServerAI = class {
292299 }
293300 }
294301 } , false ) ;
302+
295303 document . querySelector ( '.wsa' ) . addEventListener ( 'touchstart' , function ( event ) {
296304 if ( ! event . target . classList . contains ( 'wsa-userinput' ) && event . target . tagName . toLowerCase ( ) !== 'i' ) {
297305 this . classList . add ( 'dragging' ) ;
@@ -554,11 +562,6 @@ window.WebServerAI = class {
554562 highlightScript . type = 'text/javascript' ;
555563 document . body . appendChild ( highlightScript ) ;
556564 } ) ;
557-
558- //Table edit
559- if ( isWSActive ( ) ) {
560- document . body . contentEditable = true ;
561- }
562565 }
563566 /**
564567 * Triggers on users input from textarea
0 commit comments