We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
gw-rich-text-html-fields.php
1 parent 355facd commit e0bc1c6Copy full SHA for e0bc1c6
gravity-forms/gw-rich-text-html-fields.php
@@ -86,8 +86,15 @@
86
} );
87
88
frame.on('select', function() {
89
- var attachment = frame.state().get('selection').first().toJSON();
90
- editor.insertContent('<img src="' + attachment.url + '" alt="' + attachment.alt + '" />');
+ var selection = frame.state().get('selection').first();
+ if (!selection) {
91
+ return;
92
+ }
93
+
94
+ var attachment = selection.toJSON();
95
+ var url = attachment.url.replace(/"/g, '"');
96
+ var alt = (attachment.alt || '').replace(/"/g, '"');
97
+ editor.insertContent('<img src="' + url + '" alt="' + alt + '" />');
98
99
100
frame.open();
0 commit comments