ckeditor5-elements 0.0.0-stage → 49.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ivan Kildyushov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,64 @@
1
- # Temporary Holding Version
1
+ # ckeditor5-elements
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Element-level features for CKEditor 5 v49 or later, in one package:
4
+
5
+ | Feature | Exports |
6
+ | -------------------- | ---------------------------------------------------------------------------------------------------------- |
7
+ | Commands and buttons | `ElementOrPositionCommand`, `ElementCommand`, `ElementOrPositionButtonView`, `ElementButtonView` |
8
+ | Element menu | `ElementMenu` (the plugin that shows the menus below), `ElementMenuView` |
9
+ | Context menu | `ElementContextMenu`: a menu of commands for the right-clicked element (or Shift+F10) |
10
+ | Clipboard | `ElementClipboard`: `copyElement`, `cutElement`, `pasteElement`, `pasteElementBefore`, `pasteElementAfter` |
11
+ | Quick insert | `QuickInsert`: Alt+Enter opens a searchable list of the elements allowed at the cursor |
12
+ | Breadcrumbs | `Breadcrumbs`: the element path at the cursor, as labels or buttons that open the element menu |
13
+
14
+ ## Installation
15
+
16
+ ```sh
17
+ npm install ckeditor5 ckeditor5-elements
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ Import the features from `ckeditor5-elements`, and its stylesheet, which styles all of them:
23
+
24
+ ```ts
25
+ import { ClassicEditor, Essentials, Paragraph } from 'ckeditor5';
26
+ import { Breadcrumbs, ElementClipboard, ElementContextMenu, QuickInsert } from 'ckeditor5-elements';
27
+
28
+ import 'ckeditor5/ckeditor5.css';
29
+ import 'ckeditor5-elements/index.css';
30
+
31
+ const menu = (element, editor) => [
32
+ {
33
+ title: 'Insert',
34
+ items: [editor.commands.get('quickInsertBefore'), editor.commands.get('quickInsertAfter')]
35
+ },
36
+ '|',
37
+ editor.commands.get('copyElement'),
38
+ editor.commands.get('cutElement'),
39
+ editor.commands.get('pasteElement')
40
+ ];
41
+
42
+ await ClassicEditor.create({
43
+ attachTo: document.querySelector('#editor'),
44
+ licenseKey: 'GPL',
45
+ plugins: [Essentials, Paragraph, ElementContextMenu, ElementClipboard, QuickInsert, Breadcrumbs],
46
+ toolbar: ['undo', 'redo', '|', 'breadcrumbs'],
47
+ elementContextMenu: menu,
48
+ breadcrumbs: { menu }
49
+ });
50
+ ```
51
+
52
+ Load only the plugins you use: the others are not part of your build.
53
+
54
+ The features come in packages of their own (`ckeditor5-elements-core`, `-clipboard`, `-context-menu`, `-quick-insert`,
55
+ `-breadcrumbs`), in the same version as this package, which installs them. Do not install or import them yourself: two
56
+ versions of them would be loaded, which fails.
57
+
58
+ ## Documentation
59
+
60
+ [CKEditor 5 Elements documentation](https://ivankild.github.io/ckeditor5-elements/): guides with live examples, and the API reference.
61
+
62
+ ## License
63
+
64
+ MIT
package/dist/index.css ADDED
@@ -0,0 +1,134 @@
1
+ /* ckeditor5-elements-core */
2
+ /*
3
+ * The menu of an element is CKEditor's dropdown menu, so CKEditor styles it. Only the alignment of labels is added.
4
+ */
5
+
6
+ /* In a menu with icons (or a nested menu of it), items without an icon get the space of one, so that all labels line up. */
7
+ :is(.ck.ck-elements-menu, .ck.ck-elements-menu__panel > .ck-dropdown-menu-list):has(
8
+ > .ck-list__item > :is(.ck-button, .ck-dropdown-menu-list__nested-menu > .ck-button) > .ck-button__icon
9
+ )
10
+ > .ck-list__item
11
+ > :is(.ck-button, .ck-dropdown-menu-list__nested-menu > .ck-button):not(:has(> .ck-button__icon))
12
+ > .ck-button__label {
13
+ /* The width of an icon, and the gap after it. */
14
+ margin-inline-start: calc(var(--ck-icon-size) + var(--ck-button-icon-gap));
15
+ }
16
+
17
+ /* ckeditor5-elements-breadcrumbs */
18
+ /*
19
+ * The element path: ancestors are muted, the innermost element (where the cursor is) is emphasised. Items are separated
20
+ * by chevrons. Buttons (with a menu) and labels (without one) look the same, except buttons react to hover and focus.
21
+ */
22
+ .ck.ck-elements-breadcrumbs {
23
+ --ck-elements-breadcrumbs-item-height: 24px;
24
+ --ck-elements-breadcrumbs-separator-size: 0.38em;
25
+
26
+ display: flex;
27
+ align-items: center;
28
+ min-width: 0;
29
+ font-size: var(--ck-font-size-sm);
30
+ color: var(--ck-color-text);
31
+ }
32
+
33
+ .ck.ck-toolbar .ck.ck-elements-breadcrumbs {
34
+ min-height: var(--ck-size-control-min-height);
35
+ }
36
+
37
+ .ck.ck-elements-breadcrumbs__list {
38
+ display: flex;
39
+ flex-wrap: wrap;
40
+ align-items: center;
41
+ gap: 2px 0;
42
+ min-width: 0;
43
+ margin: 0;
44
+ padding: 0;
45
+ list-style: none;
46
+ }
47
+
48
+ .ck.ck-elements-breadcrumbs__list-item {
49
+ display: flex;
50
+ align-items: center;
51
+ min-width: 0;
52
+ margin: 0;
53
+ padding: 0;
54
+ }
55
+
56
+ /* Both item kinds: buttons and labels. */
57
+ .ck.ck-elements-breadcrumbs__item,
58
+ .ck.ck-button.ck-elements-breadcrumbs__item {
59
+ display: inline-flex;
60
+ align-items: center;
61
+ min-width: 0;
62
+ min-height: var(--ck-elements-breadcrumbs-item-height);
63
+ height: var(--ck-elements-breadcrumbs-item-height);
64
+ padding: 0 var(--ck-spacing-sm);
65
+ border-radius: var(--ck-border-radius-control);
66
+ font-family: var(--ck-font-family);
67
+ font-size: inherit;
68
+ line-height: 1;
69
+ white-space: nowrap;
70
+ color: color-mix(in srgb, var(--ck-color-text) 65%, transparent);
71
+ }
72
+
73
+ .ck.ck-button.ck-elements-breadcrumbs__item .ck-button__label {
74
+ font-size: inherit;
75
+ line-height: 1;
76
+ }
77
+
78
+ /* The innermost element: where the cursor is. */
79
+ .ck.ck-elements-breadcrumbs__item[aria-current] {
80
+ color: var(--ck-color-text);
81
+ font-weight: 600;
82
+ }
83
+
84
+ /* Labels cannot be clicked, but can be focused with the keyboard. */
85
+ .ck.ck-elements-breadcrumbs__label {
86
+ cursor: default;
87
+ }
88
+
89
+ .ck.ck-elements-breadcrumbs__label:focus {
90
+ outline: none;
91
+ box-shadow:
92
+ 0 0 0 1px var(--ck-color-focus-border),
93
+ var(--ck-focus-shadow);
94
+ }
95
+
96
+ /* Buttons show they can be clicked. */
97
+ .ck.ck-button.ck-elements-breadcrumbs__item:hover,
98
+ .ck.ck-button.ck-elements-breadcrumbs__item:focus,
99
+ .ck.ck-button.ck-elements-breadcrumbs__item.ck-on {
100
+ color: var(--ck-color-text);
101
+ }
102
+
103
+ /* A chevron between items, in the gap before each item, so it is not part of a button's hover area. */
104
+ .ck.ck-elements-breadcrumbs__list-item + .ck.ck-elements-breadcrumbs__list-item {
105
+ position: relative;
106
+ margin-left: calc(var(--ck-spacing-base) + var(--ck-elements-breadcrumbs-separator-size));
107
+ }
108
+
109
+ .ck.ck-elements-breadcrumbs__list-item + .ck.ck-elements-breadcrumbs__list-item::before {
110
+ content: '';
111
+ position: absolute;
112
+ top: 50%;
113
+ left: calc(-0.5 * var(--ck-spacing-base) - var(--ck-elements-breadcrumbs-separator-size));
114
+ width: var(--ck-elements-breadcrumbs-separator-size);
115
+ height: var(--ck-elements-breadcrumbs-separator-size);
116
+ border-top: 1.5px solid color-mix(in srgb, var(--ck-color-text) 40%, transparent);
117
+ border-right: 1.5px solid color-mix(in srgb, var(--ck-color-text) 40%, transparent);
118
+ transform: translateY(-50%) rotate(45deg);
119
+ pointer-events: none;
120
+ }
121
+
122
+ /* ckeditor5-elements-quick-insert */
123
+ .ck.ck-elements-quick-insert {
124
+ width: 260px;
125
+ }
126
+
127
+ .ck.ck-elements-quick-insert .ck-search__results {
128
+ max-height: 240px;
129
+ overflow-y: auto;
130
+ }
131
+
132
+ .ck.ck-elements-quick-insert .ck-list__item > .ck.ck-button {
133
+ width: 100%;
134
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CKEditor 5 Elements: commands that act on an element and their buttons, the element menu, the element context menu,
3
+ * clipboard commands for elements, quick insert and breadcrumbs.
4
+ *
5
+ * This package brings them all, as `ckeditor5` does for CKEditor: install it, and import everything from it. Its
6
+ * stylesheet, `ckeditor5-elements/index.css`, has the styles of all of them.
7
+ *
8
+ * @module ckeditor5-elements
9
+ */
10
+ export * from 'ckeditor5-elements-core';
11
+ export * from 'ckeditor5-elements-clipboard';
12
+ export * from 'ckeditor5-elements-context-menu';
13
+ export * from 'ckeditor5-elements-quick-insert';
14
+ export * from 'ckeditor5-elements-breadcrumbs';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CKEditor 5 Elements: commands that act on an element and their buttons, the element menu, the element context menu,
3
+ * clipboard commands for elements, quick insert and breadcrumbs.
4
+ *
5
+ * This package brings them all, as `ckeditor5` does for CKEditor: install it, and import everything from it. Its
6
+ * stylesheet, `ckeditor5-elements/index.css`, has the styles of all of them.
7
+ *
8
+ * @module ckeditor5-elements
9
+ */
10
+ export * from 'ckeditor5-elements-core';
11
+ export * from 'ckeditor5-elements-clipboard';
12
+ export * from 'ckeditor5-elements-context-menu';
13
+ export * from 'ckeditor5-elements-quick-insert';
14
+ export * from 'ckeditor5-elements-breadcrumbs';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "ckeditor5-elements",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "49.0.0-alpha.0",
4
+ "description": "Element commands, an element context menu, clipboard commands, quick insert and breadcrumbs for CKEditor 5.",
5
+ "keywords": [
6
+ "ckeditor",
7
+ "ckeditor5",
8
+ "ckeditor 5",
9
+ "ckeditor5-feature",
10
+ "ckeditor5-plugin"
11
+ ],
12
+ "license": "MIT",
13
+ "author": "Ivan Kildyushov",
14
+ "homepage": "https://ivankild.github.io/ckeditor5-elements/",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/ivankild/ckeditor5-elements.git",
18
+ "directory": "packages/ckeditor5-elements"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/ivankild/ckeditor5-elements/issues"
22
+ },
23
+ "type": "module",
24
+ "main": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ },
31
+ "./index.css": "./dist/index.css",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "src",
37
+ "README.md"
38
+ ],
39
+ "sideEffects": [
40
+ "*.css"
41
+ ],
42
+ "dependencies": {
43
+ "ckeditor5-elements-breadcrumbs": "49.0.0-alpha.0",
44
+ "ckeditor5-elements-clipboard": "49.0.0-alpha.0",
45
+ "ckeditor5-elements-context-menu": "49.0.0-alpha.0",
46
+ "ckeditor5-elements-core": "49.0.0-alpha.0",
47
+ "ckeditor5-elements-quick-insert": "49.0.0-alpha.0"
48
+ },
49
+ "peerDependencies": {
50
+ "ckeditor5": ">=49.0.0"
51
+ },
52
+ "scripts": {
53
+ "build": "tsc --build && node ../../scripts/buildUmbrellaStyles.js"
54
+ }
6
55
  }
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CKEditor 5 Elements: commands that act on an element and their buttons, the element menu, the element context menu,
3
+ * clipboard commands for elements, quick insert and breadcrumbs.
4
+ *
5
+ * This package brings them all, as `ckeditor5` does for CKEditor: install it, and import everything from it. Its
6
+ * stylesheet, `ckeditor5-elements/index.css`, has the styles of all of them.
7
+ *
8
+ * @module ckeditor5-elements
9
+ */
10
+
11
+ export * from 'ckeditor5-elements-core';
12
+ export * from 'ckeditor5-elements-clipboard';
13
+ export * from 'ckeditor5-elements-context-menu';
14
+ export * from 'ckeditor5-elements-quick-insert';
15
+ export * from 'ckeditor5-elements-breadcrumbs';