Skip to content

feat(js-api): Add types for word-count ckeditor plugin#1266

Open
chestofwonders wants to merge 1 commit into
liferay:masterfrom
chestofwonders:LPD-89734
Open

feat(js-api): Add types for word-count ckeditor plugin#1266
chestofwonders wants to merge 1 commit into
liferay:masterfrom
chestofwonders:LPD-89734

Conversation

@chestofwonders

Copy link
Copy Markdown
Member

Issue: https://liferay.atlassian.net/browse/LPD-89734

Add types for word-count ckeditor plugin

This PR adds TypeScript type support for the CKEditor 5 word-count plugin by:

  1. Creating a new ckeditor5-plugins.ts file with a module augmentation that maps @ckeditor/ckeditor5-word-count/dist/index.js to the package's declared types
  2. Referencing it from editor/index.ts via a triple-slash directive
  3. Adding @ckeditor/ckeditor5-word-count@46.0.3 as a dependency in package.json

* SPDX-License-Identifier: LGPL-3.0-or-later
*/

/// <reference path="./ckeditor5-plugins" />

@izaera izaera Jun 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint errors seem correct: why not use import here? 🤔

@dsanz dsanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chestofwonders pls check the linting errors

* SPDX-License-Identifier: LGPL-3.0-or-later
*/

declare module '@ckeditor/ckeditor5-word-count/dist/index.js' {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at some point, we shall end up adding any ootb plugin type here, so that CX implementors can include them easily regardless the plugin they want to enable.

This is something we need to think: which types should be here? All? The ones which we don't include in the toolbars at this moment? Just the ones referenced in the sample workspace?

So, this is not blocking the PR, just raising awareness

@chestofwonders chestofwonders force-pushed the LPD-89734 branch 6 times, most recently from 55d9e70 to 7ec0167 Compare June 12, 2026 10:48
…nt types

CKEditor5 v46 switched to an ESM-only distribution where types are declared
under the package root but the actual entry point is dist/index.js. Consuming
those types from inside js-toolkit is not feasible: js-toolkit's tsconfig is
configured for CommonJS/moduleResolution:node, and its CI tooling
(liferay-workspace-scripts) applies workspace-wide constraints that conflict
with the moduleResolution:bundler and TypeScript 5 required by CKEditor5 v46.

To avoid dragging js-toolkit into those requirements (and to avoid interfering
with parallel work on js-api), the editor types are extracted to a new
independent package, @liferay/js-api-editor, placed at projects/js-api-editor.
This package has its own tsconfig (moduleResolution:bundler, TS5) and no
dependency on js-toolkit's tooling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants