CMS Development

keegan-sbm
Colaborador

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

resolver

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 Me gusta
1 Soluciones aceptada
keegan-sbm
Solución
Colaborador

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

resolver
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.

Ver la solución en mensaje original publicado

7 Respuestas 7
tjoyce
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

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

resolver

CMD+SHIFT+D

(now you're unsad) 😄

0 Me gusta
keegan-sbm
Colaborador

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

resolver

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 Me gusta
tjoyce
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

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

resolver

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 Me gusta
keegan-sbm
Colaborador

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

resolver

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
Solución
Colaborador

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

resolver
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
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

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

resolver

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
Colaborador

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

resolver

rofl

0 Me gusta