Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### 1.1.4 (wip)
- Support preview for filestack urls that do not contain /api/file

### 1.1.3 (04.12.2015)
- In filepicker directive evaluate attributes on init.

Expand Down
9 changes: 8 additions & 1 deletion dist/angular_filepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ window.filepicker.plugin = 'angular_js_lib';'use strict';
angular.module('angular-filepicker')
.directive('filepicker', filepickerDirective);

function filepickerDirective($rootScope, filepickerService, $parse){
function filepickerDirective($rootScope, filepickerService){
return {
restrict: 'A',
scope:{
Expand Down Expand Up @@ -87,6 +87,13 @@ function filepickerPreviewDirective($rootScope, filepickerService){
if (!url) {
return;
} else {
// Support filestack urls that do not contain 'api/file'
if (url.indexOf('api/file/') == -1) {
var parser = document.createElement('a');
parser.href = url;
parser.pathname = '/api/file' + parser.pathname;
url = parser.href;
}
url = url.replace('api/file/', 'api/preview/');
}
iframe.src = url;
Expand Down
7 changes: 7 additions & 0 deletions src/filepicker_preview-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ function filepickerPreviewDirective($rootScope, filepickerService){
if (!url) {
return;
} else {
// Support filestack urls that do not contain 'api/file'
if (url.indexOf('api/file/') == -1) {
var parser = document.createElement('a');
parser.href = url;
parser.pathname = '/api/file' + parser.pathname;
url = parser.href;
}
url = url.replace('api/file/', 'api/preview/');
}
iframe.src = url;
Expand Down