Sfoglia il codice sorgente

fixed integration of pageHtml

Skylsmoi 6 anni fa
parent
commit
9329ea2588
7 ha cambiato i file con 188 aggiunte e 43 eliminazioni
  1. 1 0
      .gitignore
  2. 0 1
      dist/pageHtml.plugin.js
  3. 14 14
      src/container/PageHtml.jsx
  4. 0 13
      src/css/Variable.styl
  5. 160 1
      src/css/index.styl
  6. 2 2
      src/index.js
  7. 11 12
      webpack.config.js

+ 1 - 0
.gitignore Vedi File

@@ -2,4 +2,5 @@
2 2
 .idea/
3 3
 .git/
4 4
 node_modules/
5
+dist/pageHtml.plugin.js
5 6
 dist/pageHtml.plugin.js.map

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


+ 14 - 14
src/container/PageHtml.jsx Vedi File

@@ -15,16 +15,16 @@ class pageHtml extends React.Component {
15 15
       data: props.data
16 16
         ? props.data
17 17
         : { // for debugg purpose
18
-          PageHtml: {
18
+          file: {
19
+            version: '3',
20
+            text: 'Bonjour ?'
21
+          },
22
+          pluginData: {
19 23
             name: 'PageHtml',
20 24
             componentLeft: 'PageHtml',
21 25
             componentRight: 'Timeline',
22 26
             customClass: 'wsFilePageHtml',
23 27
             icon: 'fa fa-file-word-o'
24
-          },
25
-          activeFileContent: {
26
-            version: '3',
27
-            text: 'Bonjour ?'
28 28
           }
29 29
         }
30 30
     }
@@ -45,23 +45,23 @@ class pageHtml extends React.Component {
45 45
   }
46 46
 
47 47
   render () {
48
-    const { PageHtml, activeFileContent } = this.state.data
48
+    const { file, pluginData } = this.state.data
49 49
 
50 50
     return (
51
-      <PopinFixed customClass={`${PageHtml.customClass}`}>
51
+      <PopinFixed customClass={`${pluginData.customClass}`}>
52 52
         <PopinFixedHeader
53
-          customClass={`${PageHtml.customClass}`}
54
-          icon={PageHtml.icon}
55
-          name={activeFileContent.title}
53
+          customClass={`${pluginData.customClass}`}
54
+          icon={pluginData.icon}
55
+          name={file.title}
56 56
           onClickCloseBtn={this.handleClickBtnClosePlugin}
57 57
         />
58 58
 
59
-        <PopinFixedOption customClass={`${PageHtml.customClass}`} />
59
+        <PopinFixedOption customClass={`${pluginData.customClass}`} />
60 60
 
61
-        <PopinFixedContent customClass={`${PageHtml.customClass}__contentpage`}>
61
+        <PopinFixedContent customClass={`${pluginData.customClass}__contentpage`}>
62 62
           <PageHtmlComponent
63
-            version={activeFileContent.version}
64
-            text={activeFileContent.text}
63
+            version={file.version}
64
+            text={file.text}
65 65
             key={'PageHtml'}
66 66
           />
67 67
 

+ 0 - 13
src/css/Variable.styl Vedi File

@@ -1,13 +0,0 @@
1
-min-xs = 0px
2
-max-xs = 575px
3
-
4
-min-sm = 576px
5
-max-sm = 767px
6
-
7
-min-md = 768px
8
-max-md = 991px
9
-
10
-min-lg = 992px
11
-max-lg = 1199px
12
-
13
-min-xl = 1200px

+ 160 - 1
src/css/index.styl Vedi File

@@ -1 +1,160 @@
1
-@import "Variable"
1
+@import "../../node_modules/tracim_lib/src/css/Variable.styl"
2
+
3
+.wsFilePageHtml
4
+  width 1200px
5
+  height calc(100% - 85px)
6
+  overflow-Y auto
7
+  &__header
8
+    background-color htmlColor
9
+    &__icon
10
+      .fa-file-word-o
11
+        color white
12
+  &__contentpage
13
+    &__textnote
14
+      margin 10px
15
+      border-radius 10px
16
+      padding 25px
17
+      height 100%
18
+      background-color off-white
19
+      &__latestversion
20
+        text-align right
21
+        opacity 0.7
22
+      &__text
23
+        font-size 14px
24
+    &__messagelist
25
+      min-height 300px
26
+      &__item
27
+        &__content
28
+          color darkGrey
29
+      &__version
30
+        margin-top 40px
31
+        background-color grey-hover
32
+        &__btn
33
+          padding 5px 25px
34
+          border-radius 5px
35
+          width 145px
36
+          color white
37
+          font-size 17px
38
+          background-color htmlColor
39
+          & > i
40
+            margin-right 10px
41
+            color darkGrey
42
+            font-size 22px
43
+          &:hover
44
+            background-color darkHtmlColor
45
+          &:focus
46
+            background-color darkHtmlColor
47
+        &__date
48
+          color fontColor
49
+          font-size 17px
50
+    &__texteditor
51
+      &__simpletext
52
+        &__input
53
+          &:focus
54
+            color htmlColor
55
+            border-color htmlColor
56
+      &__submit
57
+        &__btn
58
+          border-color htmlColor
59
+          background-color htmlColor
60
+          color white
61
+          &:hover
62
+            border-color htmlColor
63
+            background-color htmlColor
64
+          &:focus
65
+            border-color htmlColor
66
+            background-color htmlColor
67
+
68
+.messagelistOpen
69
+  .wsFilePageHtml__contentpage__messagelist
70
+    flex 0
71
+    min-height 0
72
+
73
+.received
74
+  .wsFilePageHtml__contentpage__messagelist__item__content
75
+    background-color htmlColor
76
+
77
+@media (min-width: max-xs) and (max-width: max-lg)
78
+  .wsFilePageHtml
79
+    &__contentpage
80
+      display block
81
+      overflow-Y scroll
82
+      &__textnote
83
+        margin-right 10px
84
+        padding 10px 20px
85
+        width auto
86
+        overflow-Y hidden
87
+        &__latestversion
88
+          padding-top 10px
89
+      &__wrapper
90
+        width auto
91
+      &__texteditor
92
+        &__simpletext
93
+          display inline-flex
94
+          width 60%
95
+        &__submit
96
+          display inline-flex
97
+          margin 10px 0
98
+          &__btn
99
+            display flex
100
+            margin-left 35px
101
+            &__icon
102
+              margin-left 15px
103
+
104
+@media (min-width: min-lg) and (max-width: max-lg)
105
+  .wsFilePageHtml
106
+    width 692px
107
+    &__contentpage__texteditor__simpletext
108
+      margin-left 15px
109
+
110
+@media (min-width: min-md) and (max-width: max-md)
111
+  .wsFilePageHtml
112
+    width 768px
113
+    &__contentpage__texteditor__simpletext
114
+      margin-left 25px
115
+
116
+@media (min-width: min-sm) and (max-width: max-sm)
117
+  .wsFilePageHtml
118
+    top 69px
119
+    width 576px
120
+    height calc(100% - 69px)
121
+    &__contentpage__texteditor__simpletext
122
+      margin-left 10px
123
+
124
+@media (max-width: max-xs)
125
+  .wsFilePageHtml
126
+    top 70px
127
+    height calc(100% - 70px)
128
+    width 100%
129
+    box-shadow none
130
+    &__contentpage
131
+      display block
132
+      overflow-Y scroll
133
+      &__textnote
134
+        margin-right 10px
135
+        width auto
136
+        overflow-Y hidden
137
+        font-size 15px
138
+      &__wrapper
139
+        width auto
140
+      &__messagelist
141
+        &__item
142
+          padding 0 35px 20px 30px
143
+        &__version
144
+          &__btn
145
+            font-size 17px
146
+            vertical-align middle
147
+          &__dateversion
148
+            font-size 15px
149
+      &__texteditor
150
+        &__simpletext
151
+          margin 10px 0
152
+          display flex
153
+          width 95%
154
+          margin-left 10px
155
+        &__submit
156
+          &__btn
157
+            display flex
158
+            margin 0 auto
159
+            &__icon
160
+              margin-left 10px

+ 2 - 2
src/index.js Vedi File

@@ -5,9 +5,9 @@ import PageHtml from './container/PageHtml.jsx'
5 5
 require('./css/index.styl')
6 6
 
7 7
 const pluginInterface = {
8
-  renderPlugin: domId => {
8
+  renderPlugin: (domId, data) => {
9 9
     return ReactDOM.render(
10
-      <PageHtml />
10
+      <PageHtml file={data} />
11 11
       , document.getElementById(domId)
12 12
     )
13 13
   },

+ 11 - 12
webpack.config.js Vedi File

@@ -10,19 +10,18 @@ module.exports = {
10 10
     path: path.resolve(__dirname, 'dist'),
11 11
     filename: isProduction ? 'pageHtml.plugin.js' : 'pageHtml.plugin.dev.js',
12 12
     pathinfo: !isProduction,
13
-    library: isProduction ? 'tracim_plugin_pagehtml' : undefined,
14
-    libraryTarget: isProduction ? 'umd' : undefined,
15
-    umdNamedDefine: isProduction
13
+    library: isProduction ? 'pluginPageHtml' : undefined,
14
+    libraryTarget: isProduction ? 'var' : undefined,
16 15
   },
17
-  externals: isProduction
18
-    ? {
19
-      react: {commonjs: 'react', commonjs2: 'react', amd: 'react', root: '_'},
20
-      'react-dom': {commonjs: 'react-dom', commonjs2: 'react-dom', amd: 'react-dom', root: '_'},
21
-      classnames: {commonjs: 'classnames', commonjs2: 'classnames', amd: 'classnames', root: '_'},
22
-      'prop-types': {commonjs: 'prop-types', commonjs2: 'prop-types', amd: 'prop-types', root: '_'},
23
-      tracim_lib: {commonjs: 'tracim_lib', commonjs2: 'tracim_lib', amd: 'tracim_lib', root: '_'}
24
-    }
25
-    : {},
16
+  externals: {},
17
+    // isProduction ? { // Côme - since plugins are imported through <script>, cannot externalize libraries
18
+    //   react: {commonjs: 'react', commonjs2: 'react', amd: 'react', root: '_'},
19
+    //   'react-dom': {commonjs: 'react-dom', commonjs2: 'react-dom', amd: 'react-dom', root: '_'},
20
+    //   classnames: {commonjs: 'classnames', commonjs2: 'classnames', amd: 'classnames', root: '_'},
21
+    //   'prop-types': {commonjs: 'prop-types', commonjs2: 'prop-types', amd: 'prop-types', root: '_'},
22
+    //   tracim_lib: {commonjs: 'tracim_lib', commonjs2: 'tracim_lib', amd: 'tracim_lib', root: '_'}
23
+    // }
24
+    // : {},
26 25
   devServer: {
27 26
     contentBase: path.join(__dirname, 'dist/'),
28 27
     port: 8071,