ckeditor5-elements-schema 49.0.0-alpha.2 → 49.0.0-alpha.4
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 +28 -2
- package/dist/augmentation.d.ts +7 -1
- package/dist/augmentation.d.ts.map +1 -1
- package/dist/commands/elementBlockCommand.d.ts +46 -0
- package/dist/commands/elementBlockCommand.d.ts.map +1 -0
- package/dist/commands/elementBlockCommand.js +71 -0
- package/dist/commands/elementBlockCommand.js.map +1 -0
- package/dist/commands/elementContainerCommand.d.ts +36 -0
- package/dist/commands/elementContainerCommand.d.ts.map +1 -0
- package/dist/commands/elementContainerCommand.js +67 -0
- package/dist/commands/elementContainerCommand.js.map +1 -0
- package/dist/commands/elementInlineCommand.d.ts +87 -0
- package/dist/commands/elementInlineCommand.d.ts.map +1 -0
- package/dist/commands/elementInlineCommand.js +253 -0
- package/dist/commands/elementInlineCommand.js.map +1 -0
- package/dist/commands/elementInsertCommand.d.ts +33 -0
- package/dist/commands/elementInsertCommand.d.ts.map +1 -0
- package/dist/commands/elementInsertCommand.js +61 -0
- package/dist/commands/elementInsertCommand.js.map +1 -0
- package/dist/commands/elementSchemaCommand.d.ts +62 -0
- package/dist/commands/elementSchemaCommand.d.ts.map +1 -0
- package/dist/commands/elementSchemaCommand.js +107 -0
- package/dist/commands/elementSchemaCommand.js.map +1 -0
- package/dist/{convertElementSchema.d.ts → conversion/convertElementSchema.d.ts} +3 -2
- package/dist/conversion/convertElementSchema.d.ts.map +1 -0
- package/dist/{convertElementSchema.js → conversion/convertElementSchema.js} +16 -4
- package/dist/conversion/convertElementSchema.js.map +1 -0
- package/dist/conversion/inlineTextElement.d.ts +24 -0
- package/dist/conversion/inlineTextElement.d.ts.map +1 -0
- package/dist/conversion/inlineTextElement.js +28 -0
- package/dist/conversion/inlineTextElement.js.map +1 -0
- package/dist/definition/canHold.d.ts.map +1 -0
- package/dist/definition/canHold.js.map +1 -0
- package/dist/definition/compileElementSchema.d.ts.map +1 -0
- package/dist/definition/compileElementSchema.js.map +1 -0
- package/dist/definition/elementSchemaError.d.ts.map +1 -0
- package/dist/definition/elementSchemaError.js.map +1 -0
- package/dist/definition/readDefinition.d.ts.map +1 -0
- package/dist/definition/readDefinition.js.map +1 -0
- package/dist/definition/suggest.d.ts.map +1 -0
- package/dist/definition/suggest.js.map +1 -0
- package/dist/definition/types.d.ts.map +1 -0
- package/dist/definition/types.js.map +1 -0
- package/dist/definition/validateElementSchema.d.ts.map +1 -0
- package/dist/definition/validateElementSchema.js.map +1 -0
- package/dist/elementSchema.js +4 -4
- package/dist/elementSchema.js.map +1 -1
- package/dist/elementSchemaCommands.d.ts +83 -0
- package/dist/elementSchemaCommands.d.ts.map +1 -0
- package/dist/elementSchemaCommands.js +137 -0
- package/dist/elementSchemaCommands.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/typing/twoStepCaretMovement.d.ts +11 -0
- package/dist/typing/twoStepCaretMovement.d.ts.map +1 -0
- package/dist/typing/twoStepCaretMovement.js +76 -0
- package/dist/typing/twoStepCaretMovement.js.map +1 -0
- package/dist/validate.d.ts +4 -4
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +3 -3
- package/dist/validate.js.map +1 -1
- package/package.json +2 -2
- package/src/augmentation.ts +8 -1
- package/src/commands/elementBlockCommand.ts +87 -0
- package/src/commands/elementContainerCommand.ts +83 -0
- package/src/commands/elementInlineCommand.ts +311 -0
- package/src/commands/elementInsertCommand.ts +74 -0
- package/src/commands/elementSchemaCommand.ts +140 -0
- package/src/{convertElementSchema.ts → conversion/convertElementSchema.ts} +19 -5
- package/src/conversion/inlineTextElement.ts +31 -0
- package/src/elementSchema.ts +5 -5
- package/src/elementSchemaCommands.ts +202 -0
- package/src/index.ts +17 -1
- package/src/typing/twoStepCaretMovement.ts +119 -0
- package/src/validate.ts +4 -4
- package/dist/canHold.d.ts.map +0 -1
- package/dist/canHold.js.map +0 -1
- package/dist/compileElementSchema.d.ts.map +0 -1
- package/dist/compileElementSchema.js.map +0 -1
- package/dist/convertElementSchema.d.ts.map +0 -1
- package/dist/convertElementSchema.js.map +0 -1
- package/dist/elementSchemaError.d.ts.map +0 -1
- package/dist/elementSchemaError.js.map +0 -1
- package/dist/readDefinition.d.ts.map +0 -1
- package/dist/readDefinition.js.map +0 -1
- package/dist/suggest.d.ts.map +0 -1
- package/dist/suggest.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validateElementSchema.d.ts.map +0 -1
- package/dist/validateElementSchema.js.map +0 -1
- /package/dist/{canHold.d.ts → definition/canHold.d.ts} +0 -0
- /package/dist/{canHold.js → definition/canHold.js} +0 -0
- /package/dist/{compileElementSchema.d.ts → definition/compileElementSchema.d.ts} +0 -0
- /package/dist/{compileElementSchema.js → definition/compileElementSchema.js} +0 -0
- /package/dist/{elementSchemaError.d.ts → definition/elementSchemaError.d.ts} +0 -0
- /package/dist/{elementSchemaError.js → definition/elementSchemaError.js} +0 -0
- /package/dist/{readDefinition.d.ts → definition/readDefinition.d.ts} +0 -0
- /package/dist/{readDefinition.js → definition/readDefinition.js} +0 -0
- /package/dist/{suggest.d.ts → definition/suggest.d.ts} +0 -0
- /package/dist/{suggest.js → definition/suggest.js} +0 -0
- /package/dist/{types.d.ts → definition/types.d.ts} +0 -0
- /package/dist/{types.js → definition/types.js} +0 -0
- /package/dist/{validateElementSchema.d.ts → definition/validateElementSchema.d.ts} +0 -0
- /package/dist/{validateElementSchema.js → definition/validateElementSchema.js} +0 -0
- /package/src/{canHold.ts → definition/canHold.ts} +0 -0
- /package/src/{compileElementSchema.ts → definition/compileElementSchema.ts} +0 -0
- /package/src/{elementSchemaError.ts → definition/elementSchemaError.ts} +0 -0
- /package/src/{readDefinition.ts → definition/readDefinition.ts} +0 -0
- /package/src/{suggest.ts → definition/suggest.ts} +0 -0
- /package/src/{types.ts → definition/types.ts} +0 -0
- /package/src/{validateElementSchema.ts → definition/validateElementSchema.ts} +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Plugin, type ModelSchema, type ViewDowncastWriter, type ViewElement } from 'ckeditor5';
|
|
2
|
+
import { ElementOrPositionButtonView } from 'ckeditor5-elements-core';
|
|
3
|
+
import { createInlineTextElement } from './conversion/inlineTextElement.js';
|
|
4
|
+
import ElementBlockCommand from './commands/elementBlockCommand.js';
|
|
5
|
+
import ElementContainerCommand from './commands/elementContainerCommand.js';
|
|
6
|
+
import ElementInlineCommand from './commands/elementInlineCommand.js';
|
|
7
|
+
import ElementInsertCommand from './commands/elementInsertCommand.js';
|
|
8
|
+
import ElementSchema from './elementSchema.js';
|
|
9
|
+
import type ElementSchemaCommand from './commands/elementSchemaCommand.js';
|
|
10
|
+
import { enableTwoStepCaretMovement } from './typing/twoStepCaretMovement.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An element of {@link ElementSchemaCommands}: its command and its button.
|
|
14
|
+
*/
|
|
15
|
+
export interface ElementSchemaCommandDefinition {
|
|
16
|
+
/**
|
|
17
|
+
* The model element: of the element schema, or of another plugin. Default: the name of the command.
|
|
18
|
+
*/
|
|
19
|
+
element?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The title of the command, and the label of its button, e.g. `'Bold'`.
|
|
23
|
+
*/
|
|
24
|
+
title: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The icon of the command and of its button (an SVG string), e.g. `IconBold` of CKEditor.
|
|
28
|
+
*/
|
|
29
|
+
icon?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The keystroke that executes the command, e.g. `'Ctrl+B'`.
|
|
33
|
+
*/
|
|
34
|
+
keystroke?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The tag of the element in the data and in the editing view, e.g. `'strong'` or `'hr'`. The converters of the plugin
|
|
38
|
+
* replace the ones of the element schema (`elementSchemaConverters`) in the downcast, and the upcast takes both.
|
|
39
|
+
* Without it, the element is converted by the schema, or by your converters.
|
|
40
|
+
*/
|
|
41
|
+
view?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The `elementSchemaCommands` option: the elements, by the name of their command and of their button.
|
|
46
|
+
*/
|
|
47
|
+
export type ElementSchemaCommandsConfig = Record<string, ElementSchemaCommandDefinition>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Commands and toolbar buttons for the elements of the element schema, as CKEditor's features have for theirs: the
|
|
51
|
+
* command of an element is the one of its kind (see {@link ElementSchemaCommand}).
|
|
52
|
+
*
|
|
53
|
+
* | Element | Command | Works as CKEditor's |
|
|
54
|
+
* | ----------------------------- | --------------------------- | ----------------------------- |
|
|
55
|
+
* | inline `block` | {@link ElementInlineCommand} | bold: wraps text |
|
|
56
|
+
* | `block` | {@link ElementBlockCommand} | heading: renames blocks |
|
|
57
|
+
* | `container` | {@link ElementContainerCommand} | block quote: wraps blocks |
|
|
58
|
+
* | `empty`, inline `container` | {@link ElementInsertCommand} | horizontal line: inserts |
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* elementSchema: schema,
|
|
62
|
+
* elementSchemaCommands: {
|
|
63
|
+
* bold: { title: 'Bold', icon: IconBold, keystroke: 'Ctrl+B', view: 'strong' },
|
|
64
|
+
* callout: { title: 'Callout', icon: IconQuote },
|
|
65
|
+
* divider: { title: 'Divider', icon: IconHorizontalLine, view: 'hr' }
|
|
66
|
+
* },
|
|
67
|
+
* toolbar: ['bold', 'callout', 'divider']
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* Each key is the name of the command and of its toolbar button. The commands have titles and icons, so they can be
|
|
71
|
+
* menu items too, e.g. of the context menu.
|
|
72
|
+
*
|
|
73
|
+
* At the ends of the inline elements with text, the left and right arrow keys move in two steps, as CKEditor's two-step
|
|
74
|
+
* caret movement does at the ends of a bold: in the element, then in the text.
|
|
75
|
+
*
|
|
76
|
+
* The commands are made when the elements are registered, after `ElementSchema` and the other plugins are initialized.
|
|
77
|
+
* The editor is not created when an element is unknown.
|
|
78
|
+
*/
|
|
79
|
+
export default class ElementSchemaCommands extends Plugin {
|
|
80
|
+
public static get pluginName(): 'ElementSchemaCommands' {
|
|
81
|
+
return 'ElementSchemaCommands' as const;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public static get requires(): readonly [typeof ElementSchema] {
|
|
85
|
+
return [ElementSchema] as const;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The commands, by their name.
|
|
90
|
+
*/
|
|
91
|
+
private readonly _commands = new Map<string, ElementSchemaCommand>();
|
|
92
|
+
|
|
93
|
+
public init(): void {
|
|
94
|
+
const editor = this.editor;
|
|
95
|
+
|
|
96
|
+
for (const [name, { title, keystroke }] of this._getDefinitions()) {
|
|
97
|
+
if (keystroke) {
|
|
98
|
+
editor.keystrokes.set(keystroke, name);
|
|
99
|
+
editor.accessibility.addKeystrokeInfos({ keystrokes: [{ label: title, keystroke }] });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
editor.ui.componentFactory.add(name, locale => {
|
|
103
|
+
const command = this._commands.get(name);
|
|
104
|
+
|
|
105
|
+
// The commands are made in `afterInit()`, and the toolbars after it.
|
|
106
|
+
if (!command) {
|
|
107
|
+
throw new Error(`elementSchemaCommands.${name}: the button is created before the command.`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const button = new ElementOrPositionButtonView(locale, command);
|
|
111
|
+
|
|
112
|
+
button.bind('isOn').to(command, 'isOn');
|
|
113
|
+
button.keystroke = keystroke;
|
|
114
|
+
|
|
115
|
+
return button;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Makes the commands of the elements, which are registered then, and their converters.
|
|
122
|
+
*/
|
|
123
|
+
public afterInit(): void {
|
|
124
|
+
const editor = this.editor;
|
|
125
|
+
const schema = editor.model.schema;
|
|
126
|
+
const inlineNames = new Set<string>();
|
|
127
|
+
|
|
128
|
+
for (const [name, { element, title, icon, view }] of this._getDefinitions()) {
|
|
129
|
+
const elementName = element ?? name;
|
|
130
|
+
|
|
131
|
+
if (!schema.isRegistered(elementName)) {
|
|
132
|
+
throw new Error(
|
|
133
|
+
`elementSchemaCommands.${name}: unknown element "${elementName}". Declare it in the element schema, or ` +
|
|
134
|
+
`set "element" to an element of another plugin.`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const CommandClass = getCommandClass(schema, elementName);
|
|
139
|
+
const command = new CommandClass(editor, elementName);
|
|
140
|
+
|
|
141
|
+
command.set({ title, icon });
|
|
142
|
+
editor.commands.add(name, command);
|
|
143
|
+
this._commands.set(name, command);
|
|
144
|
+
|
|
145
|
+
if (command instanceof ElementInlineCommand) {
|
|
146
|
+
inlineNames.add(elementName);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (view) {
|
|
150
|
+
this._convert(elementName, view, (writer: ViewDowncastWriter) => {
|
|
151
|
+
if (command instanceof ElementInlineCommand) {
|
|
152
|
+
return createInlineTextElement(writer, view);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return schema.isObject(elementName)
|
|
156
|
+
? writer.createEmptyElement(view)
|
|
157
|
+
: writer.createContainerElement(view);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
enableTwoStepCaretMovement(this, inlineNames);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private _getDefinitions(): [name: string, definition: ElementSchemaCommandDefinition][] {
|
|
166
|
+
return Object.entries(this.editor.config.get('elementSchemaCommands') ?? {});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Declares the converters of an element with the tag of its `view`: the downcast with the highest priority, so it
|
|
171
|
+
* replaces the ones of the element schema, and the upcast.
|
|
172
|
+
*/
|
|
173
|
+
private _convert(elementName: string, tag: string, createView: (writer: ViewDowncastWriter) => ViewElement): void {
|
|
174
|
+
const conversion = this.editor.conversion;
|
|
175
|
+
|
|
176
|
+
conversion.for('upcast').elementToElement({ view: tag, model: elementName });
|
|
177
|
+
conversion.for('downcast').elementToElement({
|
|
178
|
+
model: elementName,
|
|
179
|
+
view: (_element, { writer }) => createView(writer),
|
|
180
|
+
// Over the ones of the schema, some of which are `high` already.
|
|
181
|
+
converterPriority: 'highest'
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Returns the command of an element, by its kind: an object, or an inline element with no text, is inserted; an inline
|
|
188
|
+
* element with text wraps text; a block-level one with text is a block; the others are containers.
|
|
189
|
+
*/
|
|
190
|
+
function getCommandClass(schema: ModelSchema, name: string): typeof ElementSchemaCommand {
|
|
191
|
+
const holdsText = schema.checkChild(name, '$text');
|
|
192
|
+
|
|
193
|
+
if (schema.isObject(name) || (schema.isInline(name) && !holdsText)) {
|
|
194
|
+
return ElementInsertCommand;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (schema.isInline(name)) {
|
|
198
|
+
return ElementInlineCommand;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return holdsText ? ElementBlockCommand : ElementContainerCommand;
|
|
202
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Element schema: declare elements in the model schema from a simple definition, e.g. a JSON file, with three types of
|
|
3
|
-
* elements (`empty`, `block`, `container`), and a validation that rejects contradictory definitions.
|
|
3
|
+
* elements (`empty`, `block`, `container`), and a validation that rejects contradictory definitions. `ElementSchemaCommands`
|
|
4
|
+
* makes commands and buttons for its elements.
|
|
4
5
|
*
|
|
5
6
|
* @module ckeditor5-elements-schema
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
// Plugins.
|
|
9
10
|
export { default as ElementSchema } from './elementSchema.js';
|
|
11
|
+
export {
|
|
12
|
+
default as ElementSchemaCommands,
|
|
13
|
+
type ElementSchemaCommandDefinition,
|
|
14
|
+
type ElementSchemaCommandsConfig
|
|
15
|
+
} from './elementSchemaCommands.js';
|
|
16
|
+
|
|
17
|
+
// Commands.
|
|
18
|
+
export { default as ElementSchemaCommand } from './commands/elementSchemaCommand.js';
|
|
19
|
+
export { default as ElementInlineCommand } from './commands/elementInlineCommand.js';
|
|
20
|
+
export { default as ElementBlockCommand } from './commands/elementBlockCommand.js';
|
|
21
|
+
export { default as ElementContainerCommand } from './commands/elementContainerCommand.js';
|
|
22
|
+
export { default as ElementInsertCommand } from './commands/elementInsertCommand.js';
|
|
23
|
+
|
|
24
|
+
// Utils.
|
|
25
|
+
export { withoutBlockFiller } from './conversion/inlineTextElement.js';
|
|
10
26
|
|
|
11
27
|
// Validation and compiling, which do not need an editor (also in `validate.ts`, for Node.js).
|
|
12
28
|
export * from './validate.js';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isForwardArrowKeyCode,
|
|
3
|
+
keyCodes,
|
|
4
|
+
type Editor,
|
|
5
|
+
type ModelDocumentFragment,
|
|
6
|
+
type ModelNode,
|
|
7
|
+
type ModelPosition,
|
|
8
|
+
type Plugin,
|
|
9
|
+
type ViewDocumentInsertTextEvent,
|
|
10
|
+
type ViewDocumentKeyDownEvent
|
|
11
|
+
} from 'ckeditor5';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Makes the left and right arrow keys move in two steps at the ends of inline elements, as CKEditor's two-step caret
|
|
15
|
+
* movement does at the ends of a bold: the first step goes into the element (or out of it), where the cursor looks the
|
|
16
|
+
* same, the next one moves in the text. `a[]<b>bc</b>` is `a<b>[]bc</b>`, then `a<b>b[]c</b>`. The browser would move by
|
|
17
|
+
* a character at once, and the positions on both sides of the end of an element would be out of reach.
|
|
18
|
+
*
|
|
19
|
+
* What is typed then goes where the cursor is. The listeners are the plugin's.
|
|
20
|
+
*/
|
|
21
|
+
export function enableTwoStepCaretMovement(plugin: Plugin, names: ReadonlySet<string>): void {
|
|
22
|
+
const editor = plugin.editor;
|
|
23
|
+
const viewDocument = editor.editing.view.document;
|
|
24
|
+
const isElement = (node: ModelNode | ModelDocumentFragment | null): node is ModelNode =>
|
|
25
|
+
!!node?.is('element') && names.has(node.name);
|
|
26
|
+
|
|
27
|
+
// Before the other features: e.g. `ElementSelectable` selects an inline object that the cursor reaches, and it may
|
|
28
|
+
// be just after the end of an element.
|
|
29
|
+
plugin.listenTo<ViewDocumentKeyDownEvent>(
|
|
30
|
+
viewDocument,
|
|
31
|
+
'keydown',
|
|
32
|
+
(evt, data) => {
|
|
33
|
+
const isPlain = !data.shiftKey && !data.ctrlKey && !data.altKey && !data.metaKey;
|
|
34
|
+
const isHorizontal = data.keyCode === keyCodes.arrowleft || data.keyCode === keyCodes.arrowright;
|
|
35
|
+
const isForward = isForwardArrowKeyCode(data.keyCode, editor.locale.contentLanguageDirection);
|
|
36
|
+
const position = isPlain && isHorizontal ? getStep(editor, isForward, isElement) : null;
|
|
37
|
+
|
|
38
|
+
if (position) {
|
|
39
|
+
editor.model.change(writer => {
|
|
40
|
+
writer.setSelection(position);
|
|
41
|
+
});
|
|
42
|
+
data.preventDefault();
|
|
43
|
+
evt.stop();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{ priority: 'highest' }
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// The browser types at a place of its own at an end of an element, e.g. at the end of the text before it, whichever
|
|
50
|
+
// side of the end the cursor is on. When that place differs from the cursor only by ends of elements, the text goes
|
|
51
|
+
// where the cursor is: at the view selection, which is the model one. The browser must not type it at its place, as
|
|
52
|
+
// CKEditor does for a fake selection; a composition is left to the browser.
|
|
53
|
+
plugin.listenTo<ViewDocumentInsertTextEvent>(
|
|
54
|
+
viewDocument,
|
|
55
|
+
'insertText',
|
|
56
|
+
(evt, data) => {
|
|
57
|
+
const target = data.selection?.rangeCount === 1 ? data.selection.getFirstRange() : null;
|
|
58
|
+
const position = target?.isCollapsed ? editor.editing.mapper.toModelPosition(target.start) : null;
|
|
59
|
+
|
|
60
|
+
if (position && !data.isComposing && isAtCursor(editor, position, isElement)) {
|
|
61
|
+
data.selection = viewDocument.selection;
|
|
62
|
+
data.preventDefault();
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{ priority: 'high' }
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Returns where the cursor goes with one step in the direction, when it is at an end of an element: into the element
|
|
71
|
+
* next to it, or out of the element it is in. `null` elsewhere, or for a selection that is not collapsed.
|
|
72
|
+
*/
|
|
73
|
+
function getStep(
|
|
74
|
+
editor: Editor,
|
|
75
|
+
isForward: boolean,
|
|
76
|
+
isElement: (node: ModelNode | ModelDocumentFragment | null) => node is ModelNode
|
|
77
|
+
): ModelPosition | null {
|
|
78
|
+
const model = editor.model;
|
|
79
|
+
const selection = model.document.selection;
|
|
80
|
+
const position = selection.getFirstPosition();
|
|
81
|
+
|
|
82
|
+
if (!selection.isCollapsed || !position) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const next = isForward ? position.nodeAfter : position.nodeBefore;
|
|
87
|
+
|
|
88
|
+
if (isElement(next)) {
|
|
89
|
+
return model.createPositionAt(next, isForward ? 0 : 'end');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if ((isForward ? position.isAtEnd : position.isAtStart) && isElement(position.parent)) {
|
|
93
|
+
return isForward ? model.createPositionAfter(position.parent) : model.createPositionBefore(position.parent);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Whether a position differs from the cursor only by ends of elements: `a[]<b>c</b>` and `a<b>[]c</b>` look the same.
|
|
101
|
+
*/
|
|
102
|
+
function isAtCursor(
|
|
103
|
+
editor: Editor,
|
|
104
|
+
position: ModelPosition,
|
|
105
|
+
isElement: (node: ModelNode | ModelDocumentFragment | null) => boolean
|
|
106
|
+
): boolean {
|
|
107
|
+
const model = editor.model;
|
|
108
|
+
const selection = model.document.selection;
|
|
109
|
+
const cursor = selection.getFirstPosition();
|
|
110
|
+
|
|
111
|
+
// Where the cursor is exactly, the browser types as usual.
|
|
112
|
+
if (!selection.isCollapsed || !cursor || cursor.isEqual(position)) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const range = cursor.isBefore(position) ? model.createRange(cursor, position) : model.createRange(position, cursor);
|
|
117
|
+
|
|
118
|
+
return Array.from(range.getWalker()).every(({ item }) => item.is('element') && isElement(item));
|
|
119
|
+
}
|
package/src/validate.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @module ckeditor5-elements-schema/validate
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export { validateElementSchema } from './validateElementSchema.js';
|
|
10
|
-
export { compileElementSchema, type CompiledElementSchema } from './compileElementSchema.js';
|
|
11
|
-
export { default as ElementSchemaError } from './elementSchemaError.js';
|
|
9
|
+
export { validateElementSchema } from './definition/validateElementSchema.js';
|
|
10
|
+
export { compileElementSchema, type CompiledElementSchema } from './definition/compileElementSchema.js';
|
|
11
|
+
export { default as ElementSchemaError } from './definition/elementSchemaError.js';
|
|
12
12
|
export type {
|
|
13
13
|
ElementSchemaDefinition,
|
|
14
14
|
ElementSchemaElement,
|
|
@@ -17,4 +17,4 @@ export type {
|
|
|
17
17
|
ElementSchemaKind,
|
|
18
18
|
ElementSchemaType,
|
|
19
19
|
ValidateElementSchemaOptions
|
|
20
|
-
} from './types.js';
|
|
20
|
+
} from './definition/types.js';
|
package/dist/canHold.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canHold.d.ts","sourceRoot":"","sources":["../src/canHold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,iBAA0D,CAAC;AAE9E;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAkBnG"}
|
package/dist/canHold.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canHold.js","sourceRoot":"","sources":["../src/canHold.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAsB,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAE9E;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,MAAyB,EAAE,KAAkC;IACnF,MAAM,MAAM,GAAG,KAAK,KAAK,OAAO,CAAC;IAEjC,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7B,OAAO,0CAA0C,CAAC;IACnD,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,SAAS,CAAC;QAEpE,OAAO,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,4CAA4C,CAAC;IAC9F,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACZ,OAAO,0DAA0D,CAAC;IACnE,CAAC;IAED,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,iEAAiE,CAAC,CAAC,CAAC,IAAI,CAAC;AAClG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compileElementSchema.d.ts","sourceRoot":"","sources":["../src/compileElementSchema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MAAM,CAAC,QAAQ,CAAC,CAAC;QACzE,GAAG,UAAU;KACb,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertElementSchema.d.ts","sourceRoot":"","sources":["../src/convertElementSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG,KAAK,GAAG,MAAM,CAE9G;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAgCpF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertElementSchema.js","sourceRoot":"","sources":["../src/convertElementSchema.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAmD;IAC7F,OAAO,QAAQ,IAAI,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,KAAyB;IAC7E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAE9B,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,OAA+B,CAAC;QAC9E,MAAM,GAAG,GAAG,UAAU,CAAC,OAA+B,CAAC,CAAC;QACxD,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AAO,OAAO,kBAAmB,SAAQ,KAAK;IACpD;;OAEG;IACH,SAAgB,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;gBAE1C,MAAM,EAAE,SAAS,kBAAkB,EAAE;CASjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elementSchemaError.js","sourceRoot":"","sources":["../src/elementSchemaError.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,KAAK;IACpD;;OAEG;IACa,MAAM,CAAgC;IAEtD,YAAY,MAAqC;QAChD,KAAK,CACJ,oCAAoC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,MAAM;YAC9G,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACvF,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readDefinition.d.ts","sourceRoot":"","sources":["../src/readDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAG7D,eAAO,MAAM,YAAY,UAAoF,CAAC;AAE9G,eAAO,MAAM,YAAY,QAAwB,CAAC;AAClD,eAAO,MAAM,cAAc,QAAuB,C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AK,CAAC,CAAC;AAC7E,CAAC"}
|
package/dist/suggest.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../src/suggest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAc3E"}
|
package/dist/suggest.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.js","sourceRoot":"","sources":["../src/suggest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,UAA6B;IAClE,IAAI,IAAwB,CAAC;IAC7B,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;QAE3E,IAAI,QAAQ,GAAG,YAAY,EAAE,CAAC;YAC7B,IAAI,GAAG,SAAS,CAAC;YACjB,YAAY,GAAG,QAAQ,CAAC;QACzB,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,mBAAmB,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACjD,CAAC;AAED,SAAS,YAAY,CAAC,CAAS,EAAE,CAAS;IACzC,IAAI,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IAEzE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,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,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACtC,MAAM,EACN;KACE,GAAG,IAAI,MAAM,oBAAoB,GAAG,GAAG,SAAS,MAAM,GACpD,MAAM,GACN,oBAAoB,CAAC,GAAG,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,GACrD,SAAS,MAAM,EAAE,GAAG,SAAS,GAC7B,oBAAoB,CAAC,GAAG,CAAC;CAC7B,CACD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;CACvD"}
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateElementSchema.d.ts","sourceRoot":"","sources":["../src/validateElementSchema.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAqB,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAEtG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,OAAO,EACd,EAAE,QAAa,EAAE,GAAE,4BAAiC,GAClD,kBA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AY,EACZ,MAAc;IAEd,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QAC1C,MAAM,CACL,IAAI,EACJ,IAAI,KAAK,OAAO;YACf,CAAC,CAAC,6EAA6E;YAC/E,CAAC,CAAC,+EAA+E,CAClF,CAAC;QAEF,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAEzB,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,MAAM,CACL,IAAI,EACJ,oBAAoB,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,yFAAyF,CAC9I,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|