@yoobic/yobi 8.6.31 → 8.6.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.
@@ -47,7 +47,7 @@ import 'froala-editor/js/languages/uk';
47
47
  import 'froala-editor/js/languages/zh_cn';
48
48
  import 'froala-editor/js/languages/zh_tw';
49
49
  import 'froala-editor/js/languages/vi';
50
- import { asyncWaterfall, closeModal, debounce as _debounce, debounce, getAsyncExtraData, getColorSwatches, getCurrentLanguage, getCustomApp, getSession, getUserDisplayName, getUUID, getVideoPoster, images, isCloudinaryLink, isImageUrl, isIOS, isSafari, isVideo, isWeb, replaceAtTagToMentionTag, showContextMenu, showModal, translate, translateMulti, updateLinkPreviews, videos } from '@shared/utils';
50
+ import { asyncWaterfall, closeModal, debounce as _debounce, debounce, getAsyncExtraData, getColorSwatches, getCurrentLanguage, getCustomApp, getSession, getUserDisplayName, getUUID, getVideoPoster, images, isAndroid, isCloudinaryLink, isImageUrl, isIOS, isSafari, isVideo, isWeb, replaceAtTagToMentionTag, showContextMenu, showModal, translate, translateMulti, updateLinkPreviews, videos } from '@shared/utils';
51
51
  import { h, Host } from '@stencil/core';
52
52
  import { getAppContext, querySelectorDeep, removeHtmlFromString } from '@yobi/utils/helpers/common-helpers';
53
53
  import { sanitizeMentionTag } from '@yobi/utils/helpers/entities-helpers';
@@ -57,6 +57,7 @@ import { destroyMountPoints, generateRandomMountElementId, initShadowMountPoints
57
57
  import FroalaEditor from 'froala-editor';
58
58
  import { assign, compact, isArray, isString } from 'lodash-es';
59
59
  import sanitizeHtml from 'sanitize-html';
60
+ const PADDING = 32;
60
61
  export class YooFormTextEditorComponent {
61
62
  constructor() {
62
63
  // the event "contentChanged" is not fired before hitting 'Enter' once,
@@ -91,6 +92,7 @@ export class YooFormTextEditorComponent {
91
92
  this.isFieldCollapsed = false;
92
93
  this.mentionText = '';
93
94
  this.isMentionMode = false;
95
+ this.keyboardOpen = false;
94
96
  }
95
97
  get mount() {
96
98
  return document.getElementById(this.mountId);
@@ -115,6 +117,7 @@ export class YooFormTextEditorComponent {
115
117
  else {
116
118
  this.blockHTMLReset = false;
117
119
  }
120
+ this.inputResize.emit();
118
121
  }
119
122
  }
120
123
  onMentionUsersChanged() {
@@ -187,6 +190,16 @@ export class YooFormTextEditorComponent {
187
190
  (_a = this.mentionDialog) === null || _a === void 0 ? void 0 : _a.remove();
188
191
  this.destroyEditor();
189
192
  }
193
+ onKeyboardShown() {
194
+ this.keyboardOpen = true;
195
+ const wrapper = this.mount.querySelector('.fr-wrapper');
196
+ wrapper && (wrapper.style.maxHeight = isAndroid() ? '80px' : '96px');
197
+ }
198
+ onKeyboardHidden() {
199
+ this.keyboardOpen = false;
200
+ const wrapper = this.mount.querySelector('.fr-wrapper');
201
+ wrapper && (wrapper.style.maxHeight = this.maxHeight ? `${this.maxHeight + PADDING}px` : '500px');
202
+ }
190
203
  destroyEditor() {
191
204
  var _a;
192
205
  if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy) {
@@ -273,7 +286,7 @@ export class YooFormTextEditorComponent {
273
286
  placeholderText: translate(this.placeholder),
274
287
  toolbarSticky: false,
275
288
  requestHeaders: { Authorization: 'Bearer ' + (session === null || session === void 0 ? void 0 : session.token) },
276
- heightMax: this.isFullscreen ? '100%' : this.maxHeight || 500,
289
+ heightMax: this.isFullscreen ? '100%' : this.maxHeight + PADDING || '500px',
277
290
  heightMin: this.isFullscreen ? '100%' : this.minHeight || 120,
278
291
  emoticonsUseImage: false,
279
292
  imageUploadParam: 'file',
@@ -478,6 +491,9 @@ export class YooFormTextEditorComponent {
478
491
  ev.preventDefault();
479
492
  (_a = this.editor) === null || _a === void 0 ? void 0 : _a.events.focus();
480
493
  }
494
+ },
495
+ 'focus': () => {
496
+ this.inputFocused.emit({ host: this.host });
481
497
  }
482
498
  }
483
499
  };
@@ -1359,7 +1375,8 @@ export class YooFormTextEditorComponent {
1359
1375
  static get states() {
1360
1376
  return {
1361
1377
  "mentionText": {},
1362
- "isMentionMode": {}
1378
+ "isMentionMode": {},
1379
+ "keyboardOpen": {}
1363
1380
  };
1364
1381
  }
1365
1382
  static get events() {
@@ -1423,6 +1440,21 @@ export class YooFormTextEditorComponent {
1423
1440
  "resolved": "any",
1424
1441
  "references": {}
1425
1442
  }
1443
+ }, {
1444
+ "method": "inputResize",
1445
+ "name": "inputResize",
1446
+ "bubbles": true,
1447
+ "cancelable": true,
1448
+ "composed": true,
1449
+ "docs": {
1450
+ "tags": [],
1451
+ "text": ""
1452
+ },
1453
+ "complexType": {
1454
+ "original": "void",
1455
+ "resolved": "void",
1456
+ "references": {}
1457
+ }
1426
1458
  }, {
1427
1459
  "method": "linkPreviewChanged",
1428
1460
  "name": "linkPreviewChanged",
@@ -1540,4 +1572,19 @@ export class YooFormTextEditorComponent {
1540
1572
  "methodName": "mentionModeChanged"
1541
1573
  }];
1542
1574
  }
1575
+ static get listeners() {
1576
+ return [{
1577
+ "name": "keyboardDidShow",
1578
+ "method": "onKeyboardShown",
1579
+ "target": "window",
1580
+ "capture": false,
1581
+ "passive": false
1582
+ }, {
1583
+ "name": "keyboardWillHide",
1584
+ "method": "onKeyboardHidden",
1585
+ "target": "window",
1586
+ "capture": false,
1587
+ "passive": false
1588
+ }];
1589
+ }
1543
1590
  }