|
|
@@ -45,7 +45,6 @@ export default class PageContainer extends Container {
|
|
|
pageId: mainContent.getAttribute('data-page-id'),
|
|
|
revisionId,
|
|
|
revisionCreatedAt: +mainContent.getAttribute('data-page-revision-created'),
|
|
|
- revisionAuthor: JSON.parse(mainContent.getAttribute('data-page-revision-author')),
|
|
|
path,
|
|
|
tocHtml: '',
|
|
|
isLiked: JSON.parse(mainContent.getAttribute('data-page-is-liked')),
|
|
|
@@ -54,7 +53,6 @@ export default class PageContainer extends Container {
|
|
|
sumOfSeenUsers: 0,
|
|
|
sumOfLikers: 0,
|
|
|
createdAt: mainContent.getAttribute('data-page-created-at'),
|
|
|
- creator: JSON.parse(mainContent.getAttribute('data-page-creator')),
|
|
|
updatedAt: mainContent.getAttribute('data-page-updated-at'),
|
|
|
isForbidden: JSON.parse(mainContent.getAttribute('data-page-is-forbidden')),
|
|
|
isDeleted: JSON.parse(mainContent.getAttribute('data-page-is-deleted')),
|
|
|
@@ -70,12 +68,26 @@ export default class PageContainer extends Container {
|
|
|
// latest(on remote) information
|
|
|
remoteRevisionId: revisionId,
|
|
|
revisionIdHackmdSynced: mainContent.getAttribute('data-page-revision-id-hackmd-synced') || null,
|
|
|
- lastUpdateUsername: undefined,
|
|
|
+ lastUpdateUsername: mainContent.getAttribute('data-page-last-update-username') || null,
|
|
|
pageIdOnHackmd: mainContent.getAttribute('data-page-id-on-hackmd') || null,
|
|
|
hasDraftOnHackmd: !!mainContent.getAttribute('data-page-has-draft-on-hackmd'),
|
|
|
isHackmdDraftUpdatingInRealtime: false,
|
|
|
};
|
|
|
|
|
|
+ // parse creator, lastUpdateUser and revisionAuthor
|
|
|
+ try {
|
|
|
+ this.state.creator = JSON.parse(mainContent.getAttribute('data-page-creator'));
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ logger.warn('The data of \'data-page-creator\' is invalid', e);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ this.state.revisionAuthor = JSON.parse(mainContent.getAttribute('data-page-revision-author'));
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ logger.warn('The data of \'data-page-revision-author\' is invalid', e);
|
|
|
+ }
|
|
|
+
|
|
|
const { interceptorManager } = this.appContainer;
|
|
|
interceptorManager.addInterceptor(new DetachCodeBlockInterceptor(appContainer), 10); // process as soon as possible
|
|
|
interceptorManager.addInterceptor(new DrawioInterceptor(appContainer), 20);
|