question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support a literal Tab

See original GitHub issue

TipTap currently does not support a literal tab charicter when you press tab (particularly annoying in a code block), the browser will move focus to the next input on the page. This should probably be the default behaviour, see:

https://discuss.prosemirror.net/t/tab-stops/225 https://discuss.prosemirror.net/t/parsedom-for-tab/723

However maybe include a standard extension (such as below) to add support, note that due to https://github.com/ueberdosis/tiptap-next/issues/115 this would need to be after the list extensions as you would want the standard tab indent behaviour for them.

import { Extension } from '@tiptap/core';

export const LiteralTab = Extension.create({
  name: 'literalTab',

  addKeyboardShortcuts() {
    return {
      Tab: () => {
        console.log('test');
        return this.editor.commands.insertText('\t')
      }
    }
  }

})

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
iamurskycommented, Oct 19, 2021

Here is my solution that allows to insert tabs while editing the text in code block:

import BaseCodeBlock from "@tiptap/extension-code-block";

export const CodeBlock = BaseCodeBlock.extend({
  addKeyboardShortcuts() {
    return {
      Tab: () => {
        if (this.editor.isActive("codeBlock")) {
          return this.editor.commands.insertContent("\t");
        }
      },
    };
  },
});
1reaction
hanspagelcommented, Mar 30, 2021

I think we should focus on building the CodeMirror extension, before we try to improve the CodeBlock extension. Closing this here for now. ✌️

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I enter a literal tab character in a bash shell?
It allows you to enter a string, but also have escaped characters. Double quoting literally prints \t If you leave off the quotes...
Read more >
How do I type a literal tab character in Eclipse? - Stack Overflow
Only way I can find to do it in Eclipse (version=Juno) was to type say XXX where I wanted the tab character and...
Read more >
How to insert a literal tab character? · Issue #2478 · fish-shell ...
In bash Ctrl+V followed by Tab worked fine. Unfortunatelly this doesn't work on Fish.
Read more >
218762 – Request ability to insert literal TAB using ... - Bugs
Build ID: M20071023-1652 Steps To Reproduce: 1. Editors | Text Editors preference is set to 'insert spaces for tabs' 2. Try to insert...
Read more >
Insert tabs in INSERT mode when expandtab is set
Instead of just pressing Tab , first press Ctrl-V and then press Tab . This can be used to insert a variety of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found