Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 - hotkeys of disabled tools keep on working #1523

Open
Gleb1nho opened this issue Oct 9, 2024 · 2 comments
Open

🐞 - hotkeys of disabled tools keep on working #1523

Gleb1nho opened this issue Oct 9, 2024 · 2 comments
Labels
bug Something isn't working state: need triage state need triage

Comments

@Gleb1nho
Copy link

Gleb1nho commented Oct 9, 2024

Reproduction url

https://stackblitz.com/edit/angular-yiw4rr?file=src%2Fapp%2Fapp.component.ts

Description

Hotkeys of disabled tools keep on working.

Steps to reproduce:

  1. Create editor
  2. Add only undo/redo tool (or no tools at all)
  3. Type some text into the editor
  4. Select the text
  5. Press cmd + b/ctrl + b

Result: text gets bolder
Expected result: text does not change

Also works with other hotkeys: cmd + u, cmd + opt + 1/2/3, etc.

Taiga UI version

4.9.0

Browser Used

Chrome

OS Used

macOS

@Gleb1nho Gleb1nho added bug Something isn't working state: need triage state need triage labels Oct 9, 2024
@hakimio
Copy link
Contributor

hakimio commented Oct 14, 2024

If you don't want some extensions, you can just provide your own set of editor extensions instead of the default ones:

provide: TUI_EDITOR_EXTENSIONS,

import type {Extension, Mark, Node} from '@tiptap/core';

export const TUI_EDITOR_DEFAULT_EXTENSIONS: readonly (Extension | Mark | Node | Promise<Extension | Mark | Node>)[] = [
    import('@tiptap/extension-blockquote').then(({default: blockquote}) => blockquote),
    import('@tiptap/extension-bold').then(({default: bold}) => bold),
    import('@tiptap/extension-bullet-list').then(({default: bulletList}) => bulletList),
    import('@tiptap/extension-document').then(({default: document}) => document),
    import('@tiptap/extension-hard-break').then(({default: hardBreak}) => hardBreak),
    import('@tiptap/extension-history').then(({default: history}) => history.configure({
        depth: 100,
        newGroupDelay: 500
    })),
    import('@taiga-ui/editor/extensions/horizontal').then(({TuiHorizontalRule: horizontalRule}) => horizontalRule),
    import('@tiptap/extension-italic').then(({default: italic}) => italic),
    import('@tiptap/extension-list-item').then(({default: listItem}) => listItem),
    import('@tiptap/extension-task-list').then(({default: taskList}) => taskList),
    import('@tiptap/extension-task-item').then(({default: taskItem}) => taskItem.configure({
        nested: true
    })),
    import('@tiptap/extension-ordered-list').then(({default: orderedList}) => orderedList),
    import('@tiptap/extension-paragraph').then(({default: paragraph}) => paragraph),
    import('@tiptap/extension-strike').then(({default: strike}) => strike),
    import('@tiptap/extension-text').then(({default: text}) => text),
    import('@tiptap/extension-text-style').then(({default: textStyle}) => textStyle),
    import('@tiptap/extension-underline').then(({default: underline}) => underline),
    import('@taiga-ui/editor/extensions/link').then(({TuiLink: link}) => link.configure({
        HTMLAttributes: {
            target: '_blank',
            rel: 'noopener noreferrer nofollow'
        }
    }))
];

@waterplea
Copy link
Contributor

I think this issue is about adding this info to the docs, as people might think when you do not have a button in toolbar — hotkeys would also stop working, but these are actually two separate things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working state: need triage state need triage
Projects
None yet
Development

No branches or pull requests

3 participants