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
chore(skills): standardize example imports to the ckeditor5 aggregate
Elian Doran63dc917490f8
diff --git a/.claude/skills/ckeditor5-plugin-development/SKILL.md b/.claude/skills/ckeditor5-plugin-development/SKILL.mdindex 03cc619c87..3140acdab7 100644--- a/.claude/skills/ckeditor5-plugin-development/SKILL.md+++ b/.claude/skills/ckeditor5-plugin-development/SKILL.md@@ -45,6 +45,21 @@ data (HTML) ──upcast──▶ MODEL ──editing downcast──▶ editing└────data downcast──────▶ data view ──▶ getData()/output HTML```+## Importing CKEditor in your project++In your own project, import everything from the single **`ckeditor5`** npm package (and+`ckeditor5-premium-features` for premium plugins):++```js+import { Plugin, Command, ButtonView, Widget, toWidget } from 'ckeditor5';+```++The `@ckeditor/ckeditor5-*` paths you'll see in the library's own source (and cited in+`references/core-plugin-patterns.md`) resolve to the same symbols, but downstream you should import+from `ckeditor5` to avoid duplicate-module-instance problems. The routine exception is the+**CKEditor Inspector**, a separate dev-only package:+`import CKEditorInspector from '@ckeditor/ckeditor5-inspector';`.+## Plugin anatomyA plugin implements `PluginInterface`; the easy way is to extend `Plugin`. A plain functiondiff --git a/.claude/skills/ckeditor5-plugin-development/references/core-plugin-patterns.md b/.claude/skills/ckeditor5-plugin-development/references/core-plugin-patterns.mdindex ba752c7dd6..e37489336a 100644--- a/.claude/skills/ckeditor5-plugin-development/references/core-plugin-patterns.md+++ b/.claude/skills/ckeditor5-plugin-development/references/core-plugin-patterns.md@@ -9,6 +9,13 @@ Real-world idioms mined from the actual upstream `packages/*/src` source (verifilibrary at the baseline commit). These go beyond the tutorials and are the patterns the officialplugins actually use. Each item cites its source file in the upstream repository.+**Downstream imports.** The snippets keep the symbol names but, in your own project, import them all+from the single **`ckeditor5`** package — e.g. `import { Plugin, ButtonView,+MenuBarMenuListItemButtonView, AttributeCommand, TwoStepCaretMovement, findAttributeRange,+inlineHighlight, Widget, toWidget, WidgetToolbarRepository } from 'ckeditor5';`. Where a snippet+shows an `@ckeditor/ckeditor5-*` or relative `../utils.js` import (the library's internal style),+treat it as a pointer to where the symbol lives, not the path you'd write downstream.+## Toolbar + menu-bar button in one factoryOfficial feature-UI plugins register **both** a toolbar button and a menu-bar item from a single@@ -16,9 +23,11 @@ shared factory, using the `menuBar:` name prefix. The button binds to the commanthe editor on execute.```ts-// packages/ckeditor5-basic-styles/src/bold/boldui.ts (+ utils.ts getButtonCreator)-import { ButtonView, MenuBarMenuListItemButtonView } from '@ckeditor/ckeditor5-ui';-import { getButtonCreator } from '../utils.js';+// Source: packages/ckeditor5-basic-styles/src/{bold/boldui.ts, utils.ts}+import { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5';+// The shared factory is the library's internal helper; downstream import it as+// `_getBasicStylesButtonCreator` from 'ckeditor5', or write the ~12-line factory yourself.+import { _getBasicStylesButtonCreator as getButtonCreator } from 'ckeditor5';const createButton = getButtonCreator( {editor, commandName: 'bold', plugin: this,@@ -101,13 +110,13 @@ For attributes that wrap text and need correct caret behavior at their edges:```ts// packages/ckeditor5-link/src/linkediting.ts-import { TwoStepCaretMovement, inlineHighlight } from '@ckeditor/ckeditor5-typing';+import { TwoStepCaretMovement, inlineHighlight } from 'ckeditor5'; // source: @ckeditor/ckeditor5-typingeditor.plugins.get( TwoStepCaretMovement ).registerAttribute( 'linkHref' ); // caret stops at edgesinlineHighlight( editor, 'linkHref', 'a', 'ck-link_selected' ); // class when caret inside// packages/ckeditor5-link/src/linkcommand.ts-import { findAttributeRange } from '@ckeditor/ckeditor5-typing';+import { findAttributeRange } from 'ckeditor5'; // source: @ckeditor/ckeditor5-typingconst linkRange = findAttributeRange( position, 'linkHref', linkHref, model ); // whole same-value run```diff --git a/.claude/skills/ckeditor5-testing/SKILL.md b/.claude/skills/ckeditor5-testing/SKILL.mdindex f14d229800..8e22bab8eb 100644--- a/.claude/skills/ckeditor5-testing/SKILL.md+++ b/.claude/skills/ckeditor5-testing/SKILL.md@@ -50,6 +50,10 @@ package-generator template; the **test-writing patterns** below transfer unchang`*config.ts`). Provider `v8`.- **TypeScript:** tests may be `.js` or `.ts`; import source with explicit `.js` extension(`../src/foo.js`).+- **Imports:** in your own project, import editor classes and the model/view helpers from the+ `ckeditor5` package (e.g. `import { ClassicEditor, _setModelData } from 'ckeditor5';`). The+ `@ckeditor/ckeditor5-core/tests/_utils/*` test editors shown below exist only in the ckeditor5+ monorepo — see `references/test-utilities.md` for the downstream alternative.## Running tests@@ -80,8 +84,9 @@ pnpm run test -- -c --files=core # with coverage```jsimport { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';+// ModelTestEditor lives in the ckeditor5 monorepo's tests/_utils (see references/test-utilities.md).import { ModelTestEditor } from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor.js';-import { _setModelData, _getModelData } from '@ckeditor/ckeditor5-engine';+import { _setModelData, _getModelData } from 'ckeditor5';import { ParagraphCommand } from '../src/paragraphcommand.js';describe( 'ParagraphCommand', () => {diff --git a/.claude/skills/ckeditor5-testing/references/test-utilities.md b/.claude/skills/ckeditor5-testing/references/test-utilities.mdindex 1a1aec3a95..7c06e39110 100644--- a/.claude/skills/ckeditor5-testing/references/test-utilities.md+++ b/.claude/skills/ckeditor5-testing/references/test-utilities.md@@ -65,8 +65,10 @@ feature-specific fixtures and helpers — follow the local conventions of the pa## Model & view data helpers-From `@ckeditor/ckeditor5-engine` (the `dev-utils` model/view modules). They stringify/parse-engine structures and are the backbone of assertions. **Test/debug only — never in `src/`.**+From the engine's `dev-utils` modules. They are re-exported by the `ckeditor5` aggregate, so+**import them from `'ckeditor5'` in your own project** (or from `@ckeditor/ckeditor5-engine`, the+in-monorepo style). They stringify/parse engine structures and are the backbone of assertions.+**Test/debug only — never in `src/`.**Model:- `_setModelData( model, string )` — replace the document content + selection from a string.@@ -80,7 +82,7 @@ View:- `_stringifyView( node )` / `_parseView( string )`.```js-import { _setModelData, _getModelData, _getViewData } from '@ckeditor/ckeditor5-engine';+import { _setModelData, _getModelData, _getViewData } from 'ckeditor5';_setModelData( model, '<paragraph>foo[]bar</paragraph>' );expect( _getModelData( model ) ).toEqual( '<paragraph>foo[]bar</paragraph>' );