30
30
31
31
import ace from 'brace' ;
32
32
import { Editor as IAceEditor , IEditSession as IAceEditSession } from 'brace' ;
33
- import $ from 'jquery' ;
34
33
import {
35
34
CoreEditor ,
36
35
Position ,
@@ -54,11 +53,11 @@ const rangeToAceRange = ({ start, end }: Range) =>
54
53
55
54
export class LegacyCoreEditor implements CoreEditor {
56
55
private _aceOnPaste : any ;
57
- $ actions : any ;
56
+ actions : any ;
58
57
resize : ( ) => void ;
59
58
60
59
constructor ( private readonly editor : IAceEditor , actions : HTMLElement ) {
61
- this . $ actions = $ ( actions ) ;
60
+ this . actions = actions ;
62
61
this . editor . setShowPrintMargin ( false ) ;
63
62
64
63
const session = this . editor . getSession ( ) ;
@@ -274,20 +273,16 @@ export class LegacyCoreEditor implements CoreEditor {
274
273
275
274
private setActionsBar = ( value ?: any , topOrBottom : 'top' | 'bottom' = 'top' ) => {
276
275
if ( value === null ) {
277
- this . $ actions. css ( ' visibility' , 'hidden' ) ;
276
+ this . actions . style . visibility = 'hidden' ;
278
277
} else {
279
278
if ( topOrBottom === 'top' ) {
280
- this . $actions . css ( {
281
- bottom : 'auto' ,
282
- top : value ,
283
- visibility : 'visible' ,
284
- } ) ;
279
+ this . actions . style . bottom = 'auto' ;
280
+ this . actions . style . top = value ;
281
+ this . actions . style . visibility = 'visible' ;
285
282
} else {
286
- this . $actions . css ( {
287
- top : 'auto' ,
288
- bottom : value ,
289
- visibility : 'visible' ,
290
- } ) ;
283
+ this . actions . style . top = 'auto' ;
284
+ this . actions . style . bottom = value ;
285
+ this . actions . style . visibility = 'visible' ;
291
286
}
292
287
}
293
288
} ;
@@ -318,14 +313,14 @@ export class LegacyCoreEditor implements CoreEditor {
318
313
}
319
314
320
315
legacyUpdateUI ( range : any ) {
321
- if ( ! this . $ actions) {
316
+ if ( ! this . actions ) {
322
317
return ;
323
318
}
324
319
if ( range ) {
325
320
// elements are positioned relative to the editor's container
326
321
// pageY is relative to page, so subtract the offset
327
322
// from pageY to get the new top value
328
- const offsetFromPage = $ ( this . editor . container ) . offset ( ) ! . top ;
323
+ const offsetFromPage = this . editor . container . offsetTop ;
329
324
const startLine = range . start . lineNumber ;
330
325
const startColumn = range . start . column ;
331
326
const firstLine = this . getLineValue ( startLine ) ;
@@ -345,11 +340,11 @@ export class LegacyCoreEditor implements CoreEditor {
345
340
let offset = 0 ;
346
341
if ( isWrapping ) {
347
342
// Try get the line height of the text area in pixels.
348
- const textArea = $ ( this . editor . container . querySelector ( 'textArea' ) ! ) ;
343
+ const textArea = this . editor . container . querySelector ( 'textArea' ) ;
349
344
const hasRoomOnNextLine = this . getLineValue ( startLine ) . length < maxLineLength ;
350
345
if ( textArea && hasRoomOnNextLine ) {
351
346
// Line height + the number of wraps we have on a line.
352
- offset += this . getLineValue ( startLine ) . length * textArea . height ( ) ! ;
347
+ offset += this . getLineValue ( startLine ) . length * textArea . getBoundingClientRect ( ) . height ;
353
348
} else {
354
349
if ( startLine > 1 ) {
355
350
this . setActionsBar ( getScreenCoords ( startLine - 1 ) ) ;
0 commit comments