Selaa lähdekoodia

integrated pagehtml plugin

Skylsmoi 6 vuotta sitten
vanhempi
commit
6c69ca99b6

+ 1 - 1
dist/index.html Näytä tiedosto

25
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
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
     <script src="./dev/jquery-3.2.1.js"></script>
30
     <script src="./dev/jquery-3.2.1.js"></script>
31
     <script src="./dev/popper-1.12.3.js"></script>
31
     <script src="./dev/popper-1.12.3.js"></script>

+ 6 - 6
jsonserver/static_db.json Näytä tiedosto

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

+ 20 - 20
src/component/PluginContentType.jsx Näytä tiedosto

5
 import {FILE_TYPE} from '../helper.js'
5
 import {FILE_TYPE} from '../helper.js'
6
 
6
 
7
 const PluginContentType = props => {
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
 export default PluginContentType
30
 export default PluginContentType

+ 31 - 3
src/container/WorkspaceContent.jsx Näytä tiedosto

12
   getWorkspaceContent
12
   getWorkspaceContent
13
 } from '../action-creator.async.js'
13
 } from '../action-creator.async.js'
14
 import { setActiveFileContent, hideActiveFileContent } from '../action-creator.sync.js'
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
 class WorkspaceContent extends React.Component {
21
 class WorkspaceContent extends React.Component {
17
   constructor (props) {
22
   constructor (props) {
36
   }
41
   }
37
 
42
 
38
   render () {
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
     return (
69
     return (
42
       <PageWrapper customeClass='workspace'>
70
       <PageWrapper customeClass='workspace'>
70
           <DropdownCreateButton customClass='workspace__content__button mb-5' />
98
           <DropdownCreateButton customClass='workspace__content__button mb-5' />
71
 
99
 
72
           <div id='pluginContainer'>
100
           <div id='pluginContainer'>
73
-
101
+            { activeFileContent.display && pluginContent }
74
           </div>
102
           </div>
75
         </PageContent>
103
         </PageContent>
76
 
104
 
79
   }
107
   }
80
 }
108
 }
81
 
109
 
82
-const mapStateToProps = ({ workspace, activeFileContent }) => ({ workspace, activeFileContent })
110
+const mapStateToProps = ({ workspace, activeFileContent, plugin }) => ({ workspace, activeFileContent, plugin })
83
 export default connect(mapStateToProps)(WorkspaceContent)
111
 export default connect(mapStateToProps)(WorkspaceContent)

+ 2 - 0
src/css/Timeline.styl Näytä tiedosto

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

+ 11 - 11
src/css/index.styl Näytä tiedosto

3
 html, body, #content, #content > div
3
 html, body, #content, #content > div
4
   height 100%
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
 @import '../plugin/ContentType/Thread/Thread.styl'
21
 @import '../plugin/ContentType/Thread/Thread.styl'
21
 @import '../plugin/ContentType/PageHtml/PageHtml.styl'
22
 @import '../plugin/ContentType/PageHtml/PageHtml.styl'
22
-@import 'Timeline'

+ 6 - 6
src/helper.js Näytä tiedosto

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

+ 2 - 6
src/plugin/ContentType/PageHtml/PageHtml.jsx Näytä tiedosto

3
 const PageHtml = props => {
3
 const PageHtml = props => {
4
   return (
4
   return (
5
     <div className='wsFilePageHtml__contentpage__textnote'>
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
     </div>
8
     </div>
13
   )
9
   )
14
 }
10
 }

+ 8 - 8
src/plugin/ContentType/PageHtml/PageHtml.styl Näytä tiedosto

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

+ 1 - 1
src/reducer/plugin.js Näytä tiedosto

1
 import { combineReducers } from 'redux'
1
 import { combineReducers } from 'redux'
2
 import pageHtml from '../plugin/ContentType/PageHtml/pageHtml.js'
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
 export default combineReducers({
5
 export default combineReducers({
6
   pageHtml, thread
6
   pageHtml, thread