Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 478228

Summary: can not edit empty content
Product: [ECD] Orion Reporter: guji muun <gujiman>
Component: EditorAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Silenio_Quarti
Version: 10.0   
Target Milestone: 10.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description guji muun CLA 2015-09-23 14:49:07 EDT
i can not edit empty content, check out the following demo:

1) download 'built-codeEdit.zip' (Eclipse Orion Build: 10.0.0S10).
2) use the demo provided on 'https://wiki.eclipse.org/Orion/How_Tos/Code_Edit'
3) to test this bug change the variable 'contents' to "" in the demo:

var contents = '';

4) when you preview the demo, you can see that you will not be able to type anything into the editor.

Possible fix:

1) open the file 'editorSetup'.
2) locate and change the following code:

createEditor: function(options) {
   return this._editorCommands.createCommands().then(function() {
      this._editorCommands.registerCommands();
      this.createInputManager();
      this.editorView = new mEditorView.EditorView(this.defaultOptions(options.parent));
      idCounter++;
      this.editorView.create();
      this._inputManager.editor = this.editorView.editor;
      this._inputManager.setAutoSaveTimeout(300);
      this._editorCommands.inputManager = this._inputManager;
      if(options.contentType && options.contents) {
         this.editorView.setContents(options.contents, options.contentType);
      }
      return this.editorView;
   }.bind(this));
}

INTO:

createEditor: function(options) {
   return this._editorCommands.createCommands().then(function() {
      this._editorCommands.registerCommands();
      this.createInputManager();
      this.editorView = new mEditorView.EditorView(this.defaultOptions(options.parent));
      idCounter++;
      this.editorView.create();
      this._inputManager.editor = this.editorView.editor;
      this._inputManager.setAutoSaveTimeout(300);
      this._editorCommands.inputManager = this._inputManager;
      if (typeof options.contents === 'undefined') {
         options.contents = "";
      }
      if(options.contentType) {
         this.editorView.setContents(options.contents, options.contentType);
      }
      return this.editorView;
   }.bind(this));
}