Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit d94008a

Browse files
Merge pull request #364 from technote-space/release/next-v4.0.7
release: v4.1.0
2 parents 30c58cd + 61a8559 commit d94008a

File tree

29 files changed

+2169
-3511
lines changed

29 files changed

+2169
-3511
lines changed

README.ja.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
蛍光ペンで塗るようなアニメーションを表示する機能を追加するプラグインです。
1515

16-
[デモ](https://technote-space.github.io/marker-animation)
17-
1816
[最新バージョン](https://github.com/technote-space/marker-animation/releases/latest/download/release.zip)
1917

2018
## Table of Contents

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
This plugin will add the ability to display animations like painting with a highlighter.
1515

16-
[Demonstration](https://technote-space.github.io/marker-animation)
17-
1816
[Latest version](https://github.com/technote-space/marker-animation/releases/latest/download/release.zip)
1917

2018
## Table of Contents

_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
theme: jekyll-theme-cayman
2+
3+
# Google Analytics
4+
google_analytics: UA-78163306-3

assets/js/__tests__/components/__snapshots__/text-control.js.snap

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
exports[`MyTextControl should render text control: blur1 1`] = `
44
<div
5-
className="components-base-control"
5+
className="components-base-control css-wdf2ti-Wrapper e1puf3u0"
66
>
77
<div
8-
className="components-base-control__field"
8+
className="components-base-control__field css-11vcxb9-StyledField e1puf3u1"
99
>
1010
<label
11-
className="components-base-control__label"
11+
className="components-base-control__label css-pezhm9-StyledLabel e1puf3u2"
1212
htmlFor="inspector-text-control-0"
1313
>
1414
test-label
@@ -27,13 +27,13 @@ exports[`MyTextControl should render text control: blur1 1`] = `
2727

2828
exports[`MyTextControl should render text control: blur2 1`] = `
2929
<div
30-
className="components-base-control"
30+
className="components-base-control css-wdf2ti-Wrapper e1puf3u0"
3131
>
3232
<div
33-
className="components-base-control__field"
33+
className="components-base-control__field css-11vcxb9-StyledField e1puf3u1"
3434
>
3535
<label
36-
className="components-base-control__label"
36+
className="components-base-control__label css-pezhm9-StyledLabel e1puf3u2"
3737
htmlFor="inspector-text-control-1"
3838
>
3939
test-label
@@ -52,13 +52,13 @@ exports[`MyTextControl should render text control: blur2 1`] = `
5252

5353
exports[`MyTextControl should render text control: changed1 1`] = `
5454
<div
55-
className="components-base-control"
55+
className="components-base-control css-wdf2ti-Wrapper e1puf3u0"
5656
>
5757
<div
58-
className="components-base-control__field"
58+
className="components-base-control__field css-11vcxb9-StyledField e1puf3u1"
5959
>
6060
<label
61-
className="components-base-control__label"
61+
className="components-base-control__label css-pezhm9-StyledLabel e1puf3u2"
6262
htmlFor="inspector-text-control-0"
6363
>
6464
test-label
@@ -77,13 +77,13 @@ exports[`MyTextControl should render text control: changed1 1`] = `
7777

7878
exports[`MyTextControl should render text control: render1 1`] = `
7979
<div
80-
className="components-base-control"
80+
className="components-base-control css-wdf2ti-Wrapper e1puf3u0"
8181
>
8282
<div
83-
className="components-base-control__field"
83+
className="components-base-control__field css-11vcxb9-StyledField e1puf3u1"
8484
>
8585
<label
86-
className="components-base-control__label"
86+
className="components-base-control__label css-pezhm9-StyledLabel e1puf3u2"
8787
htmlFor="inspector-text-control-0"
8888
>
8989
test-label
@@ -102,13 +102,13 @@ exports[`MyTextControl should render text control: render1 1`] = `
102102

103103
exports[`MyTextControl should render text control: render2 1`] = `
104104
<div
105-
className="components-base-control"
105+
className="components-base-control css-wdf2ti-Wrapper e1puf3u0"
106106
>
107107
<div
108-
className="components-base-control__field"
108+
className="components-base-control__field css-11vcxb9-StyledField e1puf3u1"
109109
>
110110
<label
111-
className="components-base-control__label"
111+
className="components-base-control__label css-pezhm9-StyledLabel e1puf3u2"
112112
htmlFor="inspector-text-control-1"
113113
>
114114
test-label

assets/js/gutenberg.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
22
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
3-
const HardSource = require('hard-source-webpack-plugin');
43
const smp = new SpeedMeasurePlugin();
54
const webpack = require('webpack');
65
const pkg = require('./package');
@@ -31,15 +30,14 @@ const webpackConfig = {
3130
{
3231
test: /\.js$/,
3332
exclude: /node_modules/,
34-
loader: 'babel-loader?cacheDirectory',
33+
loader: 'babel-loader',
3534
},
3635
],
3736
},
3837
externals,
3938
plugins: [
4039
new webpack.BannerPlugin(banner),
4140
new DuplicatePackageCheckerPlugin(),
42-
new HardSource(),
4341
],
4442
};
4543

assets/js/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
clearMocks: true,
23
verbose: true,
34
transform: {
45
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',

assets/js/marker-animation.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
22
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
3-
const HardSource = require('hard-source-webpack-plugin');
43
const smp = new SpeedMeasurePlugin();
54
const webpack = require('webpack');
65
const pkg = require('./package');
@@ -20,7 +19,7 @@ const webpackConfig = {
2019
{
2120
test: /\.js$/,
2221
exclude: /node_modules/,
23-
loader: 'babel-loader?cacheDirectory',
22+
loader: 'babel-loader',
2423
},
2524
],
2625
},
@@ -30,7 +29,6 @@ const webpackConfig = {
3029
plugins: [
3130
new webpack.BannerPlugin(banner),
3231
new DuplicatePackageCheckerPlugin(),
33-
new HardSource(),
3432
],
3533
};
3634

assets/js/package.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "marker-animation",
3-
"version": "4.0.7",
3+
"version": "4.1.0",
44
"description": "marker animation for wordpress",
55
"main": "marker-animation.min.js",
66
"scripts": {
@@ -26,31 +26,30 @@
2626
},
2727
"license": "GPL-3.0",
2828
"devDependencies": {
29-
"@babel/core": "^7.11.6",
30-
"@babel/plugin-transform-react-jsx": "^7.10.4",
31-
"@babel/preset-env": "^7.11.5",
32-
"@technote-space/gutenberg-test-helper": "^0.0.21",
33-
"@technote-space/gutenberg-utils": "^2.2.13",
34-
"@technote-space/register-grouped-format-type": "^2.0.11",
35-
"@wordpress/components": "^10.2.0",
36-
"@wordpress/compose": "^3.20.1",
37-
"@wordpress/element": "^2.17.1",
38-
"@wordpress/rich-text": "^3.21.1",
39-
"babel-jest": "^26.3.0",
40-
"babel-loader": "^8.1.0",
29+
"@babel/core": "^7.12.9",
30+
"@babel/plugin-transform-react-jsx": "^7.12.7",
31+
"@babel/preset-env": "^7.12.7",
32+
"@technote-space/gutenberg-test-helper": "^0.1.4",
33+
"@technote-space/gutenberg-utils": "^2.3.0",
34+
"@technote-space/register-grouped-format-type": "^2.2.0",
35+
"@wordpress/components": "^11.1.3",
36+
"@wordpress/compose": "^3.22.0",
37+
"@wordpress/element": "^2.18.0",
38+
"@wordpress/rich-text": "^3.23.0",
39+
"babel-jest": "^26.6.3",
40+
"babel-loader": "^8.2.2",
4141
"duplicate-package-checker-webpack-plugin": "^3.0.0",
4242
"enzyme": "^3.11.0",
43-
"enzyme-to-json": "^3.5.0",
44-
"eslint": "^7.9.0",
45-
"eslint-plugin-react": "^7.21.1",
46-
"hard-source-webpack-plugin": "^0.13.1",
47-
"jest": "^26.4.2",
43+
"enzyme-to-json": "^3.6.1",
44+
"eslint": "^7.14.0",
45+
"eslint-plugin-react": "^7.21.5",
46+
"jest": "^26.6.3",
4847
"jest-extended": "^0.11.5",
4948
"jquery": "^3.5.1",
50-
"jquery.marker-animation": "^1.4.29",
51-
"react": "^16.13.1",
49+
"jquery.marker-animation": "^1.5.2",
50+
"lodash": "^4.17.20",
5251
"speed-measure-webpack-plugin": "^1.3.3",
53-
"webpack": "^4.44.2",
54-
"webpack-cli": "~3.3.12"
52+
"webpack": "^5.9.0",
53+
"webpack-cli": "~4.2.0"
5554
}
5655
}
Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import React from 'react';
22
import { TextControl } from '@wordpress/components';
3-
import { compose, withState } from '@wordpress/compose';
4-
5-
const { isEqual } = window.lodash;
3+
import { useState, useMemo, useCallback } from '@wordpress/element';
4+
import { isEqual } from 'lodash';
65

76
/**
8-
* @param {object?} stateArgs state args
9-
* @param {string?} initialValue initial value
10-
* @param {string?} stateValue state value
11-
* @param {function} setState set state
127
* @param {function} onChange on change
138
* @param {object} args args
149
* @param {string} id id
@@ -17,29 +12,30 @@ const { isEqual } = window.lodash;
1712
* @returns {Component} text control
1813
* @constructor
1914
*/
20-
const MyTextControl = ({ stateArgs, initialValue, stateValue, setState, onChange, args, id, label, value }) => {
15+
const MyTextControl = ({ onChange, args, id, label, value }) => {
16+
const [stateArgs, setStateArgs] = useState(undefined);
17+
const [stateValue, setStateValue] = useState('');
18+
const [initialValue, setInitialValue] = useState('');
19+
const onBlur = useCallback(() => {
20+
if (initialValue !== stateValue) {
21+
onChange(stateValue);
22+
}
23+
});
24+
25+
2126
if (undefined === stateArgs || !isEqual([args.value.start, args.value.end, args.value.text], [stateArgs.value.start, stateArgs.value.end, stateArgs.value.text])) {
22-
setState({ stateArgs: args });
23-
setState({ initialValue: value });
24-
setState({ stateValue: value });
27+
setStateArgs(args);
28+
setStateValue(value);
29+
setInitialValue(value);
2530
}
26-
return <TextControl
31+
32+
return useMemo(() => <TextControl
2733
id={id}
2834
label={label}
2935
value={stateValue}
30-
onChange={value => setState({ stateValue: value })}
31-
onBlur={() => {
32-
if (initialValue !== stateValue) {
33-
onChange(stateValue);
34-
}
35-
}}
36-
/>;
36+
onChange={setStateValue}
37+
onBlur={onBlur}
38+
/>, [id, stateValue]);
3739
};
3840

39-
export default compose(
40-
withState({
41-
stateArgs: undefined,
42-
stateValue: '',
43-
initialValue: '',
44-
}),
45-
)(MyTextControl);
41+
export default MyTextControl;

assets/js/src/gutenberg/utils/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const getPanelComponent = (setting, args, formatName, value, stripe) => {
2222
}
2323

2424
// eslint-disable-next-line no-magic-numbers
25-
if (stripe && ['duration', 'delay', 'function', 'repeat'].indexOf(setting.name) >= 0) {
25+
if (stripe && ['duration', 'delay', 'function', 'repeat', 'rtl'].indexOf(setting.name) >= 0) {
2626
return null;
2727
}
2828

0 commit comments

Comments
 (0)