ckeditor5-elements 49.0.0-alpha.0 → 49.0.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/README.md CHANGED
@@ -1,15 +1,22 @@
1
1
  # ckeditor5-elements
2
2
 
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 |
3
+ Element-first editing for CKEditor 5 v49, in one package. The content is a tree of named elements, each with its
4
+ attributes, and every feature acts on an element:
5
+
6
+ | Feature | Exports |
7
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
8
+ | Commands and buttons | `ElementOrPositionCommand`, `ElementCommand` and a command for each kind of element, `ElementOrPositionButtonView`, `ElementButtonView` |
9
+ | Element menu | `ElementMenu` (the plugin that shows the menus below), `ElementMenuView` |
10
+ | Context menu | `ElementContextMenu`: a menu of commands for the right-clicked element (or Shift+F10) |
11
+ | Clipboard | `ElementClipboard`: `copyElement`, `cutElement`, `pasteElement`, `pasteElementBefore`, `pasteElementAfter` |
12
+ | Actions | `ElementActions`: `moveElementUp`, `moveElementDown`, `duplicateElement`, `deleteElement` |
13
+ | Attributes | `ElementAttributes`: `showElementAttributes` shows the attributes of an element in a modal |
14
+ | Element schema | `ElementSchema`: declare the elements of the content from a JSON file, with a validation; `ElementSchemaCommands`: their commands |
15
+ | Element toolbar | `ElementToolbar`: floating toolbars for the elements that match a name or a filter |
16
+ | Selectable elements | `ElementSelectable`: select an element as a whole, by a click or by the arrow keys, without widgets |
17
+ | Clickable elements | `ElementClickable`: a callback with the model element when an element is clicked or double-clicked |
18
+ | Quick insert | `ElementQuickInsert`: Alt+Enter opens a searchable list of the elements allowed at the cursor |
19
+ | Breadcrumbs | `ElementBreadcrumbs`: the element path at the cursor, as labels or buttons that open the element menu |
13
20
 
14
21
  ## Installation
15
22
 
@@ -23,7 +30,7 @@ Import the features from `ckeditor5-elements`, and its stylesheet, which styles
23
30
 
24
31
  ```ts
25
32
  import { ClassicEditor, Essentials, Paragraph } from 'ckeditor5';
26
- import { Breadcrumbs, ElementClipboard, ElementContextMenu, QuickInsert } from 'ckeditor5-elements';
33
+ import { ElementBreadcrumbs, ElementClipboard, ElementContextMenu, ElementQuickInsert } from 'ckeditor5-elements';
27
34
 
28
35
  import 'ckeditor5/ckeditor5.css';
29
36
  import 'ckeditor5-elements/index.css';
@@ -42,23 +49,24 @@ const menu = (element, editor) => [
42
49
  await ClassicEditor.create({
43
50
  attachTo: document.querySelector('#editor'),
44
51
  licenseKey: 'GPL',
45
- plugins: [Essentials, Paragraph, ElementContextMenu, ElementClipboard, QuickInsert, Breadcrumbs],
52
+ plugins: [Essentials, Paragraph, ElementContextMenu, ElementClipboard, ElementQuickInsert, ElementBreadcrumbs],
46
53
  toolbar: ['undo', 'redo', '|', 'breadcrumbs'],
47
54
  elementContextMenu: menu,
48
- breadcrumbs: { menu }
55
+ elementBreadcrumbs: { menu }
49
56
  });
50
57
  ```
51
58
 
52
59
  Load only the plugins you use: the others are not part of your build.
53
60
 
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
61
+ The features come in packages of their own (`ckeditor5-elements-core`, `-actions`, `-attributes`, `-schema`, `-interaction`, `-toolbar`, `-menu`), in the same version as this package, which installs them. Do not install or import them yourself: two
56
62
  versions of them would be loaded, which fails.
57
63
 
58
64
  ## Documentation
59
65
 
60
66
  [CKEditor 5 Elements documentation](https://ivankild.github.io/ckeditor5-elements/): guides with live examples, and the API reference.
61
67
 
68
+ The [full example](https://ivankild.github.io/ckeditor5-elements/examples/) shows all the features together in one editor.
69
+
62
70
  ## License
63
71
 
64
72
  MIT
package/dist/index.css CHANGED
@@ -1,4 +1,46 @@
1
- /* ckeditor5-elements-core */
1
+ /* ckeditor5-elements-attributes */
2
+ /*
3
+ * The table of the attributes dialog. It is excluded from CKEditor's reset (`ck-reset_all-excluded`), so it has its own
4
+ * styles.
5
+ */
6
+ .ck-elements-attributes table {
7
+ width: min(32em, 80vw);
8
+ border-collapse: collapse;
9
+ table-layout: fixed;
10
+ }
11
+
12
+ .ck-elements-attributes th,
13
+ .ck-elements-attributes td {
14
+ padding: 0.3em 0.8em;
15
+ border-bottom: 1px solid var(--ck-color-base-border);
16
+ text-align: left;
17
+ vertical-align: top;
18
+ /* The dialog does not wrap its content, but long values, such as the data of an image, must wrap. */
19
+ white-space: normal;
20
+ overflow-wrap: anywhere;
21
+ }
22
+
23
+ .ck-elements-attributes th {
24
+ width: 7em;
25
+ font-weight: 600;
26
+ }
27
+
28
+ .ck-elements-attributes .ck-elements-attributes__empty {
29
+ color: var(--ck-color-text);
30
+ opacity: 0.65;
31
+ }
32
+
33
+ /* ckeditor5-elements-interaction */
34
+ /*
35
+ * A selected element: the editing view marks it with this class, and the selection is a fake one, so the browser draws
36
+ * nothing on the element itself.
37
+ */
38
+ .ck-content .ck-elements-selected {
39
+ outline: 2px solid var(--ck-color-focus-border);
40
+ outline-offset: 1px;
41
+ }
42
+
43
+ /* ckeditor5-elements-menu */
2
44
  /*
3
45
  * The menu of an element is CKEditor's dropdown menu, so CKEditor styles it. Only the alignment of labels is added.
4
46
  */
@@ -14,7 +56,6 @@
14
56
  margin-inline-start: calc(var(--ck-icon-size) + var(--ck-button-icon-gap));
15
57
  }
16
58
 
17
- /* ckeditor5-elements-breadcrumbs */
18
59
  /*
19
60
  * The element path: ancestors are muted, the innermost element (where the cursor is) is emphasised. Items are separated
20
61
  * by chevrons. Buttons (with a menu) and labels (without one) look the same, except buttons react to hover and focus.
@@ -119,7 +160,6 @@
119
160
  pointer-events: none;
120
161
  }
121
162
 
122
- /* ckeditor5-elements-quick-insert */
123
163
  .ck.ck-elements-quick-insert {
124
164
  width: 260px;
125
165
  }
@@ -132,3 +172,12 @@
132
172
  .ck.ck-elements-quick-insert .ck-list__item > .ck.ck-button {
133
173
  width: 100%;
134
174
  }
175
+
176
+ /* ckeditor5-elements-schema */
177
+ /*
178
+ * A verbatim block of the element schema, in the editor: it keeps its whitespace, whatever its tag, e.g. the
179
+ * `editingTag` of the element. (In a `pre`, the browser keeps it anyway.)
180
+ */
181
+ .ck-content .ck-elements-verbatim {
182
+ white-space: pre-wrap;
183
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
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.
2
+ * CKEditor 5 Elements: element-first editing. The content is a tree of named elements, each with its attributes,
3
+ * formatting included, declared by an element schema; every feature acts on an element: commands and their buttons, the
4
+ * element menu and context menu, element actions (move, duplicate, delete, and the clipboard), element attributes,
5
+ * selectable and clickable elements, element toolbars, quick insert and breadcrumbs.
4
6
  *
5
7
  * This package brings them all, as `ckeditor5` does for CKEditor: install it, and import everything from it. Its
6
8
  * stylesheet, `ckeditor5-elements/index.css`, has the styles of all of them.
@@ -8,8 +10,10 @@
8
10
  * @module ckeditor5-elements
9
11
  */
10
12
  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';
13
+ export * from 'ckeditor5-elements-actions';
14
+ export * from 'ckeditor5-elements-schema';
15
+ export * from 'ckeditor5-elements-interaction';
16
+ export * from 'ckeditor5-elements-attributes';
17
+ export * from 'ckeditor5-elements-toolbar';
18
+ export * from 'ckeditor5-elements-menu';
15
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
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.
2
+ * CKEditor 5 Elements: element-first editing. The content is a tree of named elements, each with its attributes,
3
+ * formatting included, declared by an element schema; every feature acts on an element: commands and their buttons, the
4
+ * element menu and context menu, element actions (move, duplicate, delete, and the clipboard), element attributes,
5
+ * selectable and clickable elements, element toolbars, quick insert and breadcrumbs.
4
6
  *
5
7
  * This package brings them all, as `ckeditor5` does for CKEditor: install it, and import everything from it. Its
6
8
  * stylesheet, `ckeditor5-elements/index.css`, has the styles of all of them.
@@ -8,8 +10,10 @@
8
10
  * @module ckeditor5-elements
9
11
  */
10
12
  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';
13
+ export * from 'ckeditor5-elements-actions';
14
+ export * from 'ckeditor5-elements-schema';
15
+ export * from 'ckeditor5-elements-interaction';
16
+ export * from 'ckeditor5-elements-attributes';
17
+ export * from 'ckeditor5-elements-toolbar';
18
+ export * from 'ckeditor5-elements-menu';
15
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The validation of an element schema without CKEditor, so that it works in Node.js, e.g. to validate a schema file in a
3
+ * test or in CI: `import { validateElementSchema } from 'ckeditor5-elements/validate-schema'`. The main entry loads
4
+ * CKEditor, which needs a DOM.
5
+ *
6
+ * @module ckeditor5-elements/validate-schema
7
+ */
8
+ export * from 'ckeditor5-elements-schema/validate';
9
+ //# sourceMappingURL=validateSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSchema.d.ts","sourceRoot":"","sources":["../src/validateSchema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The validation of an element schema without CKEditor, so that it works in Node.js, e.g. to validate a schema file in a
3
+ * test or in CI: `import { validateElementSchema } from 'ckeditor5-elements/validate-schema'`. The main entry loads
4
+ * CKEditor, which needs a DOM.
5
+ *
6
+ * @module ckeditor5-elements/validate-schema
7
+ */
8
+ export * from 'ckeditor5-elements-schema/validate';
9
+ //# sourceMappingURL=validateSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSchema.js","sourceRoot":"","sources":["../src/validateSchema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,oCAAoC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ckeditor5-elements",
3
- "version": "49.0.0-alpha.0",
4
- "description": "Element commands, an element context menu, clipboard commands, quick insert and breadcrumbs for CKEditor 5.",
3
+ "version": "49.0.0",
4
+ "description": "Element commands, an element context menu, element actions and clipboard commands, element attributes, an element schema, selectable and clickable elements, element toolbars, quick insert and breadcrumbs for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
7
7
  "ckeditor5",
@@ -29,6 +29,10 @@
29
29
  "import": "./dist/index.js"
30
30
  },
31
31
  "./index.css": "./dist/index.css",
32
+ "./validate-schema": {
33
+ "types": "./dist/validateSchema.d.ts",
34
+ "import": "./dist/validateSchema.js"
35
+ },
32
36
  "./package.json": "./package.json"
33
37
  },
34
38
  "files": [
@@ -40,14 +44,16 @@
40
44
  "*.css"
41
45
  ],
42
46
  "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"
47
+ "ckeditor5-elements-actions": "49.0.0",
48
+ "ckeditor5-elements-attributes": "49.0.0",
49
+ "ckeditor5-elements-core": "49.0.0",
50
+ "ckeditor5-elements-interaction": "49.0.0",
51
+ "ckeditor5-elements-menu": "49.0.0",
52
+ "ckeditor5-elements-schema": "49.0.0",
53
+ "ckeditor5-elements-toolbar": "49.0.0"
48
54
  },
49
55
  "peerDependencies": {
50
- "ckeditor5": ">=49.0.0"
56
+ "ckeditor5": "^49.0.0"
51
57
  },
52
58
  "scripts": {
53
59
  "build": "tsc --build && node ../../scripts/buildUmbrellaStyles.js"
package/src/index.ts CHANGED
@@ -1,6 +1,8 @@
1
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.
2
+ * CKEditor 5 Elements: element-first editing. The content is a tree of named elements, each with its attributes,
3
+ * formatting included, declared by an element schema; every feature acts on an element: commands and their buttons, the
4
+ * element menu and context menu, element actions (move, duplicate, delete, and the clipboard), element attributes,
5
+ * selectable and clickable elements, element toolbars, quick insert and breadcrumbs.
4
6
  *
5
7
  * This package brings them all, as `ckeditor5` does for CKEditor: install it, and import everything from it. Its
6
8
  * stylesheet, `ckeditor5-elements/index.css`, has the styles of all of them.
@@ -9,7 +11,9 @@
9
11
  */
10
12
 
11
13
  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';
14
+ export * from 'ckeditor5-elements-actions';
15
+ export * from 'ckeditor5-elements-schema';
16
+ export * from 'ckeditor5-elements-interaction';
17
+ export * from 'ckeditor5-elements-attributes';
18
+ export * from 'ckeditor5-elements-toolbar';
19
+ export * from 'ckeditor5-elements-menu';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The validation of an element schema without CKEditor, so that it works in Node.js, e.g. to validate a schema file in a
3
+ * test or in CI: `import { validateElementSchema } from 'ckeditor5-elements/validate-schema'`. The main entry loads
4
+ * CKEditor, which needs a DOM.
5
+ *
6
+ * @module ckeditor5-elements/validate-schema
7
+ */
8
+
9
+ export * from 'ckeditor5-elements-schema/validate';