hoeditor-web 3.0.90 → 3.0.91
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/lib/hoeditor.umd.js +6 -7
- package/lib/hoeditor.umd.min.js +3 -3
- package/package.json +1 -1
package/lib/hoeditor.umd.js
CHANGED
|
@@ -99380,14 +99380,14 @@ if(image.colorSpace===color_spaces.INDEXED){var objId=this.internal.newObject();
|
|
|
99380
99380
|
putStream({data:arrayBufferToBinaryString(new Uint8Array(image.palette)),objectId:objId});out("endobj");}};var putResourcesCallback=function putResourcesCallback(){var images=this.internal.collections[namespace+"images"];for(var i in images){putImage.call(this,images[i]);}};var putXObjectsDictCallback=function putXObjectsDictCallback(){var images=this.internal.collections[namespace+"images"],out=this.internal.write,image;for(var i in images){image=images[i];out("/I"+image.index,image.objectId,"0","R");}};var checkCompressValue=function checkCompressValue(value){if(value&&typeof value==="string")value=value.toUpperCase();return value in jsPDFAPI.image_compression?value:image_compression.NONE;};var initialize=function initialize(){if(!this.internal.collections[namespace+"images"]){this.internal.collections[namespace+"images"]={};this.internal.events.subscribe("putResources",putResourcesCallback);this.internal.events.subscribe("putXobjectDict",putXObjectsDictCallback);}};var getImages=function getImages(){var images=this.internal.collections[namespace+"images"];initialize.call(this);return images;};var getImageIndex=function getImageIndex(){return Object.keys(this.internal.collections[namespace+"images"]).length;};var notDefined=function notDefined(value){return typeof value==="undefined"||value===null||value.length===0;};var generateAliasFromImageData=function generateAliasFromImageData(imageData){if(typeof imageData==="string"||isArrayBufferView(imageData)){return sHashCode(imageData);}else if(isArrayBufferView(imageData.data)){return sHashCode(imageData.data);}return null;};var isImageTypeSupported=function isImageTypeSupported(type){return typeof jsPDFAPI["process"+type.toUpperCase()]==="function";};var isDOMElement=function isDOMElement(object){return (0,esm_typeof/* default */.Z)(object)==="object"&&object.nodeType===1;};var getImageDataFromElement=function getImageDataFromElement(element,format){//if element is an image which uses data url definition, just return the dataurl
|
|
99381
99381
|
if(element.nodeName==="IMG"&&element.hasAttribute("src")){var src=""+element.getAttribute("src");//is base64 encoded dataUrl, directly process it
|
|
99382
99382
|
if(src.indexOf("data:image/")===0){return atob(unescape(src).split("base64,").pop());}//it is probably an url, try to load it
|
|
99383
|
-
var tmpImageData=jsPDFAPI.loadFile(src,true);if(tmpImageData!==undefined){return tmpImageData;}}if(element.nodeName==="CANVAS"){if(element.width===0||element.height===0){throw new Error("Given canvas must have data. Canvas width: "+element.width+", height: "+element.height);}var mimeType;switch(format){case"PNG":mimeType="image/png";break;case"WEBP":mimeType="image/webp";break;case"JPEG":case"JPG":default:mimeType="image/jpeg";break;}return atob(element.toDataURL(mimeType,1.0).split("base64,").pop());}};var checkImagesForAlias=function checkImagesForAlias(alias){var images=this.internal.collections[namespace+"images"];if(images){for(var e in images){if(alias===images[e].alias){return images[e];}}}};var determineWidthAndHeight=function determineWidthAndHeight(width,height,image){if(!width&&!height){width=-96;height=-96;}if(width<0){width=-1*image.width*72/width/this.internal.scaleFactor;}if(height<0){height=-1*image.height*72/height/this.internal.scaleFactor;}if(width===0){width=height*image.width/image.height;}if(height===0){height=width*image.height/image.width;}return[width,height];};var writeImageToPDF=function writeImageToPDF(x,y,width,height,image,rotation){var dims=determineWidthAndHeight.call(this,width,height,image),coord=this.internal.getCoordinateString,vcoord=this.internal.getVerticalCoordinateString;var images=getImages.call(this);width=dims[0];height=dims[1];images[image.index]=image;
|
|
99383
|
+
var tmpImageData=jsPDFAPI.loadFile(src,true);if(tmpImageData!==undefined){return tmpImageData;}}if(element.nodeName==="CANVAS"){if(element.width===0||element.height===0){throw new Error("Given canvas must have data. Canvas width: "+element.width+", height: "+element.height);}var mimeType;switch(format){case"PNG":mimeType="image/png";break;case"WEBP":mimeType="image/webp";break;case"JPEG":case"JPG":default:mimeType="image/jpeg";break;}return atob(element.toDataURL(mimeType,1.0).split("base64,").pop());}};var checkImagesForAlias=function checkImagesForAlias(alias){var images=this.internal.collections[namespace+"images"];if(images){for(var e in images){if(alias===images[e].alias){return images[e];}}}};var determineWidthAndHeight=function determineWidthAndHeight(width,height,image){if(!width&&!height){width=-96;height=-96;}if(width<0){width=-1*image.width*72/width/this.internal.scaleFactor;}if(height<0){height=-1*image.height*72/height/this.internal.scaleFactor;}if(width===0){width=height*image.width/image.height;}if(height===0){height=width*image.height/image.width;}return[width,height];};var writeImageToPDF=function writeImageToPDF(x,y,width,height,image,rotation){var dims=determineWidthAndHeight.call(this,width,height,image),coord=this.internal.getCoordinateString,vcoord=this.internal.getVerticalCoordinateString;var images=getImages.call(this);width=dims[0];height=dims[1];images[image.index]=image;if(image.exifdata&&image.exifdata.Orientation){rotation={6:270,8:90,// 5: 180,
|
|
99384
99384
|
// 7: 180,
|
|
99385
99385
|
2:270,4:90// 1: 180,
|
|
99386
99386
|
// 3: 180
|
|
99387
99387
|
}[image.exifdata.Orientation];}if(rotation){rotation*=Math.PI/180;var c=Math.cos(rotation);var s=Math.sin(rotation);//like in pdf Reference do it 4 digits instead of 2
|
|
99388
99388
|
var f4=function f4(number){return number.toFixed(4);};var rotationTransformationMatrix=[f4(c),f4(s),f4(s*-1),f4(c),0,0,"cm"];}this.internal.write("q");//Save graphics state
|
|
99389
99389
|
if(rotation){if(image.exifdata&&image.exifdata.Orientation){if(image.exifdata.Orientation==8||image.exifdata.Orientation==4){x+=height;y-=width-10;}else if(image.exifdata.Orientation==6||image.exifdata.Orientation==2){y-=width-10;}}else{// 自定义修改 修复图片旋转后位置错误问题 水平方向增加自身宽度 减去的 18px 来源未知 垂直方向减去自身高度
|
|
99390
|
-
x+=Number(coord(width))+20;y-=height;}
|
|
99390
|
+
x+=Number(coord(width))+20;y-=height;}this.internal.write([1,"0","0",1,coord(x),vcoord(y+height),"cm"].join(" "));//Translate
|
|
99391
99391
|
this.internal.write(rotationTransformationMatrix.join(" "));//Rotate
|
|
99392
99392
|
this.internal.write([coord(width),"0","0",coord(height),"0","0","cm"].join(" "));//Scale
|
|
99393
99393
|
}else{this.internal.write([coord(width),"0","0",coord(height),coord(x),vcoord(y+height),"cm"].join(" "));//Translate and Scale
|
|
@@ -99954,8 +99954,7 @@ var f2,getHorizontalCoordinateString,getVerticalCoordinateString,getHorizontalCo
|
|
|
99954
99954
|
* A pattern object to use to fill the drawing (not supported by context2d)
|
|
99955
99955
|
*/Object.defineProperty(this,"fillStyle",{get:function get(){return this.ctx.fillStyle;},set:function set(value){var rgba;rgba=getRGBA(value);this.ctx.fillStyle=rgba.style;this.ctx.isFillTransparent=rgba.a===0;//自定义修改 当透明度小于1时改成0 ,以适配不支持透明度的打印机
|
|
99956
99956
|
if(rgba.a<1){this.ctx.fillOpacity=0;}else{this.ctx.fillOpacity=rgba.a;}// 自定义修改 处理彩色字体打印问题
|
|
99957
|
-
var alpha=this.ctx.fillOpacity;
|
|
99958
|
-
this.pdf.setFillColor(rgba.r,rgba.g,rgba.b,{a:alpha});this.pdf.setTextColor(rgba.r,rgba.g,rgba.b,{a:alpha});}}});/**
|
|
99957
|
+
var alpha=this.ctx.fillOpacity;if(window.printBlack&&!['#000','#000000','#fff','#ffffff','#FFF','#FFFFFF'].includes(this.ctx.fillStyle)){if(Array.isArray(this.ctx.path)&&this.ctx.path.length>4){this.ctx.fillStyle="#000000";}this.pdf.setFillColor(255,255,255,{a:alpha});this.pdf.setTextColor(0,0,0,{a:alpha});}else{this.pdf.setFillColor(rgba.r,rgba.g,rgba.b,{a:alpha});this.pdf.setTextColor(rgba.r,rgba.g,rgba.b,{a:alpha});}}});/**
|
|
99959
99958
|
* Sets or returns the color, gradient, or pattern used for strokes
|
|
99960
99959
|
*
|
|
99961
99960
|
* @name strokeStyle
|
|
@@ -100196,7 +100195,7 @@ Context2D.prototype.arcTo=function(x1,y1,x2,y2,radius){throw new Error("arcTo no
|
|
|
100196
100195
|
var scale=this.ctx.transform.scaleX;var acharSpace=this.letterSpacing?parseFloat(this.letterSpacing):0.0;//自定义修改 以处理宋体粗体
|
|
100197
100196
|
if(this.font.indexOf("SimSun")>=0&&this.font.indexOf("bold")>=0){//renderingMode: "stroke",
|
|
100198
100197
|
putText.call(this,{text:text,x:x,y:y,scale:scale,angle:degs,align:this.textAlign,maxWidth:maxWidth,// renderingMode: "fillThenStroke",
|
|
100199
|
-
charSpace:acharSpace
|
|
100198
|
+
charSpace:acharSpace});}else{putText.call(this,{text:text,x:x,y:y,scale:scale,angle:degs,align:this.textAlign,maxWidth:maxWidth,charSpace:acharSpace});}};/**
|
|
100200
100199
|
* Draws text on the canvas (no fill)
|
|
100201
100200
|
*
|
|
100202
100201
|
* @name strokeText
|
|
@@ -100325,7 +100324,7 @@ return y;case"alphabetic":default:return y;}};var getTextBottom=function getText
|
|
|
100325
100324
|
* @param counterclockwise
|
|
100326
100325
|
* @param style
|
|
100327
100326
|
* @param isClip
|
|
100328
|
-
*/var drawArc=function drawArc(x,y,r,a1,a2,counterclockwise,style,isClip){var curves=createArc.call(this,r,a1,a2,counterclockwise);for(var i=0;i<curves.length;i++){var curve=curves[i];if(i===0){doMove.call(this,curve.x1+x,curve.y1+y);}drawCurve.call(this,x,y,curve.x2,curve.y2,curve.x3,curve.y3,curve.x4,curve.y4);}if(!isClip){putStyle.call(this,style);}else{doClip.call(this);}};var putStyle=function putStyle(style){switch(style){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f");break;}};var doClip=function doClip(){this.pdf.clip();this.pdf.discardPath();};var doMove=function doMove(x,y){this.pdf.internal.out(getHorizontalCoordinateString(x)+" "+getVerticalCoordinateString(y)+" m");};var putText=function putText(options){var textAlign;switch(options.align){case"right":case"end":textAlign="right";break;case"center":textAlign="center";break;case"left":case"start":default:textAlign="left";break;}var textDimensions=this.pdf.getTextDimensions(options.text);
|
|
100327
|
+
*/var drawArc=function drawArc(x,y,r,a1,a2,counterclockwise,style,isClip){var curves=createArc.call(this,r,a1,a2,counterclockwise);for(var i=0;i<curves.length;i++){var curve=curves[i];if(i===0){doMove.call(this,curve.x1+x,curve.y1+y);}drawCurve.call(this,x,y,curve.x2,curve.y2,curve.x3,curve.y3,curve.x4,curve.y4);}if(!isClip){putStyle.call(this,style);}else{doClip.call(this);}};var putStyle=function putStyle(style){switch(style){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f");break;}};var doClip=function doClip(){this.pdf.clip();this.pdf.discardPath();};var doMove=function doMove(x,y){this.pdf.internal.out(getHorizontalCoordinateString(x)+" "+getVerticalCoordinateString(y)+" m");};var putText=function putText(options){var textAlign;switch(options.align){case"right":case"end":textAlign="right";break;case"center":textAlign="center";break;case"left":case"start":default:textAlign="left";break;}var textDimensions=this.pdf.getTextDimensions(options.text);var yBaseLine=getBaseline.call(this,options.y);var yBottom=getTextBottom.call(this,yBaseLine);var yTop=yBottom-textDimensions.h;var pt=this.ctx.transform.applyToPoint(new Point(options.x,yBaseLine));var decomposedTransformationMatrix=this.ctx.transform.decompose();var matrix=new Matrix();matrix=matrix.multiply(decomposedTransformationMatrix.translate);matrix=matrix.multiply(decomposedTransformationMatrix.skew);matrix=matrix.multiply(decomposedTransformationMatrix.scale);var baselineRect=this.ctx.transform.applyToRectangle(new Rectangle(options.x,yBaseLine,textDimensions.w,textDimensions.h));var textBounds=matrix.applyToRectangle(new Rectangle(options.x,yTop,textDimensions.w,textDimensions.h));var pageArray=getPagesByPath.call(this,textBounds);var pages=[];for(var ii=0;ii<pageArray.length;ii+=1){if(pages.indexOf(pageArray[ii])===-1){pages.push(pageArray[ii]);}}sortPages(pages);var clipPath,oldSize,oldLineWidth;options.text=options.text.replace(/[\t]/g,' ');// 自定义修改 修复打印不了tab键的问题
|
|
100329
100328
|
if(this.autoPaging){var min=pages[0];var max=pages[pages.length-1];for(var i=min;i<max+1;i++){this.pdf.setPage(i);var topMargin=i===1?this.posY+this.margin[0]:this.margin[0];var firstPageHeight=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2];var pageHeightMinusBottomMargin=this.pdf.internal.pageSize.height-this.margin[2];var pageHeightMinusMargins=pageHeightMinusBottomMargin-this.margin[0];var pageWidthMinusRightMargin=this.pdf.internal.pageSize.width-this.margin[1];var pageWidthMinusMargins=pageWidthMinusRightMargin-this.margin[3];var previousPageHeightSum=i===1?0:firstPageHeight+(i-2)*pageHeightMinusMargins;var acharSpace=options.charSpace?parseFloat(options.charSpace):0.0;//自定义修改
|
|
100330
100329
|
if(this.ctx.clip_path.length!==0){var tmpPaths=this.path;clipPath=JSON.parse(JSON.stringify(this.ctx.clip_path));this.path=pathPositionRedo(clipPath,this.posX+this.margin[3],-1*previousPageHeightSum+topMargin);drawPaths.call(this,"fill",true);this.path=tmpPaths;}var textBoundsOnPage=pathPositionRedo([JSON.parse(JSON.stringify(textBounds))],this.posX+this.margin[3],-previousPageHeightSum+topMargin+this.ctx.prevPageLastElemOffset)[0];if(options.scale>=0.01){oldSize=this.pdf.internal.getFontSize();this.pdf.setFontSize(oldSize*options.scale);oldLineWidth=this.lineWidth;this.lineWidth=oldLineWidth*options.scale;}var doSlice=this.autoPaging!=="text";if(doSlice||textBoundsOnPage.y+textBoundsOnPage.h<=pageHeightMinusBottomMargin){if(doSlice||textBoundsOnPage.y>=topMargin&&textBoundsOnPage.x<=pageWidthMinusRightMargin){var croppedText=doSlice?options.text:this.pdf.splitTextToSize(options.text,options.maxWidth||pageWidthMinusRightMargin-textBoundsOnPage.x)[0];var baseLineRectOnPage=pathPositionRedo([JSON.parse(JSON.stringify(baselineRect))],this.posX+this.margin[3],-previousPageHeightSum+topMargin+this.ctx.prevPageLastElemOffset)[0];var needsClipping=doSlice&&(i>min||i<max)&&hasMargins.call(this);if(needsClipping){this.pdf.saveGraphicsState();this.pdf.rect(this.margin[3],this.margin[0],pageWidthMinusMargins,pageHeightMinusMargins,null).clip().discardPath();}this.pdf.text(croppedText,baseLineRectOnPage.x,baseLineRectOnPage.y,{angle:options.angle,align:textAlign,renderingMode:options.renderingMode,charSpace:acharSpace// 自定义修改
|
|
100331
100330
|
});if(needsClipping){this.pdf.restoreGraphicsState();}}}else{// This text is the last element of the page, but it got cut off due to the margin
|
|
@@ -239153,7 +239152,7 @@ var ParagraphNode = __webpack_require__(67945);
|
|
|
239153
239152
|
// EXTERNAL MODULE: ./src/editor/dom/treeNode/MarkNode.ts
|
|
239154
239153
|
var MarkNode = __webpack_require__(57727);
|
|
239155
239154
|
;// CONCATENATED MODULE: ./src/components/version.ts
|
|
239156
|
-
/* harmony default export */ var version = ('3.0.
|
|
239155
|
+
/* harmony default export */ var version = ('3.0.91');
|
|
239157
239156
|
// EXTERNAL MODULE: ./src/components/controls/poperTipText/PoperTipText.vue + 5 modules
|
|
239158
239157
|
var PoperTipText = __webpack_require__(36081);
|
|
239159
239158
|
;// CONCATENATED MODULE: ./src/components/controls/poperTipText/index.ts
|