Browse Source

started removing plugin from tracim to make in others apps

Skylsmoi 6 years ago
parent
commit
a15203985d
3 changed files with 18 additions and 56 deletions
  1. 15 1
      dist/index.html
  2. 0 48
      src/component/Workspace/FileContentViewer.jsx
  3. 3 7
      src/container/WorkspaceContent.jsx

+ 15 - 1
dist/index.html View File

@@ -24,11 +24,25 @@
24 24
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
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
+
28
+    <script src='./plugin/pageHtml.plugin.js'></script>
29
+
27 30
     <script src="./dev/jquery-3.2.1.js"></script>
28 31
     <script src="./dev/popper-1.12.3.js"></script>
29 32
     <script src="./dev/bootstrap-4.0.0-beta.2.js"></script>
30 33
 
31
-    <script type="text/javascript">
34
+    <script type='text/javascript'>
35
+      function GLOBAL_renderPlugin () {
36
+        pluginPageHtml.renderPlugin('pluginContainer')
37
+      }
38
+
39
+      function GLOBAL_dispatchEvent (data) {
40
+        var event = new CustomEvent('pluginCustomEvent', {detail: data})
41
+        document.dispatchEvent(event)
42
+      }
43
+    </script>
44
+
45
+    <script type='text/javascript'>
32 46
       if (window.matchMedia("(min-width:1200px)").matches) {
33 47
 
34 48
         var jsScript = document.createElement("script");

+ 0 - 48
src/component/Workspace/FileContentViewer.jsx View File

@@ -1,57 +1,9 @@
1 1
 import React from 'react'
2
-import PropTypes from 'prop-types'
3
-import PopinFixed from '../common/PopinFixed/PopinFixed'
4
-import PopinFixedHeader from '../common/PopinFixed/PopinFixedHeader.jsx'
5
-import PopinFixedOption from '../common/PopinFixed/PopinFixedOption.jsx'
6
-import PopinFixedContent from '../common/PopinFixed/PopinFixedContent.jsx'
7
-import { FILE_TYPE } from '../../helper.js'
8
-// import PluginContentType from '../PluginContentType.jsx'
9
-import PageHtml from '../../plugin/ContentType/PageHtml/PageHtml.jsx'
10
-// import Thread from '../../plugin/ContentType/Thread/Thread.jsx'
11 2
 
12 3
 const FileContentViewer = props => {
13
-  const defaultPlugin = {
14
-    customClass: '',
15
-    icon: '',
16
-    componentLeft: undefined,
17
-    componentRight: undefined
18
-  }
19
-  const { customClass, icon, componentLeft, componentRight } = FILE_TYPE.find(f => f.name === props.file.type) || defaultPlugin
20
-
21
-  const PluginLeft = props => {
22
-    console.log('componentLeft === PageHtml.name', componentLeft === PageHtml.name)
23
-    switch (componentLeft) {
24
-      case PageHtml.name:
25
-        return <PageHtml version={props.file.version} text={props.file.text} />
26
-    }
27
-    // componentLeft is a string, I cant do <componentLeft /> because it needs to be a react object (component) like PageHtml is
28
-  }
29
-
30 4
   return (
31
-    <PopinFixed customClass={`${customClass}`}>
32
-      <PopinFixedHeader
33
-        customClass={`${customClass}`}
34
-        icon={icon}
35
-        name={props.file.title}
36
-        onClickCloseBtn={props.onClose}
37
-      />
38
-
39
-      <PopinFixedOption customClass={`${customClass}`} />
40 5
 
41
-      <PopinFixedContent customClass={`${customClass}__contentpage`}>
42
-        {/* <PluginContentType customeClass={customClass} file={props.file} /> */}
43
-        <PluginLeft file={props.file} />
44
-      </PopinFixedContent>
45
-    </PopinFixed>
46 6
   )
47 7
 }
48 8
 
49 9
 export default FileContentViewer
50
-
51
-FileContentViewer.PropTypes = {
52
-  file: PropTypes.shape({
53
-    type: PropTypes.oneOf(FILE_TYPE.map(f => f.name)).isRequired,
54
-    title: PropTypes.string.isRequired
55
-  }).isRequired,
56
-  onClose: PropTypes.func.isRequired
57
-}

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

@@ -7,7 +7,6 @@ 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 FileContentViewer from '../component/Workspace/FileContentViewer.jsx'
11 10
 import {
12 11
   getPluginList,
13 12
   getWorkspaceContent
@@ -70,12 +69,9 @@ class WorkspaceContent extends React.Component {
70 69
 
71 70
           <DropdownCreateButton customClass='workspace__content__button mb-5' />
72 71
 
73
-          { activeFileContent.display &&
74
-            <FileContentViewer
75
-              file={activeFileContent}
76
-              onClose={this.handleClickCloseBtn}
77
-            />
78
-          }
72
+          <div id='pluginContainer'>
73
+
74
+          </div>
79 75
         </PageContent>
80 76
 
81 77
       </PageWrapper>