Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency upgrade #188

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const ManifestPlugin = require('webpack-manifest-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const path = require('path');

Expand All @@ -15,7 +15,6 @@ const commonConfig = {
chunkFilename: 'inc/[name]/build/chunk.[id].[chunkhash:8].js',
publicPath: '/',
libraryTarget: 'this',
jsonpFunction: 'HMSmartMedia'
},
target: 'web',
resolve: { extensions: [ '.js', '.css', '.scss' ] },
Expand All @@ -28,14 +27,19 @@ const commonConfig = {
options: {
babelrc: false,
presets: [
[ require( '@babel/preset-env' ), {
modules: false,
targets: { browsers: [ ' > 0.01%' ] },
} ],
[
require( '@babel/preset-env' ),
{
targets: {
browsers: ['> 0.01%'],
},
useBuiltIns: 'usage',
corejs: 3,
}
],
],
plugins: [
require( '@babel/plugin-proposal-object-rest-spread' ),
require( '@babel/polyfill' ),
],
},
},
Expand Down Expand Up @@ -63,7 +67,6 @@ const commonConfig = {
'@wordpress/template': { this: [ 'wp', 'template' ] },
'@wordpress/i18n': { this: [ 'wp', 'i18n' ] },
'@wordpress/hooks': { this: [ 'wp', 'hooks' ] },
'jQuery': 'jQuery',
lodash: '_',
wp: 'wp',
},
Expand All @@ -76,7 +79,7 @@ const commonConfig = {
},
},
plugins: [
new ManifestPlugin( {
new WebpackManifestPlugin( {
writeToFileEmit: true,
} ),
new CleanWebpackPlugin( {
Expand All @@ -86,10 +89,9 @@ const commonConfig = {
};

const devConfig = Object.assign( {}, commonConfig, {
devtool: 'cheap-module-eval-source-map',
devtool: 'eval-cheap-module-source-map',
devServer: {
port: 9022,
//hot: true,
allowedHosts: [
'.local',
'.localhost',
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
build
manifest.json
yarn-error.log
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

## v0.4.4

- Dependency upgrade

## v0.4.3

- Bug: Check model has mime type before checking value
Expand Down
1 change: 1 addition & 0 deletions inc/cropper/src/cropper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "core-js/stable";
import { addAction, applyFilters, addFilter } from '@wordpress/hooks';
import { __ } from '@wordpress/i18n';
import Media from '@wordpress/media';
Expand Down
23 changes: 13 additions & 10 deletions inc/cropper/src/views/image-editor.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import Media from '@wordpress/media';
import template from '@wordpress/template';
import ajax from '@wordpress/ajax';
import jQuery from 'jQuery';
import smartcrop from 'smartcrop';
import { getMaxCrop } from '../utils';

const $ = jQuery;

/**
* Image editor.
*/
Expand Down Expand Up @@ -186,6 +183,7 @@ const ImageEditor = Media.View.extend( {
}

const aspectRatio = `${size.width}:${size.height}`;
const model = this.model

// Load imgAreaSelect.
this.cropper = $image.imgAreaSelect( {
Expand All @@ -201,15 +199,20 @@ const ImageEditor = Media.View.extend( {
aspectRatio: aspectRatio,
persistent: true,
onInit( img ) {
// Ensure that the imgAreaSelect wrapper elements are position:absolute.
// (even if we're in a position:fixed modal)
const $img = $( img );
$img.next().css( 'position', 'absolute' )
.nextAll( '.imgareaselect-outer' ).css( 'position', 'absolute' );
img.nextElementSibling.style.position = 'absolute';
let currentSibling = img.nextElementSibling
let nextSibling = currentSibling.nextElementSibling
while(nextSibling) {
if (nextSibling.classList.contains('imgareaselect-outer')) {
nextSibling.style.position = 'absolute'
}
currentSibling = nextSibling
nextSibling = currentSibling.nextElementSibling
}

// Account for rounding errors in imgareaselect with jQuery v3 innerHeight sub-pixel values.
$img.width( Math.round( $img.innerWidth() ) );
$img.height( Math.round( $img.innerHeight() ) );
img.style.width = img.clientWidth + 'px';
img.style.height = img.clientHeight + 'px';

// Set initial crop.
view.reset();
Expand Down
Loading