@textbus/platform-browser 3.0.0-alpha.56 → 3.0.0-alpha.58
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/bundles/_utils/env.d.ts
CHANGED
package/bundles/index.esm.js
CHANGED
@@ -101,6 +101,7 @@ function getLayoutRectByRange(range) {
|
|
101
101
|
const isWindows = () => /win(dows|32|64)/i.test(navigator.userAgent);
|
102
102
|
const isMac = () => /mac os/i.test(navigator.userAgent);
|
103
103
|
const isSafari = () => /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
|
104
|
+
const isFirefox = () => /Firefox/.test(navigator.userAgent);
|
104
105
|
|
105
106
|
/******************************************************************************
|
106
107
|
Copyright (c) Microsoft Corporation.
|
@@ -1586,6 +1587,7 @@ let MagicInput = class MagicInput extends Input {
|
|
1586
1587
|
this.composition = false;
|
1587
1588
|
this.caret = new ExperimentalCaret(this.scheduler, this.injector.get(VIEW_MASK));
|
1588
1589
|
this.isSafari = isSafari();
|
1590
|
+
this.isFirefox = isFirefox();
|
1589
1591
|
this.isMac = isMac();
|
1590
1592
|
this.isWindows = isWindows();
|
1591
1593
|
this._disabled = false;
|
@@ -1714,7 +1716,10 @@ let MagicInput = class MagicInput extends Input {
|
|
1714
1716
|
this.doc.body.appendChild(div);
|
1715
1717
|
div.focus();
|
1716
1718
|
setTimeout(() => {
|
1717
|
-
|
1719
|
+
let html = div.innerHTML;
|
1720
|
+
if (!html && text && this.isFirefox) {
|
1721
|
+
html = `<p>${text}</p>`;
|
1722
|
+
}
|
1718
1723
|
this.handlePaste(html, text);
|
1719
1724
|
this.doc.body.removeChild(div);
|
1720
1725
|
});
|
@@ -1769,6 +1774,7 @@ let MagicInput = class MagicInput extends Input {
|
|
1769
1774
|
handleInput(textarea) {
|
1770
1775
|
let startIndex = 0;
|
1771
1776
|
this.subscription.add(fromEvent(textarea, 'compositionstart').subscribe(() => {
|
1777
|
+
this.composition = true;
|
1772
1778
|
startIndex = this.selection.startOffset;
|
1773
1779
|
}), fromEvent(textarea, 'compositionupdate').subscribe(ev => {
|
1774
1780
|
if (ev.data === ' ') {
|
@@ -1803,6 +1809,7 @@ let MagicInput = class MagicInput extends Input {
|
|
1803
1809
|
this.isSougouPinYin = false;
|
1804
1810
|
return !b;
|
1805
1811
|
}))).subscribe(text => {
|
1812
|
+
this.composition = false;
|
1806
1813
|
if (text) {
|
1807
1814
|
this.commander.write(text);
|
1808
1815
|
}
|
@@ -2715,4 +2722,4 @@ class Viewer extends Starter {
|
|
2715
2722
|
}
|
2716
2723
|
}
|
2717
2724
|
|
2718
|
-
export { CollaborateCursor, CollaborateSelectionAwarenessDelegate, DomRenderer, EDITOR_OPTIONS, Input, MagicInput, NativeInput, OutputTranslator, Parser, SelectionBridge, VIEW_CONTAINER, VIEW_DOCUMENT, VIEW_MASK, Viewer, createElement, createTextNode, getLayoutRectByRange, isMac, isSafari, isWindows };
|
2725
|
+
export { CollaborateCursor, CollaborateSelectionAwarenessDelegate, DomRenderer, EDITOR_OPTIONS, Input, MagicInput, NativeInput, OutputTranslator, Parser, SelectionBridge, VIEW_CONTAINER, VIEW_DOCUMENT, VIEW_MASK, Viewer, createElement, createTextNode, getLayoutRectByRange, isFirefox, isMac, isSafari, isWindows };
|
package/bundles/index.js
CHANGED
@@ -103,6 +103,7 @@ function getLayoutRectByRange(range) {
|
|
103
103
|
const isWindows = () => /win(dows|32|64)/i.test(navigator.userAgent);
|
104
104
|
const isMac = () => /mac os/i.test(navigator.userAgent);
|
105
105
|
const isSafari = () => /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
|
106
|
+
const isFirefox = () => /Firefox/.test(navigator.userAgent);
|
106
107
|
|
107
108
|
/******************************************************************************
|
108
109
|
Copyright (c) Microsoft Corporation.
|
@@ -1588,6 +1589,7 @@ exports.MagicInput = class MagicInput extends Input {
|
|
1588
1589
|
this.composition = false;
|
1589
1590
|
this.caret = new ExperimentalCaret(this.scheduler, this.injector.get(VIEW_MASK));
|
1590
1591
|
this.isSafari = isSafari();
|
1592
|
+
this.isFirefox = isFirefox();
|
1591
1593
|
this.isMac = isMac();
|
1592
1594
|
this.isWindows = isWindows();
|
1593
1595
|
this._disabled = false;
|
@@ -1716,7 +1718,10 @@ exports.MagicInput = class MagicInput extends Input {
|
|
1716
1718
|
this.doc.body.appendChild(div);
|
1717
1719
|
div.focus();
|
1718
1720
|
setTimeout(() => {
|
1719
|
-
|
1721
|
+
let html = div.innerHTML;
|
1722
|
+
if (!html && text && this.isFirefox) {
|
1723
|
+
html = `<p>${text}</p>`;
|
1724
|
+
}
|
1720
1725
|
this.handlePaste(html, text);
|
1721
1726
|
this.doc.body.removeChild(div);
|
1722
1727
|
});
|
@@ -1771,6 +1776,7 @@ exports.MagicInput = class MagicInput extends Input {
|
|
1771
1776
|
handleInput(textarea) {
|
1772
1777
|
let startIndex = 0;
|
1773
1778
|
this.subscription.add(stream.fromEvent(textarea, 'compositionstart').subscribe(() => {
|
1779
|
+
this.composition = true;
|
1774
1780
|
startIndex = this.selection.startOffset;
|
1775
1781
|
}), stream.fromEvent(textarea, 'compositionupdate').subscribe(ev => {
|
1776
1782
|
if (ev.data === ' ') {
|
@@ -1805,6 +1811,7 @@ exports.MagicInput = class MagicInput extends Input {
|
|
1805
1811
|
this.isSougouPinYin = false;
|
1806
1812
|
return !b;
|
1807
1813
|
}))).subscribe(text => {
|
1814
|
+
this.composition = false;
|
1808
1815
|
if (text) {
|
1809
1816
|
this.commander.write(text);
|
1810
1817
|
}
|
@@ -2727,6 +2734,7 @@ exports.Viewer = Viewer;
|
|
2727
2734
|
exports.createElement = createElement;
|
2728
2735
|
exports.createTextNode = createTextNode;
|
2729
2736
|
exports.getLayoutRectByRange = getLayoutRectByRange;
|
2737
|
+
exports.isFirefox = isFirefox;
|
2730
2738
|
exports.isMac = isMac;
|
2731
2739
|
exports.isSafari = isSafari;
|
2732
2740
|
exports.isWindows = isWindows;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/platform-browser",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.58",
|
4
4
|
"description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
|
5
5
|
"main": "./bundles/index.js",
|
6
6
|
"module": "./bundles/index.esm.js",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"dependencies": {
|
28
28
|
"@tanbo/di": "^1.1.4",
|
29
29
|
"@tanbo/stream": "^1.1.9",
|
30
|
-
"@textbus/core": "^3.0.0-alpha.
|
30
|
+
"@textbus/core": "^3.0.0-alpha.57",
|
31
31
|
"reflect-metadata": "^0.1.13"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"bugs": {
|
49
49
|
"url": "https://github.com/textbus/textbus.git/issues"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "a4b64281a947ebc09ed3d6f5d357baef89493648"
|
52
52
|
}
|