Explorar el Código

renamed plugin into app

Skylsmoi hace 6 años
padre
commit
83e829c154
Se han modificado 6 ficheros con 39 adiciones y 39 borrados
  1. 4 4
      .gitignore
  2. 14 14
      dist/index.html
  3. 2 2
      src/component/PageHtml.jsx
  4. 13 13
      src/container/PageHtml.jsx
  5. 4 4
      src/index.js
  6. 2 2
      webpack.config.js

+ 4 - 4
.gitignore Ver fichero

2
 .idea/
2
 .idea/
3
 .git/
3
 .git/
4
 node_modules/
4
 node_modules/
5
-dist/pageHtml.plugin.js
6
-dist/pageHtml.plugin.js.map
7
-dist/pageHtml.plugin.dev.js
8
-dist/pageHtml.plugin.dev.js.map
5
+dist/pageHtml.app.js
6
+dist/pageHtml.app.js.map
7
+dist/pageHtml.app.dev.js
8
+dist/pageHtml.app.dev.js.map

+ 14 - 14
dist/index.html Ver fichero

3
 <head>
3
 <head>
4
   <meta charset='utf-8' />
4
   <meta charset='utf-8' />
5
   <meta name="viewport" content="width=device-width, user-scalable=no" />
5
   <meta name="viewport" content="width=device-width, user-scalable=no" />
6
-  <title>Tracim Lib</title>
6
+  <title>Tracim App PageHtml</title>
7
   <link rel='shortcut icon' href='favicon.ico'>
7
   <link rel='shortcut icon' href='favicon.ico'>
8
 
8
 
9
   <link rel="stylesheet" type="text/css" href="./font/font-awesome-4.7.0/css/font-awesome.css">
9
   <link rel="stylesheet" type="text/css" href="./font/font-awesome-4.7.0/css/font-awesome.css">
17
 
17
 
18
   <div id='content'></div>
18
   <div id='content'></div>
19
 
19
 
20
-  <script src='./pageHtml.plugin.dev.js'></script>
20
+  <script src='./pageHtml.app.dev.js'></script>
21
 
21
 
22
   <script type='text/javascript'>
22
   <script type='text/javascript'>
23
-    GLOBAL_renderPlugin = pluginName => {
24
-      if (pluginName === 'PageHtml') {
25
-        pluginPageHtml.renderPlugin('pluginContainer')
26
-        console.log('plugin pagehtml rendered')
23
+    GLOBAL_renderApp = appName => {
24
+      if (appName === 'PageHtml') {
25
+        appPageHtml.renderApp('appContainer')
26
+        console.log('app pagehtml rendered')
27
       }
27
       }
28
     }
28
     }
29
 
29
 
30
     GLOBAL_dispatchEvent = (data) => {
30
     GLOBAL_dispatchEvent = (data) => {
31
-      var event = new CustomEvent('pluginCustomEvent', {detail: data})
31
+      var event = new CustomEvent('appCustomEvent', {detail: data})
32
       document.dispatchEvent(event)
32
       document.dispatchEvent(event)
33
     }
33
     }
34
 
34
 
35
-    GLOBAL_unmountPlugin = () => {
35
+    GLOBAL_unmountApp = () => {
36
       console.log('btn close clicked')
36
       console.log('btn close clicked')
37
-      pluginPageHtml.hidePlugin('pluginContainer')
37
+      appPageHtml.hideApp('appContainer')
38
     }
38
     }
39
 
39
 
40
-    // only usefull if plugin doesn't handle fileContent himself
40
+    // only usefull if app doesn't handle fileContent himself
41
     GLOBAL_handleRequireRedraw = () => {
41
     GLOBAL_handleRequireRedraw = () => {
42
-      var rez = pluginA.destroyPlugin('plugin')
43
-      if (rez) GLOBAL_drawPlugin('redraw')
44
-      else console.log('Erreur, failed at destroying plugin')
42
+      var rez = appA.destroyApp('app')
43
+      if (rez) GLOBAL_drawApp('redraw')
44
+      else console.log('Erreur, failed at destroying app')
45
     }
45
     }
46
   </script>
46
   </script>
47
 
47
 
48
   <script type='text/javascript'>
48
   <script type='text/javascript'>
49
-    // pluginPageHtml.renderPlugin('content')
49
+    // appPageHtml.renderApp('content')
50
   </script>
50
   </script>
51
 </body>
51
 </body>
52
 </html>
52
 </html>

+ 2 - 2
src/component/PageHtml.jsx Ver fichero

1
 import React from 'react'
1
 import React from 'react'
2
-import { TextAreaPlugin } from 'tracim_lib'
2
+import { TextAreaApp } from 'tracim_lib'
3
 
3
 
4
 const PageHtml = props => {
4
 const PageHtml = props => {
5
   return (
5
   return (
7
       <div className='wsFilePageHtml__contentpage__textnote__latestversion' dangerouslySetInnerHTML={{__html: props.version}} />
7
       <div className='wsFilePageHtml__contentpage__textnote__latestversion' dangerouslySetInnerHTML={{__html: props.version}} />
8
       <div className='wsFilePageHtml__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
8
       <div className='wsFilePageHtml__contentpage__textnote__text' dangerouslySetInnerHTML={{__html: props.text}} />
9
 
9
 
10
-      <TextAreaPlugin customClass={'wsFilePageHtml'} />
10
+      <TextAreaApp customClass={'wsFilePageHtml'} />
11
     </div>
11
     </div>
12
   )
12
   )
13
 }
13
 }

