Hi! I have Editor control, which I use for a comments section on one of my pages.
I use FileBrowser to select attachments.
Here are the issues I found:
- No upload function or even uploaded event. To get correct fileUrl I'm maintaining list of existing attachments to query against them when matching filename of selected file to id, which should be a part of fileUrl. I can run synchronous http.get in fileUrl function to update existing attachments list, but this is not absolutely correct solution. I would prefer getting id of uploaded file in a response to upload request. But I don't see how to get this response, as uploadUrl property of FileBrowser's transport doesn't support using function, which can provide a callback when done.
- How to customize FileBrowser dialog? I want to set fixed width/height, position, resizeable property, etc.
- How to set custom Title programmatically in fileUrl method? How do I access Title property? Should I set it with jquery or there is a built-in support for that?
- When using "stock" editor without tools customization, it renders lists of styles, fonts, colors, with predefined list of values and selected default values. When setting the same tools manually, there's no style tool and font face and font size tools doesn't have default values as when using "stock" configuration. How do I set styles tool manually?
- Outdent tool, when setting in a list of custom tools, seems to be broken.
my code:
01.
$(
"#commentEditor"
)
02.
.kendoEditor({
03.
resizable: {
04.
content:
true
,
05.
toolbar:
true
06.
},
07.
tools: [
08.
"bold"
,
"italic"
,
"underline"
,
"strikethrough"
,
"fontName"
,
"fontSize"
,
"foreColor"
,
09.
"backColor"
,
"justifyLeft"
,
"justifyCenter"
,
"justifyRight"
,
"insertUnorderedList"
,
10.
"insertOrderedList"
,
"indent"
,
"insertFile"
,
"pdf"
11.
],
12.
fileBrowser: {
13.
transport: {
14.
read:
function
(options) {
15.
$.ajax({
16.
url:
"api/PAWorkOrderDocuments/Source/"
+ woId,
17.
success:
function
(result) {
18.
// notify the data source that the request succeeded
19.
self.attachments = result;
20.
options.success(result);
21.
},
22.
error:
function
(result) {
23.
// notify the data source that the request failed
24.
options.error(result);
25.
}
26.
});
27.
},
28.
uploadUrl:
"/api/PAWorkOrderDocuments/Upload/"
+ woId,
29.
fileUrl:
function
(options) {
30.
var
url =
""
;
31.
for
(
var
i = 0; i < self.attachments.length; i++) {
32.
if
(self.attachments[i].name === options) {
33.
url =
"/api/PAWorkOrderDocuments/Download/"
+ self.attachments[i].ID.toString();
34.
break
;
35.
}
36.
}
37.
return
url;
38.
}
39.
}
40.
}
41.
});