(url)
| 1918 | }; |
| 1919 | |
| 1920 | async function loadSvgAsset(url) { |
| 1921 | let svgText = ""; |
| 1922 | try { |
| 1923 | const response = await fetch(url); |
| 1924 | svgText = await response.text(); |
| 1925 | } catch (err) { |
| 1926 | return; |
| 1927 | } |
| 1928 | |
| 1929 | if (svgEditAvailable) { |
| 1930 | if (!svgEditPath) { |
| 1931 | return; |
| 1932 | } |
| 1933 | if (!svgReady) { |
| 1934 | pendingSvgText = svgText; |
| 1935 | return; |
| 1936 | } |
| 1937 | |
| 1938 | const loaded = tryLoadSvg(svgText); |
| 1939 | if (!loaded) { |
| 1940 | iframe.src = `${svgEditPath}?url=${encodeURIComponent(url)}`; |
| 1941 | } |
| 1942 | } else { |
| 1943 | fallbackObject.data = url; |
| 1944 | } |
| 1945 | } |
| 1946 | |
| 1947 | function tryLoadSvg(svgText) { |
| 1948 | if (!iframe.contentWindow) { |
no test coverage detected