|
|
@ -29,16 +29,18 @@ define(['require', 'underscore', 'jquery', 'text!partials/pdfcanvas_sandbox.html |
|
|
|
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { |
|
|
|
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { |
|
|
|
|
|
|
|
|
|
|
|
var container = $($element); |
|
|
|
var container = $($element); |
|
|
|
|
|
|
|
|
|
|
|
var pdfCanvas; |
|
|
|
var pdfCanvas; |
|
|
|
|
|
|
|
|
|
|
|
var template = sandboxTemplate; |
|
|
|
var template = sandboxTemplate; |
|
|
|
template = template.replace(/__PARENT_ORIGIN__/g, $window.location.protocol + "//" + $window.location.host); |
|
|
|
template = template.replace(/__PARENT_ORIGIN__/g, $window.location.protocol + "//" + $window.location.host); |
|
|
|
template = template.replace(/__PDFJS_SANDBOX_JS_URL__/g, restURL.createAbsoluteUrl(require.toUrl('sandboxes/pdf') + ".js")); |
|
|
|
template = template.replace(/__PDFJS_SANDBOX_JS_URL__/g, restURL.createAbsoluteUrl(require.toUrl('sandboxes/pdf') + ".js")); |
|
|
|
template = template.replace(/__PDFJS_URL__/g, restURL.createAbsoluteUrl(require.toUrl('pdf') + ".js")); |
|
|
|
template = template.replace(/__PDFJS_URL__/g, restURL.createAbsoluteUrl(require.toUrl('pdf') + ".js")); |
|
|
|
template = template.replace(/__PDFJS_WORKER_URL__/g, restURL.createAbsoluteUrl(require.toUrl('pdf.worker') + ".js")); |
|
|
|
template = template.replace(/__PDFJS_WORKER_URL__/g, restURL.createAbsoluteUrl(require.toUrl('pdf.worker') + ".js")); |
|
|
|
template = template.replace(/__PDFJS_COMPATIBILITY_URL__/g, restURL.createAbsoluteUrl(require.toUrl('libs/pdf/compatibility') + ".js")); |
|
|
|
template = template.replace(/__PDFJS_COMPATIBILITY_URL__/g, restURL.createAbsoluteUrl(require.toUrl('libs/pdf/compatibility') + ".js")); |
|
|
|
var sandboxApi = sandbox.createSandbox($("iframe", container)[0], template); |
|
|
|
var sandboxApi = sandbox.createSandbox(container, template, "allow-scripts", null, { |
|
|
|
|
|
|
|
allowfullscreen: true, |
|
|
|
|
|
|
|
mozallowfullscreen: true, |
|
|
|
|
|
|
|
webkitallowfullscreen: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
sandboxApi.e.on("message", function(event, message) { |
|
|
|
sandboxApi.e.on("message", function(event, message) { |
|
|
|
var msg = message.data; |
|
|
|
var msg = message.data; |
|
|
@ -289,7 +291,7 @@ define(['require', 'underscore', 'jquery', 'text!partials/pdfcanvas_sandbox.html |
|
|
|
return { |
|
|
|
return { |
|
|
|
restrict: 'E', |
|
|
|
restrict: 'E', |
|
|
|
replace: true, |
|
|
|
replace: true, |
|
|
|
template: '<div class="canvasContainer"><iframe allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" sandbox="allow-scripts"></iframe></div>', |
|
|
|
template: '<div class="canvasContainer"></div>', |
|
|
|
controller: controller |
|
|
|
controller: controller |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|