Skip to content

Build your personal knowledge base with Trilium Notes

docs(ckeditor5): make the admonition copyright headers reflect reality

Elian Doran62e95cfcd047
diff --git a/packages/ckeditor5/src/plugins/admonition/README.md b/packages/ckeditor5/src/plugins/admonition/README.md
index 219a183731..de155f9186 100644
--- a/packages/ckeditor5/src/plugins/admonition/README.md
+++ b/packages/ckeditor5/src/plugins/admonition/README.md
@@ -17,10 +17,29 @@ The feature is split the usual CKEditor way:
## Provenance
-Adapted from CKEditor 5's **block-quote** feature (`@ckeditor/ckeditor5-block-quote`), copyright
-CKSource Holding sp. z o.o., which Trilium forked to build admonitions on: the command, editing
-plugin and UI plugin still carry the CKSource license header, and the command's internals still
-speak in terms of "quotes". The autoformat, toolbar and type-dropdown parts are Trilium's own.
+The feature began as a copy of CKEditor 5's **block-quote** plugin
+(`@ckeditor/ckeditor5-block-quote`, copyright CKSource Holding sp. z o.o.) and was then tailored to
+admonitions — a different model element, a type attribute, its own styling and a different toolbar.
+How much of upstream survives varies a lot per file, so the headers say so individually rather than
+blanket-stamping the folder:
+
+| File | Relationship to `ckeditor5-block-quote` |
+|---|---|
+| `admonition_command.ts` | **Substantially derived.** The block grouping/splitting/merging logic is upstream's; the type attribute, `forceValue`/`usePreviousChoice` handling and retyping are ours |
+| `admonition_editing.ts` | **Substantially derived.** The post-fixer and Enter/Backspace break-out are upstream's; the schema, class-list upcast and downcast are ours |
+| `admonition.ts` | Same glue-plugin shape as upstream's `BlockQuote`, plus our autoformat |
+| `admonition_ui.ts` | **Ours.** Upstream has one toggle button; this is a split button with a type dropdown. Only the bind-and-focus idiom is shared |
+| `admonition_autoformat.ts` | **Ours.** No upstream counterpart |
+| `admonition_toolbar.ts`, `admonition_type_dropdown.ts` | **Ours.** No upstream counterpart |
+
+CKEditor 5 is dual-licensed; the derived files are used under its
+[GPL-2.0-or-later arm](https://ckeditor.com/legal/ckeditor-licensing-options), which combines with
+this repository's AGPL-3.0-only license. GPL-2.0 §2(a) requires derived files to carry notice that
+they were changed, which is what the headers on the two derived files do.
+
+Separately, [aarkue/ckeditor5-admonition](https://github.com/aarkue/ckeditor5-admonition) was an
+inspiration for the feature, the toolbar icon included — as recorded on the *Technologies used* page
+of the User Guide.
It lived at `packages/ckeditor5-admonition` until it was folded into this package — it had no
consumers outside `@triliumnext/ckeditor5`, was never published, and shipped a
diff --git a/packages/ckeditor5/src/plugins/admonition/admonition.ts b/packages/ckeditor5/src/plugins/admonition/admonition.ts
index 9d3a5b716e..21371b54d5 100644
--- a/packages/ckeditor5/src/plugins/admonition/admonition.ts
+++ b/packages/ckeditor5/src/plugins/admonition/admonition.ts
@@ -12,7 +12,8 @@ import AdmonitionUI from "./admonition_ui.js";
* This is a "glue" plugin which loads {@link AdmonitionEditing}, {@link AdmonitionUI} and
* {@link AdmonitionAutoformat}.
*
- * Adapted from CKEditor 5's block-quote feature; see the `README.md` next to this file.
+ * The feature began as a copy of CKEditor 5's block-quote plugin and has since been tailored to
+ * admonitions; `README.md` next to this file records which parts still derive from it.
*/
export default class Admonition extends Plugin {
diff --git a/packages/ckeditor5/src/plugins/admonition/admonition_command.ts b/packages/ckeditor5/src/plugins/admonition/admonition_command.ts
index f4c4ef41a6..69b95f6368 100644
--- a/packages/ckeditor5/src/plugins/admonition/admonition_command.ts
+++ b/packages/ckeditor5/src/plugins/admonition/admonition_command.ts
@@ -1,7 +1,14 @@
/**
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see the `README.md` next to this file or
- * https://ckeditor.com/legal/ckeditor-oss-license
+ * Derived from `BlockQuoteCommand` in `@ckeditor/ckeditor5-block-quote`.
+ * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
+ * Used under the GPL-2.0-or-later arm of CKEditor 5's dual license; see
+ * https://ckeditor.com/legal/ckeditor-licensing-options.
+ *
+ * Modified by the Trilium Notes contributors: the model element is `<aside>` rather than
+ * `<blockQuote>` and carries an `admonitionType` attribute, so `value` reports the admonition's
+ * type instead of a boolean, `execute()` takes `forceValue`/`usePreviousChoice` options resolved
+ * by `_getType()`, and `_applyQuote()` retypes an admonition the selection already sits in. The
+ * block grouping, splitting and merging logic is upstream's.
*/
import { Command, first } from "ckeditor5";
diff --git a/packages/ckeditor5/src/plugins/admonition/admonition_editing.ts b/packages/ckeditor5/src/plugins/admonition/admonition_editing.ts
index e868e14f95..b108a89743 100644
--- a/packages/ckeditor5/src/plugins/admonition/admonition_editing.ts
+++ b/packages/ckeditor5/src/plugins/admonition/admonition_editing.ts
@@ -1,7 +1,14 @@
/**
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see the `README.md` next to this file or
- * https://ckeditor.com/legal/ckeditor-oss-license
+ * Derived from `BlockQuoteEditing` in `@ckeditor/ckeditor5-block-quote`.
+ * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
+ * Used under the GPL-2.0-or-later arm of CKEditor 5's dual license; see
+ * https://ckeditor.com/legal/ckeditor-licensing-options.
+ *
+ * Modified by the Trilium Notes contributors: the schema registers `<aside>` with an
+ * `admonitionType` attribute, and the plain `elementToElement` conversion is replaced by an upcast
+ * that reads the type from the element's class list and a downcast that writes
+ * `class="admonition <type>"`. Upstream's post-fixer and Enter/Backspace break-out handlers are
+ * kept, minus one branch that is unreachable here (see the comment on the post-fixer).
*/
import { Delete, Enter, Plugin, ViewDocumentDeleteEvent, ViewDocumentEnterEvent } from "ckeditor5";
diff --git a/packages/ckeditor5/src/plugins/admonition/admonition_ui.ts b/packages/ckeditor5/src/plugins/admonition/admonition_ui.ts
index c9fa163bb7..28625c28bc 100644
--- a/packages/ckeditor5/src/plugins/admonition/admonition_ui.ts
+++ b/packages/ckeditor5/src/plugins/admonition/admonition_ui.ts
@@ -1,7 +1,11 @@
/**
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see the `README.md` next to this file or
- * https://ckeditor.com/legal/ckeditor-oss-license
+ * Written for Trilium Notes, and not a derivative of `BlockQuoteUI` beyond the handful of lines
+ * every CKEditor UI plugin shares: register a component in the factory, bind it to the command's
+ * `value`/`isEnabled`, and focus the editing view after executing.
+ *
+ * Upstream offers a single toggle `ButtonView` (plus a menu-bar variant); this is a `SplitButtonView`
+ * in a dropdown, where the button re-applies the previously chosen type and the list offers all five.
+ * The type definitions, titles and per-item bindings below have no upstream counterpart.
*/
import { addListToDropdown, Collection, createDropdown, ListDropdownItemDefinition, Plugin, SplitButtonView, ViewModel } from "ckeditor5";