@vaadin/rich-text-editor 24.7.13 → 24.7.14
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 +14 -14
- 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.7.
|
|
3
|
+
"version": "24.7.14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
43
43
|
"@polymer/polymer": "^3.0.0",
|
|
44
|
-
"@vaadin/button": "~24.7.
|
|
45
|
-
"@vaadin/component-base": "~24.7.
|
|
46
|
-
"@vaadin/confirm-dialog": "~24.7.
|
|
47
|
-
"@vaadin/overlay": "~24.7.
|
|
48
|
-
"@vaadin/text-field": "~24.7.
|
|
49
|
-
"@vaadin/tooltip": "~24.7.
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "~24.7.
|
|
51
|
-
"@vaadin/vaadin-material-styles": "~24.7.
|
|
52
|
-
"@vaadin/vaadin-themable-mixin": "~24.7.
|
|
44
|
+
"@vaadin/button": "~24.7.14",
|
|
45
|
+
"@vaadin/component-base": "~24.7.14",
|
|
46
|
+
"@vaadin/confirm-dialog": "~24.7.14",
|
|
47
|
+
"@vaadin/overlay": "~24.7.14",
|
|
48
|
+
"@vaadin/text-field": "~24.7.14",
|
|
49
|
+
"@vaadin/tooltip": "~24.7.14",
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "~24.7.14",
|
|
51
|
+
"@vaadin/vaadin-material-styles": "~24.7.14",
|
|
52
|
+
"@vaadin/vaadin-themable-mixin": "~24.7.14",
|
|
53
53
|
"lit": "^3.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@vaadin/a11y-base": "~24.7.
|
|
57
|
-
"@vaadin/chai-plugins": "~24.7.
|
|
58
|
-
"@vaadin/test-runner-commands": "~24.7.
|
|
56
|
+
"@vaadin/a11y-base": "~24.7.14",
|
|
57
|
+
"@vaadin/chai-plugins": "~24.7.14",
|
|
58
|
+
"@vaadin/test-runner-commands": "~24.7.14",
|
|
59
59
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
60
60
|
"gulp": "^4.0.2",
|
|
61
61
|
"gulp-cli": "^2.3.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"web-types.json",
|
|
68
68
|
"web-types.lit.json"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c0f28df793bb9cea35792848592ac9a1700e8c3a"
|
|
71
71
|
}
|
|
@@ -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;
|
|
@@ -345,11 +344,6 @@ export const RichTextEditorMixin = (superClass) =>
|
|
|
345
344
|
this.__patchToolbar();
|
|
346
345
|
this.__patchKeyboard();
|
|
347
346
|
|
|
348
|
-
/* c8 ignore next 3 */
|
|
349
|
-
if (isFirefox) {
|
|
350
|
-
this.__patchFirefoxFocus();
|
|
351
|
-
}
|
|
352
|
-
|
|
353
347
|
this.__setDirection(this.__dir);
|
|
354
348
|
|
|
355
349
|
const editorContent = editor.querySelector('.ql-editor');
|
|
@@ -505,69 +499,6 @@ export const RichTextEditorMixin = (superClass) =>
|
|
|
505
499
|
this._toolbarState = STATE.DEFAULT;
|
|
506
500
|
}
|
|
507
501
|
|
|
508
|
-
/** @private */
|
|
509
|
-
__createFakeFocusTarget() {
|
|
510
|
-
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
511
|
-
const elem = document.createElement('textarea');
|
|
512
|
-
// Reset box model
|
|
513
|
-
elem.style.border = '0';
|
|
514
|
-
elem.style.padding = '0';
|
|
515
|
-
elem.style.margin = '0';
|
|
516
|
-
// Move element out of screen horizontally
|
|
517
|
-
elem.style.position = 'absolute';
|
|
518
|
-
elem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
|
519
|
-
// Move element to the same position vertically
|
|
520
|
-
const yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
521
|
-
elem.style.top = `${yPosition}px`;
|
|
522
|
-
return elem;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/** @private */
|
|
526
|
-
__patchFirefoxFocus() {
|
|
527
|
-
// In Firefox 63+ with native Shadow DOM, when moving focus out of
|
|
528
|
-
// contenteditable and back again within same shadow root, cursor
|
|
529
|
-
// disappears. See https://bugzilla.mozilla.org/show_bug.cgi?id=1496769
|
|
530
|
-
const editorContent = this.shadowRoot.querySelector('.ql-editor');
|
|
531
|
-
let isFake = false;
|
|
532
|
-
|
|
533
|
-
const focusFake = () => {
|
|
534
|
-
isFake = true;
|
|
535
|
-
this.__fakeTarget = this.__createFakeFocusTarget();
|
|
536
|
-
document.body.appendChild(this.__fakeTarget);
|
|
537
|
-
// Let the focus step out of shadow root!
|
|
538
|
-
this.__fakeTarget.focus();
|
|
539
|
-
return new Promise((resolve) => {
|
|
540
|
-
setTimeout(resolve);
|
|
541
|
-
});
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
const focusBack = (offsetNode, offset) => {
|
|
545
|
-
this._editor.focus();
|
|
546
|
-
if (offsetNode) {
|
|
547
|
-
this._editor.selection.setNativeRange(offsetNode, offset);
|
|
548
|
-
}
|
|
549
|
-
document.body.removeChild(this.__fakeTarget);
|
|
550
|
-
delete this.__fakeTarget;
|
|
551
|
-
isFake = false;
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
editorContent.addEventListener('mousedown', (e) => {
|
|
555
|
-
if (!this._editor.hasFocus()) {
|
|
556
|
-
const { x, y } = e;
|
|
557
|
-
const { offset, offsetNode } = document.caretPositionFromPoint(x, y);
|
|
558
|
-
focusFake().then(() => {
|
|
559
|
-
focusBack(offsetNode, offset);
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
editorContent.addEventListener('focusin', () => {
|
|
565
|
-
if (isFake === false) {
|
|
566
|
-
focusFake().then(() => focusBack());
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
|
|
571
502
|
/** @private */
|
|
572
503
|
__patchToolbar() {
|
|
573
504
|
const toolbar = this._editor.getModule('toolbar');
|
package/web-types.json
CHANGED