Editor attach

Fixed css editor updating when attaching if open.
This commit is contained in:
Alexei Stukov 2017-04-30 05:21:08 +03:00 committed by GitHub
parent 6d23660361
commit b15f56212d
1 changed files with 4 additions and 3 deletions

View File

@ -3588,6 +3588,7 @@ class V2C_CssEditorDetached extends BDV2.reactComponent {
let self = this; let self = this;
switch (id) { switch (id) {
case 'attach': case 'attach':
if ($("#editor-detached").length) self.props.attach();
BDV2.reactDom.unmountComponentAtNode(self.root); BDV2.reactDom.unmountComponentAtNode(self.root);
break; break;
case 'update': case 'update':
@ -3618,13 +3619,13 @@ class V2C_CssEditor extends BDV2.reactComponent {
constructor(props) { constructor(props) {
super(props); super(props);
let self = this; let self = this;
self.detachedEditor = BDV2.react.createElement(V2C_CssEditorDetached, null);
self.setInitialState(); self.setInitialState();
self.attach = self.attach.bind(self);
self.detachedEditor = BDV2.react.createElement(V2C_CssEditorDetached, { attach: self.attach });
self.onClick = self.onClick.bind(self); self.onClick = self.onClick.bind(self);
self.updateCss = self.updateCss.bind(self); self.updateCss = self.updateCss.bind(self);
self.saveCss = self.saveCss.bind(self); self.saveCss = self.saveCss.bind(self);
self.detach = self.detach.bind(self); self.detach = self.detach.bind(self);
self.attach = self.attach.bind(self);
self.codeMirror = self.codeMirror.bind(self); self.codeMirror = self.codeMirror.bind(self);
} }
@ -4384,7 +4385,7 @@ class V2C_PublicServers extends BDV2.reactComponent {
url: `${self.joinEndPoint}/session`, url: `${self.joinEndPoint}/session`,
crossDomain: true, crossDomain: true,
xhrFields: { xhrFields: {
withCredentials: true withCredentials: true
}, },
success: data => { success: data => {
self.setState({ self.setState({