@fto-consult/expo-ui 7.4.49 → 7.4.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/electron/index.js +6 -0
- package/electron/preload.js +9 -9
- package/package.json +1 -1
package/electron/index.js
CHANGED
@@ -504,6 +504,12 @@ ipcMain.on("set-main-window-title",(event,title)=>{
|
|
504
504
|
|
505
505
|
|
506
506
|
ipcMain.handle("create-browser-windows",function(event,options){
|
507
|
+
if(typeof options =='string'){
|
508
|
+
try {
|
509
|
+
const t = JSON.parse(options);
|
510
|
+
options = t;
|
511
|
+
} catch{}
|
512
|
+
}
|
507
513
|
options = Object.assign({},options);
|
508
514
|
createBrowserWindow(options);
|
509
515
|
})
|
package/electron/preload.js
CHANGED
@@ -102,7 +102,7 @@ const removeListener = (channel, callback) => {
|
|
102
102
|
const createWindow = (options)=>{
|
103
103
|
options = Object.assign({},options);
|
104
104
|
options.showOnLoad = typeof options.showOnLoad =='boolean'? options.showOnLoad : true;
|
105
|
-
return ipcRenderer.invoke("create-browser-windows",options);
|
105
|
+
return ipcRenderer.invoke("create-browser-windows",JSON.stringify(options));
|
106
106
|
};
|
107
107
|
|
108
108
|
const createPDFFile = (options)=>{
|
@@ -110,7 +110,7 @@ const createPDFFile = (options)=>{
|
|
110
110
|
const dir = getPath("temp");
|
111
111
|
options = Object.assign({},options);
|
112
112
|
let {content,filename,fileName,charset,fileExtension,extension} = options;
|
113
|
-
|
113
|
+
fileName = defaultStr(filename,fileName)
|
114
114
|
if(isDataURL(content)){
|
115
115
|
content = isDataURL.toBase64(content);
|
116
116
|
}
|
@@ -123,19 +123,19 @@ const createPDFFile = (options)=>{
|
|
123
123
|
console.warn('type de contenu invalide!! impression création fichier electron');
|
124
124
|
return null;
|
125
125
|
}
|
126
|
-
|
127
|
-
fileExtension = defaultStr(fileExtension,extension,'pdf');
|
126
|
+
fileName = defaultStr(fileName,uniqid("generated-printed-pdf-file-name"))
|
127
|
+
fileExtension = defaultStr(fileExtension,extension,'pdf').split(".")[0];
|
128
128
|
charset = defaultStr(charset,'utf-8')
|
129
|
-
|
129
|
+
fileName = sanitize(fileName);
|
130
130
|
if(!fileName.endsWith(`.${fileExtension}`)){
|
131
131
|
fileName += "."+fileExtension
|
132
132
|
}
|
133
|
-
return fs.writeFile(path.join(dir,
|
133
|
+
return fs.writeFile(path.join(dir,fileName), content,{charset},(err)=>{
|
134
134
|
if(!err) {
|
135
|
-
const
|
136
|
-
const
|
135
|
+
const p = path.join(dir,fileName);
|
136
|
+
const fileUrl = 'file://'+p.replaceAll("\\","/");
|
137
137
|
const filePathUrl = 'file://'+p;
|
138
|
-
resolve({content,fileName
|
138
|
+
resolve({content,fileName,filename:fileName,path:p,filePathUrl,filePathUri:filePathUrl,fileUrl,filePath:p,fileUri:fileUrl})
|
139
139
|
} else {
|
140
140
|
reject(err);
|
141
141
|
}
|