mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	extract errorSvg
This commit is contained in:
		| @@ -7,6 +7,7 @@ import openService from "./open.js"; | |||||||
| import froca from "./froca.js"; | import froca from "./froca.js"; | ||||||
| import utils from "./utils.js"; | import utils from "./utils.js"; | ||||||
| import linkService from "./link.js"; | import linkService from "./link.js"; | ||||||
|  | import errorSvg from "../widgets/type_widgets/canvas-note-utils/errorSvg"; | ||||||
|  |  | ||||||
| let idCounter = 1; | let idCounter = 1; | ||||||
|  |  | ||||||
| @@ -149,9 +150,9 @@ async function getRenderedContent(note, options = {}) { | |||||||
|         const content = noteComplement.content || ""; |         const content = noteComplement.content || ""; | ||||||
|  |  | ||||||
|         try { |         try { | ||||||
|             const errorSvg = `<svg viewBox="0 0 240 80" style="background-color: white" xmlns="http://www.w3.org/2000/svg"><style>.red { font: 12px serif; fill: red; }</style><text x="20" y="35" class="red">Error: note svg is undefined or empty</text></svg>`; |             const placeHolderSVG = errorSvg; | ||||||
|             const data = JSON.parse(content) |             const data = JSON.parse(content) | ||||||
|             const svg = data.svg || errorSvg; |             const svg = data.svg || placeHolderSVG; | ||||||
|             /** |             /** | ||||||
|              * maxWidth: size down to 100% (full) width of container but do not enlarge! |              * maxWidth: size down to 100% (full) width of container but do not enlarge! | ||||||
|              * height:auto to ensure that height scales with width |              * height:auto to ensure that height scales with width | ||||||
|   | |||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | /** | ||||||
|  |  * used a placeholder, when svg parsing fails | ||||||
|  |  */ | ||||||
|  | const erorrSvg = `<svg viewBox="0 0 240 80" style="background-color: white" xmlns="http://www.w3.org/2000/svg"> | ||||||
|  | <style>.red { font: 12px serif; fill: red; }</style> | ||||||
|  | <text x="20" y="35" class="red"> | ||||||
|  | Error: note svg is undefined or empty | ||||||
|  | </text> | ||||||
|  | </svg>`; | ||||||
|  |  | ||||||
|  | export default erorrSvg; | ||||||
		Reference in New Issue
	
	Block a user