X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/34c9285ef29074d0c13cea81fbb05e93eb369b4a..f90725bd2dd63943756915116b9a5f743ab94616:/src/editor/modules/data/document.js diff --git a/src/editor/modules/data/document.js b/src/editor/modules/data/document.js index db2b7a8..23aa000 100644 --- a/src/editor/modules/data/document.js +++ b/src/editor/modules/data/document.js @@ -45,6 +45,14 @@ _.extend(Document.prototype, { link = cfg.documentAttachmentUrl(link.substr(7)); } return link; + }, + getLinkForUrl: function(url) { + /* globals window */ + var baseUrl = function(url) {return url.split('/').slice(0,-1).join('/');}; + if(baseUrl(url) === baseUrl(window.location.origin + this.getUrlForLink('file://test'))) { + return 'file://' + _.last(url.split('/')); + } + return url; } });