@@ -893,7 +893,7 @@ function RemoteFunctions(config) {
893893 // this value decides where we need to show the box in the UI
894894 // we are creating this here, because if the element has IDs and Classes then we need to increase the value
895895 // so that the box doesn't obscure the element
896- let pushBoxUp = 28 ; // px value
896+ let pushBoxUp = 32 ; // px value
897897
898898 // get the ID and classes for that element, as we need to display it in the box
899899 const id = this . element . id ;
@@ -905,7 +905,7 @@ function RemoteFunctions(config) {
905905 // Add ID if present
906906 if ( id ) {
907907 content += "<div class='id-name'>#" + id + "</div>" ;
908- pushBoxUp += 16 ;
908+ pushBoxUp += 20 ;
909909 }
910910
911911 // Add classes (limit to 3 with dropdown indicator)
@@ -918,7 +918,7 @@ function RemoteFunctions(config) {
918918 content += "<span class='exceeded-classes'>+" + ( classes . length - 3 ) + " more</span>" ;
919919 }
920920 content += "</div>" ;
921- pushBoxUp += 16 ;
921+ pushBoxUp += 20 ;
922922 }
923923
924924 let leftPos = elemBounds . left + scrollLeft ;
@@ -941,7 +941,6 @@ function RemoteFunctions(config) {
941941 // Calculate estimated width based on character count
942942 // Formula: base padding + (character count * average character width)
943943 const boxWidth = basePadding + ( charCount * avgCharWidth ) ;
944- const boxHeight = 40 + ( id ? 16 : 0 ) + ( classes . length > 0 ? 16 : 0 ) ; // rough estimate
945944
946945 // we need to check for overlap if this is from a click
947946 if ( this . isFromClick ) {
@@ -953,16 +952,16 @@ function RemoteFunctions(config) {
953952
954953 // Estimate the height of the info box based on its content
955954 // base height for tag name + padding
956- let estimatedHeight = 20 ;
955+ let estimatedHeight = 32 ;
957956
958957 // height adjustment if ID is present
959958 if ( id ) {
960- estimatedHeight += 15 ;
959+ estimatedHeight += 20 ;
961960 }
962961
963962 // height adjustment if classes are present
964963 if ( classes . length > 0 ) {
965- estimatedHeight += 15 ;
964+ estimatedHeight += 20 ;
966965 }
967966
968967 // check if element is near bottom of viewport
@@ -2031,8 +2030,7 @@ function RemoteFunctions(config) {
20312030 * This function is responsible to move the cursor to the end of the text content when we start editing
20322031 * @param {DOMElement } element
20332032 */
2034- function moveCursorToEnd ( element ) {
2035- const selection = window . getSelection ( ) ;
2033+ function moveCursorToEnd ( selection , element ) {
20362034 const range = document . createRange ( ) ;
20372035 range . selectNodeContents ( element ) ;
20382036 range . collapse ( false ) ;
@@ -2050,7 +2048,12 @@ function RemoteFunctions(config) {
20502048 element . setAttribute ( "contenteditable" , "true" ) ;
20512049 element . focus ( ) ;
20522050
2053- moveCursorToEnd ( element ) ;
2051+ // Move cursor to end if no existing selection
2052+ const selection = window . getSelection ( ) ;
2053+ if ( selection . rangeCount === 0 || selection . isCollapsed ) {
2054+ moveCursorToEnd ( selection , element ) ;
2055+ }
2056+
20542057 dismissMoreOptionsBox ( ) ;
20552058
20562059 element . _originalContent = cleanupElementProperties ( element ) ;
0 commit comments