+ 13 - 13
src/container/PageHtml.jsx Ver fichero

12
   constructor (props) {
12
   constructor (props) {
13
     super(props)
13
     super(props)
14
     this.state = {
14
     this.state = {
15
-      pluginName: 'PageHtml',
15
+      appName: 'PageHtml',
16
       data: props.data
16
       data: props.data
17
         ? props.data
17
         ? props.data
18
         : { // for debugg purpose
18
         : { // for debugg purpose
20
             version: '3',
20
             version: '3',
21
             text: 'Bonjour ?'
21
             text: 'Bonjour ?'
22
           },
22
           },
23
-          pluginData: {
23
+          appData: {
24
             name: 'PageHtml',
24
             name: 'PageHtml',
25
             componentLeft: 'PageHtml',
25
             componentLeft: 'PageHtml',
26
             componentRight: 'Timeline',
26
             componentRight: 'Timeline',
30
         }
30
         }
31
     }
31
     }
32
 
32
 
33
-    document.addEventListener('pluginCustomEvent', this.customEventReducer, false)
33
+    document.addEventListener('appCustomEvent', this.customEventReducer, false)
34
   }
34
   }
35
 
35
 
36
   customEventReducer = ({detail}) => {
36
   customEventReducer = ({detail}) => {
41
     }
41
     }
42
   }
42
   }
43
 
43
 
44
-  handleClickBtnClosePlugin = () => {
45
-    GLOBAL_unmountPlugin(this.state.pluginName)
44
+  handleClickBtnCloseApp = () => {
45
+    GLOBAL_unmountApp(this.state.appName)
46
   }
46
   }
47
 
47
 
48
   render () {
48
   render () {
49
-    const { file, pluginData } = this.state.data
49
+    const { file, appData } = this.state.data
50
 
50
 
51
     return (
51
     return (
52
-      <PopinFixed customClass={`${pluginData.customClass}`}>
52
+      <PopinFixed customClass={`${appData.customClass}`}>
53
         <PopinFixedHeader
53
         <PopinFixedHeader
54
-          customClass={`${pluginData.customClass}`}
55
-          icon={pluginData.icon}
54
+          customClass={`${appData.customClass}`}
55
+          icon={appData.icon}
56
           name={file.title}
56
           name={file.title}
57
-          onClickCloseBtn={this.handleClickBtnClosePlugin}
57
+          onClickCloseBtn={this.handleClickBtnCloseApp}
58
         />
58
         />
59
 
59
 
60
-        <PopinFixedOption customClass={`${pluginData.customClass}`} />
60
+        <PopinFixedOption customClass={`${appData.customClass}`} />
61
 
61
 
62
-        <PopinFixedContent customClass={`${pluginData.customClass}__contentpage`}>
62
+        <PopinFixedContent customClass={`${appData.customClass}__contentpage`}>
63
           <PageHtmlComponent
63
           <PageHtmlComponent
64
             version={file.version}
64
             version={file.version}
65
             text={file.text}
65
             text={file.text}
67
           />
67
           />
68
 
68
 
69
           <Timeline
69
           <Timeline
70
-            customClass={`${pluginData.customClass}__contentpage`}
70
+            customClass={`${appData.customClass}__contentpage`}
71
             key={'pageHtml__timeline'}
71
             key={'pageHtml__timeline'}
72
           />
72
           />
73
         </PopinFixedContent>
73
         </PopinFixedContent>

+ 4 - 4
src/index.js Ver fichero

4
 
4
 
5
 require('./css/index.styl')
5
 require('./css/index.styl')
6
 
6
 
7
-const pluginInterface = {
8
-  renderPlugin: (domId, data) => {
7
+const appInterface = {
8
+  renderApp: (domId, data) => {
9
     return ReactDOM.render(
9
     return ReactDOM.render(
10
       <PageHtml file={data} />
10
       <PageHtml file={data} />
11
       , document.getElementById(domId)
11
       , document.getElementById(domId)
12
     )
12
     )
13
   },
13
   },
14
-  hidePlugin: domId => {
14
+  hideApp: domId => {
15
     // TODO: should be a display none
15
     // TODO: should be a display none
16
     return ReactDOM.unmountComponentAtNode(document.getElementById(domId)) // returns bool
16
     return ReactDOM.unmountComponentAtNode(document.getElementById(domId)) // returns bool
17
   }
17
   }
18
 }
18
 }
19
 
19
 
20
-module.exports = pluginInterface
20
+module.exports = appInterface

+ 2 - 2
webpack.config.js Ver fichero

8
   entry: isProduction ? './src/index.js' : './src/index.dev.js',
8
   entry: isProduction ? './src/index.js' : './src/index.dev.js',
9
   output: {
9
   output: {
10
     path: path.resolve(__dirname, 'dist'),
10
     path: path.resolve(__dirname, 'dist'),
11
-    filename: isProduction ? 'pageHtml.plugin.js' : 'pageHtml.plugin.dev.js',
11
+    filename: isProduction ? 'pageHtml.app.js' : 'pageHtml.app.dev.js',
12
     pathinfo: !isProduction,
12
     pathinfo: !isProduction,
13
-    library: isProduction ? 'pluginPageHtml' : undefined,
13
+    library: isProduction ? 'appPageHtml' : undefined,
14
     libraryTarget: isProduction ? 'var' : undefined,
14
     libraryTarget: isProduction ? 'var' : undefined,
15
   },
15
   },
16
   externals: {},
16
   externals: {},