Browse Source

integration inside tracim_frontend

Skylsmoi 5 years ago
parent
commit
ce104f7b4a

File diff suppressed because it is too large
+ 7 - 7
dist/html-documents.app.js


+ 1 - 1
dist/index.html View File

@@ -3,7 +3,7 @@
3 3
 <head>
4 4
   <meta charset='utf-8' />
5 5
   <meta name="viewport" content="width=device-width, user-scalable=no" />
6
-  <title>PageHtml App Tracim</title>
6
+  <title>Html-documents App Tracim</title>
7 7
   <link rel='shortcut icon' href='favicon.ico'>
8 8
 
9 9
   <link rel="stylesheet" type="text/css" href="./font/font-awesome-4.7.0/css/font-awesome.css">

+ 1 - 1
package.json View File

@@ -1,5 +1,5 @@
1 1
 {
2
-  "name": "tracim_app_pagehtml",
2
+  "name": "tracim_app_html-documents",
3 3
   "version": "1.1.2",
4 4
   "description": "",
5 5
   "main": "index.js",

+ 28 - 0
src/component/HtmlDocument.jsx View File

@@ -0,0 +1,28 @@
1
+import React from 'react'
2
+import { TextAreaApp } from 'tracim_lib'
3
+import { MODE } from '../helper.js'
4
+
5
+const HtmlDocument = props => {
6
+  return (
7
+    <div className='wsContentHtmlDocument__contentpage__textnote'>
8
+      {props.mode === MODE.VIEW &&
9
+        <div>
10
+          <div className='html-documents__contentpage__textnote__latestversion' dangerouslySetInnerHTML={{__html: props.version}} />
11
+          <div className='html-documents__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
12
+        </div>
13
+      }
14
+
15
+      {props.mode === MODE.EDIT &&
16
+        <TextAreaApp
17
+          customClass={'wsContentHtmlDocument'}
18
+          onClickCancelBtn={props.onClickCloseEditMode}
19
+          onClickValidateBtn={props.onClickValidateBtn}
20
+          text={props.text}
21
+          onChangeText={props.onChangeText}
22
+        />
23
+      }
24
+    </div>
25
+  )
26
+}
27
+
28
+export default HtmlDocument

+ 0 - 22
src/component/PageHtml.jsx View File

@@ -1,22 +0,0 @@
1
-import React from 'react'
2
-import { TextAreaApp } from 'tracim_lib'
3
-import { MODE } from '../helper.js'
4
-
5
-const PageHtml = props => {
6
-  return (
7
-    <div className='wsContentPageHtml__contentpage__textnote'>
8
-      {props.mode === MODE.VIEW &&
9
-        <div>
10
-          <div className='wsContentPageHtml__contentpage__textnote__latestversion' dangerouslySetInnerHTML={{__html: props.version}} />
11
-          <div className='wsContentPageHtml__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
12
-        </div>
13
-      }
14
-
15
-      {props.mode === MODE.EDIT &&
16
-        <TextAreaApp customClass={'wsContentPageHtml'} onClickCancelBtn={props.onClickCloseEditMode} />
17
-      }
18
-    </div>
19
-  )
20
-}
21
-
22
-export default PageHtml

+ 243 - 0
src/container/HtmlDocument.jsx View File

@@ -0,0 +1,243 @@
1
+import React from 'react'
2
+import HtmlDocumentComponent from '../component/HtmlDocument.jsx'
3
+import {
4
+  handleFetchResult,
5
+  PopinFixed,
6
+  PopinFixedHeader,
7
+  PopinFixedOption,
8
+  PopinFixedContent,
9
+  Timeline
10
+} from 'tracim_lib'
11
+import { FETCH_CONFIG, MODE, debug } from '../helper.js'
12
+import i18n from '../i18n.js'
13
+
14
+class HtmlDocument extends React.Component {
15
+  constructor (props) {
16
+    super(props)
17
+    this.state = {
18
+      appName: 'html-documents',
19
+      isVisible: true,
20
+      config: props.data ? props.data.config : debug.config,
21
+      loggedUser: props.data ? props.data.loggedUser : debug.loggedUser,
22
+      content: props.data ? props.data.content : debug.content,
23
+      timeline: props.data ? [] : [], // debug.timeline,
24
+      newComment: '',
25
+      mode: MODE.VIEW
26
+    }
27
+
28
+    document.addEventListener('appCustomEvent', this.customEventReducer)
29
+  }
30
+
31
+  customEventReducer = ({ detail: { type, data } }) => { // action: { type: '', data: {} }
32
+    switch (type) {
33
+      case 'html-documents_showApp':
34
+        this.setState({isVisible: true})
35
+        break
36
+      case 'html-documents_hideApp':
37
+        this.setState({isVisible: false})
38
+        break
39
+      case 'html-documents_reloadContent':
40
+        this.setState({content: data})
41
+    }
42
+  }
43
+
44
+  componentDidMount () {
45
+    console.log('HtmlDocument did mount')
46
+    if (this.state.content.content_id === -1) return // debug case
47
+
48
+    this.loadContent()
49
+    // wysiwyg()
50
+  }
51
+
52
+  componentDidUpdate (prevProps, prevState) {
53
+    console.log('HtmlDocument did update', prevState, this.state)
54
+    if (!prevState.content || !this.state.content) return
55
+
56
+    if (prevState.content.content_id !== this.state.content.content_id) {
57
+      this.loadContent()
58
+    }
59
+  }
60
+
61
+  loadContent = async () => {
62
+    const { content, config } = this.state
63
+
64
+    const fetchResultHtmlDocument = await fetch(`${config.apiUrl}/workspaces/${content.workspace_id}/html-documents/${content.content_id}`, { // ${content.workspace_id} ${content.content_id}
65
+      ...FETCH_CONFIG,
66
+      method: 'GET'
67
+    })
68
+    const fetchResultComment = await fetch(`${config.apiUrl}/workspaces/${content.workspace_id}/contents/${content.content_id}/comments`, { // ${content.workspace_id} ${content.content_id}
69
+      ...FETCH_CONFIG,
70
+      method: 'GET'
71
+    })
72
+    const fetchResultRevision = await fetch(`${config.apiUrl}/workspaces/${content.workspace_id}/html-documents/${content.content_id}/revisions`, { // ${content.workspace_id} ${content.content_id}
73
+      ...FETCH_CONFIG,
74
+      method: 'GET'
75
+    })
76
+
77
+    handleFetchResult(fetchResultHtmlDocument)
78
+      .then(resHtmlDocument => this.setState({content: resHtmlDocument.body}))
79
+      .catch(e => console.log('Error loading content.', e))
80
+
81
+    Promise.all([
82
+      handleFetchResult(fetchResultComment),
83
+      handleFetchResult(fetchResultRevision)
84
+    ])
85
+      .then(([resComment, resRevision]) => {
86
+        const resCommentWithProperDate = resComment.body.map(c => ({...c, created: (new Date(c.created)).toLocaleString()}))
87
+        const revisionWithComment = resRevision.body
88
+          .map(r => ({
89
+            ...r,
90
+            created: (new Date(r.created)).toLocaleString(),
91
+            timelineType: 'revision',
92
+            commentList: r.comments_ids.map(ci => ({
93
+              timelineType: 'comment',
94
+              ...resCommentWithProperDate.find(c => c.content_id === ci)
95
+            }))
96
+          }))
97
+          .reduce((acc, rev) => [
98
+            ...acc,
99
+            rev,
100
+            ...rev.commentList.map(comment => ({
101
+              ...comment,
102
+              customClass: '',
103
+              loggedUser: this.state.config.loggedUser
104
+            }))
105
+          ], [])
106
+
107
+        console.log(revisionWithComment)
108
+
109
+        this.setState({timeline: revisionWithComment})
110
+      })
111
+      .catch(e => {
112
+        console.log('Error loading Timeline.', e)
113
+        this.setState({timeline: []})
114
+      })
115
+  }
116
+
117
+  saveEditHtmlDocument = (label, rawContent) => fetch(`${this.state.config.apiUrl}/workspaces/${this.state.content.workspace_id}/html-documents/${this.state.content.content_id}`, {
118
+    ...FETCH_CONFIG,
119
+    method: 'PUT',
120
+    body: JSON.stringify({
121
+      label: label,
122
+      raw_content: rawContent
123
+    })
124
+  })
125
+
126
+  handleClickBtnCloseApp = () => {
127
+    this.setState({ isVisible: false })
128
+    GLOBAL_dispatchEvent({type: 'appClosed', data: {}})
129
+  }
130
+
131
+  handleSaveEditTitle = async newTitle => {
132
+    const fetchResultSaveHtmlDoc = await this.saveEditHtmlDocument(newTitle, this.state.content.raw_content)
133
+
134
+    handleFetchResult(fetchResultSaveHtmlDoc)
135
+      .then(resSave => {
136
+        if (resSave.apiResponse.status === 200) this.loadContent()
137
+        else console.warn('Error saving html-document. Result:', resSave, 'content:', this.state.content, 'config:', this.state.config)
138
+      })
139
+  }
140
+
141
+  handleClickNewVersion = () => {
142
+    this.setState({ mode: MODE.EDIT })
143
+  }
144
+
145
+  handleCloseNewVersion = () => {
146
+    this.setState({ mode: MODE.VIEW })
147
+  }
148
+
149
+  handleSaveHtmlDocument = async () => {
150
+    const { content, config } = this.state
151
+
152
+    const fetchResultSaveHtmlDoc = await this.saveEditHtmlDocument(content.label, content.raw_content)
153
+
154
+    handleFetchResult(fetchResultSaveHtmlDoc)
155
+      .then(resSave => {
156
+        if (resSave.apiResponse.status === 200) {
157
+          this.handleCloseNewVersion()
158
+          this.loadContent()
159
+        } else {
160
+          console.warn('Error saving html-document. Result:', resSave, 'content:', content, 'config:', config)
161
+        }
162
+      })
163
+  }
164
+
165
+  handleChangeText = e => {
166
+    const newText = e.target.value // because SyntheticEvent is pooled (react specificity
167
+    this.setState(prev => ({content: {...prev.content, raw_content: newText}}))
168
+  }
169
+
170
+  handleChangeNewComment = e => {
171
+    const newComment = e.target.value
172
+    this.setState({newComment})
173
+  }
174
+
175
+  handleClickValidateNewCommentBtn = async () => {
176
+    const { config, content, newComment } = this.state
177
+
178
+    const fetchResultSaveNewComment = await fetch(`${config.apiUrl}/workspaces/${content.workspace_id}/contents/${content.content_id}/comments`, {
179
+      ...FETCH_CONFIG,
180
+      method: 'POST',
181
+      body: JSON.stringify({
182
+        raw_content: newComment
183
+      })
184
+    })
185
+
186
+    handleFetchResult(fetchResultSaveNewComment)
187
+      .then(resSave => {
188
+        if (resSave.apiResponse.status === 200) {
189
+          this.setState({newComment: ''})
190
+          this.loadContent()
191
+        } else {
192
+          console.warn('Error saving html-document comment. Result:', resSave, 'content:', content, 'config:', config)
193
+        }
194
+      })
195
+  }
196
+
197
+  render () {
198
+    const { isVisible, loggedUser, content, timeline, newComment, config } = this.state
199
+
200
+    if (!isVisible) return null
201
+
202
+    return (
203
+      <PopinFixed customClass={`${config.slug}`}>
204
+        <PopinFixedHeader
205
+          customClass={`${config.slug}`}
206
+          faIcon={config.faIcon}
207
+          title={content.label}
208
+          onClickCloseBtn={this.handleClickBtnCloseApp}
209
+          onValidateChangeTitle={this.handleSaveEditTitle}
210
+        />
211
+
212
+        <PopinFixedOption
213
+          customClass={`${config.slug}`}
214
+          onClickNewVersionBtn={this.handleClickNewVersion}
215
+          i18n={i18n}
216
+        />
217
+
218
+        <PopinFixedContent customClass={`${config.slug}__contentpage`}>
219
+          <HtmlDocumentComponent
220
+            mode={this.state.mode}
221
+            onClickCloseEditMode={this.handleCloseNewVersion}
222
+            onClickValidateBtn={this.handleSaveHtmlDocument}
223
+            version={content.current_revision_id}
224
+            text={content.raw_content}
225
+            onChangeText={this.handleChangeText}
226
+            key={'html-documents'}
227
+          />
228
+
229
+          <Timeline
230
+            customClass={`${config.slug}__contentpage`}
231
+            loggedUser={loggedUser}
232
+            timelineData={timeline}
233
+            newComment={newComment}
234
+            onChangeNewComment={this.handleChangeNewComment}
235
+            onClickValidateNewCommentBtn={this.handleClickValidateNewCommentBtn}
236
+          />
237
+        </PopinFixedContent>
238
+      </PopinFixed>
239
+    )
240
+  }
241
+}
242
+
243
+export default HtmlDocument

+ 0 - 206
src/container/PageHtml.jsx View File

@@ -1,206 +0,0 @@
1
-import React from 'react'
2
-import PageHtmlComponent from '../component/PageHtml.jsx'
3
-import {
4
-  handleFetchResult,
5
-  PopinFixed,
6
-  PopinFixedHeader,
7
-  PopinFixedOption,
8
-  PopinFixedContent,
9
-  Timeline
10
-} from 'tracim_lib'
11
-import { timelineDebugData } from '../timelineDebugData.js'
12
-import { FETCH_CONFIG, MODE } from '../helper.js'
13
-import i18n from '../i18n.js'
14
-
15
-const debug = {
16
-  config: {
17
-    label: 'Text Document',
18
-    slug: 'page',
19
-    faIcon: 'file-text-o',
20
-    hexcolor: '#3f52e3',
21
-    creationLabel: 'Write a document',
22
-    domContainer: 'appContainer',
23
-    apiUrl: 'localhost:6543/api/v2',
24
-    mockApiUrl: 'localhost:3001',
25
-    apiHeader: {
26
-      'Accept': 'application/json',
27
-      'Content-Type': 'application/json'
28
-      // 'Authorization': 'Basic ' + btoa(`${'admin@admin.admin'}:${'admin@admin.admin'}`)
29
-    }
30
-  },
31
-  loggedUser: {
32
-    id: 5,
33
-    username: 'Smoi',
34
-    firstname: 'Côme',
35
-    lastname: 'Stoilenom',
36
-    email: 'osef@algoo.fr',
37
-    avatar: 'https://avatars3.githubusercontent.com/u/11177014?s=460&v=4'
38
-  },
39
-  content: {
40
-    author: {
41
-      avatar_url: null,
42
-      public_name: 'Global manager',
43
-      user_id: 1
44
-    },
45
-    content_id: -1,
46
-    content_type: 'page',
47
-    created: '2018-06-18T14:59:26Z',
48
-    current_revision_id: 11,
49
-    is_archived: false,
50
-    is_deleted: false,
51
-    label: 'Current Menu',
52
-    last_modifier: {
53
-      avatar_url: null,
54
-      public_name: 'Global manager',
55
-      user_id: 1
56
-    },
57
-    modified: '2018-06-18T14:59:26Z',
58
-    parent_id: 2,
59
-    raw_content: '<div>bonjour, je suis un lapin.</div>',
60
-    show_in_ui: true,
61
-    slug: 'current-menu',
62
-    status: 'open',
63
-    sub_content_types: ['thread', 'page', 'file', 'folder'],
64
-    workspace_id: 1
65
-  },
66
-  timeline: timelineDebugData
67
-}
68
-
69
-class pageHtml extends React.Component {
70
-  constructor (props) {
71
-    super(props)
72
-    this.state = {
73
-      appName: 'page',
74
-      isVisible: true,
75
-      config: props.data ? props.data.config : debug.config,
76
-      loggedUser: props.data ? props.data.loggedUser : debug.loggedUser,
77
-      content: props.data ? props.data.content : debug.content,
78
-      timeline: props.data ? [] : debug.timeline,
79
-      mode: MODE.VIEW
80
-    }
81
-
82
-    document.addEventListener('appCustomEvent', this.customEventReducer)
83
-  }
84
-
85
-  customEventReducer = ({ detail: { type, data } }) => { // action: { type: '', data: {} }
86
-    switch (type) {
87
-      case 'page_showApp':
88
-        this.setState({isVisible: true})
89
-        break
90
-      case 'page_hideApp':
91
-        this.setState({isVisible: false})
92
-        break
93
-      case 'page_reloadContent':
94
-        this.setState({content: data})
95
-    }
96
-  }
97
-
98
-  componentDidMount () {
99
-    console.log('pageHtml did mount')
100
-    if (this.state.content.content_id === -1) return // debug case
101
-
102
-    this.loadContent()
103
-    // wysiwyg()
104
-  }
105
-
106
-  componentDidUpdate (prevProps, prevState) {
107
-    console.log('pageHtml did update', prevState, this.state)
108
-    if (!prevState.content || !this.state.content) return
109
-
110
-    if (prevState.content.content_id !== this.state.content.content_id) {
111
-      this.loadContent()
112
-    }
113
-  }
114
-
115
-  loadContent = async () => {
116
-    console.log('loadContent')
117
-    const { content, config } = this.state
118
-
119
-    const fetchResultPageHtml = await fetch(`${config.apiUrl}/workspaces/${content.workspace_id}/html-documents/${content.content_id}`, {
120
-      ...FETCH_CONFIG,
121
-      method: 'GET'
122
-    })
123
-    const fetchResultTimeline = await fetch(`${config.apiUrl}/workspaces/${content.workspace_id}/contents/${content.content_id}/comments`, {
124
-      ...FETCH_CONFIG,
125
-      method: 'GET'
126
-    })
127
-
128
-    // Promise.all([
129
-    //   handleFetchResult(fetchResultPageHtml),
130
-    //   handleFetchResult(fetchResultTimeline)
131
-    // ])
132
-    //   .then(([resPageHtml, resTimeline]) => {
133
-    //     this.setState({
134
-    //       content: resPageHtml,
135
-    //       timeline: resTimeline
136
-    //     })
137
-    //   })
138
-    handleFetchResult(fetchResultPageHtml)
139
-      .then(resPageHtml => this.setState({content: resPageHtml}))
140
-      .catch(e => console.log('Error loading content.', e))
141
-
142
-    handleFetchResult(fetchResultTimeline)
143
-      .then(resTimeline => this.setState({timeline: resTimeline}))
144
-      .catch(e => {
145
-        console.log('Error loading Timeline.', e)
146
-        this.setState({timeline: []})
147
-      })
148
-  }
149
-
150
-  handleClickBtnCloseApp = () => {
151
-    this.setState({ isVisible: false })
152
-    GLOBAL_dispatchEvent({type: 'appClosed', data: {}})
153
-  }
154
-
155
-  handleChangeTitle = e => console.log('new title : ', e.target.value)
156
-
157
-  handleClickNewVersion = () => {
158
-    this.setState({ mode: MODE.EDIT })
159
-  }
160
-
161
-  handleCloseNewVersion = () => {
162
-    this.setState({ mode: MODE.VIEW })
163
-  }
164
-
165
-  render () {
166
-    const { isVisible, loggedUser, content, timeline, config } = this.state
167
-
168
-    if (!isVisible) return null
169
-
170
-    return (
171
-      <PopinFixed customClass={`${config.slug}`}>
172
-        <PopinFixedHeader
173
-          customClass={`${config.slug}`}
174
-          icon={config.faIcon}
175
-          name={content.label}
176
-          onClickCloseBtn={this.handleClickBtnCloseApp}
177
-          onChangeTitle={this.handleChangeTitle}
178
-        />
179
-
180
-        <PopinFixedOption
181
-          customClass={`${config.slug}`}
182
-          onClickNewVersionBtn={this.handleClickNewVersion}
183
-          i18n={i18n}
184
-        />
185
-
186
-        <PopinFixedContent customClass={`${config.slug}__contentpage`}>
187
-          <PageHtmlComponent
188
-            mode={this.state.mode}
189
-            onClickCloseEditMode={this.handleCloseNewVersion}
190
-            version={content.current_revision_id}
191
-            text={content.raw_content}
192
-            key={'html-documents'}
193
-          />
194
-
195
-          <Timeline
196
-            customClass={`${config.slug}__contentpage`}
197
-            loggedUser={loggedUser}
198
-            timelineData={timeline}
199
-          />
200
-        </PopinFixedContent>
201
-      </PopinFixed>
202
-    )
203
-  }
204
-}
205
-
206
-export default pageHtml

src/container/PopupCreatePageHtml.jsx → src/container/PopupCreateHtmlDocument.jsx View File

@@ -1,14 +1,13 @@
1 1
 import React from 'react'
2 2
 import {
3
-  CardPopupCreateContent,
4
-  handleFetchResult
3
+  CardPopupCreateContent
5 4
 } from 'tracim_lib'
6 5
 import { FETCH_CONFIG } from '../helper.js'
7 6
 
8 7
 const debug = {
9 8
   config: {
10 9
     label: 'Text Document',
11
-    slug: 'page',
10
+    slug: 'html-documents',
12 11
     faIcon: 'file-text-o',
13 12
     hexcolor: '#3f52e3',
14 13
     creationLabel: 'Write a document',
@@ -33,7 +32,7 @@ const debug = {
33 32
   idFolder: null
34 33
 }
35 34
 
36
-class PopupCreatePageHtml extends React.Component {
35
+class PopupCreateHtmlDocument extends React.Component {
37 36
   constructor (props) {
38 37
     super(props)
39 38
     this.state = {
@@ -101,4 +100,4 @@ class PopupCreatePageHtml extends React.Component {
101 100
   }
102 101
 }
103 102
 
104
-export default PopupCreatePageHtml
103
+export default PopupCreateHtmlDocument

+ 1 - 1
src/css/index.styl View File

@@ -5,7 +5,7 @@ btncolor()
5 5
   box-shadow 0 0 1px 2px htmlColor
6 6
   color off-white
7 7
 
8
-.page
8
+.html-documents
9 9
   width 1155px
10 10
   &__header
11 11
     background-color htmlColor

+ 56 - 0
src/helper.js View File

@@ -1,3 +1,5 @@
1
+import { timelineDebugData } from './timelineDebugData.js'
2
+
1 3
 export const FETCH_CONFIG = {
2 4
   headers: {
3 5
     'Accept': 'application/json',
@@ -10,3 +12,57 @@ export const MODE = {
10 12
   VIEW: 'view',
11 13
   EDIT: 'edit'
12 14
 }
15
+
16
+export const debug = {
17
+  config: {
18
+    label: 'Text Document',
19
+    slug: 'html-documents',
20
+    faIcon: 'file-text-o',
21
+    hexcolor: '#3f52e3',
22
+    creationLabel: 'Write a document',
23
+    domContainer: 'appContainer',
24
+    apiUrl: 'http://localhost:6543/api/v2',
25
+    mockApiUrl: 'http://localhost:3001',
26
+    apiHeader: {
27
+      'Accept': 'application/json',
28
+      'Content-Type': 'application/json'
29
+      // 'Authorization': 'Basic ' + btoa(`${'admin@admin.admin'}:${'admin@admin.admin'}`)
30
+    }
31
+  },
32
+  loggedUser: { // @FIXME this object is outdated
33
+    user_id: 5,
34
+    username: 'Smoi',
35
+    firstname: 'Côme',
36
+    lastname: 'Stoilenom',
37
+    email: 'osef@algoo.fr',
38
+    avatar_url: 'https://avatars3.githubusercontent.com/u/11177014?s=460&v=4'
39
+  },
40
+  content: {
41
+    author: {
42
+      avatar_url: null,
43
+      public_name: 'Global manager',
44
+      user_id: 1 // -1 or 1 for debug
45
+    },
46
+    content_id: 22, // 1 or 22 for debug
47
+    content_type: 'html-documents',
48
+    created: '2018-06-18T14:59:26Z',
49
+    current_revision_id: 11,
50
+    is_archived: false,
51
+    is_deleted: false,
52
+    label: 'Current Menu',
53
+    last_modifier: {
54
+      avatar_url: null,
55
+      public_name: 'Global manager',
56
+      user_id: 1
57
+    },
58
+    modified: '2018-06-18T14:59:26Z',
59
+    parent_id: 2,
60
+    raw_content: '<div>bonjour, je suis un lapin.</div>',
61
+    show_in_ui: true,
62
+    slug: 'current-menu',
63
+    status: 'open',
64
+    sub_content_types: ['thread', 'html-documents', 'file', 'folder'],
65
+    workspace_id: 1
66
+  },
67
+  timeline: timelineDebugData
68
+}

+ 3 - 3
src/index.dev.js View File

@@ -1,12 +1,12 @@
1 1
 import React from 'react'
2 2
 import ReactDOM from 'react-dom'
3
-import PageHtml from './container/PageHtml.jsx'
4
-import PopupCreatePageHtml from './container/PopupCreatePageHtml.jsx'
3
+import HtmlDocument from './container/HtmlDocument.jsx'
4
+// import PopupCreateHtmlDocument from './container/PopupCreateHtmlDocument.jsx'
5 5
 
6 6
 require('./css/index.styl')
7 7
 
8 8
 ReactDOM.render(
9
-  <PageHtml data={undefined} />
9
+  <HtmlDocument data={undefined} />
10 10
   , document.getElementById('content')
11 11
 )
12 12
 

+ 23 - 22
src/index.js View File

@@ -1,35 +1,36 @@
1 1
 import React from 'react'
2 2
 import ReactDOM from 'react-dom'
3
-import PageHtml from './container/PageHtml.jsx'
4
-import PopupCreatePageHtml from './container/PopupCreatePageHtml.jsx'
3
+import HtmlDocument from './container/HtmlDocument.jsx'
4
+import PopupCreateHtmlDocument from './container/PopupCreateHtmlDocument.jsx'
5 5
 
6 6
 require('./css/index.styl')
7 7
 
8
-/* data : {
9
-  loggedUser: {},
10
-  config: {
11
-    name: 'PageHtml',
12
-    label: {
13
-      fr: 'Document',
14
-      en: 'Document'
8
+/*
9
+  data : {
10
+    loggedUser: {},
11
+    config: {
12
+      name: 'HtmlDocument',
13
+      label: {
14
+        fr: 'Document',
15
+        en: 'Document'
16
+      },
17
+      customClass: 'wsContentHtmlDocument',
18
+      icon: 'fa fa-fw fa-file-text-o',
19
+      color: '#3f52e3',
20
+      domContainer: 'appContainer'
21
+      apiUrl: FETCH_CONFIG.apiUrl,
22
+      mockApiUrl: FETCH_CONFIG.mockApiUrl
15 23
     },
16
-    customClass: 'wsContentPageHtml',
17
-    icon: 'fa fa-fw fa-file-text-o',
18
-    color: '#3f52e3',
19
-    domContainer: 'appContainer'
20
-    apiUrl: FETCH_CONFIG.apiUrl,
21
-    mockApiUrl: FETCH_CONFIG.mockApiUrl
22
-  },
23
-  content || folder
24
-}
25
- */
24
+    content || folder
25
+  }
26
+*/
26 27
 
27 28
 const appInterface = {
28
-  name: 'PageHtml',
29
+  name: 'HtmlDocument',
29 30
   isRendered: false,
30 31
   renderApp: data => {
31 32
     return ReactDOM.render(
32
-      <PageHtml data={data} />
33
+      <HtmlDocument data={data} />
33 34
       , document.getElementById(data.config.domContainer)
34 35
     )
35 36
   },
@@ -38,7 +39,7 @@ const appInterface = {
38 39
   },
39 40
   renderPopupCreation: data => {
40 41
     return ReactDOM.render(
41
-      <PopupCreatePageHtml data={data} />
42
+      <PopupCreateHtmlDocument data={data} />
42 43
       , document.getElementById(data.config.domContainer)
43 44
     )
44 45
   }

+ 1 - 1
webpack.config.js View File

@@ -12,7 +12,7 @@ module.exports = {
12 12
     path: path.resolve(__dirname, 'dist'),
13 13
     filename: isProduction ? 'html-documents.app.js' : 'html-documents.app.dev.js',
14 14
     pathinfo: !isProduction,
15
-    library: isProduction ? 'appPageHtml' : undefined,
15
+    library: isProduction ? 'appHtmlDocument' : undefined,
16 16
     libraryTarget: isProduction ? 'var' : undefined
17 17
   },
18 18
   externals: {},