diff --git a/.eslintrc.json b/.eslintrc.json index 54301d6..356a741 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,7 +13,6 @@ }, "rules": { "no-jquery/no-global-selector": "warn", - "no-new": "warn", "yml/no-empty-document": "warn", "yml/no-empty-mapping-value": "warn" } diff --git a/assets/app.js b/assets/app.js index a870a1c..5d6beba 100644 --- a/assets/app.js +++ b/assets/app.js @@ -173,7 +173,7 @@ $( () => { width = document.querySelector( '[name="crop[width]"]' ), height = document.querySelector( '[name="crop[height]"]' ), $modeButtons = $( '.drag-mode' ); - new Cropper( img, { + const cropper = new Cropper( img, { viewMode: 2, dragMode: 'move', // Remove double-click drag mode toggling, because we've got buttons for that. @@ -184,14 +184,14 @@ $( () => { ready() { // Make textarea match height of image. $( '#text' ).css( { - height: this.cropper.getContainerData().height + height: cropper.getContainerData().height } ); // React to changes in the crop-mode buttons. $modeButtons.on( 'click', ( event ) => { const $button = $( event.currentTarget ); $modeButtons.removeClass( 'active' ); $button.addClass( 'active' ); - this.cropper.setDragMode( $button.data( 'drag-mode' ) ); + cropper.setDragMode( $button.data( 'drag-mode' ) ); } ); }, data: {