MCPcopy Create free account
hub / github.com/TruthHun/BookStack / submitHandler

Function submitHandler

static/editor.md/plugins/image-dialog/image-dialog.js:149–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147 loading(true);
148
149 var submitHandler = function() {
150
151 var uploadIframe = document.getElementById(iframeName);
152
153 uploadIframe.onload = function() {
154
155 loading(false);
156
157 var body = (uploadIframe.contentWindow ? uploadIframe.contentWindow : uploadIframe.contentDocument).document.body;
158 var json = (body.innerText) ? body.innerText : ( (body.textContent) ? body.textContent : null);
159
160 json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");
161
162 if (json.success === 1)
163 {
164 dialog.find("[data-url]").val(json.url);
165 dialog.find("[data-alt]").val(json.alt);
166 }
167 else
168 {
169 alert(json.message);
170 }
171
172 return false;
173 };
174 };
175
176 dialog.find("[type=\"submit\"]").bind("click", submitHandler).trigger("click");
177 });

Callers

nothing calls this directly

Calls 2

parseMethod · 0.80
loadingFunction · 0.70

Tested by

no test coverage detected