- 添加 Babel 配置文件支持 ES6+ 语法转换 - 添加 ESLint 忽略规则和配置文件 - 添加 Git 忽略规则文件 - 添加 Travis CI 配置文件 - 添加 1.4.2 版本变更日志文件 - 添加 Helm 图表辅助模板文件 - 添加 Helm 忽略规则文件
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
import Editor from '@components/Base/Editor';
|
|
import {
|
|
MIND_CONTAINER,
|
|
MIND_CLASS_NAME,
|
|
EVENT_BEFORE_ADD_PAGE,
|
|
EVENT_AFTER_ADD_PAGE,
|
|
} from '@common/constants';
|
|
import Page from '@components/Page';
|
|
import withGGEditorContext from '@common/context/GGEditorContext/withGGEditorContext';
|
|
|
|
class Mind extends Page {
|
|
get pageId() {
|
|
const { editor } = this.props;
|
|
|
|
return `${MIND_CONTAINER}_${editor.id}`;
|
|
}
|
|
|
|
initPage() {
|
|
const { editor } = this.props;
|
|
|
|
editor.emit(EVENT_BEFORE_ADD_PAGE, { className: MIND_CLASS_NAME });
|
|
|
|
this.page = new Editor.Mind(this.config);
|
|
|
|
editor.add(this.page);
|
|
|
|
editor.emit(EVENT_AFTER_ADD_PAGE, { page: this.page });
|
|
}
|
|
|
|
bindEvent() {
|
|
super.bindEvent();
|
|
this.bindKeyUpEditLabel();
|
|
}
|
|
|
|
bindKeyUpEditLabel() {
|
|
const editLabel = this.page.get('labelTextArea');
|
|
|
|
editLabel.on('keyup', (e) => {
|
|
e.stopPropagation();
|
|
|
|
const item = editLabel.focusItem;
|
|
const text = editLabel.textContent;
|
|
|
|
this.page.emit('keyUpEditLabel', {
|
|
item,
|
|
text,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
export default withGGEditorContext(Mind);
|