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

Function submitHandler

static/editor.md/plugins/file-dialog/file-dialog.js:142–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

parseMethod · 0.80
loadingFunction · 0.70

Tested by

no test coverage detected