Commit 18857ffc by chenshu

fix:修复

parent 70150640
...@@ -18,14 +18,12 @@ class GraphicsEditor extends React.Component { ...@@ -18,14 +18,12 @@ class GraphicsEditor extends React.Component {
diskList: [], diskList: [],
} }
this.editorInt = null; this.editorInt = null;
this.isContent = true;
} }
componentDidMount() { componentDidMount() {
this.renderEditor() this.renderEditor()
this.resetIndex(true); this.resetIndex(true);
this.initBus(); this.initBus();
this.bindClick();
} }
...@@ -33,23 +31,6 @@ class GraphicsEditor extends React.Component { ...@@ -33,23 +31,6 @@ class GraphicsEditor extends React.Component {
componentWillUnmount() { componentWillUnmount() {
this.resetIndex(); this.resetIndex();
this.removeBus(); this.removeBus();
this.removeClick();
}
bindClick = () => {
window.addEventListener('click', this.clickEditor)
}
removeClick = () => {
window.removeEventListener('click', this.clickEditor)
}
clickEditor = (e) => {
if (e && e.target.closest('.content-editor')) {
this.isContent = true
} else if (e && e.target.closest('.introduce-editor')) {
this.isContent = false
}
} }
resetIndex = (bool) => { resetIndex = (bool) => {
...@@ -103,9 +84,10 @@ class GraphicsEditor extends React.Component { ...@@ -103,9 +84,10 @@ class GraphicsEditor extends React.Component {
} }
this.editorInt = new E(`#editor${editorId}`); this.editorInt = new E(`#editor${editorId}`);
this.editorInt.config.focus = false;
this.editorInt.config.showFullScreen = !isIntro this.editorInt.config.showFullScreen = !isIntro
this.editorInt.menus.extend('xmimage', ImageMenu); this.editorInt.menus.extend('xmimage', ImageMenu);
this.editorInt.menus.extend('xmvideo', VideoMenu); !isIntro && this.editorInt.menus.extend('xmvideo', VideoMenu);
this.editorInt.config.menus = isIntro ? this.editorInt.config.menus = isIntro ?
[ [
'head', 'head',
...@@ -185,19 +167,21 @@ class GraphicsEditor extends React.Component { ...@@ -185,19 +167,21 @@ class GraphicsEditor extends React.Component {
// 选择图文 // 选择图文
handleSelectVideo = (file) => { handleSelectVideo = (file) => {
const { ossUrl } = file || {};
if (!ossUrl) return null;
this.setState({ this.setState({
showSelectVideoModal: false showSelectVideoModal: false
}) })
const { ossUrl } = file;
const { detail } = this.props; const { detail } = this.props;
this.editorInt && this.editorInt.txt.html(`${detail.content}<p style="width: 100%;padding-top: 56.25%;position: relative;"><iframe style="position: absolute;width: 100%;height: 100%;top: 0;left: 0;" src="${ossUrl}"></iframe><br/></p><p><br/></p>`) this.editorInt && this.editorInt.txt.html(`${detail.content}<p style="width: 100%;padding-top: 56.25%;position: relative;"><iframe style="position: absolute;width: 100%;height: 100%;top: 0;left: 0;" src="${ossUrl}"></iframe><br/></p><p><br/></p>`)
} }
handleSelectImage = (file) => { handleSelectImage = (file) => {
const { ossUrl } = file || {};
if (!ossUrl) return null;
this.setState({ this.setState({
showSelectImageModal: false showSelectImageModal: false
}) })
const { ossUrl } = file;
const { detail } = this.props; const { detail } = this.props;
this.editorInt && this.editorInt.txt.html(`${detail.content}<p><img style="max-width: 100%;" src="${ossUrl}" /><br/><p>`) this.editorInt && this.editorInt.txt.html(`${detail.content}<p><img style="max-width: 100%;" src="${ossUrl}" /><br/><p>`)
} }
...@@ -205,13 +189,13 @@ class GraphicsEditor extends React.Component { ...@@ -205,13 +189,13 @@ class GraphicsEditor extends React.Component {
initBus = () => { initBus = () => {
const { isIntro } = this.props; const { isIntro } = this.props;
Bus.bind(`graphicsEditorImage${isIntro ? '' : 'Content'}`, this.uploadImage) Bus.bind(`graphicsEditorImage${isIntro ? '' : 'Content'}`, this.uploadImage)
Bus.bind('graphicsEditorVideo', this.uploadVideo) !isIntro && Bus.bind('graphicsEditorVideo', this.uploadVideo)
} }
removeBus = () => { removeBus = () => {
const { isIntro } = this.props; const { isIntro } = this.props;
Bus.unbind(`graphicsEditorImage${isIntro ? '' : 'Content'}`, this.uploadImage) Bus.unbind(`graphicsEditorImage${isIntro ? '' : 'Content'}`, this.uploadImage)
Bus.unbind('graphicsEditorVideo', this.uploadVideo) !isIntro && Bus.unbind('graphicsEditorVideo', this.uploadVideo)
} }
uploadImage = () => { uploadImage = () => {
......
...@@ -64,7 +64,6 @@ class AddGraphicsCourse extends React.Component { ...@@ -64,7 +64,6 @@ class AddGraphicsCourse extends React.Component {
courseCatalogList:[], //分类列表 courseCatalogList:[], //分类列表
categoryId:null, //分类的Id值 categoryId:null, //分类的Id值
whetherVisitorsJoin: 'NO', // 是否允许游客加入 whetherVisitorsJoin: 'NO', // 是否允许游客加入
isContent: true,
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment