Browse Source

integrated pagehtml plugin

Skylsmoi 6 years ago
parent
commit
6c69ca99b6

+ 1 - 1
dist/index.html View File

@@ -25,7 +25,7 @@
25 25
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
26 26
     -->
27 27
 
28
-    <script src='./plugin/pageHtml.plugin.js'></script>
28
+    <!-- script src='./plugin/pageHtml.plugin.js'></script -->
29 29
 
30 30
     <script src="./dev/jquery-3.2.1.js"></script>
31 31
     <script src="./dev/popper-1.12.3.js"></script>

+ 6 - 6
jsonserver/static_db.json View File

@@ -13,37 +13,37 @@
13 13
     "name": "PageHtml",
14 14
     "componentLeft": "PageHtml",
15 15
     "componentRight": "Timeline",
16
-    "customClass": "wsContentPageHtml",
16
+    "customClass": "wsFilePageHtml",
17 17
     "icon": "fa fa-file-word-o"
18 18
   }, {
19 19
     "name": "PageMarkdown",
20 20
     "componentLeft": "PageMarkdown",
21 21
     "componentRight": "undefined",
22
-    "customClass": "wsContentPageMarkdown",
22
+    "customClass": "wsFilePageMarkdown",
23 23
     "icon": "fa fa-file-code-o"
24 24
   }, {
25 25
     "name": "File",
26 26
     "componentLeft": "File",
27 27
     "componentRight": "undefined",
28
-    "customClass": "wsContentFile",
28
+    "customClass": "wsFileFile",
29 29
     "icon": "fa fa-file-text-o"
30 30
   }, {
31 31
     "name": "Thread",
32 32
     "componentLeft": "Thread",
33 33
     "componentRight": "undefined",
34
-    "customClass": "wsContentThread",
34
+    "customClass": "wsFileThread",
35 35
     "icon": "fa fa-comments-o"
36 36
   }, {
37 37
     "name": "Task",
38 38
     "componentLeft": "Task",
39 39
     "componentRight": "undefined",
40
-    "customClass": "wsContentTask",
40
+    "customClass": "wsFileTask",
41 41
     "icon": "fa fa-list-ul"
42 42
   }, {
43 43
     "name": "Issue",
44 44
     "componentLeft": "Issue",
45 45
     "componentRight": "undefined",
46
-    "customClass": "wsContentIssue",
46
+    "customClass": "wsFileIssue",
47 47
     "icon": "fa fa-ticket"
48 48
   }],
