mirror of https://github.com/layui/layui
优化 code 当开启 iframe 模式时对 `codeParse` 的解析支持
parent
5871d8248b
commit
be13118fd1
|
@ -90,6 +90,14 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
|
||||||
|
|
||||||
othis.data('code', codes);
|
othis.data('code', codes);
|
||||||
|
|
||||||
|
// code
|
||||||
|
var html = finalCode = codes.join('');
|
||||||
|
|
||||||
|
// 外部重新解析 code
|
||||||
|
if(typeof options.codeParse === 'function'){
|
||||||
|
html = finalCode = options.codeParse(html);
|
||||||
|
}
|
||||||
|
|
||||||
// 工具栏
|
// 工具栏
|
||||||
var tools = {
|
var tools = {
|
||||||
copy: {
|
copy: {
|
||||||
|
@ -231,7 +239,7 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
|
||||||
var run = function(thisItemBody){
|
var run = function(thisItemBody){
|
||||||
var iframe = thisItemBody.children('iframe')[0];
|
var iframe = thisItemBody.children('iframe')[0];
|
||||||
if(isIframePreview && iframe){
|
if(isIframePreview && iframe){
|
||||||
iframe.srcdoc = codes.join('');
|
iframe.srcdoc = finalCode;
|
||||||
} else {
|
} else {
|
||||||
thisItemBody.html(codes.join(''));
|
thisItemBody.html(codes.join(''));
|
||||||
}
|
}
|
||||||
|
@ -297,13 +305,7 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// code
|
|
||||||
var html = finalCode = codes.join('');
|
|
||||||
|
|
||||||
// 外部重新解析 code
|
|
||||||
if(typeof options.codeParse === 'function'){
|
|
||||||
html = finalCode = options.codeParse(html);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转义 HTML 标签
|
// 转义 HTML 标签
|
||||||
if(options.encode) html = util.escape(html); // 编码
|
if(options.encode) html = util.escape(html); // 编码
|
||||||
|
|
Loading…
Reference in New Issue