Explorar o código

create ref from Crowi to Page

utsushiiro %!s(int64=7) %!d(string=hai) anos
pai
achega
56f665103f
Modificáronse 2 ficheiros con 9 adicións e 0 borrados
  1. 4 0
      src/client/js/app.js
  2. 5 0
      src/client/js/util/Crowi.js

+ 4 - 0
src/client/js/app.js

@@ -158,6 +158,10 @@ Object.keys(componentMappings).forEach((key) => {
   }
 });
 
+// set page if exists
+if (componentInstances['page'] != null) {
+  crowi.setPage(componentInstances['page']);
+}
 
 /**
  * save success handler when reloading is not needed

+ 5 - 0
src/client/js/util/Crowi.js

@@ -29,6 +29,7 @@ export default class Crowi {
     this.document = window.document || {};
     this.localStorage = window.localStorage || {};
     this.socketClientId = Math.floor(Math.random() * 100000);
+    this.page = undefined;
     this.pageEditor = undefined;
 
     this.fetchUsers = this.fetchUsers.bind(this);
@@ -69,6 +70,10 @@ export default class Crowi {
     return this.config;
   }
 
+  setPage(page) {
+    this.page = page;
+  }
+
   setPageEditor(pageEditor) {
     this.pageEditor = pageEditor;
   }