Skip to content

URL handling #9

@jamienk

Description

@jamienk

Hi again,

If a user types a url and it linkifies it, but then the user text-edits the written url, then the link becomes wrong:

User types:

http://yahoo.com

becomes

<a href='http://yahoo.com'>http://yahoo.com</a>

User then edits it to be

<a href='http://yahoo.com'>http://google.com</a>

My users are not technical and I've found that the LINK dialog is too complex for them. My idea is to make typed urls become surrounded by a <span class='url'>

Then I can handle this, so that, for example, we can have a simpler google-style link changer, or make double-click go to the url or something.

For example I have this code which makes double-click open a link:

    myckeditor=CKEDITOR.inline( editorinst,
    {
        on:
        {
            doubleclick: function(ev)
            {   

                if(this.elementPath().contains( 'a' ))
                {
                    sel = this.getSelection();
                    sel.selectElement(sel.getStartElement());
                    selagain = this.getSelection();
                    var selection = selagain.getNative();
                    if(isURL(selection))
                    {
                        window.open(selection, '_blank');
                    }
                }

        }
    }

Anyway, would be nice to have options: linktag and linkattr to default to current

var attributes = {'data-cke-saved-href': href, href: href};
var style = new CKEDITOR.style({ element: 'a', attributes: attributes } );

but that I could use to make it a span class=url

Make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions