akc52 / zen-coding

Automatically exported from code.google.com/p/zen-coding
0 stars 0 forks source link

Duplicate line and Duplicate selection actions #350

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Feature request:
Can you add duplicate of the current line and Duplicate of the selection to 
this extension (for dreamweaver) please?

I've added something like this but as I'm not familiar with Dreamweaver API and 
your (great) extension it may not be the best solution:)

function duplicateLine(editor)
{
    var range = editor.getCurrentLineRange();
    editor.createSelection(range.start, range.end);
    //copy selection
    var content = editor.getContent();
    //alert("content="+content);
    var nl = zen_coding.getNewline();
    var copied = content.substring(range.start, range.end);

    if(!!copied)
    {
        editor.replaceContent((nl+copied), range.end, range.end, true);
    }
    else
    {
        editor.setCaretPos(range.end);
    }
}

Original issue reported on code.google.com by lukasz.g...@gmail.com on 15 Aug 2012 at 11:00