Exploring the ckeditor5-typing plugin within CKEditor

Currently, I am in the process of developing a soft keyboard using CKEditor. One part of this involves transforming text upon input (which I have completed) and occasionally needing to delete a key (where I am currently facing challenges). Below is the snippet of my current code:

ClassicEditor
        .create( document.querySelector( '#editor' ) )
        .then(editor => {
            console.log( editor );
            editor.editing.view.document.on( 'keydown', ( event, data ) => {

                var keyPressed = data.domEvent.key;
                //getMappedCharacter returns a map
                //String newKey -> value of the keyPressed
                //Boolean deleteKey -> Whether the previous character should be deleted
                var mappedCode = getMappedCharacter(keyPressed);
                console.log('mc', mappedCode)

                if (mappedCode.newKey != keyPressed) {
                    data.preventDefault();
                    event.stop();


                    if(mappedCode.deleteKey){
                      //  Struggling with this section
                      // Attempting to delete the most recently inserted character at cursor location.
                    }

                    editor.model.change( writer => {
                        writer.insertText( mappedCode.newKey, editor.model.document.selection.getFirstPosition() );
                    } );
                }

            })
        })
        .catch( error => {
            console.error( error );
        } );

As part of my project, I am trying to incorporate the ckeditor5-typing package's Delete command with CKEditor5 in an Angular/Typescript application. The documentation suggests adding the Typing package within the Plugins like so

    ClassicEditor
        .create( document.querySelector( '#editor' ), {
            plugins: [ Essentials, Paragraph, Bold, Italic ],
            toolbar: [ 'bold', 'italic' ]
        } )

However, when implementing this, I encounter the following error in the console:

https://i.sstatic.net/eJRT0.png

Upon executing

document.querySelector('#editor')
in the console, I receive the following result:

<textarea _ngcontent-c1 dir=​"rtl" id=​"editor" name=​"content">​</textarea>​

Therefore, it is unclear why a null error is being displayed in the console.

Any assistance on this matter would be greatly appreciated.

Answer №1

Explanation of the code:

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        plugins: [ Typing ]
    }  )

This code specifically loads only the Typing plugin into the editor. However, using a CKEditor 5 build with a pre-configured toolbar results in warnings being logged because the editor is trying to add multiple non-existent buttons to the toolbar.

What's interesting is that enabling the Typing plugin may seem unnecessary since it's already enabled in all editor builds. Additionally, other plugins need to be enabled for the editor to display content correctly. For example, enabling the Paragraph plugin is essential.

It's important to note that adding plugins to a build can only be done during the source building process. Refer to for more information on correctly installing plugins.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to integrate Angular-cli with babel transforms?

My current project is a unique combination of AngularJS and Angular, with Gulp handling the transformations for the Angular portion. We are converting TS to ES6, then using Babel to transpile to ES5+ before utilizing Rollup or SystemJS. There's a lot ...

Mapping JSON data from an array with multiple properties

