CMS Development

keegan-sbm
Contributor

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE

In the old code editor, the CMD+D command used to duplicate the current line, and now it just deletes it. This was a super usefult shortcut. Deleting a line is not super useful.

 

I'm sad now. Is there anything that can make me unsad?

0 Upvotes
1 Accepted solution
keegan-sbm
Solution
Contributor

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE
CodeMirror.keyMap.macDefault["Cmd-D"] = function(cm){
    var current_cursor = cm.doc.getCursor();
    var line_content = cm.doc.getLine(current_cursor.line);
    CodeMirror.commands.goLineEnd(cm);
    CodeMirror.commands.newlineAndIndent(cm);
    CodeMirror.commands.goLineLeft(cm);
    cm.doc.replaceSelection(line_content);
    cm.doc.setCursor(current_cursor.line + 1, current_cursor.ch);
};

Running ^ from the chrome console brings back duplicate line functionality to CMD+D.

View solution in original post

7 Replies 7
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE

CMD+SHIFT+D

(now you're unsad) 😄

0 Upvotes
keegan-sbm
Contributor

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE

I want to believe that's working for somebody. For me (in chrome) that's just causing the bookmarks dialogue to pop up. Cest la vie. Thanks for trying though.

0 Upvotes
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE

The bookmark does appear if I'm not "focused" in the editor, but once I click on any code in the editor, the duplicate works. Not sure if that helps your scenario.

0 Upvotes
keegan-sbm
Contributor

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE

Tried a couple variations to no avail, although maybe its an issue of too many hubspot tabs open or stale session or something. I bet this is something a crafty bookmarklet could fix.

keegan-sbm
Solution
Contributor

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE
CodeMirror.keyMap.macDefault["Cmd-D"] = function(cm){
    var current_cursor = cm.doc.getCursor();
    var line_content = cm.doc.getLine(current_cursor.line);
    CodeMirror.commands.goLineEnd(cm);
    CodeMirror.commands.newlineAndIndent(cm);
    CodeMirror.commands.goLineLeft(cm);
    cm.doc.replaceSelection(line_content);
    cm.doc.setCursor(current_cursor.line + 1, current_cursor.ch);
};

Running ^ from the chrome console brings back duplicate line functionality to CMD+D.

tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE

Yep, you're right, this is from their project bundle - (no duplicate) 

nodups.png

 

Also, found this in the source code, kinda funny 😄

fired.png

keegan-sbm
Contributor

Keyboard shortcut for duplicate line was changed in new design editor and that makes me sad.

SOLVE

rofl

0 Upvotes