Skip to content

Commit 3b1c87a

Browse files
committed
ESNext, bugfixes, wp-release
1 parent 61c6e24 commit 3b1c87a

27 files changed

+3982
-1704
lines changed

.babelrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env"
4+
],
5+
"plugins": [
6+
"@babel/plugin-proposal-object-rest-spread",
7+
"@babel/plugin-proposal-class-properties",
8+
[
9+
"@babel/transform-react-jsx",
10+
{
11+
"pragma": "wp.element.createElement"
12+
}
13+
]
14+
],
15+
"env": {
16+
"default": {
17+
"plugins": ["transform-runtime"]
18+
}
19+
}
20+
}

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = tab
6+
indent_size = 4
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[{package.json, .eslintrc, *.yml}]
13+
indent_style = space
14+
indent_size = 2
15+
16+
[composer.json, eslintrc.json]
17+
indent_style = tab
18+
indent_size = 4
19+
20+
[*.md]
21+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor
2+
node_modules

.eslintrc

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
{
2+
"root": true,
3+
"parser": "babel-eslint",
4+
"extends": [
5+
"wordpress",
6+
"plugin:react/recommended"
7+
],
8+
"env": {
9+
"browser": false,
10+
"es6": true,
11+
"node": true,
12+
"mocha": true
13+
},
14+
"parserOptions": {
15+
"sourceType": "module",
16+
"ecmaFeatures": {
17+
"jsx": true
18+
}
19+
},
20+
"globals": {
21+
"wp": true,
22+
"wpApiSettings": true,
23+
"window": true,
24+
"document": true
25+
},
26+
"plugins": ["react"],
27+
"settings": {
28+
"react": {
29+
"pragma": "wp"
30+
}
31+
},
32+
"rules": {
33+
"linebreak-style": 0,
34+
"array-bracket-spacing": ["error", "always"],
35+
"brace-style": ["error", "1tbs"],
36+
"camelcase": ["error", { "properties": "never" }],
37+
"comma-dangle": ["error", "always-multiline"],
38+
"comma-spacing": "error",
39+
"comma-style": "error",
40+
"computed-property-spacing": ["error", "always"],
41+
"constructor-super": "error",
42+
"dot-notation": "error",
43+
"eol-last": "error",
44+
"eqeqeq": "error",
45+
"func-call-spacing": "error",
46+
"indent": ["error", "tab", { "SwitchCase": 1 }],
47+
"jsx-quotes": "error",
48+
"key-spacing": "error",
49+
"keyword-spacing": "error",
50+
"lines-around-comment": "off",
51+
"no-alert": "error",
52+
"no-bitwise": "error",
53+
"no-caller": "error",
54+
"no-console": "off",
55+
"no-const-assign": "error",
56+
"no-debugger": "error",
57+
"no-dupe-args": "error",
58+
"no-dupe-class-members": "error",
59+
"no-dupe-keys": "error",
60+
"no-duplicate-case": "error",
61+
"no-duplicate-imports": "error",
62+
"no-else-return": "error",
63+
"no-eval": "error",
64+
"no-extra-semi": "error",
65+
"no-fallthrough": "error",
66+
"no-lonely-if": "error",
67+
"no-mixed-operators": "error",
68+
"no-mixed-spaces-and-tabs": "error",
69+
"no-multiple-empty-lines": ["error", { "max": 1 }],
70+
"no-multi-spaces": "error",
71+
"no-multi-str": "off",
72+
"no-negated-in-lhs": "error",
73+
"no-nested-ternary": "error",
74+
"no-redeclare": "error",
75+
"no-restricted-syntax": [
76+
"error",
77+
{
78+
"selector":
79+
"ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]",
80+
"message": "Path access on WordPress dependencies is not allowed."
81+
},
82+
{
83+
"selector": "ImportDeclaration[source.value=/^blocks$/]",
84+
"message": "Use @wordpress/blocks as import path instead."
85+
},
86+
{
87+
"selector": "ImportDeclaration[source.value=/^components$/]",
88+
"message": "Use @wordpress/components as import path instead."
89+
},
90+
{
91+
"selector": "ImportDeclaration[source.value=/^date$/]",
92+
"message": "Use @wordpress/date as import path instead."
93+
},
94+
{
95+
"selector": "ImportDeclaration[source.value=/^editor$/]",
96+
"message": "Use @wordpress/editor as import path instead."
97+
},
98+
{
99+
"selector": "ImportDeclaration[source.value=/^element$/]",
100+
"message": "Use @wordpress/element as import path instead."
101+
},
102+
{
103+
"selector": "ImportDeclaration[source.value=/^i18n$/]",
104+
"message": "Use @wordpress/i18n as import path instead."
105+
},
106+
{
107+
"selector": "ImportDeclaration[source.value=/^data$/]",
108+
"message": "Use @wordpress/data as import path instead."
109+
},
110+
{
111+
"selector": "ImportDeclaration[source.value=/^utils$/]",
112+
"message": "Use @wordpress/utils as import path instead."
113+
},
114+
{
115+
"selector":
116+
"CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
117+
"message": "Translate function arguments must be string literals."
118+
},
119+
{
120+
"selector":
121+
"CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
122+
"message": "Translate function arguments must be string literals."
123+
},
124+
{
125+
"selector":
126+
"CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
127+
"message": "Translate function arguments must be string literals."
128+
}
129+
],
130+
"no-shadow": "error",
131+
"no-undef": "error",
132+
"no-undef-init": "error",
133+
"no-unreachable": "error",
134+
"no-unsafe-negation": "error",
135+
"no-unused-expressions": "error",
136+
"no-unused-vars": "error",
137+
"no-useless-computed-key": "error",
138+
"no-useless-constructor": "error",
139+
"no-useless-return": "error",
140+
"no-var": "error",
141+
"no-whitespace-before-property": "error",
142+
"object-curly-spacing": ["error", "always"],
143+
"padded-blocks": ["error", { "classes": "always" }],
144+
"prefer-const": "error",
145+
"quote-props": ["error", "as-needed"],
146+
"react/display-name": "off",
147+
"react/jsx-curly-spacing": [
148+
"error",
149+
{
150+
"when": "always",
151+
"children": true
152+
}
153+
],
154+
"react/jsx-equals-spacing": "error",
155+
"react/jsx-indent": ["error", "tab"],
156+
"react/jsx-indent-props": ["error", "tab"],
157+
"react/jsx-key": "error",
158+
"react/jsx-tag-spacing": "error",
159+
"react/no-children-prop": "off",
160+
"react/no-find-dom-node": "warn",
161+
"react/prop-types": "off",
162+
"semi": "error",
163+
"semi-spacing": "error",
164+
"space-before-blocks": ["error", "always"],
165+
"space-before-function-paren": ["error", "never"],
166+
"space-in-parens": ["error", "always"],
167+
"space-infix-ops": ["error", { "int32Hint": false }],
168+
"space-unary-ops": [
169+
"error",
170+
{
171+
"overrides": {
172+
"!": true
173+
}
174+
}
175+
],
176+
"template-curly-spacing": ["error", "always"],
177+
"valid-jsdoc": ["error", { "requireReturn": false }],
178+
"valid-typeof": "error",
179+
"yoda": 1
180+
}
181+
}

.sassrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"sourceMap": true,
3+
"sourceMapEmbed": true
4+
}

.wporg/screenshot-1.png

487 KB
Loading

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
PDF Renderer
22
============
33

4-
Client-Side conversion of PDF Files when dropped into the media library.
4+
Client-Side conversion of PDF Files to images when dropped into the media library.
55

6+
![Upload Dialog](.wporg/screenshot-1.png)
7+
PDF-Contents: cc-by [Creative Commons](https://creativecommons.org/)
68

79
Installation
810
------------
911

10-
### Production (Stand-Alone)
11-
- Head over to [releases](../../releases)
12-
- Download 'pdf-renderer.zip'
13-
- Upload and activate it like any other WordPress plugin
14-
- AutoUpdate will run as long as the plugin is active
15-
1612
### Production (using Github Updater – recommended for Multisite)
1713
- Install [Andy Fragen's GitHub Updater](https://github.com/afragen/github-updater) first.
1814
- In WP Admin go to Settings / GitHub Updater / Install Plugin. Enter `mcguffin/pdf-renderer` as a Plugin-URI.

TODO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
PDF Renderer TODO
2+
=================
3+
- [x] ESNext
4+
- [x] Reset on close (cant select a second time)
5+
- [ ] Proper filenames / attachement titles
6+
- [ ] Refactor pdf-frame.js
7+
- [ ] close Popup before upload / or indicate progress somehow...

css/admin/media.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/admin/media.dev.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)