Skip to content

Commit 81bde1d

Browse files
committed
PINT-15225 Chore: delete old instructions about filepicker for public
1 parent 5488be9 commit 81bde1d

File tree

1 file changed

+118
-107
lines changed

1 file changed

+118
-107
lines changed

src/docs/widgets.md

Lines changed: 118 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,135 @@
1-
# Widgets
1+
# Widgets [deprecated]
22

3-
|Sections|
4-
| --- |
5-
|[File picker](#file-picker-on-file-system-api)|
6-
|[prompt](#prompt-widget)|
3+
| Sections |
4+
| ---------------------------------------------- |
5+
| [File picker](#file-picker-on-file-system-api) |
6+
| [prompt](#prompt-widget) |
77

88
## File picker on File System API
99

1010
### Initialize Egnyte SDK to use API
11+
1112
```javascript
1213
var egnyte = Egnyte.init("http://mydomain.egnyte.com", {
1314
...
1415
});
1516
```
17+
1618
(See API docs)
1719

1820
### Open file picker:
21+
1922
```javascript
20-
//find a DOM node to put the picker in:
21-
var containerNode = document.getElementById("myPickerContainer");
22-
//open file picker
23-
var picker = egnyte.filePicker(containerNode,options);
23+
//find a DOM node to put the picker in:
24+
var containerNode = document.getElementById("myPickerContainer");
25+
//open file picker
26+
var picker = egnyte.filePicker(containerNode, options);
2427
```
2528

2629
None of the options are required. (although without the selection callback it doesn't make much sense to use the picker)
2730

2831
The options are:
29-
- `path` _String_ - a path to open the filepicker at, default: "/"
30-
- `cancel` _Function_ - a callback to run when the user decides to cancel selecting
31-
- `selection` _Function_ - a callback to run when the user makes a selection. First argument is an array of selected items.
32-
- `error` _Function_ - a callback to call when an error occurs. First argument is an error object. Filepicker has its default error handling, return false from your error handler function to supress that, return a string to replace the default error text. When picker instance is not useful after an error, remember to close it.
33-
- `barAlign` _String_ - decide if buttons on the bottom bar should be aligned to left or right, default: "right"
34-
- `select` _Map_ of selectables configuration
35-
```javascript
36-
select: {
37-
folder: true, //should folders be selectable
38-
file: true, //should files be selectable (files are hidden when not selectable)
39-
filesRemainVisible: false, //should files be visible even if not selectable
40-
multiple: true, //should allow multiselection
41-
forbidden: [] //array of folder paths that selection is forbidden in
42-
}
43-
```
44-
- `texts` _Map_ of labels in the filepicker to replace with given replacements, optional
45-
```javascript
46-
texts: {
47-
"Ok": "...",
48-
"Cancel": "...",
49-
"Loading": "...",
50-
"This folder is empty": "..."
51-
}
52-
```
53-
54-
- `keys` _Map_ to override default keybinding, set to false to disable all keyboard handling
55-
56-
```javascript
57-
keys: {
58-
"up": "<up>",
59-
"down": "<down>",
60-
"select": "<space>",
61-
"explore": "<right>",
62-
"back": "<left>",
63-
"confirm": "none",
64-
"close": "<escape>"
65-
}
66-
```
32+
33+
- `path` _String_ - a path to open the filepicker at, default: "/"
34+
- `cancel` _Function_ - a callback to run when the user decides to cancel selecting
35+
- `selection` _Function_ - a callback to run when the user makes a selection. First argument is an array of selected items.
36+
- `error` _Function_ - a callback to call when an error occurs. First argument is an error object. Filepicker has its default error handling, return false from your error handler function to supress that, return a string to replace the default error text. When picker instance is not useful after an error, remember to close it.
37+
- `barAlign` _String_ - decide if buttons on the bottom bar should be aligned to left or right, default: "right"
38+
- `select` _Map_ of selectables configuration
39+
40+
```javascript
41+
select: {
42+
folder: true, //should folders be selectable
43+
file: true, //should files be selectable (files are hidden when not selectable)
44+
filesRemainVisible: false, //should files be visible even if not selectable
45+
multiple: true, //should allow multiselection
46+
forbidden: [] //array of folder paths that selection is forbidden in
47+
}
48+
```
49+
50+
- `texts` _Map_ of labels in the filepicker to replace with given replacements, optional
51+
52+
```javascript
53+
texts: {
54+
"Ok": "...",
55+
"Cancel": "...",
56+
"Loading": "...",
57+
"This folder is empty": "..."
58+
}
59+
```
60+
61+
- `keys` _Map_ to override default keybinding, set to false to disable all keyboard handling
62+
63+
```javascript
64+
keys: {
65+
"up": "<up>",
66+
"down": "<down>",
67+
"select": "<space>",
68+
"explore": "<right>",
69+
"back": "<left>",
70+
"confirm": "none",
71+
"close": "<escape>"
72+
}
73+
```
74+
6775
All keys handled by https://github.com/chrisdickinson/vkey are available.
6876

69-
- `filterExtensions` _Function_ - a filter function that decides if file should be visible to the user. Google drive files are filtered out by default. Pass `false` explicitly to disable filtering. First argument to the function is 3 first characters of file extension, second is the internal mime group name (used for icon colors too).
77+
- `filterExtensions` _Function_ - a filter function that decides if file should be visible to the user. Google drive files are filtered out by default. Pass `false` explicitly to disable filtering. First argument to the function is 3 first characters of file extension, second is the internal mime group name (used for icon colors too).
78+
79+
```javascript
80+
filterExtensions: function(ext3chars, mime){
81+
return ext3chars==="htm"; //show only htm* files
82+
}
83+
```
7084

71-
```javascript
72-
filterExtensions: function(ext3chars, mime){
73-
return ext3chars==="htm"; //show only htm* files
74-
}
75-
```
76-
Possible values of mime: `"audio", "video", "pdf", "word_processing", "spreadsheet", "presentation", "cad", "text", "image", "archive", "goog"`
85+
Possible values of mime: `"audio", "video", "pdf", "word_processing", "spreadsheet", "presentation", "cad", "text", "image", "archive", "goog"`
7786

78-
- `noFont` _Boolean_ - set to true to opt-out from linking Open Sans from google fonts. The font will be linked to only once if at least one filepicker instance doesn't have `noFont:true` in options.
87+
- `noFont` _Boolean_ - set to true to opt-out from linking Open Sans from google fonts. The font will be linked to only once if at least one filepicker instance doesn't have `noFont:true` in options.
7988

80-
----
89+
---
8190

8291
_Examples_
8392

8493
Open on `/Private` location, with single selection and changed labels for OK and empty folder
8594

8695
```javascript
87-
var picker = egnyte.filePicker(containerNode,{
88-
path: "/Private",
89-
navigation: function(currentFolder){
90-
//handle change folder
91-
},
92-
selection: function(list){
93-
//handle selection
94-
},
95-
cancel: function(){
96-
//the user cancelled. containerNode will be emptied by the filepicker itself.
97-
},
98-
select: {
99-
multiple: false //single selection
100-
},
101-
texts: {
102-
"Ok": "Continue",
103-
"This folder is empty": "Nothing here, sorry"
104-
}
105-
});
96+
var picker = egnyte.filePicker(containerNode, {
97+
path: "/Private",
98+
navigation: function (currentFolder) {
99+
//handle change folder
100+
},
101+
selection: function (list) {
102+
//handle selection
103+
},
104+
cancel: function () {
105+
//the user cancelled. containerNode will be emptied by the filepicker itself.
106+
},
107+
select: {
108+
multiple: false, //single selection
109+
},
110+
texts: {
111+
Ok: "Continue",
112+
"This folder is empty": "Nothing here, sorry",
113+
},
114+
});
106115
```
107116

108117
Added a detailed error handler for
118+
109119
```javascript
110-
var picker = egnyte.filePicker(containerNode,{
111-
selection: function(list){
112-
//handle selection
113-
},
114-
cancel: function(){
115-
//the user cancelled. containerNode will be emptied by the filepicker itself.
116-
},
117-
error: function(e){
118-
if(e.statusCode == 503){
119-
return "Server is tired of all this querying"
120-
}
121-
}
122-
});
120+
var picker = egnyte.filePicker(containerNode, {
121+
selection: function (list) {
122+
//handle selection
123+
},
124+
cancel: function () {
125+
//the user cancelled. containerNode will be emptied by the filepicker itself.
126+
},
127+
error: function (e) {
128+
if (e.statusCode == 503) {
129+
return "Server is tired of all this querying";
130+
}
131+
},
132+
});
123133
```
124134

125135
File picker will fill the container node (width and height 100%). Minimal dimensions of the container node are 400x400 px
@@ -165,14 +175,15 @@ _Folder_
165175
### Close file picker
166176

167177
File picker can be closed without the user clicking "cancel":
178+
168179
```javascript
169-
picker.close();
180+
picker.close();
170181
```
171182

172183
### Get current folder
173184

174185
```javascript
175-
picker.getCurrentFolder();
186+
picker.getCurrentFolder();
176187
```
177188

178189
### Change the style
@@ -183,32 +194,32 @@ You can also modify the defaults to keep everything in one package. Change the c
183194

184195
## Prompt widget
185196

186-
187197
### Open prompt:
198+
188199
```javascript
189-
//find a DOM node to work with:
190-
var containerNode = document.getElementById("myPickerContainer");
191-
//open prompt
192-
var promptObj = egnyte.prompt(containerNode,{
193-
texts:{
194-
question: "What's your name"
195-
},
196-
result:function(name){
197-
//do stuff
198-
}
199-
});
200+
//find a DOM node to work with:
201+
var containerNode = document.getElementById("myPickerContainer");
202+
//open prompt
203+
var promptObj = egnyte.prompt(containerNode, {
204+
texts: {
205+
question: "What's your name",
206+
},
207+
result: function (name) {
208+
//do stuff
209+
},
210+
});
200211
```
201212

202-
203213
The options are:
204-
- `result` _Function_ - a callback to run when the user clicks ok. First argument is the string from user input
205-
- `barAlign` _String_ - decide if buttons on the bottom bar should be aligned to left or right, default: "right"
206-
- `texts` _Map_ of labels in the widget to replace with given replacements. Put your question in the `question` field
207214

215+
- `result` _Function_ - a callback to run when the user clicks ok. First argument is the string from user input
216+
- `barAlign` _String_ - decide if buttons on the bottom bar should be aligned to left or right, default: "right"
217+
- `texts` _Map_ of labels in the widget to replace with given replacements. Put your question in the `question` field
208218

209219
### Close the prompt
210220

211221
Prompt can be closed without the user clicking the button:
222+
212223
```javascript
213-
promptObj.close();
224+
promptObj.close();
214225
```

0 commit comments

Comments
 (0)