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

Using this keyboard with summernote editor #712

Closed
sanjit11 opened this issue Dec 3, 2018 · 1 comment
Closed

Using this keyboard with summernote editor #712

sanjit11 opened this issue Dec 3, 2018 · 1 comment

Comments

@sanjit11
Copy link

sanjit11 commented Dec 3, 2018

Is is possible to use this editor with summernote editor . if yes , how can i use it ?

@Mottie
Copy link
Owner

Mottie commented Dec 3, 2018

Hi @sanjit11!

This keyboard works with contenteditable elements, so there shouldn't be too many issues with integrating it. I threw together this demo. Please let me know if you encounter any issues (other than the keyboard repositioning - I think fixing it at the bottom of the page might be better (see this example css)

$(function() {
  $("#summernote").on("summernote.init", initKeyboard).summernote();

  function initKeyboard() {
    $(".note-editable")
      .keyboard({
        layout: "custom",
        customLayout: {
          normal: [
            "` 1 2 3 4 5 6 7 8 9 0 - = {bksp}",
            "{tab} q w e r t y u i o p [ ] \\",
            "a s d f g h j k l ; ' {enter}",
            "{shift} z x c v b n m , . / {shift}",
            "{space} {left} {right}"
          ],
          shift: [
            "~ ! @ # $ % ^ & * ( ) _ + {bksp}",
            "{tab} Q W E R T Y U I O P { } |",
            'A S D F G H J K L : " {enter}',
            "{shift} Z X C V B N M < > ? {shift}",
            "{space} {left} {right}"
          ]
        },
        css: {
          // input & preview
          input: "form-control input-sm",
          // keyboard container
          container: "center-block dropdown-menu", // jumbotron
          // default state
          buttonDefault: "btn btn-default",
          // hovered button
          buttonHover: "btn-primary",
          // Action keys (e.g. Accept, Cancel, Tab, etc);
          // this replaces "actionClass" option
          buttonAction: "active",
          // used when disabling the decimal button {dec}
          // when a decimal exists in the input area
          buttonDisabled: "disabled"
        }
      })
      // activate the typing extension
      .addTyping({
        showTyping: true,
        delay: 50
      });
  }
});

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

No branches or pull requests

2 participants