Commit 60ddc009 authored by 张博's avatar 张博

feat(release): update to fix svg and png export bug

parent 5dc7f91c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "kityminder-core", "name": "kityminder-core",
"title": "Kity Minder Core", "title": "Kity Minder Core",
"description": "Powerful online mind graphic visualization and editor (command based)", "description": "Powerful online mind graphic visualization and editor (command based)",
"version": "1.4.34", "version": "1.4.35",
"main": [ "main": [
"dist/kityminder.core.min.js", "dist/kityminder.core.min.js",
"dist/kityminder.core.css" "dist/kityminder.core.css"
......
/*! /*!
* ==================================================== * ====================================================
* kityminder - v1.4.34 - 2016-09-06 * kityminder - v1.4.35 - 2017-02-03
* https://github.com/fex-team/kityminder-core * https://github.com/fex-team/kityminder-core
* GitHub: https://github.com/fex-team/kityminder-core.git * GitHub: https://github.com/fex-team/kityminder-core.git
* Copyright (c) 2016 Baidu FEX; Licensed MIT * Copyright (c) 2017 Baidu FEX; Licensed MIT
* ==================================================== * ====================================================
*/ */
...@@ -8037,8 +8037,7 @@ _p[65] = { ...@@ -8037,8 +8037,7 @@ _p[65] = {
image.onerror = function(err) { image.onerror = function(err) {
reject(err); reject(err);
}; };
//image.setAttribute('crossOrigin', 'anonymous'); image.crossOrigin = "anonymous";
image.crossOrigin = "";
image.src = info.url; image.src = info.url;
}); });
} }
...@@ -8115,10 +8114,10 @@ _p[65] = { ...@@ -8115,10 +8114,10 @@ _p[65] = {
var bgColor = kity.Color.parse(bgDeclare); var bgColor = kity.Color.parse(bgDeclare);
/* 获取 SVG 文件内容 */ /* 获取 SVG 文件内容 */
var svgInfo = getSVGInfo(minder); var svgInfo = getSVGInfo(minder);
var width = option.width && option.width > svgInfo.width ? option.width : svgInfo.width; var width = option && option.width && option.width > svgInfo.width ? option.width : svgInfo.width;
var height = option.height && option.height > svgInfo.height ? option.height : svgInfo.height; var height = option && option.height && option.height > svgInfo.height ? option.height : svgInfo.height;
var offsetX = option.width && option.width > svgInfo.width ? (option.width - svgInfo.width) / 2 : 0; var offsetX = option && option.width && option.width > svgInfo.width ? (option.width - svgInfo.width) / 2 : 0;
var offsetY = option.height && option.height > svgInfo.height ? (option.height - svgInfo.height) / 2 : 0; var offsetY = option && option.height && option.height > svgInfo.height ? (option.height - svgInfo.height) / 2 : 0;
var svgDataUrl = svgInfo.dataUrl; var svgDataUrl = svgInfo.dataUrl;
var imagesInfo = svgInfo.imagesInfo; var imagesInfo = svgInfo.imagesInfo;
/* 画布的填充大小 */ /* 画布的填充大小 */
...@@ -8428,9 +8427,9 @@ _p[66] = { ...@@ -8428,9 +8427,9 @@ _p[66] = {
} }
} }
} }
svgDom.style.display = "none"; svgDom.style.visibility = "hidden";
replaceWithNode(svgDom, x || 0, y || 0); replaceWithNode(svgDom, x || 0, y || 0);
svgDom.style.display = "inline"; svgDom.style.visibility = "visible";
} }
data.registerProtocol("svg", module.exports = { data.registerProtocol("svg", module.exports = {
fileDescription: "SVG 矢量图", fileDescription: "SVG 矢量图",
...@@ -8443,6 +8442,7 @@ _p[66] = { ...@@ -8443,6 +8442,7 @@ _p[66] = {
svgXml = paper.container.innerHTML; svgXml = paper.container.innerHTML;
paper.shapeNode.setAttribute("transform", paperTransform); paper.shapeNode.setAttribute("transform", paperTransform);
svgContainer = document.createElement("div"); svgContainer = document.createElement("div");
document.body.appendChild(svgContainer);
svgContainer.innerHTML = svgXml; svgContainer.innerHTML = svgXml;
svgDom = svgContainer.querySelector("svg"); svgDom = svgContainer.querySelector("svg");
svgDom.setAttribute("width", width + padding * 2 | 0); svgDom.setAttribute("width", width + padding * 2 | 0);
...@@ -8450,11 +8450,12 @@ _p[66] = { ...@@ -8450,11 +8450,12 @@ _p[66] = {
svgDom.setAttribute("style", "background: " + minder.getStyle("background")); svgDom.setAttribute("style", "background: " + minder.getStyle("background"));
//"font-family: Arial, Microsoft Yahei, Heiti SC; " + //"font-family: Arial, Microsoft Yahei, Heiti SC; " +
svgDom.setAttribute("viewBox", [ 0, 0, width + padding * 2 | 0, height + padding * 2 | 0 ].join(" ")); svgDom.setAttribute("viewBox", [ 0, 0, width + padding * 2 | 0, height + padding * 2 | 0 ].join(" "));
svgContainer = document.createElement("div"); tempSvgContainer = document.createElement("div");
cleanSVG(svgDom, renderBox.x - padding | 0, renderBox.y - padding | 0); cleanSVG(svgDom, renderBox.x - padding | 0, renderBox.y - padding | 0);
svgContainer.appendChild(svgDom); document.body.removeChild(svgContainer);
tempSvgContainer.appendChild(svgDom);
// need a xml with width and height // need a xml with width and height
svgXml = svgContainer.innerHTML; svgXml = tempSvgContainer.innerHTML;
// svg 含有   符号导出报错 Entity 'nbsp' not defined // svg 含有   符号导出报错 Entity 'nbsp' not defined
svgXml = svgXml.replace(/ /g, " "); svgXml = svgXml.replace(/ /g, " ");
// svg 含有   符号导出报错 Entity 'nbsp' not defined // svg 含有   符号导出报错 Entity 'nbsp' not defined
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "kityminder", "name": "kityminder",
"title": "kityminder", "title": "kityminder",
"description": "KityMinder Core Implement", "description": "KityMinder Core Implement",
"version": "1.4.34", "version": "1.4.35",
"homepage": "https://github.com/fex-team/kityminder-core", "homepage": "https://github.com/fex-team/kityminder-core",
"author": { "author": {
"name": "Baidu FEX", "name": "Baidu FEX",
......
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