@vaadin/rich-text-editor 24.4.20 → 24.4.22
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/package.json +11 -11
- package/src/vaadin-rich-text-editor-mixin.js +0 -69
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/rich-text-editor",
|
|
3
|
-
"version": "24.4.
|
|
3
|
+
"version": "24.4.22",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
43
43
|
"@polymer/polymer": "^3.0.0",
|
|
44
|
-
"@vaadin/button": "~24.4.
|
|
45
|
-
"@vaadin/component-base": "~24.4.
|
|
46
|
-
"@vaadin/confirm-dialog": "~24.4.
|
|
47
|
-
"@vaadin/text-field": "~24.4.
|
|
48
|
-
"@vaadin/tooltip": "~24.4.
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "~24.4.
|
|
50
|
-
"@vaadin/vaadin-material-styles": "~24.4.
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "~24.4.
|
|
44
|
+
"@vaadin/button": "~24.4.22",
|
|
45
|
+
"@vaadin/component-base": "~24.4.22",
|
|
46
|
+
"@vaadin/confirm-dialog": "~24.4.22",
|
|
47
|
+
"@vaadin/text-field": "~24.4.22",
|
|
48
|
+
"@vaadin/tooltip": "~24.4.22",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "~24.4.22",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "~24.4.22",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "~24.4.22",
|
|
52
52
|
"lit": "^3.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@esm-bundle/chai": "^4.3.4",
|
|
56
|
-
"@vaadin/a11y-base": "~24.4.
|
|
56
|
+
"@vaadin/a11y-base": "~24.4.22",
|
|
57
57
|
"@vaadin/testing-helpers": "^0.6.0",
|
|
58
58
|
"gulp": "^4.0.2",
|
|
59
59
|
"gulp-cli": "^2.3.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"web-types.json",
|
|
66
66
|
"web-types.lit.json"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "51590b0f1e3b3f732d03368b2d85a408269c94d9"
|
|
69
69
|
}
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import '../vendor/vaadin-quill.js';
|
|
12
12
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
13
|
-
import { isFirefox } from '@vaadin/component-base/src/browser-utils.js';
|
|
14
13
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
15
14
|
|
|
16
15
|
const Quill = window.Quill;
|
|
@@ -301,11 +300,6 @@ export const RichTextEditorMixin = (superClass) =>
|
|
|
301
300
|
this.__patchToolbar();
|
|
302
301
|
this.__patchKeyboard();
|
|
303
302
|
|
|
304
|
-
/* c8 ignore next 3 */
|
|
305
|
-
if (isFirefox) {
|
|
306
|
-
this.__patchFirefoxFocus();
|
|
307
|
-
}
|
|
308
|
-
|
|
309
303
|
this.__setDirection(this.__dir);
|
|
310
304
|
|
|
311
305
|
const editorContent = editor.querySelector('.ql-editor');
|
|
@@ -450,69 +444,6 @@ export const RichTextEditorMixin = (superClass) =>
|
|
|
450
444
|
this._toolbarState = STATE.DEFAULT;
|
|
451
445
|
}
|
|
452
446
|
|
|
453
|
-
/** @private */
|
|
454
|
-
__createFakeFocusTarget() {
|
|
455
|
-
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
456
|
-
const elem = document.createElement('textarea');
|
|
457
|
-
// Reset box model
|
|
458
|
-
elem.style.border = '0';
|
|
459
|
-
elem.style.padding = '0';
|
|
460
|
-
elem.style.margin = '0';
|
|
461
|
-
// Move element out of screen horizontally
|
|
462
|
-
elem.style.position = 'absolute';
|
|
463
|
-
elem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
|
464
|
-
// Move element to the same position vertically
|
|
465
|
-
const yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
466
|
-
elem.style.top = `${yPosition}px`;
|
|
467
|
-
return elem;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/** @private */
|
|
471
|
-
__patchFirefoxFocus() {
|
|
472
|
-
// In Firefox 63+ with native Shadow DOM, when moving focus out of
|
|
473
|
-
// contenteditable and back again within same shadow root, cursor
|
|
474
|
-
// disappears. See https://bugzilla.mozilla.org/show_bug.cgi?id=1496769
|
|
475
|
-
const editorContent = this.shadowRoot.querySelector('.ql-editor');
|
|
476
|
-
let isFake = false;
|
|
477
|
-
|
|
478
|
-
const focusFake = () => {
|
|
479
|
-
isFake = true;
|
|
480
|
-
this.__fakeTarget = this.__createFakeFocusTarget();
|
|
481
|
-
document.body.appendChild(this.__fakeTarget);
|
|
482
|
-
// Let the focus step out of shadow root!
|
|
483
|
-
this.__fakeTarget.focus();
|
|
484
|
-
return new Promise((resolve) => {
|
|
485
|
-
setTimeout(resolve);
|
|
486
|
-
});
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
const focusBack = (offsetNode, offset) => {
|
|
490
|
-
this._editor.focus();
|
|
491
|
-
if (offsetNode) {
|
|
492
|
-
this._editor.selection.setNativeRange(offsetNode, offset);
|
|
493
|
-
}
|
|
494
|
-
document.body.removeChild(this.__fakeTarget);
|
|
495
|
-
delete this.__fakeTarget;
|
|
496
|
-
isFake = false;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
editorContent.addEventListener('mousedown', (e) => {
|
|
500
|
-
if (!this._editor.hasFocus()) {
|
|
501
|
-
const { x, y } = e;
|
|
502
|
-
const { offset, offsetNode } = document.caretPositionFromPoint(x, y);
|
|
503
|
-
focusFake().then(() => {
|
|
504
|
-
focusBack(offsetNode, offset);
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
editorContent.addEventListener('focusin', () => {
|
|
510
|
-
if (isFake === false) {
|
|
511
|
-
focusFake().then(() => focusBack());
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
|
|
516
447
|
/** @private */
|
|
517
448
|
__patchToolbar() {
|
|
518
449
|
const toolbar = this._editor.getModule('toolbar');
|
package/web-types.json
CHANGED