@textbus/platform-browser 3.0.2 → 3.0.3

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.
@@ -2,3 +2,4 @@ export declare const isWindows: () => boolean;
2
2
  export declare const isMac: () => boolean;
3
3
  export declare const isSafari: () => boolean;
4
4
  export declare const isFirefox: () => boolean;
5
+ export declare const isMobileBrowser: () => boolean;
@@ -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;
@@ -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
- return null;
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) {
@@ -2825,4 +2833,4 @@ class Viewer extends Starter {
2825
2833
  }
2826
2834
  }
2827
2835
 
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 };
2836
+ 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
- return null;
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) {
@@ -2839,5 +2847,6 @@ exports.createTextNode = createTextNode;
2839
2847
  exports.getLayoutRectByRange = getLayoutRectByRange;
2840
2848
  exports.isFirefox = isFirefox;
2841
2849
  exports.isMac = isMac;
2850
+ exports.isMobileBrowser = isMobileBrowser;
2842
2851
  exports.isSafari = isSafari;
2843
2852
  exports.isWindows = isWindows;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
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": "01d6397297fa0999b4ef6ffef3ae36b37118ad44"
51
+ "gitHead": "8087ffa86e0db3b8be429308ce81a3739b36fec6"
52
52
  }