Commit 908385e7 by Edgar HIPP

Remove all unnecessary references to DocUtils.env

docxtemplater shouldn't have any references to browser or node specific
functionality, so that it can be used from both without some magic
tricks
parent a359fcc8
DocXTemplater=require('docxtemplater')
DocUtils=DocXTemplater.DocUtils
vm=require('vm')
JSZip=require('jszip')
......@@ -11,8 +10,6 @@ module.exports= class DocxQrCode
@callbacked=false
@data=imageData
if @data==undefined then throw new Error("data of qrcode can't be undefined")
if DocUtils.env=='browser'
@base64Data=JSZip.base64.encode(@data)
@ready=false
@result=null
decode:(@callback) ->
......@@ -27,9 +24,6 @@ module.exports= class DocxQrCode
testdoc.render()
_this.result=testdoc.content
_this.searchImage()
if DocUtils.env=='browser'
@qr.decode("data:image/png;base64,#{@base64Data}")
else
@qr.decode(@data,@data.decoded)
searchImage:() ->
cb=(err,@data=@data.data)=>
......
......@@ -52,10 +52,6 @@ module.exports= class ImgReplacer
if imageTag==undefined then throw new Error('imageTag undefined')
replacement= DocUtils.xml2Str imageTag
@xmlTemplater.content= @xmlTemplater.content.replace(match[0], replacement)
if DocUtils.env=='browser'
@qr[u]= new DocxQrCode(oldFile.asBinary(),@xmlTemplater,imgName,num,@getDataFromString)
@qr[u].decode(@imageSetter)
else
mockedQrCode={xmlTemplater:@xmlTemplater,imgName:imgName,data:oldFile.asBinary(),num:num}
if /\.png$/.test(oldFile.name)
do (imgName) =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment