简体   繁体   English

所见即所得Tiny MCE,添加自定义链接时出现问题

[英]Wysiwyg Tiny MCE, problem adding custom links

I am trying to see witch one i like best, Tiny MCE or CKEditor. 我试图看到我最喜欢的女巫Tiny MCE或CKEditor。 The problem that i am getting is that i need to add a custom toolbar button (or extend the anchor button). 我得到的问题是我需要添加一个自定义工具栏按钮(或扩展锚按钮)。 Trying now to modify the advlink plugin to insert internal links from the CMS. 现在尝试修改advlink插件以插入CMS中的内部链接。 So i modified the page link.htm and added one button next to the href field. 所以我修改了页面link.htm,并在href字段旁边添加了一个按钮。 This button opens up a small popup where the user can select an internal link in the CMS and then press insert. 此按钮将打开一个小弹出窗口,用户可以在其中选择CMS中的内部链接,然后按插入。 The small popup then uses javascript to send the result back to the link.htm page. 然后,小的弹出窗口使用javascript将结果发送回link.htm页面。 The link is then inserted into the href field. 然后将链接插入到href字段中。 My problem is that when i press insert on the link.htm page, it just reloads the page and nothing is inserted. 我的问题是,当我在link.htm页面上按插入时,它只是重新加载页面而没有插入任何内容。

This is the javascript that i added to the link.htm page: 这是我添加到link.htm页面的javascript:

    function ShowInternalLinks() {
        window.open('InternalLink.aspx', 'InternalLink', 'toolbar=0,status=0,menubar=0,location=0,directories=0,resizable=0,scrollbar=0,width=400,height=200');
    }
    function InsertInternalLink(link) {
        document.getElementById('href').value = '/1/?' + link;            
    }

Nothing fancy, just opens up my custom aspx page when the ShowInternalLink is clicked. 没什么,只是在单击ShowInternalLink时打开我的自定义aspx页面。 Then when the user clicks on insert on that page, the page calls the javascript InsertInternalLink and then closes the small popup. 然后,当用户在该页面上单击插入时,该页面将调用javascript InsertInternalLink,然后关闭小弹出窗口。 Everything works when i run the page, the href gets the correct value from the popup page, but when i then press insert, the page just reloads and the href field resets itself. 当我运行页面时,一切正常,href从弹出页面中获取正确的值,但是当我然后按插入键时,页面将重新加载,href字段将自行重置。

Any ideas? 有任何想法吗? (If i write in the URL in the href field, it works perfectly. Just doesn't work when i use my popup window) (如果我在href字段中的URL中写代码,则可以正常工作。当我使用弹出窗口时,它不起作用)

Side question: Can this even be done easily in CKEditor? 附带问题:甚至可以在CKEditor中轻松完成吗?

The href field has an onchange listener that performs the following: selectByValue(this.form,'linklisthref',this.value); href字段具有一个onchange侦听器,该侦听器执行以下操作:selectByValue(this.form,'linklisthref',this.value);

Can you debug and see if this is being called. 您可以调试并查看是否正在调用它吗? I'm thinking that it isn't, and this might be your problem. 我以为不是,这可能是您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM