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

Format as code #1957

Closed
4 tasks done
raineorshine opened this issue May 26, 2024 · 0 comments
Closed
4 tasks done

Format as code #1957

raineorshine opened this issue May 26, 2024 · 0 comments
Assignees
Labels
feature New feature or request

Comments

@raineorshine
Copy link
Contributor

raineorshine commented May 26, 2024

  • Add a new command and toolbar button to wrap the thought in <code>...</code> tags.
  • Use an icon from the Noun Project that looks like <>. Make sure it is positioned, sized, and styled consistently with other toolbar buttons.
  • Use a similar isActive method as bold, italic, underline, strikethrough toolbar buttons.

    em/src/shortcuts/bold.ts

    Lines 20 to 25 in ee9b4ba

    isActive: getState => {
    const state = getState()
    if (!state.cursor) return false
    const thought = getThoughtById(state, head(state.cursor))
    return thought.value.includes('<b>') || thought.value.includes('<strong>')
    },
  • When part of a thought is selected, activating the command should wrap the selected text in <code>...</code> rather than the full thought, and set the caret to the end of the selection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants