Code Monkey home page Code Monkey logo

ckeditor5-keyboard-marker's Introduction

npm

CKEditor 5 keyboard marker

This plugin adds support for the keyboard input element (<kbd>) to CKEditor 5.

Keyboard marker example

Installation

  • Follow the Creating custom builds guide.
  • Execute npm i @mlewand/ckeditor5-keyboard-marker --save (or yarn add @mlewand/ckeditor5-keyboard-marker)
  • Include the Kbd plugin and add kbd button to the toolbar (if desired).

An example configuration:

'use strict';

// The editor creator to use.
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';

import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials';
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat';
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat';

import Kbd from '@mlewand/ckeditor5-keyboard-marker/src/Kbd';

export default class ClassicEditor extends ClassicEditorBase {}

// Plugins to include in the build.
ClassicEditor.builtinPlugins = [
	EssentialsPlugin,
	AutoformatPlugin,
	BoldPlugin,
	ItalicPlugin,
	HeadingPlugin,
	LinkPlugin,
	ListPlugin,
	ParagraphPlugin,
	RemoveFormat,

	Kbd
];

ClassicEditor.defaultConfig = {
	toolbar: [ 'heading', '|', 'bold', 'italic', 'kbd', 'removeFormat' ],

	// This value must be kept in sync with the language defined in webpack.config.js.
	language: 'en'
};

ckeditor5-keyboard-marker's People

Contributors

fredck avatar mlewand avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fredck

ckeditor5-keyboard-marker's Issues

Fancy dialog to input keys

It would be lovely to provide a way to capture keys to be inserted.

The way I see it:

  • If you have a collapsed selection and trigger kbd command.
  • A sort of dialog is shown where your focus is trapped, and as you're pressing any key combination it shows captured shortcut in this dialog.
  • Once you commit the dialog, it gets inserted into the editor.

That would simplify adding multi key hotkeys, so that you don't have to mark each individual keys yourself.

There are some catches:

  • How to cancel the dialog from keyboard? esc key seems to be natural choice, but this will disallow usage of esc key.
  • Same as above, but how to commit? Here enter is a candidate.

Despite what option will be used it should be written in the dialog.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.