|
@@ -31,13 +31,17 @@ export default class AppContainer extends Container {
|
|
|
|
|
|
|
|
const body = document.querySelector('body');
|
|
const body = document.querySelector('body');
|
|
|
|
|
|
|
|
- this.me = body.dataset.currentUsername || null; // will be initialized with null when data is empty string
|
|
|
|
|
this.isAdmin = body.dataset.isAdmin === 'true';
|
|
this.isAdmin = body.dataset.isAdmin === 'true';
|
|
|
this.csrfToken = body.dataset.csrftoken;
|
|
this.csrfToken = body.dataset.csrftoken;
|
|
|
this.isPluginEnabled = body.dataset.pluginEnabled === 'true';
|
|
this.isPluginEnabled = body.dataset.pluginEnabled === 'true';
|
|
|
this.isLoggedin = document.querySelector('.main-container.nologin') == null;
|
|
this.isLoggedin = document.querySelector('.main-container.nologin') == null;
|
|
|
|
|
|
|
|
- this.config = JSON.parse(document.getElementById('crowi-context-hydrate').textContent || '{}');
|
|
|
|
|
|
|
+ this.config = JSON.parse(document.getElementById('growi-context-hydrate').textContent || '{}');
|
|
|
|
|
+
|
|
|
|
|
+ const currentUserElem = document.getElementById('growi-current-user');
|
|
|
|
|
+ if (currentUserElem != null) {
|
|
|
|
|
+ this.currentUser = JSON.parse(currentUserElem.textContent);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
const userAgent = window.navigator.userAgent.toLowerCase();
|
|
const userAgent = window.navigator.userAgent.toLowerCase();
|
|
|
this.isMobile = /iphone|ipad|android/.test(userAgent);
|
|
this.isMobile = /iphone|ipad|android/.test(userAgent);
|
|
@@ -107,6 +111,20 @@ export default class AppContainer extends Container {
|
|
|
window.crowiPlugin = window.growiPlugin;
|
|
window.crowiPlugin = window.growiPlugin;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ get currentUserId() {
|
|
|
|
|
+ if (this.currentUser == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.currentUser._id;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ get currentUsername() {
|
|
|
|
|
+ if (this.currentUser == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.currentUser.username;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @return {Object} window.Crowi (js/legacy/crowi.js)
|
|
* @return {Object} window.Crowi (js/legacy/crowi.js)
|
|
|
*/
|
|
*/
|
|
@@ -271,14 +289,6 @@ export default class AppContainer extends Container {
|
|
|
return users;
|
|
return users;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- findUser(username) {
|
|
|
|
|
- if (this.userByName && this.userByName[username]) {
|
|
|
|
|
- return this.userByName[username];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
launchHandsontableModal(componentKind, beginLineNumber, endLineNumber) {
|
|
launchHandsontableModal(componentKind, beginLineNumber, endLineNumber) {
|
|
|
let targetComponent;
|
|
let targetComponent;
|
|
|
switch (componentKind) {
|
|
switch (componentKind) {
|