const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const fs = require ('fs')
const joint = require ('jointjs')
const path = require ('path')
const filepath = path.join( __dirname , './template_raccordement.html')
const content = fs.readFileSync(filepath, {encoding:'utf8', flag:'r'});
const myLibrary = fs.readFileSync("../node_modules/jointjs/dist/joint.js", { encoding: "utf-8" });
const { window } = new JSDOM(content, {
contentType: "text/html",
includeNodeLocations: true,
resources: "usable",
storageQuota: 10000000,
runScripts: "dangerously"
});
const $ = require('jquery')(window);
global.window = window
global.document = window.document
global.jQuery = $
global.$ = $
var element = $('#raccordementDiv')
console.log (element.text())
var graph = new joint.dia.Graph;
const paper = new joint.dia.Paper({
el: element,
model: graph,
width: 1600,
height: 800,
gridSize: 1,
interactive: true,
async: true,
frozen: false,
sorting: joint.dia.Paper.sorting.APPROX,
background: { color: '#F3F7F6' },
//cellViewNamespace: shapes
});
console.log (paper)