Browse Source

Moved TableBlock block's table.js into client

Karl Hobley 4 years ago
parent
commit
84010b92a7

+ 2 - 1
wagtail/contrib/table_block/static/table_block/js/table.js → client/src/entrypoints/contrib/table_block/table.js

@@ -1,4 +1,4 @@
-'use strict';
+/* eslint-disable */
 
 function initTable(id, tableOptions) {
     var containerId = id + '-handsontable-container';
@@ -172,3 +172,4 @@ function initTable(id, tableOptions) {
         });
     }
 }
+window.initTable = initTable;

+ 16 - 5
client/webpack.config.js

@@ -2,7 +2,15 @@ const path = require('path');
 
 // Generates a path to the output bundle to be loaded in the browser.
 const getOutputPath = (app, filename) => {
-  const appLabel = (app === 'documents' ? 'wagtaildocs' : `wagtail${app}`);
+  let appLabel = `wagtail${app}`;
+
+  // Exceptions
+  if (app === 'documents') {
+    appLabel = 'wagtaildocs';
+  } else if (app === 'contrib/table_block') {
+    appLabel = 'table_block';
+  }
+
   return path.join('wagtail', app, 'static', appLabel, 'js', filename);
 };
 
@@ -17,7 +25,7 @@ const exposedDependencies = {
 
 module.exports = function exports() {
   const entrypoints = {
-    admin: [
+    'admin': [
       'blocks/list',
       'blocks/sequence',
       'blocks/stream',
@@ -47,18 +55,21 @@ module.exports = function exports() {
       'workflow-action',
       'workflow-status',
     ],
-    images: [
+    'images': [
       'image-chooser',
       'image-chooser-telepath',
     ],
-    documents: [
+    'documents': [
       'document-chooser',
       'document-chooser-telepath',
     ],
-    snippets: [
+    'snippets': [
       'snippet-chooser',
       'snippet-chooser-telepath',
     ],
+    'contrib/table_block': [
+      'table',
+    ],
   };
 
   const entry = {};

+ 2 - 0
wagtail/contrib/table_block/static/table_block/js/.gitignore

@@ -0,0 +1,2 @@
+/table.js
+/table.js.map