Skip to content

Commit 121b5d5

Browse files
committed
修改 inject 方法
1 parent 393ba44 commit 121b5d5

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ All notable changes to this project will be documented in this file.
1010
The format is based on [Keep a Changelog](http://keepachangelog.com/)
1111
and this project adheres to [Semantic Versioning](http://semver.org/).
1212

13+
## 0.1.0
14+
ADDED:
15+
- 修改 inject 方式
1316

1417
## 0.0.1-alpha.06
1518
ADDED:

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "WebIDE-Plugin-AccessUrl",
3-
"version": "0.0.1-alpha.06",
3+
"version": "0.1.0",
44
"description": "WebIDE-Plugin-AccessUrl for Coding WebIDE",
55
"repository": {
66
"url": "git@github.com:Coding/WebIDE-Plugin-Env.git"
@@ -60,7 +60,7 @@
6060
"babel-runtime": "^6.11.6",
6161
"body-parser": "^1.15.2",
6262
"classnames": "^2.2.5",
63-
"codingSDK": "https://github.com/Coding/WebIDE-Plugin-SDK.git#0.0.1-alpha.11",
63+
"codingSDK": "https://github.com/Coding/WebIDE-Plugin-SDK.git#0.1.1-alpha.01",
6464
"cors": "^2.8.1",
6565
"express": "^4.14.0",
6666
"fs-promise": "^1.0.0",

src/manager.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import component, { store } from './app';
21
import APP from 'codingSDK/utils';
2+
import Manager from 'codingSDK/Manager';
3+
4+
import component, { store } from './app';
35

46
const languagePool = require('../i18n/index.json').reduce((p, v) => {
5-
p[v] = require(`../i18n/${v}/index`).default
6-
return p
7-
}, {})
7+
p[v] = require(`../i18n/${v}/index`).default;
8+
return p;
9+
}, {});
810

911
export const global = new APP({
1012
subscribeDataArray: ['GitState'],
@@ -13,23 +15,23 @@ export const global = new APP({
1315
});
1416

1517
const { injectComponent, i18n } = global;
16-
export default class {
18+
const { position, inject } = injectComponent;
19+
20+
export default class extends Manager {
1721
pluginWillMount() {
18-
console.log('plugin will Mount');
19-
injectComponent.addComToSideBar('right', {
22+
inject(position.sideBar.right, {
2023
text: i18n`global.sidebar`,
2124
icon: 'fa fa-external-link',
2225
key: 'access-url',
23-
onSidebarActive: () => {
24-
console.log('Access URL is active');
26+
actions: {
27+
onSidebarActive: () => {
28+
console.log('Access URL is active');
29+
},
30+
onSidebarDeactive: () => {
31+
console.log('Access URL is deactive');
32+
},
2533
},
26-
onSidebarDeactive: () => {
27-
console.log('Access URL is deactive');
28-
},
29-
}, extension => extension.app);
30-
}
31-
pluginOnActive() {
32-
34+
}, extension => extension.app);
3335
}
3436
/**
3537
* this will call only when plugin is unmount

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,9 +1332,9 @@ code-point-at@^1.0.0:
13321332
version "1.1.0"
13331333
resolved "http://registry.npm.taobao.org/code-point-at/download/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
13341334

1335-
"codingSDK@https://github.com/Coding/WebIDE-Plugin-SDK.git#0.0.1-alpha.11":
1336-
version "0.0.1-alpha.11"
1337-
resolved "https://github.com/Coding/WebIDE-Plugin-SDK.git#9a647837e82d8dad7c4108514c9dad7a4efdf9ab"
1335+
"codingSDK@https://github.com/Coding/WebIDE-Plugin-SDK.git#0.1.1-alpha.01":
1336+
version "0.1.1"
1337+
resolved "https://github.com/Coding/WebIDE-Plugin-SDK.git#3e4ebbf3b721a6a1295903bf1a3df5cf0ceaafde"
13381338
dependencies:
13391339
babel-preset-env "^1.1.8"
13401340
babel-runtime "^6.11.6"

0 commit comments

Comments
 (0)