Issue 10: When saving a file from editor -- default extension should be .gms
Project Member Reported by h.paul.h...@gmail.com, Feb 18, 2014
What steps will reproduce the problem?
1. Create a file in editor, then try to save
2.
3.

What is the expected output? What do you see instead?
Expected output filter should be .gms NOT .bin


Please use labels and text to provide additional information.


Feb 18, 2014
Project Member #1 vance.mo...@gmail.com
What browser are you using? I just get a 'download' file that automatically downloads when I use Chrome.

There's really no way to control what the file extension is, here's the code I used to pull off the save from the editor:

	Command saveCommand = new Command() {
		@Override
		public void execute() {
			Log.debug("In editor, SAVE command clicked.");
			String content = editor.getText();
			saveContent(content);
		}
		// JSNI to save content - creates a long URI with the
		// file contents to save, pops a window and the browser
		// handles it from there
		private native void saveContent(String content) 
		/*-{;
			uriContent = "data:application/octet-stream," + encodeURIComponent(content);
			 newWindow=$wnd.open(uriContent);
		}-*/;
	};

You can see, I use the JavaScript Native Interface to encode a bytestream of the contents of the editor, then pop a new window.

There might be a better way to pull this off, but I don't have the time to research it now!