Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9167625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:26:11+00:00 2026-06-17T15:26:11+00:00

I am currently trying to use CKEditor to add XML entries. I modified the

  • 0

I am currently trying to use CKEditor to add XML entries. I modified the sample plugin’s code:

CKEDITOR.dialog.add( 'abbrDialog', function( editor ) {
return {
    title: 'Abbreviation Properties',
    minWidth: 400,
    minHeight: 200,
    contents: [
        {
            id: 'tab-basic',
            label: 'Basic Settings',
            elements: [
                {
                    type: 'text',
                    id: 'abbr',
                    label: 'Title',
                    validate: CKEDITOR.dialog.validate.notEmpty( "Title cannot be empty" )
                },
                {
                    type: 'text',
                    id: 'title',
                    label: 'Price',
                    validate: CKEDITOR.dialog.validate.notEmpty( "Price cannot be empty" )
                }    
            ]
        },
        {
            id: 'tab-adv',
            label: 'Advanced Settings',
            elements: [
                {
                    type: 'text',
                    id: 'id',
                    label: 'Id'
                }
            ]
        }
    ],          
    onOk: function() {
        var dialog = this;

        var abbr = editor.document.createElement( 'abbr' );
        abbr.setAttribute( 'title', dialog.getValueOf( 'tab-basic', 'title' ) );
        abbr.setText( dialog.getValueOf( 'tab-basic', 'abbr' ) );

        var id = dialog.getValueOf( 'tab-adv', 'id' );
        if ( id )
            abbr.setAttribute( 'id', id );

        editor.insertElement( abbr );
    }
};

});

However, when I click the editor again to add more items the tags became nested, like . This is not desired. How can I restrict that there will be no any tag inside another tag? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:26:12+00:00Added an answer on June 17, 2026 at 3:26 pm

    This will retrieve the element under your caret:

    var selectedElement = editor.getSelection().getStartElement();
    

    And with this you can retrieve the closest ascendant of a specific type:

    selectedElement.getAscendant( 'abbr', 1 );
    

    Basically, when there’s one, don’t insert anything and/or update selectedElement with new attributes, properties, etc.


    BTW: This will give you an iterable array of parent elements (towards DOM root) if you wish to have a more specific filtering:

    selectedElement.getParents();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to use Miles J plugin located here http://milesj.me/code/cakephp/uploader Although I
I'm having trouble editing an XML file. I'm currently trying to use Nokogiri ,
I'm a beginner coder in Ruby and currently I'm trying to use this plugin:
I am transitioning my CMS to use CKEditor. I am currently trying to make
I am trying to use ckeditor in a web project I am currently developing.
Hi I'm currently trying to use the elem function in prelude. data MyType =
I'm currently trying to use Quicksand, a jquery plugin that allows you to animate
I am currently trying to use Eclipse to develop some code that I've been
I am currently trying to use the PhoneGap LocalNotification Plugin , using Android 4.1
I am currently trying to use the CloudDrive (Powershell) sample that comes with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.