Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import 'ng2-charts';
import 'chart.js';
require('script-loader!raphael/raphael.min.js');
require('script-loader!moment/min/moment.min.js');
import 'md-date-time-picker/dist/css/mdDateTimePicker.css';
require('script-loader!md-date-time-picker/dist/js/mdDateTimePicker.min.js');
require('script-loader!md-date-time-picker/dist/js/draggabilly.pkgd.min.js');
require('pdfjs-dist/web/compatibility.js');
// Setting worker path to worker bundle.
let pdfjsLib = require('pdfjs-dist');
if (process.env.ENV === 'production') {
pdfjsLib.PDFJS.workerSrc = './pdf.worker.js';
} else {
pdfjsLib.PDFJS.workerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.js';
}
require('pdfjs-dist/web/pdf_viewer.js');
require('three/build/three.min.js');
// 3D viewer
import 'three';
import 'ng2-3d-editor';
import { isContainedView, isSlide } from "../../../../common/utils";
import { randomPositionGenerator } from "../../clipboard/clipboard.utils";
import { ID_PREFIX_BOX, ID_PREFIX_PAGE, ID_PREFIX_SORTABLE_CONTAINER, PAGE_TYPES } from '../../../../common/constants';
import Ediphy from "../../../../core/editor/main";
// styles
import './_ImportFile.scss';
import { createBox } from '../../../../common/common_tools';
// PDF Library conf.
const pdflib = require('pdfjs-dist');
const pdfjsWorker = require('pdfjs-dist/build/pdf.worker.js');
const pdfjsWorkerBlob = new Blob([pdfjsWorker]);
const pdfjsWorkerBlobURL = URL.createObjectURL(pdfjsWorkerBlob);
pdflib.PDFJS.workerSrc = pdfjsWorkerBlobURL;
/**
* Generic import file modal
*/
export default class ImportFileModal extends Component {
constructor(props) {
super(props);
this.state = {
FileURL: '',
FileLoaded: false,
FileName: '',
FilePages: 0,
FileType: '',
ImportAs: '',
PagesFrom: 1,
PagesTo: 1,
// Google Material Design Lite
import 'material-design-lite/material.js';
import 'material-design-icons/iconfont/material-icons.css';
import '@angular/material/prebuilt-themes/indigo-pink.css';
// Polyfill(s) for dialogs
require('script-loader!dialog-polyfill/dialog-polyfill');
import 'dialog-polyfill/dialog-polyfill.css';
require('pdfjs-dist/web/compatibility.js');
// Setting worker path to worker bundle.
let pdfjsLib = require('pdfjs-dist');
if (process.env.ENV === 'production') {
pdfjsLib.PDFJS.workerSrc = './pdf.worker.js';
} else {
pdfjsLib.PDFJS.workerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.js';
}
require('pdfjs-dist/web/pdf_viewer.js');
'use strict';
// HACK few hacks to let PDF.js be loaded not as a module in global space.
const domFacade = require('./pdfjs-utils/domfacade');
const fs = require('fs');
const PDFJSLib = require('pdfjs-dist');
const MetaDataHandler = require('./MetaDataHandler');
const CanvasRenderer = require('./renderer/CanvasRenderer');
const JsonRenderer = require('./renderer/JsonRenderer');
const SvgRenderer = require('./renderer/SvgRenderer');
const packageJson = require('../package.json');
PDFJSLib.PDFJS.disableFontFace = true;
class PdfExtractor
{
constructor(outputDir, options) {
options = options || {};
this.pageRange = options.pageRange || [1, Infinity];
fs.accessSync(outputDir, fs.R_OK | fs.W_OK);
let viewportScale = options.viewportScale || 1.5;
this.renderers = Array.isArray(options.renderers) ? options.renderers : [
new CanvasRenderer(outputDir, viewportScale, options),
new SvgRenderer(outputDir, viewportScale, options)
];
pdflib.PDFJS.workerSrc = pdfjsWorkerBlobURL;
import { setOptions, Document, Page } from 'react-pdf';
import {
ButtonsContainer,
DroppableRichZone,
FullScreen,
PageNumber,
PDFButton,
PDFContainer, PDFDocument, PDFPage,
RotateL,
RotateR,
ScaleButton,
TopBar,
} from "../Styles";
setOptions({
workerSrc: pdflib.PDFJS.workerSrc,
});
/* eslint-disable react/prop-types */
export default class EnrichedPDFPlugin extends React.Component {
constructor(props) {
super(props);
this.state = {
fullscreen: false,
numPages: null,
scale: 1,
pageNumber: 1,
rotate: 0,
};
this.onDocumentLoad = ({ numPages }) => {
let pageNumber = 1;
if (this.props.state.currentState) {
import React from 'react';
import i18n from 'i18next';
import EnrichedPDFPluginEditor from './components/EnrichedPDFPluginEditor.js';
const pdflib = require('pdfjs-dist');
const pdfjsWorker = require('pdfjs-dist/build/pdf.worker.js');
const pdfjsWorkerBlob = new Blob([pdfjsWorker]);
const pdfjsWorkerBlobURL = URL.createObjectURL(pdfjsWorkerBlob);
pdflib.PDFJS.workerSrc = pdfjsWorkerBlobURL;
import { setOptions, Document, Page } from 'react-pdf';
setOptions({
workerSrc: pdflib.PDFJS.workerSrc,
});
import './EnrichedPDF.scss';
export function EnrichedPDF(base) {
return {
getConfig: function() {
return {
name: 'EnrichedPDF',
flavor: "react",
displayName: i18n.t('EnrichedPDF.PluginName'),
category: "objects",
aspectRatioButtonConfig: {
location: ["main", "structure"],
defaultValue: false,
},
isRich: true,
initialWidth: 'auto',
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import 'hammerjs';
import * as pdfjsLib from 'pdfjs-dist';
pdfjsLib.PDFJS.workerSrc = 'pdf.worker.js';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
import React from 'react';
import { findDOMNode } from 'react-dom';
import screenfull from 'screenfull';
import Mark from '../../../common/components/mark/Mark';
const pdflib = require('pdfjs-dist');
const pdfjsWorker = require('pdfjs-dist/build/pdf.worker.js');
const pdfjsWorkerBlob = new Blob([pdfjsWorker]);
const pdfjsWorkerBlobURL = URL.createObjectURL(pdfjsWorkerBlob);
pdflib.PDFJS.workerSrc = pdfjsWorkerBlobURL;
import { setOptions, Document, Page } from 'react-pdf';
setOptions({
workerSrc: pdflib.PDFJS.workerSrc,
});
export default class EnrichedPDFPlugin extends React.Component {
constructor(props) {
super(props);
this.state = {
fullscreen: false,
numPages: null,
scale: 1,
pageNumber: 1,
rotate: 0,
};
this.onDocumentLoad = ({ numPages }) => {
import React from 'react';
import EnrichedPDFPlugin from '../components/EnrichedPDFPlugin.js';
const pdflib = require('pdfjs-dist');
const pdfjsWorker = require('pdfjs-dist/build/pdf.worker.js');
const pdfjsWorkerBlob = new Blob([pdfjsWorker]);
const pdfjsWorkerBlobURL = URL.createObjectURL(pdfjsWorkerBlob);
pdflib.PDFJS.workerSrc = pdfjsWorkerBlobURL;
import { setOptions } from 'react-pdf';
setOptions({
workerSrc: pdflib.PDFJS.workerSrc,
});
import { PDFViewerPlugin } from "../Styles";
export function EnrichedPDF(base) {
return {
getRenderTemplate: function(state, props) {
return (
);
},
};
}
import React from 'react';
import { findDOMNode } from 'react-dom';
import screenfull from 'screenfull';
import Mark from '../../../common/components/mark/Mark';
const pdflib = require('pdfjs-dist');
const pdfjsWorker = require('pdfjs-dist/build/pdf.worker.js');
const pdfjsWorkerBlob = new Blob([pdfjsWorker]);
const pdfjsWorkerBlobURL = URL.createObjectURL(pdfjsWorkerBlob);
pdflib.PDFJS.workerSrc = pdfjsWorkerBlobURL;
import { setOptions, Document, Page } from 'react-pdf';
setOptions({
workerSrc: pdflib.PDFJS.workerSrc,
});
export default class EnrichedPDFPlugin extends React.Component {
constructor(props) {
super(props);
this.state = {
fullscreen: false,
numPages: null,
scale: 1,
pageNumber: 1,
rotate: 0,
};
this.onDocumentLoad = ({ numPages }) => {
let pageNumber = 1;
if (this.props.state.currentState) {
try{