Yuki Takei 4 лет назад
Родитель
Сommit
2508ac3180

+ 4 - 4
packages/plugin-lsx/src/client-entry.js

@@ -1,10 +1,10 @@
 import { LsxPreRenderInterceptor } from './client/js/util/Interceptor/LsxPreRenderInterceptor';
 import { LsxPostRenderInterceptor } from './client/js/util/Interceptor/LsxPostRenderInterceptor';
 
-module.exports = (crowi, crowiRenderer) => {
+export default (appContainer) => {
   // add interceptors
-  crowi.interceptorManager.addInterceptors([
-    new LsxPreRenderInterceptor(crowi),
-    new LsxPostRenderInterceptor(crowi),
+  appContainer.interceptorManager.addInterceptors([
+    new LsxPreRenderInterceptor(),
+    new LsxPostRenderInterceptor(appContainer),
   ]);
 };

+ 2 - 2
packages/plugin-lsx/src/client/js/components/Lsx.jsx

@@ -46,7 +46,7 @@ export class Lsx extends React.Component {
     // ex: '/Java/' not to match to '/JavaScript'
     const pagePath = pathUtils.addTrailingSlash(lsxContext.pagePath);
 
-    this.props.crowi.apiGet('/plugins/lsx', { pagePath, options: lsxContext.options })
+    this.props.appContainer.apiGet('/plugins/lsx', { pagePath, options: lsxContext.options })
       .then((res) => {
         if (res.ok) {
           const nodeTree = this.generatePageNodeTree(pagePath, res.pages);
@@ -200,7 +200,7 @@ export class Lsx extends React.Component {
 }
 
 Lsx.propTypes = {
-  crowi: PropTypes.object.isRequired,
+  appContainer: PropTypes.object.isRequired,
 
   lsxContext: PropTypes.instanceOf(LsxContext).isRequired,
   lsxStateCache: PropTypes.object,

+ 3 - 3
packages/plugin-lsx/src/client/js/util/Interceptor/LsxPostRenderInterceptor.js

@@ -13,9 +13,9 @@ import { LsxCacheHelper } from '../LsxCacheHelper';
  */
 export class LsxPostRenderInterceptor extends BasicInterceptor {
 
-  constructor(crowi) {
+  constructor(appContainer) {
     super();
-    this.crowi = crowi;
+    this.appContainer = appContainer;
   }
 
   /**
@@ -55,7 +55,7 @@ export class LsxPostRenderInterceptor extends BasicInterceptor {
 
   renderReactDOM(lsxContext, lsxStateCache, elem) {
     ReactDOM.render(
-      <Lsx crowi={this.crowi} lsxContext={lsxContext} lsxStateCache={lsxStateCache} />,
+      <Lsx appContainer={this.appContainer} lsxContext={lsxContext} lsxStateCache={lsxStateCache} />,
       elem,
     );
   }

+ 2 - 6
packages/plugin-lsx/src/client/js/util/Interceptor/LsxPreRenderInterceptor.js

@@ -10,12 +10,6 @@ import { LsxCacheHelper } from '../LsxCacheHelper';
  */
 export class LsxPreRenderInterceptor extends BasicInterceptor {
 
-  constructor(crowi) {
-    super();
-    this.crowi = crowi;
-    this.crowiForJquery = crowi.getCrowiForJquery();
-  }
-
   /**
    * @inheritdoc
    */
@@ -35,6 +29,8 @@ export class LsxPreRenderInterceptor extends BasicInterceptor {
     const currentPagePath = context.currentPagePath;
     this.initializeCache(contextName);
 
+    console.log('LsxPreRenderInterceptor');
+
     context.lsxContextMap = {};
 
     // TODO retrieve from args for interceptor