49 49
   "workspace_detail": {

+ 20 - 20
src/component/PluginContentType.jsx View File

@@ -5,26 +5,26 @@ import Timeline from './Timeline.jsx'
5 5
 import {FILE_TYPE} from '../helper.js'
6 6
 
7 7
 const PluginContentType = props => {
8
-  // const [leftPart, rightPart] = (() => {
9
-  //   switch (props.file.type) {
10
-  //     case FILE_TYPE[0].name: // pageHtml
11
-  //       return [
12
-  //         <PageHtml version={props.file.version} text={props.file.text} />,
13
-  //         <Timeline customClass={`${props.customClass}__contentpage`} />
14
-  //       ]
15
-  //     case FILE_TYPE[3].name: // thread
16
-  //       return [
17
-  //         <Thread />
18
-  //       ]
19
-  //   }
20
-  // })()
21
-  // return [leftPart, rightPart]
22
-  const { componentLeft, componentRight, customClass, } = FILE_TYPE.find(p => p.name === props.file.type)
23
-
24
-  return [
25
-    genericPlugin.componentLeft,
26
-    genericPlugin.componentRight
27
-  ]
8
+  const [leftPart, rightPart] = (() => {
9
+    switch (props.file.type) {
10
+      case FILE_TYPE[0].name: // pageHtml
11
+        return [
12
+          <PageHtml version={props.file.version} text={props.file.text} key={'pageHtml'} />,
13
+          <Timeline customClass={`${props.customClass}__contentpage`} key={'pageHtml__timeline'} />
14
+        ]
15
+      case FILE_TYPE[3].name: // thread
16
+        return [
17
+          <Thread />
18
+        ]
19
+    }
20
+  })()
21
+  return [leftPart, rightPart]
22
+  // const { componentLeft, componentRight, customClass, } = FILE_TYPE.find(p => p.name === props.file.type)
23
+  //
24
+  // return [
25
+  //   genericPlugin.componentLeft,
26
+  //   genericPlugin.componentRight
27
+  // ]
28 28
 }
29 29
 
30 30
 export default PluginContentType

+ 31 - 3
src/container/WorkspaceContent.jsx View File

@@ -12,6 +12,11 @@ import {
12 12
   getWorkspaceContent
13 13
 } from '../action-creator.async.js'
14 14
 import { setActiveFileContent, hideActiveFileContent } from '../action-creator.sync.js'
15
+import PopinFixed from '../component/common/PopinFixed/PopinFixed.jsx'
16
+import PopinFixedHeader from '../component/common/PopinFixed/PopinFixedHeader.jsx'
17
+import PopinFixedOption from '../component/common/PopinFixed/PopinFixedOption.jsx'
18
+import PopinFixedContent from '../component/common/PopinFixed/PopinFixedContent.jsx'
19
+import PluginContentType from '../component/PluginContentType.jsx'
15 20
 
16 21
 class WorkspaceContent extends React.Component {
17 22
   constructor (props) {
@@ -36,7 +41,30 @@ class WorkspaceContent extends React.Component {
36 41
   }
37 42
 
38 43
   render () {
39
-    const { workspace, activeFileContent } = this.props
44
+    const { workspace, activeFileContent, plugin } = this.props
45
+
46
+    const pluginContent = (() => {
47
+      switch (activeFileContent.type) {
48
+        case 'PageHtml':
49
+          return <PopinFixed customClass={`${plugin.pageHtml.customClass}`}>
50
+            <PopinFixedHeader
51
+              customClass={`${plugin.pageHtml.customClass}`}
52
+              icon={plugin.pageHtml.icon}
53
+              name={activeFileContent.title}
54
+              onClickCloseBtn={this.handleClickCloseBtn}
55
+            />
56
+
57
+            <PopinFixedOption customClass={`${plugin.pageHtml.customClass}`} />
58
+
59
+            <PopinFixedContent customClass={`${plugin.pageHtml.customClass}__contentpage`}>
60
+              <PluginContentType
61
+                file={activeFileContent}
62
+                customClass={`${plugin.pageHtml.customClass}`}
63
+              />
64
+            </PopinFixedContent>
65
+          </PopinFixed>
66
+      }
67
+    })()
40 68
 
41 69
     return (
42 70
       <PageWrapper customeClass='workspace'>
@@ -70,7 +98,7 @@ class WorkspaceContent extends React.Component {
70 98
           <DropdownCreateButton customClass='workspace__content__button mb-5' />
71 99
 
72 100
           <div id='pluginContainer'>
73
-
101
+            { activeFileContent.display && pluginContent }
74 102
           </div>
75 103
         </PageContent>
76 104
 
@@ -79,5 +107,5 @@ class WorkspaceContent extends React.Component {
79 107
   }
80 108
 }
81 109
 
82
-const mapStateToProps = ({ workspace, activeFileContent }) => ({ workspace, activeFileContent })
110
+const mapStateToProps = ({ workspace, activeFileContent, plugin }) => ({ workspace, activeFileContent, plugin })
83 111
 export default connect(mapStateToProps)(WorkspaceContent)

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

@@ -1,4 +1,6 @@
1 1
 .timeline
2
+  display flex
3
+  flex-direction column
2 4
   &__messagelist
3 5
     flex 1 1 0
4 6
     margin-bottom 0

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

@@ -3,20 +3,20 @@ body
3 3
 html, body, #content, #content > div
4 4
   height 100%
5 5
 
6
-@import 'Variable'
7
-@import 'Generic'
6
+@import 'Variable.styl'
7
+@import 'Generic.styl'
8 8
 
9
-@import 'Sidebar'
10
-@import 'Header'
11
-@import 'Footer'
9
+@import 'Sidebar.styl'
10
+@import 'Header.styl'
11
+@import 'Footer.styl'
12 12
 
13
-@import 'Login'
14
-@import 'Workspace'
13
+@import 'Login.styl'
14
+@import 'Workspace.styl'
15 15
 
16
-@import 'FileItem'
17
-@import 'FileItemHeader'
18
-@import 'Folder'
16
+@import 'FileItem.styl'
17
+@import 'FileItemHeader.styl'
18
+@import 'Folder.styl'
19 19
 
20
+@import 'Timeline.styl'
20 21
 @import '../plugin/ContentType/Thread/Thread.styl'
21 22
 @import '../plugin/ContentType/PageHtml/PageHtml.styl'
22
-@import 'Timeline'

+ 6 - 6
src/helper.js View File

@@ -9,36 +9,36 @@ export const FILE_TYPE = [{
9 9
   name: 'PageHtml',
10 10
   componentLeft: 'PageHtml',
11 11
   componentRight: 'Timeline',
12
-  customClass: 'wsContentPageHtml',
12
+  customClass: 'wsFilePageHtml',
13 13
   icon: 'fa fa-file-word-o'
14 14
 }, {
15 15
   name: 'PageMarkdown',
16 16
   componentLeft: 'PageMarkdown',
17 17
   componentRight: 'undefined',
18
-  customClass: 'wsContentPageMarkdown',
18
+  customClass: 'wsFilePageMarkdown',
19 19
   icon: 'fa fa-file-code-o'
20 20
 }, {
21 21
   name: 'File',
22 22
   componentLeft: 'File',
23 23
   componentRight: 'undefined',
24
-  customClass: 'wsContentFile',
24
+  customClass: 'wsFileFile',
25 25
   icon: 'fa fa-file-text-o'
26 26
 }, {
27 27
   name: 'Thread',
28 28
   componentLeft: 'Thread',
29 29
   componentRight: 'undefined',
30
-  customClass: 'wsContentThread',
30
+  customClass: 'wsFileThread',
31 31
   icon: 'fa fa-comments-o'
32 32
 }, {
33 33
   name: 'Task',
34 34
   componentLeft: 'Task',
35 35
   componentRight: 'undefined',
36
-  customClass: 'wsContentTask',
36
+  customClass: 'wsFileTask',
37 37
   icon: 'fa fa-list-ul'
38 38
 }, {
39 39
   name: 'Issue',
40 40
   componentLeft: 'Issue',
41 41
   componentRight: 'undefined',
42
-  customClass: 'wsContentIssue',
42
+  customClass: 'wsFileIssue',
43 43
   icon: 'fa fa-ticket'
44 44
 }]

+ 2 - 6
src/plugin/ContentType/PageHtml/PageHtml.jsx View File

@@ -3,12 +3,8 @@ import React from 'react'
3 3
 const PageHtml = props => {
4 4
   return (
5 5
     <div className='wsFilePageHtml__contentpage__textnote'>
6
-      <div className='wsFilePageHtml__contentpage__textnote__latestversion'>
7
-        { props.version }
8
-      </div>
9
-      <div className='wsFilePageHtml__contentpage__textnote__text'>
10
-        { props.text }
11
-      </div>
6
+      <div className='wsFilePageHtml__contentpage__textnote__latestversion' dangerouslySetInnerHTML={{__html: props.version}} />
7
+      <div className='wsFilePageHtml__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
12 8
     </div>
13 9
   )
14 10
 }

+ 8 - 8
src/plugin/ContentType/PageHtml/PageHtml.styl View File

@@ -1,4 +1,4 @@
1
-.wsContentPageHtml
1
+.wsFilePageHtml
2 2
   width 1200px
3 3
   height calc(100% - 85px)
4 4
   overflow-Y auto
@@ -81,16 +81,16 @@
81 81
             background-color htmlColor
82 82
 
83 83
 .messagelistOpen
84
-  .wsContentPageHtml__contentpage__messagelist
84
+  .wsFilePageHtml__contentpage__messagelist
85 85
     flex 0
86 86
     min-height 0
87 87
 
88 88
 .received
89
-  .wsContentPageHtml__contentpage__messagelist__item__content
89
+  .wsFilePageHtml__contentpage__messagelist__item__content
90 90
       background-color htmlColor
91 91
 
92 92
 @media (min-width: max-xs) and (max-width: max-lg)
93
-  .wsContentPageHtml
93
+  .wsFilePageHtml
94 94
     &__contentpage
95 95
       display block
96 96
       overflow-Y scroll
@@ -117,19 +117,19 @@
117 117
               margin-left 15px
118 118
 
119 119
 @media (min-width: min-lg) and (max-width: max-lg)
120
-  .wsContentPageHtml
120
+  .wsFilePageHtml
121 121
     width 692px
122 122
     &__contentpage__texteditor__simpletext
123 123
       margin-left 15px
124 124
 
125 125
 @media (min-width: min-md) and (max-width: max-md)
126
-  .wsContentPageHtml
126
+  .wsFilePageHtml
127 127
     width 768px
128 128
     &__contentpage__texteditor__simpletext
129 129
       margin-left 25px
130 130
 
131 131
 @media (min-width: min-sm) and (max-width: max-sm)
132
-  .wsContentPageHtml
132
+  .wsFilePageHtml
133 133
       top 69px
134 134
       width 576px
135 135
       height calc(100% - 69px)
@@ -137,7 +137,7 @@
137 137
         margin-left 10px
138 138
 
139 139
 @media (max-width: max-xs)
140
-  .wsContentPageHtml
140
+  .wsFilePageHtml
141 141
     top 70px
142 142
     height calc(100% - 70px)
143 143
     width 100%

+ 1 - 1
src/reducer/plugin.js View File

@@ -1,6 +1,6 @@
1 1
 import { combineReducers } from 'redux'
2 2
 import pageHtml from '../plugin/ContentType/PageHtml/pageHtml.js'
3
-import thread from '../plugin/ContentType/Thread/thread'
3
+import thread from '../plugin/ContentType/Thread/thread.js'
4 4
 
5 5
 export default combineReducers({
6 6
   pageHtml, thread