@textbus/platform-browser 3.0.2 → 3.0.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/bundles/_utils/env.d.ts +1 -0
- package/bundles/core/native-input.d.ts +1 -0
- package/bundles/core/types.d.ts +6 -0
- package/bundles/index.esm.js +13 -3
- package/bundles/index.js +13 -2
- package/bundles/viewer.d.ts +1 -6
- package/package.json +2 -2
package/bundles/_utils/env.d.ts
CHANGED
@@ -45,6 +45,7 @@ export declare class NativeInput extends Input {
|
|
45
45
|
private nativeRange;
|
46
46
|
private isSafari;
|
47
47
|
private isMac;
|
48
|
+
private isMobileBrowser;
|
48
49
|
private isSougouPinYin;
|
49
50
|
constructor(injector: Injector, parser: Parser, scheduler: Scheduler, selection: Selection, keyboard: Keyboard, renderer: Renderer, commander: Commander, controller: Controller);
|
50
51
|
focus(nativeRange: Range): void;
|
package/bundles/core/types.d.ts
CHANGED
@@ -57,7 +57,13 @@ export interface CompositionState {
|
|
57
57
|
data: string;
|
58
58
|
}
|
59
59
|
export declare abstract class Input {
|
60
|
+
/**
|
61
|
+
* @experimental
|
62
|
+
*/
|
60
63
|
abstract composition: boolean;
|
64
|
+
/**
|
65
|
+
* @experimental
|
66
|
+
*/
|
61
67
|
abstract compositionState: CompositionState | null;
|
62
68
|
abstract onReady: Promise<void>;
|
63
69
|
abstract caret: Caret;
|
package/bundles/index.esm.js
CHANGED
@@ -102,6 +102,7 @@ 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
104
|
const isFirefox = () => /Firefox/.test(navigator.userAgent);
|
105
|
+
const isMobileBrowser = () => /Android|iPhone|iPad/.test(navigator.userAgent);
|
105
106
|
|
106
107
|
/******************************************************************************
|
107
108
|
Copyright (c) Microsoft Corporation.
|
@@ -2022,6 +2023,7 @@ let NativeInput = class NativeInput extends Input {
|
|
2022
2023
|
this.nativeRange = null;
|
2023
2024
|
this.isSafari = isSafari();
|
2024
2025
|
this.isMac = isMac();
|
2026
|
+
this.isMobileBrowser = isMobileBrowser();
|
2025
2027
|
this.isSougouPinYin = false; // 有 bug 版本搜狗拼音
|
2026
2028
|
this.documentView = injector.get(VIEW_DOCUMENT);
|
2027
2029
|
if (!controller.readonly) {
|
@@ -2196,7 +2198,13 @@ let NativeInput = class NativeInput extends Input {
|
|
2196
2198
|
}
|
2197
2199
|
isCompositionEnd = ev.inputType === 'insertFromComposition';
|
2198
2200
|
if (isCompositionEnd && this.composition) {
|
2199
|
-
|
2201
|
+
if (this.isMobileBrowser) {
|
2202
|
+
this.composition = false;
|
2203
|
+
this.compositionState = null;
|
2204
|
+
}
|
2205
|
+
else {
|
2206
|
+
return null;
|
2207
|
+
}
|
2200
2208
|
}
|
2201
2209
|
if (this.isSafari) {
|
2202
2210
|
if (ev.inputType === 'insertText' || isCompositionEnd) {
|
@@ -2209,7 +2217,9 @@ let NativeInput = class NativeInput extends Input {
|
|
2209
2217
|
return null;
|
2210
2218
|
}), filter(text => {
|
2211
2219
|
return text;
|
2212
|
-
})), this.isSafari ? new Observable() : fromEvent(input, 'compositionend').pipe(
|
2220
|
+
})), (!this.isMobileBrowser && this.isSafari) ? new Observable() : fromEvent(input, 'compositionend').pipe(filter(() => {
|
2221
|
+
return this.composition;
|
2222
|
+
}), map(ev => {
|
2213
2223
|
isCompositionEnd = true;
|
2214
2224
|
ev.preventDefault();
|
2215
2225
|
return ev.data;
|
@@ -2825,4 +2835,4 @@ class Viewer extends Starter {
|
|
2825
2835
|
}
|
2826
2836
|
}
|
2827
2837
|
|
2828
|
-
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 };
|
2838
|
+
export { CollaborateCursor, CollaborateSelectionAwarenessDelegate, DomRenderer, EDITOR_OPTIONS, Input, MagicInput, NativeInput, OutputTranslator, Parser, SelectionBridge, VIEW_CONTAINER, VIEW_DOCUMENT, VIEW_MASK, Viewer, createElement, createTextNode, getLayoutRectByRange, isFirefox, isMac, isMobileBrowser, isSafari, isWindows };
|
package/bundles/index.js
CHANGED
@@ -104,6 +104,7 @@ 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
106
|
const isFirefox = () => /Firefox/.test(navigator.userAgent);
|
107
|
+
const isMobileBrowser = () => /Android|iPhone|iPad/.test(navigator.userAgent);
|
107
108
|
|
108
109
|
/******************************************************************************
|
109
110
|
Copyright (c) Microsoft Corporation.
|
@@ -2024,6 +2025,7 @@ exports.NativeInput = class NativeInput extends Input {
|
|
2024
2025
|
this.nativeRange = null;
|
2025
2026
|
this.isSafari = isSafari();
|
2026
2027
|
this.isMac = isMac();
|
2028
|
+
this.isMobileBrowser = isMobileBrowser();
|
2027
2029
|
this.isSougouPinYin = false; // 有 bug 版本搜狗拼音
|
2028
2030
|
this.documentView = injector.get(VIEW_DOCUMENT);
|
2029
2031
|
if (!controller.readonly) {
|
@@ -2198,7 +2200,13 @@ exports.NativeInput = class NativeInput extends Input {
|
|
2198
2200
|
}
|
2199
2201
|
isCompositionEnd = ev.inputType === 'insertFromComposition';
|
2200
2202
|
if (isCompositionEnd && this.composition) {
|
2201
|
-
|
2203
|
+
if (this.isMobileBrowser) {
|
2204
|
+
this.composition = false;
|
2205
|
+
this.compositionState = null;
|
2206
|
+
}
|
2207
|
+
else {
|
2208
|
+
return null;
|
2209
|
+
}
|
2202
2210
|
}
|
2203
2211
|
if (this.isSafari) {
|
2204
2212
|
if (ev.inputType === 'insertText' || isCompositionEnd) {
|
@@ -2211,7 +2219,9 @@ exports.NativeInput = class NativeInput extends Input {
|
|
2211
2219
|
return null;
|
2212
2220
|
}), stream.filter(text => {
|
2213
2221
|
return text;
|
2214
|
-
})), this.isSafari ? new stream.Observable() : stream.fromEvent(input, 'compositionend').pipe(stream.
|
2222
|
+
})), (!this.isMobileBrowser && this.isSafari) ? new stream.Observable() : stream.fromEvent(input, 'compositionend').pipe(stream.filter(() => {
|
2223
|
+
return this.composition;
|
2224
|
+
}), stream.map(ev => {
|
2215
2225
|
isCompositionEnd = true;
|
2216
2226
|
ev.preventDefault();
|
2217
2227
|
return ev.data;
|
@@ -2839,5 +2849,6 @@ exports.createTextNode = createTextNode;
|
|
2839
2849
|
exports.getLayoutRectByRange = getLayoutRectByRange;
|
2840
2850
|
exports.isFirefox = isFirefox;
|
2841
2851
|
exports.isMac = isMac;
|
2852
|
+
exports.isMobileBrowser = isMobileBrowser;
|
2842
2853
|
exports.isSafari = isSafari;
|
2843
2854
|
exports.isWindows = isWindows;
|
package/bundles/viewer.d.ts
CHANGED
@@ -60,12 +60,7 @@ export declare class Viewer extends Starter {
|
|
60
60
|
/**
|
61
61
|
* 获取编辑器所有资源
|
62
62
|
*/
|
63
|
-
getResources():
|
64
|
-
styleSheets: string[];
|
65
|
-
styleSheet: string;
|
66
|
-
links: Record<string, string>[];
|
67
|
-
scripts: string[];
|
68
|
-
};
|
63
|
+
getResources(): Resources;
|
69
64
|
/**
|
70
65
|
* 获取 HTML 格式的内容
|
71
66
|
*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/platform-browser",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.4",
|
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",
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"bugs": {
|
49
49
|
"url": "https://github.com/textbus/textbus.git/issues"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "6de95d0f7ff105c27834abd7e552f62bc109d5d8"
|
52
52
|
}
|