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

keymap: change to support bold and italic keyboard shortcuts. #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gyger
Copy link

@gyger gyger commented May 6, 2024

This adds the function to use CTRL + B and CTRL + I to toggle between bold and italic.

@gyger
Copy link
Author

gyger commented May 6, 2024

Together with PR #203 they solve #122.

If you want I can also merge the two pull requests into one. We could also add other commands easily.

As an inspiration from the sample file (https://github.com/ProseMirror/prosemirror-example-setup/blob/master/src/keymap.ts) the following shortcuts are implemented (Dont think we need all, just as inspiration).

  • Mod-b for toggling strong
  • Mod-i for toggling emphasis
  • Mod-` for toggling code font
  • Ctrl-Shift-0 for making the current textblock a paragraph
  • Ctrl-Shift-1 to Ctrl-Shift-Digit6 for making the current textblock a heading of the corresponding level
  • Ctrl-Shift-Backslash to make the current textblock a code block
  • Ctrl-Shift-8 to wrap the selection in an ordered list
  • Ctrl-Shift-9 to wrap the selection in a bullet list
  • Ctrl-> to wrap the selection in a block quote
  • Enter to split a non-empty textblock in a list item while atnthe same time splitting the list item
  • Mod-Enter to insert a hard break
  • Mod-_ to insert a horizontal rule
  • Backspace to undo an input rule
  • Alt-ArrowUp to joinUp
  • Alt-ArrowDown to joinDown
  • Mod-BracketLeft to lift
  • Escape to selectParentNode

@splitbrain
Copy link
Member

I'm not a mac user, how does this map to macos and does it make sense there?

@gyger
Copy link
Author

gyger commented May 6, 2024

I am neither, but according to documentation Mod- matches to CTRL on Win/Lin and Command on Mac.

Only italic and bold is implemented in this pull request, the test is just a list from the example implementation.

@StefanP74
Copy link

StefanP74 commented Jul 25, 2024

Is this only working with a special browser in windows 10? I tried with edge and firefox.
I copied the code from https://github.com/cosmocode/dokuwiki-plugin-prosemirror/pull/204/files to /var/www/html/dokuwiki/lib/plugins/prosemirror/script/plugins/Keymap/keymap.js ... but nothing happened.
Ctrl+z is the only working short-cut.
Is there something left to do ... or ist the code only working on a special OS or browser? ... or is it not realy implemented in the currently downloadable "build"?

@pgschk
Copy link

pgschk commented Jul 25, 2024

@StefanP74 it's been a while since I applied this PR to my installation (a shame it's not been merged yet 😢). If I remember correctly this code ends up in bundle.js after building. I thought it would be enough to yarn build this branch and replace bundle.js, but what did work for me at the end was:

@StefanP74
Copy link

StefanP74 commented Jul 25, 2024 via email

@pgschk
Copy link

pgschk commented Jul 25, 2024

@StefanP74 I can't test your approache, but if you are working directly on the system the easiest approach would be:

  • Uninstall prosemirror plugin through dokuwiki
  • cd /var/www/html/dokuwiki/lib/plugins/
  • git clone -b fix-shortcutsformat https://github.com/gyger/dokuwiki-plugin-prosemirror/ prosemirror
  • cd prosemirror
  • yarn install
  • yarn build

Afterwards make sure to refresh the dokuwiki page in your browser, ideally clearing cache, and try a different browser, to make sure you are not experiencing a cached javascript.

@StefanP74
Copy link

StefanP74 commented Jul 25, 2024 via email

@pgschk
Copy link

pgschk commented Jul 25, 2024

@StefanP74 You're right, this branch does not build on it's own, it is dependend on #203.

I failed to mention yarn install, in case you did not run it before yarn build, but I think you did.

You need to actually apply both changes, #203 and #204:

Afterwards make sure to refresh the dokuwiki page in your browser, ideally clearing cache, and try a different browser, to make sure you are not experiencing a cached javascript.

@gyger I think you need to remove exitCode from line 4 for this PR, as it is only used by PR #203.

@StefanP74
Copy link

StefanP74 commented Jul 30, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants