gpt4 book ai didi

javascript - TinyMce imagemanager 与 iframe 一起使用时不会生成图像路径

转载 作者:行者123 更新时间:2023-11-28 02:54:45 25 4
gpt4 key购买 nike

我已成功设置tinymce 以在iframe 内的页面上工作。一切都很完美。

但是,当您使用 imagemanager 在编辑器中选择要插入或替换的图像时,它不会将图像的路径(和文件名)复制到“插入/编辑图像”框中输入的“图像 URL” 。该框将保持为空或保留上一个图像的地址。

其行为与文件管理器插件相同。

tinyMCE.init(    
{
mode : "none",
editor_selector : "mceEditor",
theme : "advanced",
plugins : "filemanager,imagemanager,autoresize,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,spellchecker",
theme_advanced_buttons1 : "insertfile,insertimage,advimage,imagemanager,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,nonbreaking,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist",
theme_advanced_buttons2 : "blockquote,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,|,forecolor,backcolor,|,charmap,iespell,media,advhr",
theme_advanced_layout_manager : "SimpleLayout",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,strikethrough",
theme_advanced_buttons4 : "styleselect,formatselect,fontselect,fontsizeselect,|,undo,redo,|,spellchecker",
theme_advanced_toolbar_location : "external",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
relative_urls : true,
document_base_url : "http://xxxxxxxxxxx.com/",
auto_resize : true,
content_css : "/custom/css/style.css",
extended_valid_elements : "iframe[height|width|src|frameborder|scrolling]",
});

/*
The following code comes from- http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12966
Without it the editor only loads 10% of the time. With it, it's pretty much 100% consistent.
The other changes mentioned in the post have also been implemented.
*/
var setupTiny = function()
{
var ifrObj = document.getElementById('pageEditIFrame');
var win = ifrObj;
if (win.contentWindow)
{
win = win.contentWindow;
}

var d;
if(ifrObj.contentDocument)
{
d = ifrObj.contentDocument;
}
else if (ifrObj.contentWindow)
{
d = ifrObj.contentWindow.document;
}
else if (ifrObj.document)
{
d = ifrObj.document;
}

textAreas.each(function(txtEl)
{
tinyMCE.execCommand('mceAddFrameControl', false,
{
element_id : txtEl,
window : win,
doc : d
});
});
};

//Waiting 1 second seems to make the editor load more reliably.
setTimeout("setupTiny();",1000);

最佳答案

我遇到了类似的问题,该问题仅出现在较新版本的 Firefox 中 - Chrome 和 IE 对我来说工作正常。不确定这是否是完全相同的问题(我没有使用 iframe),但它以相同的方式呈现。

这是我找到解决方案的地方: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=23302

正如你所读到的,TinyMCE 的一位编码员认为这是 FF 中的一个错误,尽管修复看起来更像是tiny_mce,假设 Firefox 中仍然存在一个错误,该错误已在 3.5 中的某个时刻得到修复。这是对我有用的解决方案(引自帖子):

1)转到tiny_mce.js

2)找到这一行: this.isGecko = ua.indexOf('Gecko') != -1;

在其下添加:

this.isGecko369 = (this.isGecko && ua.indexOf('irefox/3.6.')!= -1 && parseInt(ua.substr(ua.indexOf('irefox/3.6.')+11,2)) >= 9);
this.isGecko369 = (this.isGecko369 || (this.isGecko && ua.indexOf('irefox/3.5.')!= -1 && parseInt(ua.substr(ua.indexOf('irefox/3.5.')+11,2)) >= 9 ) );

3)找到这一行:fixGeckoBaseHREFBug : function(m, e, h) {

下面有这一行:if (tinyMCE.isGecko) {更改为: if (tinyMCE.isGecko && !tinyMCE.isGecko369) {

关于javascript - TinyMce imagemanager 与 iframe 一起使用时不会生成图像路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2967602/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com