diff options
Diffstat (limited to 'js/io')
8 files changed, 157 insertions, 118 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index b0ffe2d8..a06f45c6 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -1085,14 +1085,14 @@ exports.CoreIoApi = Montage.create(Component, { | |||
1085 | isValidUri:{ | 1085 | isValidUri:{ |
1086 | value: function(uri){ | 1086 | value: function(uri){ |
1087 | var isWindowsUri=false, isUnixUri=false,status=false; | 1087 | var isWindowsUri=false, isUnixUri=false,status=false; |
1088 | if(uri !== ""){ | 1088 | if((uri !== null) && (uri !== "")){ |
1089 | uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces | 1089 | uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces |
1090 | 1090 | ||
1091 | //for local machine folder uri | 1091 | //for local machine folder uri |
1092 | isWindowsUri = /^([a-zA-Z]:)([\\/][^<>:"/\\|?*]+)*[\\/]?$/gi.test(uri); | 1092 | isWindowsUri = /^([a-zA-Z]:)([\\/][^<>:"/\\|?*]+)*[\\/]?$/gi.test(uri); |
1093 | isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix | 1093 | isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix |
1094 | status = isWindowsUri || isUnixUri; | 1094 | status = isWindowsUri || isUnixUri; |
1095 | if(isWindowsUri && isUnixUri){status = false;} | 1095 | if((uri === "") || (isWindowsUri && isUnixUri)){status = false;} |
1096 | } | 1096 | } |
1097 | return status; | 1097 | return status; |
1098 | } | 1098 | } |
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.html b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html index 2fcaa075..00df1c11 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.html +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html | |||
@@ -10,13 +10,21 @@ | |||
10 | <link rel="stylesheet" type="text/css" href="file-input-field.css"> | 10 | <link rel="stylesheet" type="text/css" href="file-input-field.css"> |
11 | <script type="text/montage-serialization"> | 11 | <script type="text/montage-serialization"> |
12 | { | 12 | { |
13 | |||
14 | "newFileDirectory": { | ||
15 | "prototype": "montage/ui/textfield.reel", | ||
16 | "properties": { | ||
17 | "element": {"#": "newFileDirectory"} | ||
18 | } | ||
19 | }, | ||
20 | |||
13 | "owner":{ | 21 | "owner":{ |
14 | "module": "js/io/ui/file-picker/file-input-field.reel", | 22 | "module": "js/io/ui/file-picker/file-input-field.reel", |
15 | "name": "FileInputField", | 23 | "name": "FileInputField", |
16 | "properties": { | 24 | "properties": { |
17 | "element": {"#": "fileInputField"}, | 25 | "element": {"#": "fileInputField"}, |
18 | "findDirectory": {"#": "findDirectory"}, | 26 | "findDirectory": {"#": "findDirectory"}, |
19 | "newFileDirectory": {"#": "newFileDirectory"} | 27 | "newFileDirectory": {"@": "newFileDirectory"} |
20 | } | 28 | } |
21 | } | 29 | } |
22 | } | 30 | } |
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index 46e8b386..9e77759f 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js | |||
@@ -14,13 +14,10 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
14 | value: function() { | 14 | value: function() { |
15 | var that = this; | 15 | var that = this; |
16 | this.findDirectory.identifier = "findDirectory"; | 16 | this.findDirectory.identifier = "findDirectory"; |
17 | |||
18 | this.findDirectory.addEventListener("click", this, false); | 17 | this.findDirectory.addEventListener("click", this, false); |
19 | 18 | this.eventManager.addEventListener("pickerSelectionsDone", this.handleFileInputPickerSelectionsDone, false); | |
20 | this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); | 19 | this.addEventListener("change@newFileDirectory.value", this.handleNewFileDirectoryChange, false); |
21 | 20 | this.newFileDirectory.element.addEventListener("keyup", this, false); | |
22 | this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); | ||
23 | this.newFileDirectory.addEventListener("paste", this, false); | ||
24 | } | 21 | } |
25 | }, | 22 | }, |
26 | 23 | ||
@@ -64,26 +61,31 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
64 | } | 61 | } |
65 | }, | 62 | }, |
66 | 63 | ||
67 | handlePaste:{ | 64 | handleNewFileDirectoryChange:{ |
68 | value:function(evt){ | ||
69 | evt.preventDefault(); | ||
70 | evt.target.value = evt.clipboardData.getData("Text"); | ||
71 | this.handleNewFileDirectoryOnkeyup(evt); | ||
72 | } | ||
73 | }, | ||
74 | |||
75 | handleNewFileDirectoryOnkeyup:{ | ||
76 | value:function(evt){ | 65 | value:function(evt){ |
77 | if(this.newFileDirectory.value !== ""){ | 66 | var newFileDirectorySetEvent = document.createEvent("Events"); |
78 | var newFileDirectorySetEvent = document.createEvent("Events"); | 67 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); |
79 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | 68 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; |
80 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | 69 | newFileDirectorySetEvent.keyCode = evt.keyCode; |
81 | newFileDirectorySetEvent.keyCode = evt.keyCode; | 70 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); |
82 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); | ||
83 | } | ||
84 | } | 71 | } |
85 | }, | 72 | }, |
86 | 73 | ||
74 | |||
75 | handleKeyup:{ | ||
76 | value: function(evt){ | ||
77 | if(evt.keyCode === 13){ | ||
78 | var enterKeyupEvent = document.createEvent("Events"); | ||
79 | enterKeyupEvent.initEvent("enterKey", false, false); | ||
80 | this.eventManager.dispatchEvent(enterKeyupEvent); | ||
81 | }else if(evt.keyCode === 27){ | ||
82 | var escKeyupEvent = document.createEvent("Events"); | ||
83 | escKeyupEvent.initEvent("escKey", false, false); | ||
84 | this.eventManager.dispatchEvent(escKeyupEvent); | ||
85 | } | ||
86 | } | ||
87 | }, | ||
88 | |||
87 | handleFileInputPickerSelectionsDone:{ | 89 | handleFileInputPickerSelectionsDone:{ |
88 | value: function(evt){ | 90 | value: function(evt){ |
89 | var selectedUri = ""; | 91 | var selectedUri = ""; |
@@ -105,7 +107,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
105 | if(!!obj && obj.uri && obj.uri.length > 0){ | 107 | if(!!obj && obj.uri && obj.uri.length > 0){ |
106 | selectedUri = obj.uri[0]; | 108 | selectedUri = obj.uri[0]; |
107 | this.newFileDirectory.value = selectedUri; | 109 | this.newFileDirectory.value = selectedUri; |
108 | 110 | this.newFileDirectory.element.focus(); | |
109 | var newFileDirectorySetEvent = document.createEvent("Events"); | 111 | var newFileDirectorySetEvent = document.createEvent("Events"); |
110 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | 112 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); |
111 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | 113 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; |
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html index 7340251c..1f9d9b9f 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html | |||
@@ -58,13 +58,20 @@ | |||
58 | } | 58 | } |
59 | }, | 59 | }, |
60 | 60 | ||
61 | "newFileName": { | ||
62 | "prototype": "montage/ui/textfield.reel", | ||
63 | "properties": { | ||
64 | "element": {"#": "newFileName"} | ||
65 | } | ||
66 | }, | ||
67 | |||
61 | "owner":{ | 68 | "owner":{ |
62 | "module": "js/io/ui/new-file-dialog/new-file-location.reel", | 69 | "module": "js/io/ui/new-file-dialog/new-file-location.reel", |
63 | "name": "NewFileLocation", | 70 | "name": "NewFileLocation", |
64 | "properties": { | 71 | "properties": { |
65 | "element": {"#": "newfileLocation"}, | 72 | "element": {"#": "newfileLocation"}, |
66 | "fileInputField": {"@": "fileInputField"}, | 73 | "fileInputField": {"@": "fileInputField"}, |
67 | "newFileName": {"#": "newFileName"} | 74 | "newFileName": {"@": "newFileName"} |
68 | } | 75 | } |
69 | } | 76 | } |
70 | } | 77 | } |
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js index 02579676..3ac38d02 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | |||
@@ -22,31 +22,34 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { | |||
22 | value: function() { | 22 | value: function() { |
23 | this.fileInputField.selectDirectory = true; | 23 | this.fileInputField.selectDirectory = true; |
24 | 24 | ||
25 | this.newFileName.addEventListener("keyup", this, false); | 25 | this.addEventListener("change@newFileName.value", this.newFileNameChange, false); |
26 | this.newFileName.addEventListener("paste", this, false); | 26 | this.newFileName.element.addEventListener("keyup", this, false); |
27 | this.newFileName.focus(); | 27 | this.newFileName.element.focus(); |
28 | this.newFileName.select(); | 28 | this.newFileName.element.select(); |
29 | } | 29 | } |
30 | }, | 30 | }, |
31 | 31 | ||
32 | handlePaste:{ | 32 | handleKeyup:{ |
33 | value:function(evt){ | 33 | value: function(evt){ |
34 | evt.preventDefault(); | 34 | if(evt.keyCode === 13){ |
35 | evt.target.value = evt.clipboardData.getData("Text"); |