Javascript TinyMCE:j未定义
这个代码怎么了?插入图像后,我得到“J是未定义的消息”。我想这是在我试图关闭自己的时候发生的Javascript TinyMCE:j未定义,javascript,tinymce,Javascript,Tinymce,这个代码怎么了?插入图像后,我得到“J是未定义的消息”。我想这是在我试图关闭自己的时候发生的 var ImageDialog = { init : function() { var f = document.forms[0], ed = tinyMCEPopup.editor; e = ed.selection.getNode(); if (e.nodeName == 'IMG') { f.
var ImageDialog =
{
init : function()
{
var f = document.forms[0], ed = tinyMCEPopup.editor;
e = ed.selection.getNode();
if (e.nodeName == 'IMG')
{
f.src.value = ed.dom.getAttrib(e, 'src');
}
},
update : function()
{
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;
tinyMCEPopup.restoreSelection();
if (f.src.value === '')
{
if (ed.selection.getNode().nodeName == 'IMG')
{
ed.dom.remove(ed.selection.getNode());
ed.execCommand('mceRepaint');
}
tinyMCEPopup.close();
return;
}
tinymce.extend(args,
{
src : f.src.value
});
el = ed.selection.getNode();
if (el && el.nodeName == 'IMG')
{
ed.dom.setAttribs(el, args);
tinyMCEPopup.editor.execCommand('mceRepaint');
tinyMCEPopup.editor.focus();
}
else
{
ed.execCommand('mceInsertContent', false, '<img src="'+args['src']+'" id="_mce_temp_rob" alt="" />', {skip_undo : 1});
ed.undoManager.add();
ed.focus();
ed.selection.select(ed.dom.select('#_mce_temp_rob')[0]);
ed.selection.collapse(0);
ed.dom.setAttrib('_mce_temp_rob', 'id', '');
tinyMCEPopup.storeSelection();
}
tinyMCEPopup.close();
},
getImageData : function()
{
var f = document.forms[0];
this.preloadImg = new Image();
this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);
}
};
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
var-ImageDialog=
{
init:function()
{
var f=document.forms[0],ed=tinymcepoup.editor;
e=ed.selection.getNode();
如果(e.nodeName=='IMG')
{
f、 src.value=ed.dom.getAttrib(e,'src');
}
},
更新:函数()
{
var f=document.forms[0],nl=f.elements,ed=tinyMCEPopup.editor,args={},el;
tinyMCEPopup.restoreSelection();
如果(f.src.value=='')
{
if(ed.selection.getNode().nodeName=='IMG')
{
remove(ed.selection.getNode());
ed.execCommand('mceRepaint');
}
tinyMCEPopup.close();
返回;
}
tinymce.extend(args,
{
src:f.src.value
});
el=ed.selection.getNode();
if(el&&el.nodeName=='IMG')
{
ed.dom.setAttribs(el,args);
tinymcepoup.editor.execCommand('mceRepaint');
tinymcepoup.editor.focus();
}
其他的
{
execCommand('mceInsertContent',false',,{skip_undo:1});
ed.undoManager.add();
ed.focus();
ed.selection.select(ed.dom.select('#mce_temp_rob')[0]);
ed.selection.collapse(0);
ed.dom.setAttrib(“'u mce\u temp\u rob”,“id',”);
tinyMCEPopup.storeSelection();
}
tinyMCEPopup.close();
},
getImageData:函数()
{
var f=文件.表格[0];
this.preloimg=新图像();
this.preloimg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);
}
};
tinymcepoup.onInit.add(ImageDialog.init,ImageDialog);
这是一个小错误。在内部,tinymce代码使用
来记住粘贴时插入符号的位置。在验证生成的片段时,粘贴后,跨度被视为无效并被删除,因此通过删除标记来破坏代码。
这个问题将在下一个官方tinymce次要版本中修复。这类问题有一些解决办法。一种是将id
和mce数据类型
属性添加到span
。例如:
// The valid_elements option defines which elements will remain in the edited text when the editor saves.
valid_elements: "@[id|class|title|style]," +
"a[name|href|target|title]," +
"#p,-ol,-ul,-li,br,img[src],-sub,-sup,-b,-i,-u" +
"-span[data-mce-type]",
我假设您使用的是TinyMCE的压缩版本。你能尝试使用未压缩的版本并用新的错误更新问题吗?谢谢。你说得对。我也找到了。。这是一只小虫子。