Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(ckeditor5): fold keyboard-marker into the aggregate package
Elian Doran8881014c120f
diff --git a/CLAUDE.md b/CLAUDE.mdindex b72f19f471..eef701a6dc 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -76,7 +76,7 @@ packages/highlightjs/ # Syntax highlightingshare-theme/ # Theme for shared/published notesckeditor5-admonition/, ckeditor5-footnotes/, ckeditor5-math/, ckeditor5-mermaid/- ckeditor5-keyboard-marker/, express-partial-content/, pdfjs-viewer/, splitjs/+ express-partial-content/, pdfjs-viewer/, splitjs/turndown-plugin-gfm/```diff --git a/docs/Developer Guide/Developer Guide/Architecture.md b/docs/Developer Guide/Developer Guide/Architecture.mdindex 66cb82eea2..9f39138d73 100644--- a/docs/Developer Guide/Developer Guide/Architecture.md+++ b/docs/Developer Guide/Developer Guide/Architecture.md@@ -96,7 +96,6 @@ trilium/│ ├── highlightjs/ # Syntax highlighting│ ├── ckeditor5-admonition/ # CKEditor plugin: admonitions│ ├── ckeditor5-footnotes/ # CKEditor plugin: footnotes-│ ├── ckeditor5-keyboard-marker/# CKEditor plugin: keyboard shortcuts│ ├── ckeditor5-math/ # CKEditor plugin: math equations│ ├── ckeditor5-mermaid/ # CKEditor plugin: diagrams│ ├── express-partial-content/ # HTTP partial content middlewarediff --git a/flake.nix b/flake.nixindex 834af96aa3..e2996fc4c9 100644--- a/flake.nix+++ b/flake.nix@@ -240,7 +240,6 @@ nodejs.python"packages/ckeditor5""packages/ckeditor5-admonition""packages/ckeditor5-footnotes"- "packages/ckeditor5-keyboard-marker""packages/ckeditor5-math""packages/ckeditor5-mermaid""packages/codemirror"diff --git a/packages/ckeditor5-keyboard-marker/.editorconfig b/packages/ckeditor5-keyboard-marker/.editorconfigdeleted file mode 100644index 37ea8ff914..0000000000--- a/packages/ckeditor5-keyboard-marker/.editorconfig+++ /dev/null@@ -1,19 +0,0 @@-# Configurations to normalize the IDE behavior.-# http://editorconfig.org/--root = true--[*]-indent_style = tab-tab_width = 4-charset = utf-8-end_of_line = lf-trim_trailing_whitespace = true-insert_final_newline = true--[*.{js,jsx,ts}]-quote_type = single--[package.json]-indent_style = space-tab_width = 2diff --git a/packages/ckeditor5-keyboard-marker/.gitattributes b/packages/ckeditor5-keyboard-marker/.gitattributesdeleted file mode 100644index 41be6fafe7..0000000000--- a/packages/ckeditor5-keyboard-marker/.gitattributes+++ /dev/null@@ -1,19 +0,0 @@-* text=auto--*.htaccess eol=lf-*.cgi eol=lf-*.sh eol=lf--*.css text-*.htm text-*.html text-*.js text-*.ts text-*.json text-*.php text-*.txt text-*.md text--*.png -text-*.gif -text-*.jpg -textdiff --git a/packages/ckeditor5-keyboard-marker/.gitignore b/packages/ckeditor5-keyboard-marker/.gitignoredeleted file mode 100644index 437dda1d0a..0000000000--- a/packages/ckeditor5-keyboard-marker/.gitignore+++ /dev/null@@ -1,10 +0,0 @@-build/-coverage/-dist/-node_modules/-tmp/-sample/ckeditor.dist.js--# Ignore compiled TypeScript files.-src/**/*.js-src/**/*.d.tsdiff --git a/packages/ckeditor5-keyboard-marker/.stylelintrc b/packages/ckeditor5-keyboard-marker/.stylelintrcdeleted file mode 100644index 1d86a41f98..0000000000--- a/packages/ckeditor5-keyboard-marker/.stylelintrc+++ /dev/null@@ -1,3 +0,0 @@-{- "extends": "stylelint-config-ckeditor5"-}diff --git a/packages/ckeditor5-keyboard-marker/README.md b/packages/ckeditor5-keyboard-marker/README.mddeleted file mode 100644index ed9e98925c..0000000000--- a/packages/ckeditor5-keyboard-marker/README.md+++ /dev/null@@ -1,189 +0,0 @@-# CKEditor 5 keyboard marker--This plugin adds support for the keyboard input element (`<kbd>`) to CKEditor 5.----## Table of contents--- [CKEditor 5 keyboard marker](#ckeditor-5-keyboard-marker)- - [Table of contents](#table-of-contents)- - [Developing the package](#developing-the-package)- - [Available scripts](#available-scripts)- - [`start`](#start)- - [`test`](#test)- - [`lint`](#lint)- - [`stylelint`](#stylelint)- - [`build:dist`](#builddist)- - [`translations:synchronize`](#translationssynchronize)- - [`translations:validate`](#translationsvalidate)- - [`ts:build` and `ts:clear`](#tsbuild-and-tsclear)- - [Installation](#installation)--## Developing the package--To read about the CKEditor 5 Framework, visit the [CKEditor 5 Framework documentation](https://ckeditor.com/docs/ckeditor5/latest/framework/index.html).--## Available scripts--NPM scripts are a convenient way to provide commands in a project. They are defined in the `package.json` file and shared with people contributing to the project. It ensures developers use the same command with the same options (flags).--All the scripts can be executed by running `npm run <script>`. Pre and post commands with matching names will be run for those as well.--The following scripts are available in the package.--### `start`--Starts an HTTP server with the live-reload mechanism that allows previewing and testing of plugins available in the package.--When the server starts, the default browser will open the developer sample. This can be disabled by passing the `--no-open` option to that command.--You can also define the language that will translate the created editor by specifying the `--language [LANG]` option. It defaults to `'en'`.--Examples:--```bash-# Starts the server and open the browser.-npm run start--# Disable auto-opening the browser.-npm run start -- --no-open--# Create the editor with the interface in German.-npm run start -- --language=de-```--### `test`--Allows executing unit tests for the package specified in the `tests/` directory. To check the code coverage, add the `--coverage` modifier. See other [CLI flags](https://vitest.dev/guide/cli.html) in Vitest.--Examples:--```bash-# Execute tests.-npm run test--# Generate code coverage report after each change in the sources.-npm run test -- --coverage-```--### `lint`--Runs ESLint, which analyzes the code (all `*.ts` files) to quickly find problems.--Examples:--```bash-# Execute eslint.-npm run lint-```--### `stylelint`--Similar to the `lint` task, stylelint analyzes the CSS code (`*.css` files in the `theme/` directory) in the package.--Examples:--```bash-# Execute stylelint.-npm run stylelint-```--### `build:dist`--Creates npm and browser builds of your plugin. These builds can be added to the editor by following the [Configuring CKEditor 5 features](https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/configuration.html) guide.--Examples:--```bash-# Builds the `npm` and browser files thats are ready to publish.-npm run build:dist-```--### `translations:synchronize`--Synchronizes translation messages (arguments of the `t()` function) by performing the following steps:-- * Collect all translation messages from the package by finding `t()` calls in source files.- * Detect if translation context is valid, i.e. whether the provided values do not interfere with the values specified in the `@ckeditor/ckeditor5-core` package.- * If there are no validation errors, update all translation files (`*.po` files) to be in sync with the context file:- * unused translation entries are removed,- * missing translation entries are added with empty string as the message translation,- * missing translation files are created for languages that do not have own `*.po` file yet.--The task may end with an error if one of the following conditions is met:--* Found the `Unused context` error – entries specified in the `lang/contexts.json` file are not used in source files. They should be removed.-* Found the `Duplicated contex` error – some of the entries are duplicated. Consider removing them from the `lang/contexts.json` file, or rewriting them.-* Found the `Missing context` error – entries specified in source files are not described in the `lang/contexts.json` file. They should be added.--Examples:--```bash-npm run translations:synchronize-```--### `translations:validate`--Peforms only validation steps as described in [`translations:synchronize`](#translationssynchronize) script, but without modifying any files. It only checks the correctness of the context file against the `t()` function calls.--Examples:--```bash-npm run translations:validate-```--### `ts:build` and `ts:clear`--These scripts compile TypeScript and remove the compiled files. They are used in the aforementioned life cycle scripts, and there is no need to call them manually.--## Installation--* Follow the [Creating custom builds](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/custom-builds.html) 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:--```js-'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'-};-```diff --git a/packages/ckeditor5-keyboard-marker/assets/demo.gif b/packages/ckeditor5-keyboard-marker/assets/demo.gifdeleted file mode 100644index 05a357ac43..0000000000Binary files a/packages/ckeditor5-keyboard-marker/assets/demo.gif and /dev/null differdiff --git a/packages/ckeditor5-keyboard-marker/ckeditor5-metadata.json b/packages/ckeditor5-keyboard-marker/ckeditor5-metadata.jsondeleted file mode 100644index a15c37d20d..0000000000--- a/packages/ckeditor5-keyboard-marker/ckeditor5-metadata.json+++ /dev/null@@ -1,17 +0,0 @@-{- "plugins": [- {- "name": "Keyboard marker",- "className": "KeyboardMarker",- "description": "Adds text to the editor.",- "path": "src/keyboardmarker.ts",- "uiComponents": [- {- "name": "keyboardMarker",- "type": "Button",- "iconPath": "theme/icons/kbd.svg"- }- ]- }- ]-}diff --git a/packages/ckeditor5-keyboard-marker/eslint.config.js b/packages/ckeditor5-keyboard-marker/eslint.config.jsdeleted file mode 100644index 8e49f74ea6..0000000000--- a/packages/ckeditor5-keyboard-marker/eslint.config.js+++ /dev/null@@ -1,83 +0,0 @@-import globals from 'globals';-import { defineConfig } from 'eslint/config';-import eslintConfigCKEditor5 from 'eslint-config-ckeditor5';-import eslintPluginCKEditor5Rules from 'eslint-plugin-ckeditor5-rules';--export default defineConfig( [- eslintConfigCKEditor5,- {- name: 'Ignored files config',- ignores: [- // Ignore compiled JavaScript files, as they are generated automatically.- 'src/**/*.js',- // Also, do not check typing declarations, too.- 'src/**/*.d.ts',- // Ignore the entire `dist/` (the NIM build).- 'dist/**'- ]- },- {- name: 'Base config',- languageOptions: {- ecmaVersion: 'latest',- sourceType: 'module'- },- linterOptions: {- reportUnusedInlineConfigs: 'error',- reportUnusedDisableDirectives: 'error'- },- plugins: {- 'ckeditor5-rules': eslintPluginCKEditor5Rules- },- rules: {- // This rule disallows importing from any path other than the package main entrypoint.- 'ckeditor5-rules/allow-imports-only-from-main-package-entry-point': 'error',- // As required by the ECMAScript (ESM) standard, all imports must include a file extension.- // If the import does not include it, this rule will try to automatically detect the correct file extension.- 'ckeditor5-rules/require-file-extensions-in-imports': [ 'error', {- extensions: [ '.ts', '.js', '.json' ]- } ],- // This rule ensures that all imports from `@ckeditor/*` packages are done through the main package entry points.- // This is required for the editor types to work properly and to ease migration to the installation methods- // introduced in CKEditor 5 version 42.0.0.- 'ckeditor5-rules/no-legacy-imports': 'error'- }- },- {- name: 'NodeJS environment config',- files: [- './scripts/**/*.{js,mjs,cjs}'- ],- languageOptions: {- globals: {- ...globals.node- }- }- },- {- name: 'Browser environment config',- files: [- './sample/**/*.{ts,mts,cts}',- './src/**/*.{ts,mts,cts}',- './tests/**/*.{ts,mts,cts}',- './typings/**/*.d.ts'- ],- languageOptions: {- globals: {- ...globals.browser- }- }- },- {- name: 'Sample and tests config',- files: [- 'sample/**/*.{ts,mts,cts}',- 'tests/**/*.{ts,mts,cts}'- ],- rules: {- // To write complex tests, you may need to import files that are not exported in DLL files by default.- // Hence, imports CKEditor 5 packages in test files are not checked.- 'ckeditor5-rules/ckeditor-imports': 'off'- }- }-] );diff --git a/packages/ckeditor5-keyboard-marker/lang/contexts.json b/packages/ckeditor5-keyboard-marker/lang/contexts.jsondeleted file mode 100644index 4992985703..0000000000--- a/packages/ckeditor5-keyboard-marker/lang/contexts.json+++ /dev/null@@ -1,3 +0,0 @@-{- "Keyboard marker": "Content for a tooltip is displayed when a user hovers the CKEditor 5 icon."-}diff --git a/packages/ckeditor5-keyboard-marker/package.json b/packages/ckeditor5-keyboard-marker/package.jsondeleted file mode 100644index f1a3b25a06..0000000000--- a/packages/ckeditor5-keyboard-marker/package.json+++ /dev/null@@ -1,44 +0,0 @@-{- "name": "@triliumnext/ckeditor5-keyboard-marker",- "version": "0.0.1",- "description": "A plugin for CKEditor 5.",- "keywords": [- "ckeditor",- "ckeditor5",- "ckeditor 5",- "ckeditor5-feature",- "ckeditor5-plugin",- "ckeditor5-package-generator"- ],- "type": "module",- "main": "src/index.ts",- "author": "Marek Lewandowski",- "license": "GPL-3.0",- "homepage": "https://github.com/mlewand/ckeditor5-keyboard-marker",- "engines": {- "node": ">=18.0.0",- "npm": ">=5.7.1"- },- "devDependencies": {- "@ckeditor/ckeditor5-inspector": ">=4.1.0",- "@vitest/browser": "4.1.10",- "ckeditor5": "48.3.1",- "eslint": "10.8.0",- "eslint-config-ckeditor5": ">=9.1.0",- "stylelint": "17.14.1",- "stylelint-config-ckeditor5": ">=9.1.0",- "typescript": "6.0.3",- "vite-plugin-svgo": "2.0.0",- "vitest": "4.1.10",- "webdriverio": "9.30.0"- },- "peerDependencies": {- "ckeditor5": "48.3.1"- },- "scripts": {- "lint": "eslint \"**/*.{js,ts}\" --quiet",- "stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css'",- "test": "vitest",- "test:debug": "vitest --inspect-brk --no-file-parallelism --browser.headless=false"- }-}diff --git a/packages/ckeditor5-keyboard-marker/sample/ckeditor.ts b/packages/ckeditor5-keyboard-marker/sample/ckeditor.tsdeleted file mode 100644index e1760822f5..0000000000--- a/packages/ckeditor5-keyboard-marker/sample/ckeditor.ts+++ /dev/null@@ -1,113 +0,0 @@-declare global {- interface Window {- editor: ClassicEditor;- }-}--import {- ClassicEditor,- Autoformat,- Base64UploadAdapter,- BlockQuote,- Bold,- Code,- CodeBlock,- Essentials,- Heading,- Image,- ImageCaption,- ImageStyle,- ImageToolbar,- ImageUpload,- Indent,- Italic,- Link,- List,- MediaEmbed,- Paragraph,- Table,- TableToolbar-} from 'ckeditor5';--import CKEditorInspector from '@ckeditor/ckeditor5-inspector';--import Kbd from '../src/kbd.js';--import 'ckeditor5/ckeditor5.css';--ClassicEditor- .create( document.getElementById( 'editor' )!, {- licenseKey: 'GPL',- plugins: [- Kbd,- Essentials,- Autoformat,- BlockQuote,- Bold,- Heading,- Image,- ImageCaption,- ImageStyle,- ImageToolbar,- ImageUpload,- Indent,- Italic,- Link,- List,- MediaEmbed,- Paragraph,- Table,- TableToolbar,- CodeBlock,- Code,- Base64UploadAdapter- ],- toolbar: [- 'undo',- 'redo',- '|',- 'keyboardMarker',- '|',- 'heading',- '|',- 'bold',- 'italic',- 'link',- 'code',- 'bulletedList',- 'numberedList',- '|',- 'outdent',- 'indent',- '|',- 'uploadImage',- 'blockQuote',- 'insertTable',- 'mediaEmbed',- 'codeBlock'- ],- image: {- toolbar: [- 'imageStyle:inline',- 'imageStyle:block',- 'imageStyle:side',- '|',- 'imageTextAlternative'- ]- },- table: {- contentToolbar: [- 'tableColumn',- 'tableRow',- 'mergeTableCells'- ]- }- } )- .then( editor => {- window.editor = editor;- CKEditorInspector.attach( editor );- window.console.log( 'CKEditor 5 is ready.', editor );- } )- .catch( err => {- window.console.error( err.stack );- } );diff --git a/packages/ckeditor5-keyboard-marker/sample/dll.html b/packages/ckeditor5-keyboard-marker/sample/dll.htmldeleted file mode 100644index 90d26ab075..0000000000--- a/packages/ckeditor5-keyboard-marker/sample/dll.html+++ /dev/null@@ -1,172 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <link rel="icon" type="image/png" href="https://ckeditor.com/docs/ckeditor5/latest/assets/img/favicons/32x32.png" sizes="32x32">- <meta charset="utf-8">- <title>CKEditor 5 – DLL Sample</title>- <style>- body {- max-width: 800px;- margin: 20px auto;- }- </style>-</head>-<body>--<h1>CKEditor 5 – DLL Sample</h1>--<div id="editor">- <h2>Production sample</h2>- <p>- This is a demo of the <a href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#classic-editor">classic editor- build</a>, initialized using the <a href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/dll-builds.html">DLL builds</a>.- </p>- <p>- Your plugin (KeyboardMarker) generated by the tool is already loaded into the editor. By default, it has an example button that adds some text to the editor. Whenever you change the plugin's name or toolbar items, make sure to update the editor configuration in the <code>sample/dll.html</code> file.- </p>-- <h3>Uncaught TypeError</h3>- <p>If the editor is not initialized correctly and the browser console displays an error such as the following:</p>- <pre><code>Uncaught TypeError: Cannot read properties of undefined (reading 'KeyboardMarker') at dll.html:85</code></pre>- <p>it means that the DLL build of the <code>@triliumnext/ckeditor5-keyboard-marker</code> package has not been created.</p>- <p>Please call the <code>npm run dll:build</code> command in the CLI, and after it finishes, refresh the page.</p>-- <h3>Anatomy of the DLL build</h3>- <p>The source of the DLL build is located in the <code>src/index.ts</code> file. It may export as many things as the package offers.</p>-- <h4>Maintaining the sample</h4>- <p>Whenever you change objects exported by the DLL build, please review the content of the sample. Things to keep in mind:</p>- <ul>- <li>Review the list of loaded plugins in the configuration.</li>- <li>Review names of items registered in toolbars.</li>- </ul>-- <h3>The goal</h3>- <p>The primary purpose of the sample is to verify whether the plugins in the package will work together with CKEditor 5 created with the DLL approach.</p>-- <h3>Publishing the package</h3>- <p>- While releasing TypeScript package on npm, few things have to be taken care of:- </p>- <ul>- <li>Building DLL</li>- <li>Building TypeScript</li>- <li>Changing the <code>main</code> filed in <code>package.json</code> to <code>.js</code> extension</li>- </ul>- <p>- Likewise, after the release, there are few steps:- </p>- <ul>- <li>Deleting compiled TypeScript files (they are generated in the <code>src</code> directory, and create needless clutter)</li>- <li>Changing the <code>main</code> filed in <code>package.json</code> back to <code>.ts</code> extension</li>- </ul>- <p>- When calling <code>npm publish</code>, those steps are handled automatically by predefined <code>prepublishOnly</code> and <code>postpublish</code> scripts. To learn more, see <a href="https://docs.npmjs.com/cli/v7/using-npm/scripts#pre--post-scripts">NPM docs</a>.- </p>-- <h3>Reporting issues</h3>- <p>If you found a problem with CKEditor 5 or the package generator, please, report an issue:</p>- <ul>- <li><a href="https://github.com/ckeditor/ckeditor5/issues/new/choose">CKEditor 5</a></li>- <li><a href="https://github.com/ckeditor/create-ckeditor5-plugin/issues/new">The package generator</a></li>- </ul>-</div>--<!-- DLL builds are served from the `node_modules/` directory -->-<script src="../node_modules/ckeditor5/build/ckeditor5-dll.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-editor-classic/build/editor-classic.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-code-block/build/code-block.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-essentials/build/essentials.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-basic-styles/build/basic-styles.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-heading/build/heading.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-autoformat/build/autoformat.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-block-quote/build/block-quote.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-image/build/image.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-link/build/link.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-indent/build/indent.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-media-embed/build/media-embed.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-list/build/list.js"></script>-<script src="../node_modules/@ckeditor/ckeditor5-table/build/table.js"></script>--<!-- The "@triliumnext/ckeditor5-keyboard-marker" package DLL build is served from the `build/` directory -->-<script src="../build/keyboard-marker.js"></script>--<script>- console.log( 'Objects exported by the DLL build:', CKEditor5[ 'keyboardMarker' ] );-- CKEditor5.editorClassic.ClassicEditor- .create( document.querySelector( '#editor' ), {- plugins: [- CKEditor5[ 'keyboardMarker' ].KeyboardMarker,- CKEditor5.essentials.Essentials,- CKEditor5.autoformat.Autoformat,- CKEditor5.blockQuote.BlockQuote,- CKEditor5.basicStyles.Bold,- CKEditor5.heading.Heading,- CKEditor5.image.Image,- CKEditor5.image.ImageCaption,- CKEditor5.image.ImageStyle,- CKEditor5.image.ImageToolbar,- CKEditor5.image.ImageUpload,- CKEditor5.indent.Indent,- CKEditor5.basicStyles.Italic,- CKEditor5.link.Link,- CKEditor5.list.List,- CKEditor5.mediaEmbed.MediaEmbed,- CKEditor5.paragraph.Paragraph,- CKEditor5.table.Table,- CKEditor5.table.TableToolbar,- CKEditor5.codeBlock.CodeBlock,- CKEditor5.basicStyles.Code,- CKEditor5.upload.Base64UploadAdapter- ],- toolbar: [- 'keyboardMarker',- '|',- 'heading',- '|',- 'bold',- 'italic',- 'link',- 'code',- 'bulletedList',- 'numberedList',- '|',- 'outdent',- 'indent',- '|',- 'uploadImage',- 'blockQuote',- 'insertTable',- 'mediaEmbed',- 'codeBlock',- '|',- 'undo',- 'redo'- ],- image: {- toolbar: [- 'imageStyle:inline',- 'imageStyle:block',- 'imageStyle:side',- '|',- 'imageTextAlternative'- ]- },- table: {- contentToolbar: [- 'tableColumn',- 'tableRow',- 'mergeTableCells'- ]- }- } )- .then( editor => {- window.editor = editor;- } )- .catch( error => {- console.error( 'There was a problem initializing the editor.', error );- } );-</script>-</body>-</html>diff --git a/packages/ckeditor5-keyboard-marker/sample/index.html b/packages/ckeditor5-keyboard-marker/sample/index.htmldeleted file mode 100644index d55ccb92bd..0000000000--- a/packages/ckeditor5-keyboard-marker/sample/index.html+++ /dev/null@@ -1,123 +0,0 @@-<!DOCTYPE html>-<html lang="en">--<head>- <link rel="icon" type="image/png" href="https://ckeditor.com/docs/ckeditor5/latest/assets/img/favicons/32x32.png"- sizes="32x32">- <meta charset="utf-8">- <title>CKEditor 5 – Development Sample</title>- <style>- body {- max-width: 800px;- margin: 20px auto;- }- </style>-</head>--<body>-- <h1>CKEditor 5 – Development Sample</h1>-- <div id="editor">- <h2>Development environment</h2>- <p>- This is a demo of the <a- href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#classic-editor">classic- editor- build</a> that loads your plugin (<code>KeyboardMarker</code>) generated by the- tool. You can modify this- sample and use it to validate whether a plugin or a set of plugins work fine.- </p>- <p>- <code>KeyboardMarker</code> inserts text into the editor. You can click the- CKEditor 5 icon in the toolbar and see the results.- </p>-- <h3>Helpful resources</h3>- <ul>- <li>Architecture- <ul>- <li>- <a- href="https://ckeditor.com/docs/ckeditor5/latest/framework/guides/architecture/core-editor-architecture.html">Core- editor architecture</a>- </li>- </ul>- <ul>- <li>- <a- href="https://ckeditor.com/docs/ckeditor5/latest/framework/guides/architecture/editing-engine.html">The- editing engine</a>- </li>- </ul>- <ul>- <li>- <a- href="https://ckeditor.com/docs/ckeditor5/latest/framework/guides/architecture/ui-library.html">The- UI library</a>- </li>- </ul>- </li>-- <li>- <a- href="https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/browser-compatibility.html">Browser- compatibility</a>- </li>-- <li>- <a href="https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html">The error- codes</a>- </li>-- <li><a href="https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/dll-builds.html">The DLL- builds</a></li>- </ul>-- <h3>The directory structure</h3>-- <p>- The code snippet below presents the directory structure.- </p>-- <pre><code class="language-plaintext">.-├─ lang-│ └─ contexts.json # Entries used for creating translations.-├─ sample-│ ├─ dll.html # The editor initialized using the DLL builds. Check README for details.-│ ├─ index.html # The currently displayed file.-│ └─ ckeditor.ts # The editor initialization script.-├─ src-│ ├─ keyboardmarker.ts-│ ├─ augmentation.ts # Type augmentations for the `@ckeditor/ckeditor5-core` module. Read more in <a href="https://ckeditor.com/docs/ckeditor5/latest/api/module_core_plugincollection-PluginsMap.html">PluginsMap</a> and <a href="https://ckeditor.com/docs/ckeditor5/latest/api/module_core_commandcollection-CommandsMap.html">CommandsMap</a>.-│ ├─ index.ts # The modules exported by the package when using the DLL builds.-│ └─ **/*.ts # All TypeScript source files should be saved here.-├─ tests-│ ├─ keyboardmarker.ts-│ ├─ index.ts # Tests for the plugin.-│ └─ **/*.ts # All tests should be saved here.-├─ theme-│ ├─ icons-│ │ ├─ ckeditor.svg # The CKEditor 5 icon displayed in the toolbar.-│ │ └─ **/*.svg # All icon files should be saved here.-│ └─ **/*.css # All CSS files should be saved here.-├─ typings-│ └─ **/*.d.ts # Files containing type definitions.-├─ .editorconfig-├─ ...-├─ README.md-└─ tsconfig.json # TypeScript configuration file.</code></pre>-- <h3>Reporting issues</h3>- <p>If you found a problem with CKEditor 5 or the package generator, please, report an issue:</p>- <ul>- <li><a href="https://github.com/ckeditor/ckeditor5/issues/new/choose">CKEditor 5</a></li>- <li><a href="https://github.com/ckeditor/ckeditor5-package-generator/issues/new">The package generator</a>- </li>- </ul>- </div>-- <script src="./ckeditor.dist.js"></script>-</body>--</html>diff --git a/packages/ckeditor5-keyboard-marker/src/augmentation.ts b/packages/ckeditor5-keyboard-marker/src/augmentation.tsdeleted file mode 100644index 99f615c843..0000000000--- a/packages/ckeditor5-keyboard-marker/src/augmentation.ts+++ /dev/null@@ -1,9 +0,0 @@-import type { Kbd, KbdEditing, KbdUI } from './index.js';--declare module 'ckeditor5' {- interface PluginsMap {- [ Kbd.pluginName ]: Kbd;- [ KbdUI.pluginName ]: KbdUI;- [ KbdEditing.pluginName ]: KbdEditing;- }-}diff --git a/packages/ckeditor5-keyboard-marker/src/index.ts b/packages/ckeditor5-keyboard-marker/src/index.tsdeleted file mode 100644index 8b4dfd21fa..0000000000--- a/packages/ckeditor5-keyboard-marker/src/index.ts+++ /dev/null@@ -1,10 +0,0 @@-import kbdIcon from '../theme/icons/kbd.svg?raw';-import './augmentation.js';--export { default as Kbd } from './kbd.js';-export { default as KbdEditing } from "./kbdediting.js";-export { default as KbdUI } from "./kbdui.js";--export const icons = {- kbdIcon-};diff --git a/packages/ckeditor5-keyboard-marker/src/kbd.ts b/packages/ckeditor5-keyboard-marker/src/kbd.tsdeleted file mode 100644index 6e25d4dd08..0000000000--- a/packages/ckeditor5-keyboard-marker/src/kbd.ts+++ /dev/null@@ -1,22 +0,0 @@-import { Plugin } from 'ckeditor5';-import KbdEditing from './kbdediting.js';-import KbdUI from './kbdui.js';--/**- * The keyboard shortcut feature.- *- * Provides a way to semantically mark keyboard shortcuts/hotkeys in the content.- *- * This is a "glue" plugin which loads the `KbdEditing` and `KbdUI` plugins.- */-export default class Kbd extends Plugin {-- static get requires() {- return [ KbdEditing, KbdUI ];- }-- public static get pluginName() {- return 'Kbd' as const;- }--}diff --git a/packages/ckeditor5-keyboard-marker/src/kbdediting.ts b/packages/ckeditor5-keyboard-marker/src/kbdediting.tsdeleted file mode 100644index be9cd35833..0000000000--- a/packages/ckeditor5-keyboard-marker/src/kbdediting.ts+++ /dev/null@@ -1,50 +0,0 @@-import { AttributeCommand, Plugin, TwoStepCaretMovement } from "ckeditor5";--const KBD = 'kbd';--/**- * The keyboard shortcut (`kbd`) editing feature.- *- * It registers the `'kbd'` command, associated keystroke and introduces the- * `kbd` attribute in the model which renders to the view as a `<kbd>` element.- */-export default class KbdEditing extends Plugin {-- public static get pluginName() {- return 'KbdEditing' as const;- }-- public static get requires() {- return [ TwoStepCaretMovement ] as const;- }-- /**- * @inheritDoc- */- init() {- const editor = this.editor;-- // Allow kbd attribute on text nodes.- editor.model.schema.extend( '$text', { allowAttributes: KBD } );- editor.model.schema.setAttributeProperties( KBD, {- isFormatting: true,- copyOnEnter: false- } );-- // Enable two-step caret movement so the user can arrow out of the kbd element.- editor.plugins.get( TwoStepCaretMovement ).registerAttribute( KBD );-- editor.conversion.attributeToElement( {- model: KBD,- view: {- name: KBD,- attributes: {- spellcheck: 'false'- }- }- } );-- editor.commands.add( KBD, new AttributeCommand( editor, KBD ) );- editor.keystrokes.set( 'CTRL+ALT+K', KBD );- }-}diff --git a/packages/ckeditor5-keyboard-marker/src/kbdui.ts b/packages/ckeditor5-keyboard-marker/src/kbdui.tsdeleted file mode 100644index 0d12a7d28e..0000000000--- a/packages/ckeditor5-keyboard-marker/src/kbdui.ts+++ /dev/null@@ -1,45 +0,0 @@-import { AttributeCommand, ButtonView, Plugin } from 'ckeditor5';-import kbdIcon from '../theme/icons/kbd.svg?raw';--const KBD = 'kbd';--/**- * The keyboard shortcut UI feature. It brings a proper button.- */-export default class KbdUI extends Plugin {-- public static get pluginName() {- return 'KbdUI' as const;- }-- /**- * @inheritDoc- */- init() {- const editor = this.editor;- const t = editor.t;-- editor.ui.componentFactory.add( KBD, locale => {- const command = editor.commands.get( KBD ) as AttributeCommand;- const view = new ButtonView( locale );-- view.set( {- label: t( 'Keyboard shortcut' ),- icon: kbdIcon,- keystroke: 'CTRL+ALT+K',- tooltip: true,- isToggleable: true- } );-- view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );-- // Execute command.- this.listenTo( view, 'execute', () => {- editor.execute( KBD );- editor.editing.view.focus();- } );-- return view;- } );- }-}diff --git a/packages/ckeditor5-keyboard-marker/tests/kbd.ts b/packages/ckeditor5-keyboard-marker/tests/kbd.tsdeleted file mode 100644index 29bde4a189..0000000000--- a/packages/ckeditor5-keyboard-marker/tests/kbd.ts+++ /dev/null@@ -1,72 +0,0 @@-import { ClassicEditor, Paragraph } from 'ckeditor5';-import { afterEach, beforeEach, describe, expect, it } from 'vitest';-import { icons, Kbd, KbdEditing, KbdUI } from '../src/index.js';--describe( 'Kbd', () => {- let editorElement: HTMLDivElement, editor: ClassicEditor;-- beforeEach( async () => {- editorElement = document.createElement( 'div' );- document.body.appendChild( editorElement );-- editor = await ClassicEditor.create( editorElement, {- plugins: [ Paragraph, Kbd ],- licenseKey: 'GPL'- } );- } );-- afterEach( async () => {- editorElement.remove();-- await editor.destroy();- } );-- it( 'loads the glue plugin and its editing/UI parts', () => {- expect( editor.plugins.get( Kbd ) ).toBeInstanceOf( Kbd );- expect( editor.plugins.get( KbdEditing ) ).toBeInstanceOf( KbdEditing );- expect( editor.plugins.get( KbdUI ) ).toBeInstanceOf( KbdUI );- expect( Kbd.pluginName ).toBe( 'Kbd' );- expect( icons.kbdIcon ).toContain( '<svg' );- } );-- it( 'allows the kbd attribute on text and marks it as formatting', () => {- expect( editor.model.schema.checkAttribute( '$text', 'kbd' ) ).toBe( true );-- // Regression guard: kbd is a discrete inline token, so pressing Enter must NOT- // carry the formatting onto the next paragraph (mirrors inline `code`, unlike bold/italic).- expect( editor.model.schema.getAttributeProperties( 'kbd' ) ).toEqual( {- isFormatting: true,- copyOnEnter: false- } );- } );-- it( 'downcasts the kbd attribute to a <kbd> element with spellcheck disabled', () => {- editor.setData( '<p>Ctrl</p>' );-- const root = editor.model.document.getRoot();- editor.model.change( writer => {- writer.setSelection( root?.getChild( 0 ) ?? null, 'in' );- } );- editor.execute( 'kbd' );-- expect( editor.getData() ).toBe( '<p><kbd spellcheck="false">Ctrl</kbd></p>' );- } );-- it( 'upcasts a <kbd> element back to the kbd attribute', () => {- editor.setData( '<p>Press <kbd spellcheck="false">Ctrl</kbd>.</p>' );-- expect( editor.getData() ).toBe( '<p>Press <kbd spellcheck="false">Ctrl</kbd>.</p>' );- } );-- it( 'registers the toolbar button bound to the command', () => {- const button = editor.ui.componentFactory.create( 'kbd' );- const command = editor.commands.get( 'kbd' );-- expect( button.isToggleable ).toBe( true );- expect( button.isOn ).toBe( false );-- button.fire( 'execute' );-- expect( command?.value ).toBe( true );- } );-} );diff --git a/packages/ckeditor5-keyboard-marker/tsconfig.json b/packages/ckeditor5-keyboard-marker/tsconfig.jsondeleted file mode 100644index 4248cd9589..0000000000--- a/packages/ckeditor5-keyboard-marker/tsconfig.json+++ /dev/null@@ -1,41 +0,0 @@-{- "compilerOptions": {- /**- * TypeScript automagically loads typings from all "@types/*" packages if the "compilerOptions.types" array is not defined in- * this file. However, if some dependencies have "@types/*" packages as their dependencies, they'll also be loaded as well.- * As a result, TypeScript loaded "@types/node" which we don't want to use, because it allows using Node.js specific APIs that- * are not available in the browsers.- *- * To avoid such issues, we defined this empty "types" to disable automatic inclusion of the "@types/*" packages.- */- "types": [],- "lib": [- "ES2019", // Must match the "target".- "ES2020.String",- "DOM",- "DOM.Iterable"- ],- "noImplicitAny": true,- "noImplicitOverride": true,- "strict": true,- "composite": true,- "target": "es2019",- "sourceMap": true,- "allowJs": true,- "moduleDetection": "force",- "moduleResolution": "NodeNext",- "module": "NodeNext",- "skipLibCheck": true,- "noUncheckedSideEffectImports": false,- "outDir": "out-tsc",- "typeRoots": [- "typings",- "node_modules/@types"- ]- },- "include": [- "./sample",- "./src",- "./typings"- ]-}diff --git a/packages/ckeditor5-keyboard-marker/tsconfig.test.json b/packages/ckeditor5-keyboard-marker/tsconfig.test.jsondeleted file mode 100644index 065d98e49b..0000000000--- a/packages/ckeditor5-keyboard-marker/tsconfig.test.json+++ /dev/null@@ -1,15 +0,0 @@-{- "extends": "./tsconfig.json",- "compilerOptions": {- "types": [- "@types/mocha"- ],- "sourceMap": true- },- "include": [- "./sample",- "./src",- "./tests",- "./typings"- ]-}diff --git a/packages/ckeditor5-keyboard-marker/typings/ckeditor5-inspector.d.ts b/packages/ckeditor5-keyboard-marker/typings/ckeditor5-inspector.d.tsdeleted file mode 100644index d50ee49c45..0000000000--- a/packages/ckeditor5-keyboard-marker/typings/ckeditor5-inspector.d.ts+++ /dev/null@@ -1,7 +0,0 @@-declare module '@ckeditor/ckeditor5-inspector' {- const inspector: {- attach( editor: any ): void;- };-- export default inspector;-}diff --git a/packages/ckeditor5-keyboard-marker/typings/types.d.ts b/packages/ckeditor5-keyboard-marker/typings/types.d.tsdeleted file mode 100644index 09be57e1c9..0000000000--- a/packages/ckeditor5-keyboard-marker/typings/types.d.ts+++ /dev/null@@ -1,4 +0,0 @@-declare module '*.svg?raw' {- const content: string;- export default content;-}diff --git a/packages/ckeditor5-keyboard-marker/vitest.config.ts b/packages/ckeditor5-keyboard-marker/vitest.config.tsdeleted file mode 100644index 2ee66335e2..0000000000--- a/packages/ckeditor5-keyboard-marker/vitest.config.ts+++ /dev/null@@ -1,41 +0,0 @@-/**- * @license Copyright (c) 2023-2024, CKSource Holding sp. z o.o. All rights reserved.- * For licensing, see LICENSE.md.- */--import { defineConfig } from 'vitest/config';-import svg from 'vite-plugin-svgo';-import { webdriverio } from "@vitest/browser-webdriverio";--export default defineConfig( {- plugins: [- svg()- ],- test: {- browser: {- enabled: true,- provider: webdriverio(),- headless: true,- ui: false,- instances: [ { browser: 'chrome' } ]- },- include: [- 'tests/**/*.[jt]s'- ],- globals: true,- watch: false,- passWithNoTests: true,- coverage: {- thresholds: {- lines: 100,- functions: 100,- branches: 100,- statements: 100- },- provider: 'v8',- include: [ 'src/**/*.{ts,tsx}' ],- exclude: [ '**/*.{test,spec}.{ts,mts,cts,tsx,js,jsx}', '**/*.d.ts' ],- reporter: [ 'text' ]- }- }-} );diff --git a/packages/ckeditor5/package.json b/packages/ckeditor5/package.jsonindex d798a0f486..78389f9530 100644--- a/packages/ckeditor5/package.json+++ b/packages/ckeditor5/package.json@@ -19,7 +19,6 @@"@triliumnext/ckeditor5-collapsible": "workspace:*","@triliumnext/ckeditor5-utils": "workspace:*","@triliumnext/ckeditor5-footnotes": "workspace:*",- "@triliumnext/ckeditor5-keyboard-marker": "workspace:*","@triliumnext/ckeditor5-math": "workspace:*","@triliumnext/ckeditor5-mermaid": "workspace:*","ckeditor5": "48.3.1"diff --git a/packages/ckeditor5-keyboard-marker/theme/icons/kbd.svg b/packages/ckeditor5/src/icons/kbd.svgsimilarity index 100%rename from packages/ckeditor5-keyboard-marker/theme/icons/kbd.svgrename to packages/ckeditor5/src/icons/kbd.svgdiff --git a/packages/ckeditor5/src/plugins.ts b/packages/ckeditor5/src/plugins.tsindex 7149f934a5..eb1e23443b 100644--- a/packages/ckeditor5/src/plugins.ts+++ b/packages/ckeditor5/src/plugins.ts@@ -23,7 +23,7 @@ import IncludeNote from "./plugins/includenote.js";import LinkEmbed from "./plugins/link_embed/link_embed.js";import Uploadfileplugin from "./plugins/file_upload/uploadfileplugin.js";import SyntaxHighlighting from "./plugins/syntax_highlighting/index.js";-import { Kbd } from "@triliumnext/ckeditor5-keyboard-marker";+import Kbd from "./plugins/keyboard_marker/keyboard_marker.js";import { Mermaid } from "@triliumnext/ckeditor5-mermaid";import { Admonition } from "@triliumnext/ckeditor5-admonition";import { Collapsible } from "@triliumnext/ckeditor5-collapsible";diff --git a/packages/ckeditor5-keyboard-marker/LICENSE b/packages/ckeditor5/src/plugins/keyboard_marker/LICENSEsimilarity index 100%rename from packages/ckeditor5-keyboard-marker/LICENSErename to packages/ckeditor5/src/plugins/keyboard_marker/LICENSEdiff --git a/packages/ckeditor5/src/plugins/keyboard_marker/README.md b/packages/ckeditor5/src/plugins/keyboard_marker/README.mdnew file mode 100644index 0000000000..1c9265d9ac--- /dev/null+++ b/packages/ckeditor5/src/plugins/keyboard_marker/README.md@@ -0,0 +1,20 @@+# Keyboard marker++Adds support for the keyboard input element (`<kbd>`) to CKEditor 5: a `kbd` text attribute, a+`kbd` command, the <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>K</kbd> keystroke and a toolbar button.++## Provenance++Derived from [mlewand/ckeditor5-keyboard-marker](https://github.com/mlewand/ckeditor5-keyboard-marker)+by Marek Lewandowski, licensed **GPL-3.0** — see [`LICENSE`](./LICENSE) next to this file.++The source was ported to TypeScript and to current CKEditor 5 APIs, and has since diverged from+upstream (two-step caret movement, `spellcheck="false"` on the downcast element, and+`copyOnEnter: false` so the formatting does not carry onto the next paragraph). Upstream targets a+long-obsolete CKEditor 5 version and is not tracked; treat this as Trilium-maintained code.++It lived at `packages/ckeditor5-keyboard-marker` until it was folded into this package — it had no+consumers outside `@triliumnext/ckeditor5`, was never published, and carried a full+`ckeditor5-package-generator` scaffold (sample pages, its own ESLint/Stylelint/vitest configs) that+nothing invoked. GPL-3.0 combines with this repository's AGPL-3.0-only license, so the split bought+no license isolation either.diff --git a/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker.spec.ts b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker.spec.tsnew file mode 100644index 0000000000..3c19d1f6b8--- /dev/null+++ b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker.spec.ts@@ -0,0 +1,59 @@+import { _setModelData as setModelData, ButtonView, ClassicEditor, Paragraph } from "ckeditor5";+import { beforeEach, describe, expect, it } from "vitest";++import { createTestEditor } from "../../../test/editor-kit.js";+import Kbd from "./keyboard_marker.js";+import KbdEditing from "./keyboard_marker_editing.js";+import KbdUI from "./keyboard_marker_ui.js";++describe("Kbd", () => {+ let editor: ClassicEditor;++ beforeEach(async () => {+ editor = await createTestEditor([Paragraph, Kbd]);+ });++ it("loads the glue plugin and its editing/UI parts", () => {+ expect(editor.plugins.get(Kbd)).toBeInstanceOf(Kbd);+ expect(editor.plugins.get(KbdEditing)).toBeInstanceOf(KbdEditing);+ expect(editor.plugins.get(KbdUI)).toBeInstanceOf(KbdUI);+ expect(Kbd.pluginName).toBe("Kbd");+ });++ it("allows the kbd attribute on text and marks it as formatting", () => {+ expect(editor.model.schema.checkAttribute("$text", "kbd")).toBe(true);++ // Regression guard: kbd is a discrete inline token, so pressing Enter must NOT+ // carry the formatting onto the next paragraph (mirrors inline `code`, unlike bold/italic).+ expect(editor.model.schema.getAttributeProperties("kbd")).toEqual({+ isFormatting: true,+ copyOnEnter: false+ });+ });++ it("downcasts the kbd attribute to a <kbd> element with spellcheck disabled", () => {+ setModelData(editor.model, "<paragraph>[Ctrl]</paragraph>");++ editor.execute("kbd");++ expect(editor.getData()).toBe(`<p><kbd spellcheck="false">Ctrl</kbd></p>`);+ });++ it("upcasts a <kbd> element back to the kbd attribute", () => {+ editor.setData(`<p>Press <kbd spellcheck="false">Ctrl</kbd>.</p>`);++ expect(editor.getData()).toBe(`<p>Press <kbd spellcheck="false">Ctrl</kbd>.</p>`);+ });++ it("registers the toolbar button bound to the command", () => {+ const button = editor.ui.componentFactory.create("kbd") as unknown as ButtonView;+ const command = editor.commands.get("kbd");++ expect(button.isToggleable).toBe(true);+ expect(button.isOn).toBe(false);++ button.fire("execute");++ expect(command?.value).toBe(true);+ });+});diff --git a/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker.ts b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker.tsnew file mode 100644index 0000000000..2194ea6a3e--- /dev/null+++ b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker.ts@@ -0,0 +1,34 @@+import { Plugin } from "ckeditor5";++import KbdEditing from "./keyboard_marker_editing.js";+import KbdUI from "./keyboard_marker_ui.js";++/**+ * The keyboard shortcut feature.+ *+ * Provides a way to semantically mark keyboard shortcuts/hotkeys in the content.+ *+ * This is a "glue" plugin which loads the {@link KbdEditing} and {@link KbdUI} plugins.+ *+ * Derived from `@mlewand/ckeditor5-keyboard-marker` (GPL-3.0); see the `LICENSE` and `README.md`+ * next to this file.+ */+export default class Kbd extends Plugin {++ static get requires() {+ return [KbdEditing, KbdUI] as const;+ }++ public static get pluginName() {+ return "Kbd" as const;+ }++}++declare module "ckeditor5" {+ interface PluginsMap {+ [Kbd.pluginName]: Kbd;+ [KbdEditing.pluginName]: KbdEditing;+ [KbdUI.pluginName]: KbdUI;+ }+}diff --git a/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker_editing.ts b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker_editing.tsnew file mode 100644index 0000000000..8d6cb7dc2c--- /dev/null+++ b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker_editing.ts@@ -0,0 +1,51 @@+import { AttributeCommand, Plugin, TwoStepCaretMovement } from "ckeditor5";++const KBD = "kbd";++/**+ * The keyboard shortcut (`kbd`) editing feature.+ *+ * It registers the `'kbd'` command, associated keystroke and introduces the+ * `kbd` attribute in the model which renders to the view as a `<kbd>` element.+ */+export default class KbdEditing extends Plugin {++ public static get pluginName() {+ return "KbdEditing" as const;+ }++ public static get requires() {+ return [TwoStepCaretMovement] as const;+ }++ /**+ * @inheritDoc+ */+ init() {+ const editor = this.editor;++ // Allow kbd attribute on text nodes.+ editor.model.schema.extend("$text", { allowAttributes: KBD });+ editor.model.schema.setAttributeProperties(KBD, {+ isFormatting: true,+ copyOnEnter: false+ });++ // Enable two-step caret movement so the user can arrow out of the kbd element.+ editor.plugins.get(TwoStepCaretMovement).registerAttribute(KBD);++ editor.conversion.attributeToElement({+ model: KBD,+ view: {+ name: KBD,+ attributes: {+ spellcheck: "false"+ }+ }+ });++ editor.commands.add(KBD, new AttributeCommand(editor, KBD));+ editor.keystrokes.set("CTRL+ALT+K", KBD);+ }++}diff --git a/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker_ui.ts b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker_ui.tsnew file mode 100644index 0000000000..641c4ec330--- /dev/null+++ b/packages/ckeditor5/src/plugins/keyboard_marker/keyboard_marker_ui.ts@@ -0,0 +1,47 @@+import { AttributeCommand, ButtonView, Plugin } from "ckeditor5";++import kbdIcon from "../../icons/kbd.svg?raw";++const KBD = "kbd";++/**+ * The keyboard shortcut UI feature. It brings a proper button.+ */+export default class KbdUI extends Plugin {++ public static get pluginName() {+ return "KbdUI" as const;+ }++ /**+ * @inheritDoc+ */+ init() {+ const editor = this.editor;+ const t = editor.t;++ editor.ui.componentFactory.add(KBD, (locale) => {+ const command = editor.commands.get(KBD) as AttributeCommand;+ const view = new ButtonView(locale);++ view.set({+ label: t("Keyboard shortcut"),+ icon: kbdIcon,+ keystroke: "CTRL+ALT+K",+ tooltip: true,+ isToggleable: true+ });++ view.bind("isOn", "isEnabled").to(command, "value", "isEnabled");++ // Execute command.+ this.listenTo(view, "execute", () => {+ editor.execute(KBD);+ editor.editing.view.focus();+ });++ return view;+ });+ }++}diff --git a/packages/ckeditor5/tsconfig.json b/packages/ckeditor5/tsconfig.jsonindex 26a45d76cb..75f71ff710 100644--- a/packages/ckeditor5/tsconfig.json+++ b/packages/ckeditor5/tsconfig.json@@ -15,9 +15,6 @@{"path": "../ckeditor5-mermaid"},- {- "path": "../ckeditor5-keyboard-marker"- },{"path": "../ckeditor5-utils"},diff --git a/packages/ckeditor5/tsconfig.lib.json b/packages/ckeditor5/tsconfig.lib.jsonindex ff66415d5c..addb47c0f5 100644--- a/packages/ckeditor5/tsconfig.lib.json+++ b/packages/ckeditor5/tsconfig.lib.json@@ -36,9 +36,6 @@{"path": "../ckeditor5-mermaid"},- {- "path": "../ckeditor5-keyboard-marker"- },{"path": "../ckeditor5-utils"}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 28ead24081..6fa8590971 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1103,9 +1103,6 @@ importers:'@triliumnext/ckeditor5-footnotes':specifier: workspace:*version: link:../ckeditor5-footnotes- '@triliumnext/ckeditor5-keyboard-marker':- specifier: workspace:*- version: link:../ckeditor5-keyboard-marker'@triliumnext/ckeditor5-math':specifier: workspace:*version: link:../ckeditor5-math@@ -1232,42 +1229,6 @@ importers:specifier: 9.30.0version: 9.30.0([email protected])- packages/ckeditor5-keyboard-marker:- devDependencies:- '@ckeditor/ckeditor5-inspector':- specifier: '>=4.1.0'- version: 5.0.3- '@vitest/browser':- specifier: 4.1.10- version: 4.1.10([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])- ckeditor5:- specifier: 48.3.1- version: 48.3.1([email protected])- eslint:- specifier: 10.8.0- version: 10.8.0([email protected])([email protected])- eslint-config-ckeditor5:- specifier: '>=9.1.0'- version: 19.0.0([email protected]([email protected])([email protected]))([email protected])([email protected])- stylelint:- specifier: 17.14.1- version: 17.14.1([email protected])([email protected])- stylelint-config-ckeditor5:- specifier: '>=9.1.0'- typescript:- specifier: 6.0.3- version: 6.0.3- vite-plugin-svgo:- specifier: 2.0.0- version: 2.0.0([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))- vitest:- specifier: 4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])(@vitest/[email protected])(@vitest/[email protected])([email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))- webdriverio:- specifier: 9.30.0- version: 9.30.0([email protected])-packages/ckeditor5-math:dependencies:'@ckeditor/ckeditor5-icons':diff --git a/scripts/analyze-perf.ts b/scripts/analyze-perf.tsindex 94c3dd5e60..8d677ed7f8 100644--- a/scripts/analyze-perf.ts+++ b/scripts/analyze-perf.ts@@ -191,7 +191,7 @@ function analyzePerf(entries: PerfEntry[]) {e.file.includes('footnotes') ||e.file.includes('math') ||e.file.includes('mermaid') ||- e.file.includes('keyboard-marker'))+ e.file.includes('keyboard_marker')));const byCKPlugin = new Map<string, AggregatedStats>();@@ -201,7 +201,7 @@ function analyzePerf(entries: PerfEntry[]) {else if (entry.file.includes('footnotes')) plugin = 'footnotes';else if (entry.file.includes('math')) plugin = 'math';else if (entry.file.includes('mermaid')) plugin = 'mermaid';- else if (entry.file.includes('keyboard-marker')) plugin = 'keyboard-marker';+ else if (entry.file.includes('keyboard_marker')) plugin = 'keyboard-marker';if (!byCKPlugin.has(plugin)) {byCKPlugin.set(plugin, { totalTime: 0, count: 0, files: [] });diff --git a/tsconfig.json b/tsconfig.jsonindex 6fcdc2b198..7b02a802c9 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -45,9 +45,6 @@{"path": "./packages/ckeditor5"},- {- "path": "./packages/ckeditor5-keyboard-marker"- },{"path": "./packages/ckeditor5-mermaid"},