Here is a JSON object that I have: obj = { "api": "1.0.0", "info": { "title": "Events", "version": "v1", "description": "Set of events" }, "topics": { "cust.created.v1": { "subscribe": { ...

What exactly does <T> signify within the realm of dynamic forms?

Currently, I am experimenting with the Angular2 cookbook instructions for Dynamic Forms. The instructions mention: export class QuestionBase<T>{ value: T, ... I am confused about the purpose of the "<T>" in both instances. Do you have any ins ...

Using TypeORM with a timestamp type column set to default null can lead to an endless loop of migrations being

In my NestJs project using TypeORM, I have the following column definition in an entity: @CreateDateColumn({ nullable: true, type: 'timestamp', default: () => 'NULL', }) public succeededAt?: Date; A migration is gene ...

Receiving an unexpected value from the input attribute

Currently, I am facing a challenge in retrieving data from another component by using the selector in the HTML file of the parent component. Here is how I implemented it: <app-graphs [module]="module" hidden></app-graphs> In the chi ...

A Unique Identifier in Kotlin

In my typescript class, I have a member that accepts any as the name: interface ControlTagType { type?: String | null; [name: string]: any } class ControlTag { tagSource: String | null = null; tag: ControlTagType | null = null; } expor ...

Why does the server attempt to load the chart in Angular 10 Universal using Amcharts 4?

I have experience with Angular, but I am now delving into the world of using Universal for SEO purposes. My goal is to integrate a map from amcharts 4, which works fine without Angular Universal. However, I am facing an issue where the server attempts to ...

Tips on how to access the names of all properties within a TypeScript class while excluding any methods

Looking to enhance the reactivity of my code, I want to render my view based on the properties of a class. How can I extract only the property names from a class and exclude methods? For instance: export class Customer { customerNumber: string; ...

Unique validator for form fields in Angular Reactive Forms when in edit mode

In my current project, I am developing an Angular 8 application using Reactive Forms. The form in question serves both create and update operations with a set of controls. Here is the code snippet for initializing the form: this.form = new FormGroup({ ...

Visibility of Input-properties in Angular 2

I am encountering an issue where a component parent is calling another component child with an input-property. Although the property is available in the child's template, it does not seem to be accessible within the constructor or OnInit functions. I ...

Navigating session discrepancies: Combining various social media platforms using Next.js and NextAuth

Recently, I ran into a problem where, upon logging in with Google, I found myself needing access tokens for Twitter and LinkedIn to send out API requests. The issue came about when NextAuth modified my session data to be from either Twitter or LinkedIn ins ...

Learn how to set expectations on the object returned from a spied method, Jasmine

I am currently faced with setting an expectation regarding the number of times a specific function called "upsertDocument" is executed. This function is part of a DocumentClient object within a getClient method in production. Here's how it looks: cli ...

Should I opt for 'typeof BN' or the BN Constructor when working with TypeScript and "bn.js"?

Note: Despite the recommendation to use BigInts instead of bn.js, I am currently working with a legacy codebase that has not been migrated yet. Below is the code that compiles and executes without any issues: import { BN } from "bn.js"; import a ...

What is the best way to showcase the information retrieved from my API?

I am attempting to display the ID and Document number that are retrieved from an array. Data Returned However, I am not seeing any results in return. You can view the application results here. I have tried using string interpolation like {{document.id}} ...

What is the best way to handle success data in React Query?

Currently, I have an API call function (using httpClient as axios instance) interface IRegisterResponse { accessToken: string; } export const register = async ({ name, password, token, }: IRegisterParams) => await httpClient.post<IRegiste ...

When using Typescript, I am encountering an issue where declared modules in my declaration file, specifically those with the file

One of the declarations in my ./src/types.d.ts file includes various modules: /// <reference types="@emotion/react/types/css-prop" /> import '@emotion/react'; import { PureComponent, SVGProps } from 'react'; declare mod ...

What is the best way to establish communication between the browser and an express.js server while utilizing angular ssr?

I've encountered a server-side rendering (SSR) issue that does not seem to be addressed in either the Angular documentation or the new Angular developer documentation. My inquiry pertains to transferring data from the browser to the server, as oppose ...

Struggling to bring in { useActionState } from 'react' while trying to follow the latest next.js tutorial with next.js v15.0.0-canary.28, react v19.0.0-rc, and types/react v18.2.21

Currently, I am following the tutorial on next.js available at https://nextjs.org/learn/dashboard-app I have reached chapter 14, which focuses on enhancing accessibility, located at https://nextjs.org/learn/dashboard-app/improving-accessibility During on ...

Why is passing data:{} to a route essential for achieving the desired outcome?

Check out the Angular Material Documentation Site passing {} to the Homepage route: {path: '', component: HomePage, pathMatch: 'full', data: {}} I'm interested in knowing the significance of data: {}. Recent Discovery Closer ex ...

How to store an imported JSON file in a variable using TypeScript

I am facing a challenge with a JSON file that stores crucial data in the following format { "login": { "email": "Email", "firstName": "First name", "lastName": "Last name", ...