mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
bug fixed for page refresh initialize editor mode
This commit is contained in:
parent
46ecf77b7b
commit
eaa1b86978
3 changed files with 9 additions and 4 deletions
|
|
@ -1595,9 +1595,11 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
|
||||
private void getEditorSetting(NotebookSocket conn, Message fromMessage)
|
||||
throws IOException {
|
||||
String orderId = (String) fromMessage.get("orderId");
|
||||
String replName = (String) fromMessage.get("magic");
|
||||
String noteId = getOpenNoteId(conn);
|
||||
Message resp = new Message(OP.EDITOR_SETTING);
|
||||
resp.put("orderId", orderId);
|
||||
resp.put("editor", notebook().getInterpreterFactory().getEditorSetting(noteId, replName));
|
||||
conn.send(serializeMessage(resp));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -705,13 +705,15 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
|
|||
|
||||
var getAndSetEditorSetting = function(session, interpreterName) {
|
||||
var deferred = $q.defer();
|
||||
websocketMsgSrv.getEditorSetting(interpreterName);
|
||||
websocketMsgSrv.getEditorSetting($scope.paragraph.id, interpreterName);
|
||||
$timeout(
|
||||
$scope.$on('editorSetting', function(event, data) {
|
||||
deferred.resolve(data);
|
||||
if ($scope.paragraph.id === data.orderId) {
|
||||
deferred.resolve(data);
|
||||
}
|
||||
}
|
||||
), 1000);
|
||||
|
||||
|
||||
deferred.promise.then(function(editorSetting) {
|
||||
if (!_.isEmpty(editorSetting.editor)) {
|
||||
var mode = 'ace/mode/' + editorSetting.editor.language;
|
||||
|
|
|
|||
|
|
@ -180,10 +180,11 @@ angular.module('zeppelinWebApp').service('websocketMsgSrv', function($rootScope,
|
|||
});
|
||||
},
|
||||
|
||||
getEditorSetting: function(replName) {
|
||||
getEditorSetting: function(orderId, replName) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'EDITOR_SETTING',
|
||||
data: {
|
||||
orderId: orderId,
|
||||
magic: replName
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue