@ckeditor/ckeditor5-ui 48.1.0 → 48.2.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/dist/editableui/editableuiview.d.ts +15 -4
- package/dist/editableui/inline/inlineeditableuiview.d.ts +6 -4
- package/dist/index-editor.css +12 -0
- package/dist/index.css +12 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +37 -20
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { Collection, CKEditorError, EmitterMixin, isNode, toArray, DomEmitterMixin, ObservableMixin, isIterable, global, uid, createElement, env, getEnvKeystrokeText, delay, isVisible, KeystrokeHandler, FocusTracker, Rect, getConstrainedViewportRect, toUnit, isText, ResizeObserver, getOptimalPosition, isRange, parseBase64EncodedObject, getBorderWidths, logWarning, priorities, first, getVisualViewportOffset, getAncestors } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
6
|
-
import { cloneDeepWith, isObject, isElement, throttle, debounce, cloneDeep, extend, escapeRegExp, escape } from 'es-toolkit/compat';
|
|
6
|
+
import { cloneDeepWith, isObject, isElement as isElement$1, throttle, debounce, cloneDeep, extend, escapeRegExp, escape } from 'es-toolkit/compat';
|
|
7
7
|
import { Plugin, ContextPlugin } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
8
8
|
import { IconCancel, IconCheck, IconAccessibility, IconProjectLogo, IconDropdownArrow, IconColorTileCheck, IconDragIndicator, IconPilcrow, IconThreeVerticalDots, IconText, IconPlus, IconParagraph, IconImportExport, IconBold, IconAlignLeft, IconColorPalette, IconEraser, IconPreviousArrow, IconNextArrow, IconLoupe } from '@ckeditor/ckeditor5-icons/dist/index.js';
|
|
9
9
|
import parse from 'color-parse';
|
|
@@ -2926,7 +2926,7 @@ function normalizeKeystrokeDefinition(definition) {
|
|
|
2926
2926
|
return String(!!isOn);
|
|
2927
2927
|
});
|
|
2928
2928
|
// On Safari we have to force the focus on a button on click as it's the only browser
|
|
2929
|
-
// that doesn't do that automatically. See
|
|
2929
|
+
// that doesn't do that automatically. See https://github.com/ckeditor/ckeditor5/issues/12115.
|
|
2930
2930
|
if (env.isSafari) {
|
|
2931
2931
|
if (!this._focusDelayed) {
|
|
2932
2932
|
this._focusDelayed = delay(()=>this.focus(), 0);
|
|
@@ -5837,7 +5837,7 @@ const POSITION_OFF_SCREEN = {
|
|
|
5837
5837
|
* Returns the DOM element for given object or null, if there is none,
|
|
5838
5838
|
* e.g. when the passed object is a Rect instance or so.
|
|
5839
5839
|
*/ function getDomElement(object) {
|
|
5840
|
-
if (isElement(object)) {
|
|
5840
|
+
if (isElement$1(object)) {
|
|
5841
5841
|
return object;
|
|
5842
5842
|
}
|
|
5843
5843
|
if (isRange(object)) {
|
|
@@ -10381,8 +10381,9 @@ function addMenuToOpenDropdown(dropdownView, options) {
|
|
|
10381
10381
|
return;
|
|
10382
10382
|
}
|
|
10383
10383
|
const elements = dropdownView.focusTracker.elements;
|
|
10384
|
-
// If the dropdown was closed, move the focus back to the button (
|
|
10385
|
-
// Don't touch the focus, if it moved somewhere else (e.g. moved to the editing root on #execute)
|
|
10384
|
+
// If the dropdown was closed, move the focus back to the button (https://github.com/ckeditor/ckeditor5/issues/12125).
|
|
10385
|
+
// Don't touch the focus, if it moved somewhere else (e.g. moved to the editing root on #execute).
|
|
10386
|
+
// See https://github.com/ckeditor/ckeditor5/issues/12178.
|
|
10386
10387
|
// Note: Don't use the state of the DropdownView#focusTracker here. It fires #blur with the timeout.
|
|
10387
10388
|
if (elements.some((element)=>element.contains(global.document.activeElement))) {
|
|
10388
10389
|
dropdownView.buttonView.focus();
|
|
@@ -12256,7 +12257,7 @@ const BALLOON_CLASS = 'ck-tooltip';
|
|
|
12256
12257
|
*/ _onLeaveOrBlur(evt, { target, relatedTarget }) {
|
|
12257
12258
|
if (evt.name === 'mouseleave') {
|
|
12258
12259
|
// Don't act when the event does not concern a DOM element (e.g. a mouseleave out of an entire document),
|
|
12259
|
-
if (!isElement(target)) {
|
|
12260
|
+
if (!isElement$1(target)) {
|
|
12260
12261
|
return;
|
|
12261
12262
|
}
|
|
12262
12263
|
const balloonElement = this.balloonPanelView.element;
|
|
@@ -12396,7 +12397,7 @@ const BALLOON_CLASS = 'ck-tooltip';
|
|
|
12396
12397
|
}
|
|
12397
12398
|
}
|
|
12398
12399
|
function getDescendantWithTooltip(element) {
|
|
12399
|
-
if (!isElement(element)) {
|
|
12400
|
+
if (!isElement$1(element)) {
|
|
12400
12401
|
return null;
|
|
12401
12402
|
}
|
|
12402
12403
|
return element.closest('[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])');
|
|
@@ -14246,7 +14247,7 @@ function isMenuDefinition(definition) {
|
|
|
14246
14247
|
// This ensures, the navigation works always the same and no pair of toolbars takes over
|
|
14247
14248
|
// (e.g. image and table toolbars when a selected image is inside a cell).
|
|
14248
14249
|
// * It could be that the focus went to the toolbar by clicking a toolbar item (e.g. a dropdown). In this case,
|
|
14249
|
-
// there were no candidates so they must be obtained (
|
|
14250
|
+
// there were no candidates so they must be obtained (https://github.com/ckeditor/ckeditor5/issues/12339).
|
|
14250
14251
|
if (!currentFocusedToolbarDefinition || !candidateDefinitions) {
|
|
14251
14252
|
candidateDefinitions = this._getFocusableCandidateToolbarDefinitions();
|
|
14252
14253
|
}
|
|
@@ -14607,25 +14608,35 @@ function isMenuDefinition(definition) {
|
|
|
14607
14608
|
*
|
|
14608
14609
|
* @param locale The locale instance.
|
|
14609
14610
|
* @param editingView The editing view instance the editable is related to.
|
|
14610
|
-
* @param editableElement The editable element. If
|
|
14611
|
-
*
|
|
14611
|
+
* @param editableElement The editable element. If an existing `HTMLElement` is passed, the view applies its
|
|
14612
|
+
* template to it; otherwise the view creates a fresh element (a `<div>` by default, or one matching the given
|
|
14613
|
+
* {@link module:core/editor/editorconfig~ViewRootElementDefinition}).
|
|
14612
14614
|
*/ constructor(locale, editingView, editableElement){
|
|
14613
14615
|
super(locale);
|
|
14616
|
+
const elementDefinition = isElement(editableElement) ? undefined : editableElement;
|
|
14617
|
+
const { name, classes, styles, attributes } = elementDefinition || {};
|
|
14618
|
+
this.set('isFocused', false);
|
|
14619
|
+
this.set('isInlineRoot', false);
|
|
14614
14620
|
this.setTemplate({
|
|
14615
|
-
tag: 'div',
|
|
14621
|
+
tag: name || 'div',
|
|
14616
14622
|
attributes: {
|
|
14623
|
+
...attributes,
|
|
14617
14624
|
class: [
|
|
14618
14625
|
'ck',
|
|
14619
14626
|
'ck-content',
|
|
14620
14627
|
'ck-editor__editable',
|
|
14621
|
-
'ck-rounded-corners'
|
|
14628
|
+
'ck-rounded-corners',
|
|
14629
|
+
this.bindTemplate.if('isInlineRoot', 'ck-editor__editable_inline-root'),
|
|
14630
|
+
...classes ? toArray(classes) : []
|
|
14622
14631
|
],
|
|
14632
|
+
...styles && {
|
|
14633
|
+
style: styles
|
|
14634
|
+
},
|
|
14623
14635
|
lang: locale.contentLanguage,
|
|
14624
14636
|
dir: locale.contentLanguageDirection
|
|
14625
14637
|
}
|
|
14626
14638
|
});
|
|
14627
|
-
this.
|
|
14628
|
-
this._editableElement = editableElement;
|
|
14639
|
+
this._editableElement = isElement(editableElement) ? editableElement : undefined;
|
|
14629
14640
|
this._hasExternalElement = !!this._editableElement;
|
|
14630
14641
|
this._editingView = editingView;
|
|
14631
14642
|
}
|
|
@@ -14690,6 +14701,11 @@ function isMenuDefinition(definition) {
|
|
|
14690
14701
|
}
|
|
14691
14702
|
}
|
|
14692
14703
|
}
|
|
14704
|
+
/**
|
|
14705
|
+
* An alias for `isElement` from `es-toolkit/compat` with additional type guard.
|
|
14706
|
+
*/ function isElement(value) {
|
|
14707
|
+
return isElement$1(value);
|
|
14708
|
+
}
|
|
14693
14709
|
|
|
14694
14710
|
/**
|
|
14695
14711
|
* The inline editable UI class implementing an inline {@link module:ui/editableui/editableuiview~EditableUIView}.
|
|
@@ -14702,9 +14718,10 @@ function isMenuDefinition(definition) {
|
|
|
14702
14718
|
*
|
|
14703
14719
|
* @param locale The locale instance.
|
|
14704
14720
|
* @param editingView The editing view instance the editable is related to.
|
|
14705
|
-
* @param editableElement The editable element.
|
|
14706
|
-
* {@link module:
|
|
14707
|
-
*
|
|
14721
|
+
* @param editableElement The editable element. May be an existing `HTMLElement`, a
|
|
14722
|
+
* {@link module:core/editor/editorconfig~ViewRootElementDefinition} describing the element to create,
|
|
14723
|
+
* or `undefined` to create a default `<div>` element. See
|
|
14724
|
+
* {@link module:ui/editableui/editableuiview~EditableUIView}.
|
|
14708
14725
|
* @param options Additional configuration of the view.
|
|
14709
14726
|
* @param options.label The label of the editable for assistive technologies. If not provided, a default label is used or,
|
|
14710
14727
|
* the existing `aria-label` attribute value from the specified `editableElement` is preserved.
|
|
@@ -16568,9 +16585,9 @@ const toPx$3 = /* #__PURE__ */ toUnit('px');
|
|
|
16568
16585
|
// Classic setTemplate binding for #text will not work because highlightText() replaces the
|
|
16569
16586
|
// pre-rendered DOM text node new a new one (and <mark> elements).
|
|
16570
16587
|
this.on('change:text', ()=>{
|
|
16571
|
-
this._updateInnerHTML(this.text);
|
|
16588
|
+
this._updateInnerHTML(escape(this.text || ''));
|
|
16572
16589
|
});
|
|
16573
|
-
this._updateInnerHTML(this.text);
|
|
16590
|
+
this._updateInnerHTML(escape(this.text || ''));
|
|
16574
16591
|
});
|
|
16575
16592
|
}
|
|
16576
16593
|
/**
|
|
@@ -17227,7 +17244,7 @@ const toPx = /* #__PURE__ */ toUnit('px');
|
|
|
17227
17244
|
* @inheritDoc
|
|
17228
17245
|
*/ destroy() {
|
|
17229
17246
|
super.destroy();
|
|
17230
|
-
// Destroy created UI components as they are not automatically destroyed (see ckeditor5
|
|
17247
|
+
// Destroy created UI components as they are not automatically destroyed (see https://github.com/ckeditor/ckeditor5/issues/1341).
|
|
17231
17248
|
this.panelView.destroy();
|
|
17232
17249
|
this.buttonView.destroy();
|
|
17233
17250
|
this.toolbarView.destroy();
|