Skip to content

Commit a68f270

Browse files
committed
fix: Error on new map placement
Need to handle the case that there is no src.
1 parent c6198b4 commit a68f270

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@brandextract/tinymce-plugin-map",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "A TinyMCE plugin to insert a map",
55
"main": "plugin.js",
66
"scripts": {

plugin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,13 @@
243243
if (src.indexOf("//") === 0) {
244244
src = "https:" + src;
245245
}
246-
const srcURL = new URL(src);
247-
const searchParams = new URLSearchParams(srcURL.search);
246+
if (src.indexOf("http") === 0) {
247+
const srcURL = new URL(src);
248+
const searchParams = new URLSearchParams(srcURL.search);
248249

249-
for (const [key, value] of searchParams) {
250-
params[key] = value;
250+
for (const [key, value] of searchParams) {
251+
params[key] = value;
252+
}
251253
}
252254

253255
if (params.retina === "true") {

plugin.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)