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

Function insertImg

static/wangEditor/js/wangEditor.js:6631–6645  ·  view source on GitHub ↗
(src, event)

Source from the content-addressed store, hash-verified

6629
6630 // -------- 插入图片的方法 --------
6631 function insertImg(src, event) {
6632 var img = document.createElement('img');
6633 img.onload = function () {
6634 var html = '<img src="' + src + '" style="max-width:100%;"/>';
6635 editor.command(event, 'insertHtml', html);
6636
6637 E.log('已插入图片,地址 ' + src);
6638 img = null;
6639 };
6640 img.onerror = function () {
6641 E.error('使用返回的结果获取图片,发生错误。请确认以下结果是否正确:' + src);
6642 img = null;
6643 };
6644 img.src = src;
6645 }
6646
6647 // -------- onprogress 事件 --------
6648 function updateProgress(e) {

Callers 1

wangEditor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected