Browse Source

real integration of plugin pageHtml

Skylsmoi 6 years ago
parent
commit
96091ab9d6

+ 3 - 4
dist/index.html View File

@@ -32,10 +32,9 @@
32 32
     <script src="./dev/bootstrap-4.0.0-beta.2.js"></script>
33 33
 
34 34
     <script type='text/javascript'>
35
-      GLOBAL_renderPlugin = pluginName => {
36
-        if (pluginName === 'PageHtml') {
37
-          pluginPageHtml.renderPlugin('pluginContainer')
38
-          console.log('plugin pagehtml rendered')
35
+      GLOBAL_renderPlugin = data => {
36
+        if (data.file.type === 'PageHtml') {
37
+          pluginPageHtml.renderPlugin('pluginContainer', data)
39 38
         }
40 39
       }
41 40
 

File diff suppressed because it is too large
+ 8 - 3
dist/plugin/pageHtml.plugin.js


+ 2 - 2
package.json View File

@@ -39,10 +39,10 @@
39 39
     "style-loader": "^0.19.0",
40 40
     "stylus": "^0.54.5",
41 41
     "stylus-loader": "^3.0.1",
42
+    "tracim_lib": "git://github.com/Skylsmoi/tracim_lib.git",
42 43
     "url-loader": "^0.6.2",
43 44
     "webpack": "^3.8.1",
44
-    "whatwg-fetch": "^2.0.3",
45
-    "tracim_lib": "git://github.com/Skylsmoi/tracim_lib.git"
45
+    "whatwg-fetch": "^2.0.3"
46 46
   },
47 47
   "devDependencies": {
48 48
     "json-server": "^0.12.0",

+ 1 - 1
src/component/Header/Logo.jsx View File

@@ -10,7 +10,7 @@ const Logo = props => {
10 10
 }
11 11
 export default Logo
12 12
 
13
-Logo.PropTypes = {
13
+Logo.propTypes = {
14 14
   logoSrc: PropTypes.string.isRequired,
15 15
   onClickImg: PropTypes.func.isRequired
16 16
 }

+ 1 - 1
src/component/Header/MenuActionListItem/DropdownLang.jsx View File

@@ -30,7 +30,7 @@ const DropdownLang = props => {
30 30
 }
31 31
 export default DropdownLang
32 32
 
33
-DropdownLang.PropTypes = {
33
+DropdownLang.propTypes = {
34 34
   langList: PropTypes.array.isRequired,
35 35
   onChangeLang: PropTypes.func.isRequired
36 36
 }

+ 1 - 1
src/component/Header/MenuActionListItem/Help.jsx View File

@@ -16,6 +16,6 @@ const Help = props => {
16 16
 }
17 17
 export default Help
18 18
 
19
-Help.PropTypes = {
19
+Help.propTypes = {
20 20
   onClickHelp: PropTypes.func.isRequired
21 21
 }

+ 1 - 1
src/component/Header/MenuActionListItem/MenuProfil.jsx View File

@@ -24,7 +24,7 @@ const MenuProfil = props => {
24 24
 }
25 25
 export default MenuProfil
26 26
 
27
-MenuProfil.PropTypes = {
27
+MenuProfil.propTypes = {
28 28
   user: PropTypes.object.isRequired,
29 29
   onClickMyProfil: PropTypes.func.isRequired,
30 30
   onClickLogout: PropTypes.func.isRequired

+ 1 - 1
src/component/Header/MenuActionListItem/Search.jsx View File

@@ -25,7 +25,7 @@ const Search = props => {
25 25
 }
26 26
 export default Search
27 27
 
28
-Search.PropTypes = {
28
+Search.propTypes = {
29 29
   onChangeInput: PropTypes.func.isRequired,
30 30
   onClickSubmit: PropTypes.func.isRequired
31 31
 }

+ 1 - 1
src/component/Header/MenuLinkList.jsx View File

@@ -18,7 +18,7 @@ const MenuLinkList = props => {
18 18
 }
19 19
 export default MenuLinkList
20 20
 
21
-MenuLinkList.PropTypes = {
21
+MenuLinkList.propTypes = {
22 22
   onClickFeature: PropTypes.func.isRequired,
23 23
   onClickExplore: PropTypes.func.isRequired,
24 24
   onClickAbout: PropTypes.func.isRequired

+ 1 - 1
src/component/common/Card/CardBody.jsx View File

@@ -14,7 +14,7 @@ const CardBody = props => {
14 14
 
15 15
 export default CardBody
16 16
 
17
-CardBody.PropTypes = {
17
+CardBody.propTypes = {
18 18
   children: PropTypes.element.isRequired,
19 19
   formClass: PropTypes.string
20 20
 }

+ 1 - 1
src/component/common/Card/CardHeader.jsx View File

@@ -12,7 +12,7 @@ const CardHeader = props => {
12 12
 
13 13
 export default CardHeader
14 14
 
15
-CardHeader.PropTypes = {
15
+CardHeader.propTypes = {
16 16
   children: PropTypes.element.isRequired,
17 17
   customClass: PropTypes.string
18 18
 }

+ 1 - 1
src/component/common/Input/Button.jsx View File

@@ -16,7 +16,7 @@ const Button = props => {
16 16
 
17 17
 export default Button
18 18
 
19
-Button.PropTypes = {
19
+Button.propTypes = {
20 20
   htmlType: PropTypes.oneOf(['button', 'submit', 'reset']).isRequired,
21 21
   bootstrapType: PropTypes.oneOf(
22 22
     ['primary', 'default', 'default', 'success', 'danger', 'warning', 'info', 'light', 'dark']

+ 1 - 1
src/component/common/Input/InputCheckbox.jsx View File

@@ -21,7 +21,7 @@ const InputGroupText = props => {
21 21
 
22 22
 export default InputGroupText
23 23
 
24
-InputGroupText.PropTypes = {
24
+InputGroupText.propTypes = {
25 25
   parentClassName: PropTypes.string.isRequired,
26 26
   checked: PropTypes.bool.isRequired,
27 27
   onChange: PropTypes.func.isRequired,

+ 1 - 1
src/component/common/Input/InputGroupText.jsx View File

@@ -24,7 +24,7 @@ const InputGroupText = props => {
24 24
 
25 25
 export default InputGroupText
26 26
 
27
-InputGroupText.PropTypes = {
27
+InputGroupText.propTypes = {
28 28
   parentClassName: PropTypes.string.isRequired,
29 29
   value: PropTypes.string.isRequired,
30 30
   type: PropTypes.oneOf(['text', 'email', 'password', 'tel']).isRequired,

+ 2 - 4
src/container/PrivateRoute.jsx View File

@@ -17,10 +17,8 @@ const PrivateRoute = ({ component: Component, ...rest }) => (
17 17
 const mapStateToProps = ({ user }) => ({ user })
18 18
 export default withRouter(connect(mapStateToProps)(PrivateRoute))
19 19
 
20
-PrivateRoute.PropTypes = {
21
-  component: PropTypes.shape({
22
-    Component: PropTypes.object.isRequired
23
-  }),
20
+PrivateRoute.propTypes = {
21
+  component: PropTypes.func.isRequired,
24 22
   user: PropTypes.shape({ // user is get with redux connect
25 23
     isLoggedIn: PropTypes.bool.isRequired
26 24
   })

+ 5 - 16
src/container/WorkspaceContent.jsx View File

@@ -7,13 +7,11 @@ import PageWrapper from '../component/common/layout/PageWrapper.jsx'
7 7
 import PageTitle from '../component/common/layout/PageTitle.jsx'
8 8
 import PageContent from '../component/common/layout/PageContent.jsx'
9 9
 import DropdownCreateButton from '../component/common/Input/DropdownCreateButton.jsx'
10
-// import pluginDatabase from '../plugin/index.js'
11 10
 import {
12 11
   getPluginList,
13 12
   getWorkspaceContent
14 13
 } from '../action-creator.async.js'
15
-import { setActiveFileContent } from '../action-creator.sync.js'
16
-import { bonjour } from 'tracim_lib'
14
+// import pluginDatabase from '../plugin/index.js'
17 15
 
18 16
 class WorkspaceContent extends React.Component {
19 17
   constructor (props) {
@@ -29,17 +27,10 @@ class WorkspaceContent extends React.Component {
29 27
   }
30 28
 
31 29
   handleClickFileItem = file => {
32
-    // this.props.dispatch(setActiveFileContent(file))
33
-    GLOBAL_renderPlugin(file.type)
34
-  }
35
-
36
-  handleDummyBtn = () => {
37
-    // GLOBAL_dispatchEvent({
38
-    //   source: 'Tracim',
39
-    //   type: 'PageHtml_showMsg',
40
-    //   content: 'Bonjour ?'
41
-    // })
42
-    bonjour()
30
+    GLOBAL_renderPlugin({
31
+      file,
32
+      pluginData: this.props.plugin[file.type]
33
+    })
43 34
   }
44 35
 
45 36
   render () {
@@ -58,8 +49,6 @@ class WorkspaceContent extends React.Component {
58 49
         </PageTitle>
59 50
 
60 51
         <PageContent parentClass='workspace__content'>
61
-          <button onClick={this.handleDummyBtn}>Click Me</button>
62
-
63 52
           <div className='workspace__content__fileandfolder folder__content active'>
64 53
             <FileItemHeader />
65 54
 

+ 0 - 105
src/css/Generic.styl View File

@@ -161,108 +161,3 @@
161 161
       border 1px solid grey
162 162
       border-radius 10px
163 163
       padding 15px 25px
164
-
165
-/********************/
166
-
167
-/*** PAGE FILE, THREAD, HTML, MARKDOWN, ISSUE ***/
168
-
169
-.wsFileGeneric
170
-  position fixed
171
-  top 85px
172
-  right 0
173
-  border 1px solid grey
174
-  height 100%
175
-  background-color lightGrey
176
-  box-shadow shadow-page
177
-  visibility hidden
178
-  z-index 1
179
-  &.visible
180
-    visibility visible
181
-  &__header
182
-    display flex
183
-    align-items center
184
-    padding 15px
185
-    height 64px
186
-    &__icon
187
-      margin-right 15px
188
-      font-size 22px
189
-      color white
190
-    &__title
191
-      margin-right 15px
192
-      color white
193
-      text-overflow ellipsis
194
-      overflow hidden
195
-      white-space nowrap
196
-    &__edittitle
197
-      margin 0 15px
198
-      color white
199
-      font-size 20px
200
-      cursor pointer
201
-      &:hover , &:focus
202
-        border 1px solid off-white
203
-        padding 0 10px
204
-        border-radius 5px
205
-    &__close
206
-      border 1px solid white
207
-      border-radius 5px
208
-      padding 2px 5px
209
-      cursor pointer
210
-      & > i
211
-        color white
212
-        font-size 20px
213
-  &__option
214
-    border-bottom 1px solid grey
215
-    padding 10px
216
-    height 58px
217
-    background-color off-white
218
-    & > i
219
-      vertical-align middle
220
-      margin-right 15px
221
-      font-size 25px
222
-      cursor pointer
223
-    &__menu
224
-      display flex
225
-      align-items center
226
-      &__status
227
-        margin-right 20px
228
-        .current
229
-          color blue
230
-        .check
231
-          color green
232
-        .invalid
233
-          color red
234
-        .ban
235
-          color grey
236
-        &__dropdownbtn
237
-          border 1px solid grey
238
-          width 150px
239
-          background-color transparent
240
-          cursor pointer
241
-          &::after
242
-            color fontColor
243
-          &:hover
244
-            background-color transparent
245
-          &__icon
246
-            display inline-block
247
-            margin 0 15px
248
-        &__submenu
249
-          &__item
250
-            display flex
251
-            justify-content space-between
252
-            margin 5px 0
253
-            cursor pointer
254
-            &:active
255
-              background-color transparent
256
-      &__action
257
-        margin 5px 10px 0 0
258
-        font-size 18px
259
-        cursor pointer
260
-        &:hover , &:focus
261
-          font-size 22px
262
-          color blue
263
-  &__content
264
-    display flex
265
-    &__left
266
-      width 55%
267
-    &__right
268
-      width 45%

+ 2 - 0
src/css/Variable.styl View File

@@ -1,3 +1,5 @@
1
+// Côme - 2018/02/27 - DEPRECATED : now using Variable.styl from tracim_lib
2
+
1 3
 /**** VARIABLES ****/
2 4
 /*** COULEURS ****/
3 5
 

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

@@ -3,7 +3,9 @@ body
3 3
 html, body, #content, #content > div
4 4
   height 100%
5 5
 
6
-@import 'Variable.styl'
6
+// @TODO Côme - 2018/02/27 - do not manually import from node_module relative path
7
+@import '../../node_modules/tracim_lib/src/css/Variable.styl'
8
+
7 9
 @import 'Generic.styl'
8 10
 
9 11
 @import 'Sidebar.styl'

+ 10 - 4
src/plugin/ContentType/PageHtml/PageHtmlContainer.jsx View File

@@ -1,9 +1,15 @@
1 1
 import React from 'react'
2 2
 import { connect } from 'react-redux'
3
-import PopinFixed from '../../../component/common/PopinFixed/PopinFixed.jsx'
4
-import PopinFixedHeader from '../../../component/common/PopinFixed/PopinFixedHeader.jsx'
5
-import PopinFixedOption from '../../../component/common/PopinFixed/PopinFixedOption.jsx'
6
-import PopinFixedContent from '../../../component/common/PopinFixed/PopinFixedContent.jsx'
3
+// import PopinFixed from '../../../component/common/PopinFixed/PopinFixed.jsx'
4
+// import PopinFixedHeader from '../../../component/common/PopinFixed/PopinFixedHeader.jsx'
5
+// import PopinFixedOption from '../../../component/common/PopinFixed/PopinFixedOption.jsx'
6
+// import PopinFixedContent from '../../../component/common/PopinFixed/PopinFixedContent.jsx'
7
+import {
8
+  PopinFixed,
9
+  PopinFixedHeader,
10
+  PopinFixedOption,
11
+  PopinFixedContent
12
+} from 'tracim_lib'
7 13
 import PageHtmlComponent from './PageHtmlComponent.jsx'
8 14
 import Timeline from '../../../component/Timeline.jsx'
9 15
 import { hideActiveFileContent } from '../../../action-creator.sync.js'

+ 4 - 4
src/plugin/ContentType/PageHtml/index.js View File

@@ -1,11 +1,11 @@
1 1
 import reducer from './pageHtml.js'
2
-import container from './PageHtmlContainer.jsx'
3
-import component from './PageHtmlComponent.jsx'
2
+// import container from './PageHtmlContainer.jsx'
3
+// import component from './PageHtmlComponent.jsx'
4 4
 
5 5
 const PageHtml = {
6 6
   name: 'PageHtml',
7
-  container,
8
-  component,
7
+  // container,
8
+  // component,
9 9
   reducer
10 10
 }
11 11
 

+ 8 - 3
src/plugin/ContentType/Thread/index.js View File

@@ -1,7 +1,12 @@
1 1
 import reducer from './thread.js'
2
-import component from './Thread.jsx'
3
-import style from './Thread.styl'
2
+// import container from './ThreadContainer.jsx'
3
+// import component from './ThreadComponent.jsx'
4 4
 
5
-const Thread = { name: 'Thread', component, reducer, style }
5
+const Thread = {
6
+  name: 'Thread',
7
+  // container,
8
+  // component,
9
+  reducer
10
+}
6 11
 
7 12
 export default Thread