Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
40805653
Commit
40805653
authored
Apr 10, 2018
by
serapath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor plugin tab
parent
45ff8353
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
46 deletions
+50
-46
pluginManager.js
src/app/plugin/pluginManager.js
+18
-23
plugin-tab.js
src/app/tabs/plugin-tab.js
+32
-7
plugin-tab-styles.js
src/app/tabs/styles/plugin-tab-styles.js
+0
-16
No files found.
src/app/plugin/pluginManager.js
View file @
40805653
...
@@ -37,42 +37,39 @@
...
@@ -37,42 +37,39 @@
* See index.html and remix.js in test-browser folder for sample
* See index.html and remix.js in test-browser folder for sample
*
*
*/
*/
class
PluginManager
{
module
.
exports
=
class
PluginManager
{
constructor
(
api
=
{},
events
=
{},
opts
=
{})
{
constructor
(
api
=
{},
events
=
{},
opts
=
{})
{
var
self
=
this
const
self
=
this
this
.
plugins
=
{}
self
.
_api
=
api
this
.
inFocus
self
.
_events
=
events
self
.
plugins
=
{}
self
.
inFocus
var
allowedapi
=
{
'setConfig'
:
1
,
'getConfig'
:
1
,
'removeConfig'
:
1
}
var
allowedapi
=
{
'setConfig'
:
1
,
'getConfig'
:
1
,
'removeConfig'
:
1
}
events
.
compiler
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
self
.
_
events
.
compiler
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
if
(
this
.
inFocus
)
{
if
(
self
.
inFocus
)
{
// trigger to the current focus
// trigger to the current focus
this
.
post
(
this
.
inFocus
,
JSON
.
stringify
({
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
type
:
'compilationFinished'
,
type
:
'compilationFinished'
,
value
:
{
value
:
{
success
,
data
,
source
}
success
:
success
,
data
:
data
,
source
:
source
}
}))
}))
}
}
})
})
self
.
_events
.
app
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
events
.
app
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
if
(
self
.
inFocus
&&
self
.
inFocus
!==
tabName
)
{
if
(
this
.
inFocus
&&
this
.
inFocus
!==
tabName
)
{
// trigger unfocus
// trigger unfocus
this
.
post
(
this
.
inFocus
,
JSON
.
stringify
({
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
type
:
'unfocus'
type
:
'unfocus'
}))
}))
}
}
if
(
this
.
plugins
[
tabName
])
{
if
(
self
.
plugins
[
tabName
])
{
// trigger focus
// trigger focus
this
.
post
(
tabName
,
JSON
.
stringify
({
self
.
post
(
tabName
,
JSON
.
stringify
({
type
:
'focus'
type
:
'focus'
}))
}))
this
.
inFocus
=
tabName
self
.
inFocus
=
tabName
this
.
post
(
tabName
,
JSON
.
stringify
({
self
.
post
(
tabName
,
JSON
.
stringify
({
type
:
'compilationData'
,
type
:
'compilationData'
,
value
:
api
.
compiler
.
getCompilationResult
()
value
:
self
.
_api
.
getCompilationResult
()
}))
}))
}
}
})
})
...
@@ -107,5 +104,3 @@ class PluginManager {
...
@@ -107,5 +104,3 @@ class PluginManager {
}
}
}
}
}
}
module
.
exports
=
PluginManager
src/app/tabs/plugin-tab.js
View file @
40805653
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
css
=
require
(
'./styles/plugin-tab-styles'
)
var
csjs
=
require
(
'csjs-inject'
)
var
remixLib
=
require
(
'remix-lib'
)
function
plugintab
(
api
=
{},
events
=
{},
opts
=
{})
{
var
EventManager
=
remixLib
.
EventManager
var
el
=
yo
`
module
.
exports
=
class
plugintab
{
constructor
(
api
=
{},
events
=
{},
opts
=
{})
{
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
_api
=
api
self
.
_events
=
events
self
.
_view
=
{
el
:
null
}
self
.
data
=
{
url
:
opts
.
url
}
self
.
_components
=
{}
}
render
()
{
const
self
=
this
if
(
self
.
_view
.
el
)
return
self
.
_view
.
el
self
.
_view
.
el
=
yo
`
<div class="
${
css
.
pluginTabView
}
" id="pluginView">
<div class="
${
css
.
pluginTabView
}
" id="pluginView">
<iframe class="
${
css
.
iframe
}
" src="
${
opts
.
url
}
/index.html"></iframe>
<iframe class="
${
css
.
iframe
}
" src="
${
self
.
data
.
url
}
/index.html"></iframe>
</div>`
</div>`
return
{
render
()
{
return
el
}
}
return
self
.
_view
.
el
}
}
}
const
css
=
csjs
`
module
.
exports
=
plugintab
.pluginTabView {
height: 100%;
width: 100%;
}
.iframe {
height: 100%;
width: 100%;
border: 0;
}
`
src/app/tabs/styles/plugin-tab-styles.js
deleted
100644 → 0
View file @
45ff8353
var
csjs
=
require
(
'csjs-inject'
)
var
css
=
csjs
`
.pluginTabView {
height: 100%;
width: 100%;
}
.iframe {
height: 100%;
width: 100%;
border: 0;
}
`
module
.
exports
=
css
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment