如何删除“锚点链接”从“链接” CKeditor 中的编辑器

发布于 2024-11-25 15:58:57 字数 133 浏览 2 评论 0原文

基本上,我删除了锚点按钮,因此链接窗口中不应该有指向锚点选项的链接。

有什么方法可以删除该下拉选项

在此处输入图像描述

Basically I removed the anchor button so there should not be a link to anchor option in my link window.

Any way to remove that dropdown option

enter image description here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

三岁铭 2024-12-02 15:58:57

想通了

if ( dialogName == 'link' )
    {
      var infoTab = dialogDefinition.getContents( 'info' );
      var linktypeField = infoTab.get( 'linkType' );

      /* Remove it from the array of items */
      linktypeField['items'].splice(1, 1);

    }

Figured it out

if ( dialogName == 'link' )
    {
      var infoTab = dialogDefinition.getContents( 'info' );
      var linktypeField = infoTab.get( 'linkType' );

      /* Remove it from the array of items */
      linktypeField['items'].splice(1, 1);

    }
短暂陪伴 2024-12-02 15:58:57

dialogDefinition 允许您完全重新设计对话框。

我根据 http://nightly.ckeditor.com/ 中的示例这样做了7156/_samples/api_dialog.html

CKEDITOR.on( 'dialogDefinition', function( ev )
{
    // Take the dialog name and its definition from the event
    // data.
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    // Check if the definition is from the dialog we're
    // interested on (the "Link" dialog).
    if ( dialogName == 'link' )
    {
        // Get a reference to the "Link Info" tab.
        var infoTab = dialogDefinition.getContents( 'info' );
        infoTab.remove( 'linkType' );
    }
});

$("#mydiv").ckeditor(function(){}, {
    removeDialogTabs: 'link:advanced;link:target'
    // any other customizations go here.
});

dialogDefinition allows you to completely redesign dialog boxes.

I did it this way, based on the example at http://nightly.ckeditor.com/7156/_samples/api_dialog.html

CKEDITOR.on( 'dialogDefinition', function( ev )
{
    // Take the dialog name and its definition from the event
    // data.
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    // Check if the definition is from the dialog we're
    // interested on (the "Link" dialog).
    if ( dialogName == 'link' )
    {
        // Get a reference to the "Link Info" tab.
        var infoTab = dialogDefinition.getContents( 'info' );
        infoTab.remove( 'linkType' );
    }
});

$("#mydiv").ckeditor(function(){}, {
    removeDialogTabs: 'link:advanced;link:target'
    // any other customizations go here.
});
新雨望断虹 2024-12-02 15:58:57

这是我的解决方案:

CKEDITOR.on('dialogDefinition', function (ev) {
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're
// interested in (the 'link' dialog).
if (dialogName == 'link') {
    // Remove the 'Target' and 'Advanced' tabs from the 'Link' dialog.
    //dialogDefinition.removeContents('target');
    //dialogDefinition.removeContents('advanced');

    // Get a reference to the 'Link Info' tab.
    var infoTab = dialogDefinition.getContents('info');
    infoTab.remove('protocol');
    infoTab.get('linkType').style = 'display: none';
}

});

如果您使用 infoTab.remove('linkType'); 删除链接类型,它将无法创建链接

This's my solution:

CKEDITOR.on('dialogDefinition', function (ev) {
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're
// interested in (the 'link' dialog).
if (dialogName == 'link') {
    // Remove the 'Target' and 'Advanced' tabs from the 'Link' dialog.
    //dialogDefinition.removeContents('target');
    //dialogDefinition.removeContents('advanced');

    // Get a reference to the 'Link Info' tab.
    var infoTab = dialogDefinition.getContents('info');
    infoTab.remove('protocol');
    infoTab.get('linkType').style = 'display: none';
}

});

If you get rid of Link Type using infoTab.remove('linkType'); it will fails to create the link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文