Skip to content

Commit 87b2076

Browse files
committed
Fix/improve js initialization of spreadsheet module
1 parent ab44281 commit 87b2076

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ module.exports = {
22
root: true,
33
env: {
44
browser: true,
5-
node: true
5+
node: true,
6+
es6: true
67
},
78
parser: "babel-eslint",
89
parserOptions: {

Resources/Private/Assets/JavaScript/main.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import DSN from './dsn';
22
import Renderer from './renderer';
33
import Spreadsheet from './spreadsheet';
44
import Selector from "./selector";
5+
import DocumentService from 'DocumentService';
56

67
class SpreadsheetDataInput {
78
constructor(element) {
@@ -125,7 +126,10 @@ class SpreadsheetDataInput {
125126
}
126127

127128
// initialize all spreadsheet data inputs
128-
document.querySelectorAll('.spreadsheet-input-wrap').forEach((element) => {
129-
new SpreadsheetDataInput(element);
129+
DocumentService.ready().then(() => {
130+
document.querySelectorAll('.spreadsheet-input-wrap').forEach((element) => {
131+
new SpreadsheetDataInput(element);
132+
});
133+
}).catch(() => {
134+
console.error('Failed to load DOM for processing spreadsheet inputs!');
130135
});
131-

Resources/Public/JavaScript/SpreadsheetDataInput.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ module.exports = (env, argv) => ({
3737
filename: "[name].js",
3838
libraryTarget: "amd",
3939
path: path.join(__dirname, "/Resources/Public/JavaScript"),
40-
publicPath: argv.mode !== "production" ? "/" : "../dist/",
41-
umdNamedDefine: true
40+
publicPath: argv.mode !== "production" ? "/" : "../dist/"
4241
},
4342
externals: {
44-
// require("jquery") is external and available on the global var jQuery
45-
"jquery": "jquery",
43+
"DocumentService": "TYPO3/CMS/Core/DocumentService",
4644
}
4745
});

0 commit comments

Comments
 (0)