Skip to content

Commit

Permalink
fix for non-image attachments (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren authored Nov 22, 2016
1 parent 8c07a72 commit e5e0ac6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions dist/PublicLab.Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -35083,14 +35083,22 @@ function bindCommands (surface, options, editor) {
prompts: options.prompts,
upload: options[type + 's'],
classes: options.classes,
mergeHtmlAndAttachment: options.mergeHtmlAndAttachment,
mergeHtmlAndAttachment: options.mergeHtmlAndAttachment || mergeHtmlAndAttachment,
autoUpload: autoUpload
});
};
}
function bind (id, combo, fn) {
return editor.addCommandButton(id, combo, suppress(fn));
}
function mergeHtmlAndAttachment (chunks, link) {
var linkText = chunks.selection || link.title;
return {
before: chunks.before,
selection: '<a href="' + link.href + '">' + linkText + '</a>',
after: chunks.after,
};
}
function router (method) {
return function routed (mode, chunks) { commands[mode][method].call(this, chunks); };
}
Expand Down Expand Up @@ -36769,7 +36777,7 @@ function prompt (options, done) {
fieldKey: upload.fieldKey,
xhrOptions: upload.xhrOptions,
endpoint: upload.url,
validate: 'image'
validate: upload.validate || 'image'
});

bureaucrat.on('started', function () {
Expand Down Expand Up @@ -38278,7 +38286,7 @@ module.exports = function(textarea, _editor, _module) {
// should return whether `e.dataTransfer.files[i]` is valid, defaults to a `true` operation
validate: function isItAnUploadableFile (file) {
var valid = true,
formats = _module.options.formats || ['csv', 'xls', 'zip', 'kml', 'kmz', 'gpx', 'lut', 'stl', 'dxf', 'txt'],
formats = _module.options.formats || ['csv', 'xls', 'zip', 'kml', 'kmz', 'gpx', 'lut', 'stl', 'dxf', 'txt', 'pdf', 'svg', 'doc', 'ppt'],
filetype = file.name.split('.')[file.name.split('.').length - 1];
if (formats.indexOf(filetype) === -1) valid = false;
return valid;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "publiclab-editor",
"version": "0.2.6",
"version": "0.2.7",
"description": "PublicLab.Editor is a general purpose, JavaScript/Bootstrap UI framework for rich text posting, which provides an author-friendly, minimal, mobile/desktop (fluid) interface for creating blog-like content, designed for PublicLab.org",
"main": "dist/PublicLab.Editor.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/PublicLab.Woofmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module.exports = function(textarea, _editor, _module) {
// should return whether `e.dataTransfer.files[i]` is valid, defaults to a `true` operation
validate: function isItAnUploadableFile (file) {
var valid = true,
formats = _module.options.formats || ['csv', 'xls', 'zip', 'kml', 'kmz', 'gpx', 'lut', 'stl', 'dxf', 'txt'],
formats = _module.options.formats || ['csv', 'xls', 'zip', 'kml', 'kmz', 'gpx', 'lut', 'stl', 'dxf', 'txt', 'pdf', 'svg', 'doc', 'ppt'],
filetype = file.name.split('.')[file.name.split('.').length - 1];
if (formats.indexOf(filetype) === -1) valid = false;
return valid;
Expand Down

0 comments on commit e5e0ac6

Please sign in to comment.