Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit bf34816

Browse files
committed
fix(build): missing typings
1 parent 271a749 commit bf34816

File tree

13 files changed

+189
-1
lines changed

13 files changed

+189
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@triliumnext/ckeditor5-footnotes",
3-
"version": "0.0.4-hotfix9",
3+
"version": "0.0.4-hotfix10",
44
"description": "A plugin for CKEditor 5 to allow footnotes.",
55
"keywords": [
66
"ckeditor",

sample/ckeditor.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
declare global {
2+
interface Window {
3+
editor: ClassicEditor;
4+
}
5+
}
6+
import { ClassicEditor } from 'ckeditor5';
7+
import 'ckeditor5/ckeditor5.css';

src/augmentation.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { Footnotes } from './index.js';
2+
declare module '@ckeditor/ckeditor5-core' {
3+
interface PluginsMap {
4+
[Footnotes.pluginName]: Footnotes;
5+
}
6+
}

src/constants.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export declare const TOOLBAR_COMPONENT_NAME = "footnote";
2+
export declare const DATA_FOOTNOTE_ID = "data-footnote-id";
3+
export declare const ELEMENTS: {
4+
footnoteItem: string;
5+
footnoteReference: string;
6+
footnoteSection: string;
7+
footnoteContent: string;
8+
footnoteBackLink: string;
9+
};
10+
export declare const CLASSES: {
11+
footnoteContent: string;
12+
footnoteItem: string;
13+
footnoteReference: string;
14+
footnoteSection: string;
15+
footnoteBackLink: string;
16+
footnotes: string;
17+
hidden: string;
18+
};
19+
export declare const COMMANDS: {
20+
insertFootnote: string;
21+
};
22+
export declare const ATTRIBUTES: {
23+
footnoteContent: string;
24+
footnoteId: string;
25+
footnoteIndex: string;
26+
footnoteItem: string;
27+
footnoteReference: string;
28+
footnoteSection: string;
29+
footnoteBackLink: string;
30+
footnoteBackLinkHref: string;
31+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { type Editor } from 'ckeditor5/src/core.js';
2+
import { type Element } from 'ckeditor5/src/engine.js';
3+
/**
4+
* Adds functionality to support creating footnotes using markdown syntax, e.g. `[^1]`.
5+
*/
6+
export declare const addFootnoteAutoformatting: (editor: Editor, rootElement: Element) => void;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { type Editor } from 'ckeditor5/src/core.js';
2+
/**
3+
* Defines methods for converting between model, data view, and editing view representations of each element type.
4+
*/
5+
export declare const defineConverters: (editor: Editor) => void;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* CKEditor dataview nodes can be converted to a output view or an editor view via downcasting
3+
* * Upcasting is converting to the platonic ckeditor version.
4+
* * Downcasting is converting to the output version.
5+
*/
6+
import { type RootElement } from 'ckeditor5/src/engine.js';
7+
import { Autoformat } from "@ckeditor/ckeditor5-autoformat";
8+
import { Plugin } from "ckeditor5/src/core.js";
9+
import { Widget } from 'ckeditor5/src/widget.js';
10+
import '../footnote.css';
11+
export default class FootnoteEditing extends Plugin {
12+
static get requires(): readonly [typeof Widget, typeof Autoformat];
13+
/**
14+
* The root element of the document.
15+
*/
16+
get rootElement(): RootElement;
17+
init(): void;
18+
/**
19+
* This method broadly deals with deletion of text and elements, and updating the model
20+
* accordingly. In particular, the following cases are handled:
21+
* 1. If the footnote section gets deleted, all footnote references are removed.
22+
* 2. If a delete operation happens in an empty footnote, the footnote is deleted.
23+
*/
24+
private _handleDelete;
25+
/**
26+
* Clear the children of the provided footnoteContent element,
27+
* leaving an empty paragraph behind. This allows users to empty
28+
* a footnote without deleting it. modelWriter is passed in to
29+
* batch these changes with the ones that instantiated them,
30+
* such that the set can be undone with a single action.
31+
*/
32+
private _clearContents;
33+
/**
34+
* Removes a footnote and its references, and renumbers subsequent footnotes. When a footnote's
35+
* id attribute changes, it's references automatically update from a dispatcher event in converters.js,
36+
* which triggers the `updateReferenceIds` method. modelWriter is passed in to batch these changes with
37+
* the ones that instantiated them, such that the set can be undone with a single action.
38+
*/
39+
private _removeFootnote;
40+
/**
41+
* Deletes all references to the footnote with the given id. If no id is provided,
42+
* all references are deleted. modelWriter is passed in to batch these changes with
43+
* the ones that instantiated them, such that the set can be undone with a single action.
44+
*/
45+
private _removeReferences;
46+
/**
47+
* Updates all references for a single footnote. This function is called when
48+
* the index attribute of an existing footnote changes, which happens when a footnote
49+
* with a lower index is deleted. batch is passed in to group these changes with
50+
* the ones that instantiated them.
51+
*/
52+
private _updateReferenceIndices;
53+
/**
54+
* Reindexes footnotes such that footnote references occur in order, and reorders
55+
* footnote items in the footer section accordingly. batch is passed in to group changes with
56+
* the ones that instantiated them.
57+
*/
58+
private _orderFootnotes;
59+
}

src/footnote-editing/schema.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { Schema } from 'ckeditor5/src/engine.js';
2+
/**
3+
* Declares the custom element types used by the footnotes plugin.
4+
* See here for the meanings of each rule:
5+
* https://ckeditor.com/docs/ckeditor5/latest/api/module_engine_model_schema-SchemaItemDefinition.html#member-isObject
6+
*/
7+
export declare const defineSchema: (schema: Schema) => void;

src/footnote-ui.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Plugin } from 'ckeditor5/src/core.js';
2+
import { type ListDropdownItemDefinition } from '@ckeditor/ckeditor5-ui';
3+
import { Collection } from '@ckeditor/ckeditor5-utils';
4+
export default class FootnoteUI extends Plugin {
5+
init(): void;
6+
getDropdownItemsDefinitions(): Collection<ListDropdownItemDefinition>;
7+
}

src/footnotes.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Plugin } from 'ckeditor5/src/core.js';
2+
import FootnoteEditing from './footnote-editing/footnote-editing.js';
3+
import FootnoteUI from './footnote-ui.js';
4+
export default class Footnotes extends Plugin {
5+
static get pluginName(): "Footnotes";
6+
static get requires(): readonly [typeof FootnoteEditing, typeof FootnoteUI];
7+
}

0 commit comments

Comments
 (0)