@textbus/platform-browser 4.0.0-alpha.31 → 4.0.0-alpha.32

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.
@@ -1301,13 +1301,8 @@ let MagicInput = class MagicInput extends Input {
1301
1301
  if (!this.isFocus) {
1302
1302
  (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.focus();
1303
1303
  setTimeout(() => {
1304
- var _a, _b, _c;
1305
1304
  if (!this.nativeFocus && this.isFocus) {
1306
- this.subscription.unsubscribe();
1307
- (_b = (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.textarea);
1308
- this.subscription = new Subscription();
1309
- this.init();
1310
- (_c = this.textarea) === null || _c === void 0 ? void 0 : _c.focus();
1305
+ this.reInit();
1311
1306
  }
1312
1307
  });
1313
1308
  }
@@ -1323,6 +1318,22 @@ let MagicInput = class MagicInput extends Input {
1323
1318
  this.caret.destroy();
1324
1319
  this.subscription.unsubscribe();
1325
1320
  }
1321
+ reInit(delay = false) {
1322
+ var _a, _b, _c;
1323
+ this.subscription.unsubscribe();
1324
+ (_b = (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.textarea);
1325
+ this.subscription = new Subscription();
1326
+ this.init();
1327
+ if (delay) {
1328
+ setTimeout(() => {
1329
+ var _a;
1330
+ (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.focus();
1331
+ });
1332
+ }
1333
+ else {
1334
+ (_c = this.textarea) === null || _c === void 0 ? void 0 : _c.focus();
1335
+ }
1336
+ }
1326
1337
  init() {
1327
1338
  const doc = this.doc;
1328
1339
  const contentBody = doc.body;
@@ -1331,7 +1342,10 @@ let MagicInput = class MagicInput extends Input {
1331
1342
  contentBody.appendChild(textarea);
1332
1343
  this.textarea = textarea;
1333
1344
  this.subscription.add(fromEvent(textarea, 'blur').subscribe(() => {
1334
- this.isFocus = false;
1345
+ if (this.isFocus) {
1346
+ this.isFocus = false;
1347
+ this.reInit(true);
1348
+ }
1335
1349
  this.nativeFocus = false;
1336
1350
  this.caret.hide();
1337
1351
  }), fromEvent(textarea, 'focus').subscribe(() => {
package/bundles/index.js CHANGED
@@ -1303,13 +1303,8 @@ exports.MagicInput = class MagicInput extends Input {
1303
1303
  if (!this.isFocus) {
1304
1304
  (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.focus();
1305
1305
  setTimeout(() => {
1306
- var _a, _b, _c;
1307
1306
  if (!this.nativeFocus && this.isFocus) {
1308
- this.subscription.unsubscribe();
1309
- (_b = (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.textarea);
1310
- this.subscription = new stream.Subscription();
1311
- this.init();
1312
- (_c = this.textarea) === null || _c === void 0 ? void 0 : _c.focus();
1307
+ this.reInit();
1313
1308
  }
1314
1309
  });
1315
1310
  }
@@ -1325,6 +1320,22 @@ exports.MagicInput = class MagicInput extends Input {
1325
1320
  this.caret.destroy();
1326
1321
  this.subscription.unsubscribe();
1327
1322
  }
1323
+ reInit(delay = false) {
1324
+ var _a, _b, _c;
1325
+ this.subscription.unsubscribe();
1326
+ (_b = (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.textarea);
1327
+ this.subscription = new stream.Subscription();
1328
+ this.init();
1329
+ if (delay) {
1330
+ setTimeout(() => {
1331
+ var _a;
1332
+ (_a = this.textarea) === null || _a === void 0 ? void 0 : _a.focus();
1333
+ });
1334
+ }
1335
+ else {
1336
+ (_c = this.textarea) === null || _c === void 0 ? void 0 : _c.focus();
1337
+ }
1338
+ }
1328
1339
  init() {
1329
1340
  const doc = this.doc;
1330
1341
  const contentBody = doc.body;
@@ -1333,7 +1344,10 @@ exports.MagicInput = class MagicInput extends Input {
1333
1344
  contentBody.appendChild(textarea);
1334
1345
  this.textarea = textarea;
1335
1346
  this.subscription.add(stream.fromEvent(textarea, 'blur').subscribe(() => {
1336
- this.isFocus = false;
1347
+ if (this.isFocus) {
1348
+ this.isFocus = false;
1349
+ this.reInit(true);
1350
+ }
1337
1351
  this.nativeFocus = false;
1338
1352
  this.caret.hide();
1339
1353
  }), stream.fromEvent(textarea, 'focus').subscribe(() => {
@@ -70,6 +70,7 @@ export declare class MagicInput extends Input {
70
70
  focus(range: Range, restart: boolean): void;
71
71
  blur(): void;
72
72
  destroy(): void;
73
+ private reInit;
73
74
  private init;
74
75
  private handleDefaultActions;
75
76
  private handlePaste;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "4.0.0-alpha.31",
3
+ "version": "4.0.0-alpha.32",
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",
@@ -49,5 +49,5 @@
49
49
  "bugs": {
50
50
  "url": "https://github.com/textbus/textbus.git/issues"
51
51
  },
52
- "gitHead": "54c13967d549e9c3795eb821d84ce3e811139630"
52
+ "gitHead": "00d52c23dde48068e14e46379b85ddac0743c6ff"
53
53
  }